CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTTTrigConstantShift.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author A. Vilela Pereira
5  */
6 
7 #include "DTTTrigConstantShift.h"
12 
16 
17 #include <cmath>
18 
19 using namespace std;
20 using namespace edm;
21 
22 namespace dtCalibration {
23 
24 DTTTrigConstantShift::DTTTrigConstantShift(const ParameterSet& pset):
25  dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ),
26  calibChamber_( pset.getParameter<string>("calibChamber") ),
27  value_( pset.getParameter<double>("value") ) {
28 
29  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Applying constant correction value: " << value_ << endl;
30 
31  if( calibChamber_ != "" && calibChamber_ != "None" && calibChamber_ != "All" ){
32  stringstream linestr;
33  int selWheel, selStation, selSector;
34  linestr << calibChamber_;
35  linestr >> selWheel >> selStation >> selSector;
36  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
37  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Chosen chamber: " << chosenChamberId_ << endl;
38  }
39  //FIXME: Check if chosen chamber is valid.
40 }
41 
43 
45  // Get tTrig record from DB
46  ESHandle<DTTtrig> tTrig;
47  setup.get<DTTtrigRcd>().get(dbLabel_,tTrig);
48  tTrigMap_ = &*tTrig;
49 }
50 
52 
53  float tTrigMean,tTrigSigma,kFactor;
54  int status = tTrigMap_->get(slId,tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
55  if(status != 0) throw cms::Exception("[DTTTrigConstantShift]") << "Could not find tTrig entry in DB for"
56  << slId << endl;
57 
58  float tTrigMeanNew = tTrigMean;
59  if( calibChamber_ != "" && calibChamber_ != "None"){
60  if( ( calibChamber_ == "All" ) ||
61  ( calibChamber_ != "All" && slId.chamberId() == chosenChamberId_ ) ) {
62  tTrigMeanNew = tTrigMean + value_;
63  }
64  }
65 
66  return DTTTrigData(tTrigMeanNew,tTrigSigma,kFactor);
67 }
68 
69 } // namespace
virtual void setES(const edm::EventSetup &setup)
DTChamberId chamberId() const
Return the corresponding ChamberId.
virtual DTTTrigData correction(const DTSuperLayerId &)
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:56
tuple status
Definition: mps_update.py:57