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  * $Date: 2012/03/21 13:48:06 $
5  * $Revision: 1.1 $
6  * \author A. Vilela Pereira
7  */
8 
9 #include "DTTTrigConstantShift.h"
14 
18 
19 #include <math.h>
20 
21 using namespace std;
22 using namespace edm;
23 
24 namespace dtCalibration {
25 
26 DTTTrigConstantShift::DTTTrigConstantShift(const ParameterSet& pset):
27  dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ),
28  calibChamber_( pset.getParameter<string>("calibChamber") ),
29  value_( pset.getParameter<double>("value") ) {
30 
31  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Applying constant correction value: " << value_ << endl;
32 
33  if( calibChamber_ != "" && calibChamber_ != "None" && calibChamber_ != "All" ){
34  stringstream linestr;
35  int selWheel, selStation, selSector;
36  linestr << calibChamber_;
37  linestr >> selWheel >> selStation >> selSector;
38  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
39  LogVerbatim("Calibration") << "[DTTTrigConstantShift] Chosen chamber: " << chosenChamberId_ << endl;
40  }
41  //FIXME: Check if chosen chamber is valid.
42 }
43 
45 
47  // Get tTrig record from DB
48  ESHandle<DTTtrig> tTrig;
49  setup.get<DTTtrigRcd>().get(dbLabel_,tTrig);
50  tTrigMap_ = &*tTrig;
51 }
52 
54 
55  float tTrigMean,tTrigSigma,kFactor;
56  int status = tTrigMap_->get(slId,tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
57  if(status != 0) throw cms::Exception("[DTTTrigConstantShift]") << "Could not find tTrig entry in DB for"
58  << slId << endl;
59 
60  float tTrigMeanNew = tTrigMean;
61  if( calibChamber_ != "" && calibChamber_ != "None"){
62  if( ( calibChamber_ == "All" ) ||
63  ( calibChamber_ != "All" && slId.chamberId() == chosenChamberId_ ) ) {
64  tTrigMeanNew = tTrigMean + value_;
65  }
66  }
67 
68  return DTTTrigData(tTrigMeanNew,tTrigSigma,kFactor);
69 }
70 
71 } // 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:87
const T & get() const
Definition: EventSetup.h:55
tuple status
Definition: ntuplemaker.py:245
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")