CMS 3D CMS Logo

DTTTrigConstantShift.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  */
5 
6 #include "DTTTrigConstantShift.h"
11 
15 
16 #include <cmath>
17 
18 using namespace std;
19 using namespace edm;
20 
21 namespace dtCalibration {
22 
23  DTTTrigConstantShift::DTTTrigConstantShift(const ParameterSet& pset)
24  : dbLabel_(pset.getUntrackedParameter<string>("dbLabel", "")),
25  calibChamber_(pset.getParameter<string>("calibChamber")),
26  value_(pset.getParameter<double>("value")) {
27  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Applying constant correction value: " << value_ << endl;
28 
29  if (!calibChamber_.empty() && calibChamber_ != "None" && calibChamber_ != "All") {
30  stringstream linestr;
31  int selWheel, selStation, selSector;
32  linestr << calibChamber_;
33  linestr >> selWheel >> selStation >> selSector;
34  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
35  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Chosen chamber: " << chosenChamberId_ << endl;
36  }
37  //FIXME: Check if chosen chamber is valid.
38  }
39 
41 
43  // Get tTrig record from DB
46  tTrigMap_ = &*tTrig;
47  }
48 
50  float tTrigMean, tTrigSigma, kFactor;
51  int status = tTrigMap_->get(slId, tTrigMean, tTrigSigma, kFactor, DTTimeUnits::ns);
52  if (status != 0)
53  throw cms::Exception("[DTTTrigConstantShift]") << "Could not find tTrig entry in DB for" << slId << endl;
54 
55  float tTrigMeanNew = tTrigMean;
56  if (!calibChamber_.empty() && calibChamber_ != "None") {
57  if ((calibChamber_ == "All") || (calibChamber_ != "All" && slId.chamberId() == chosenChamberId_)) {
58  tTrigMeanNew = tTrigMean + value_;
59  }
60  }
61 
62  return DTTTrigData(tTrigMeanNew, tTrigSigma, kFactor);
63  }
64 
65 } // namespace dtCalibration
DTSuperLayerId
Definition: DTSuperLayerId.h:12
dtCalibration::DTTTrigData
Definition: DTTTrigBaseCorrection.h:19
DTTtrigRcd.h
MessageLogger.h
ESHandle.h
dtCalibration::DTTTrigConstantShift::calibChamber_
std::string calibChamber_
Definition: DTTTrigConstantShift.h:38
mps_update.status
status
Definition: mps_update.py:69
DTTtrigRcd
Definition: DTTtrigRcd.h:5
edm
HLT enums.
Definition: AlignableModifier.h:19
dttriganalyzer_cfi.tTrig
tTrig
Definition: dttriganalyzer_cfi.py:11
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
dtCalibration::DTTTrigConstantShift::tTrigMap_
const DTTtrig * tTrigMap_
Definition: DTTTrigConstantShift.h:41
dtCalibration::DTTTrigConstantShift::value_
double value_
Definition: DTTTrigConstantShift.h:39
DTTimeUnits::ns
Definition: DTTimeUnits.h:32
edm::ESHandle< DTTtrig >
dtCalibration::DTTTrigConstantShift::dbLabel_
std::string dbLabel_
Definition: DTTTrigConstantShift.h:37
DTTtrig::get
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:59
DTTTrigConstantShift.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dtCalibration::DTTTrigConstantShift::setES
void setES(const edm::EventSetup &setup) override
Definition: DTTTrigConstantShift.cc:42
edm::ParameterSet
Definition: ParameterSet.h:47
dtCalibration::DTTTrigConstantShift::~DTTTrigConstantShift
~DTTTrigConstantShift() override
Definition: DTTTrigConstantShift.cc:40
DTSuperLayerId::chamberId
DTChamberId chamberId() const
Return the corresponding ChamberId.
Definition: DTSuperLayerId.h:45
edm::EventSetup
Definition: EventSetup.h:57
DTTtrig.h
get
#define get
dtCalibration
Definition: DTT0BaseCorrection.h:16
dtCalibration::DTTTrigConstantShift::correction
DTTTrigData correction(const DTSuperLayerId &) override
Definition: DTTTrigConstantShift.cc:49
std
Definition: JetResolutionObject.h:76
dttriganalyzer_cfi.kFactor
kFactor
Definition: dttriganalyzer_cfi.py:7
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dtCalibration::DTTTrigConstantShift::chosenChamberId_
DTChamberId chosenChamberId_
Definition: DTTTrigConstantShift.h:42
Exception
Definition: hltDiff.cc:246
EventSetup.h
DTChamberId
Definition: DTChamberId.h:14
ParameterSet.h
DTSuperLayerId.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27