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 
28  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Applying constant correction value: " << value_ << endl;
29 
30  if( calibChamber_ != "" && calibChamber_ != "None" && calibChamber_ != "All" ){
31  stringstream linestr;
32  int selWheel, selStation, selSector;
33  linestr << calibChamber_;
34  linestr >> selWheel >> selStation >> selSector;
35  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
36  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Chosen chamber: " << chosenChamberId_ << endl;
37  }
38  //FIXME: Check if chosen chamber is valid.
39 }
40 
42 
44  // Get tTrig record from DB
45  ESHandle<DTTtrig> tTrig;
46  setup.get<DTTtrigRcd>().get(dbLabel_,tTrig);
47  tTrigMap_ = &*tTrig;
48 }
49 
51 
52  float tTrigMean,tTrigSigma,kFactor;
53  int status = tTrigMap_->get(slId,tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
54  if(status != 0) throw cms::Exception("[DTTTrigConstantShift]") << "Could not find tTrig entry in DB for"
55  << slId << endl;
56 
57  float tTrigMeanNew = tTrigMean;
58  if( calibChamber_ != "" && calibChamber_ != "None"){
59  if( ( calibChamber_ == "All" ) ||
60  ( calibChamber_ != "All" && slId.chamberId() == chosenChamberId_ ) ) {
61  tTrigMeanNew = tTrigMean + value_;
62  }
63  }
64 
65  return DTTTrigData(tTrigMeanNew,tTrigSigma,kFactor);
66 }
67 
68 } // namespace
void setES(const edm::EventSetup &setup) override
DTChamberId chamberId() const
Return the corresponding ChamberId.
DTTTrigData correction(const DTSuperLayerId &) override
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
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:85
const T & get() const
Definition: EventSetup.h:59
HLT enums.