CMS 3D CMS Logo

DTT0FillDefaultFromDB.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 
12 
16 
17 #include <string>
18 
19 using namespace std;
20 using namespace edm;
21 
22 namespace dtCalibration {
23 
24 DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(const ParameterSet& pset):
25  dbLabelRef_( pset.getParameter<string>("dbLabelRef") ) {
26 }
27 
29 }
30 
32  // Get t0 record from DB
33  ESHandle<DTT0> t0H;
34  setup.get<DTT0Rcd>().get(t0H);
35  t0Map_ = &*t0H;
36  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] T0 version: " << t0H->version();
37 
38  // Get reference t0 DB
39  ESHandle<DTT0> t0RefH;
40  setup.get<DTT0Rcd>().get(dbLabelRef_,t0RefH);
41  t0MapRef_ = &*t0RefH;
42  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] Reference T0 version: " << t0RefH->version();
43 
44 }
45 
47  // Try to access value in default DB
48  // If it does not exist return value from reference DB
49  // If it does not exist in reference DB, throw exception
50  // Could also set to default zero value
51  float t0Mean,t0RMS;
52  int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
53  if(!status){
54  return DTT0Data(t0Mean,t0RMS);
55  } else{
56  // Now access reference DB
57  float t0MeanRef,t0RMSRef;
58  int statusRef = t0MapRef_->get(wireId,t0MeanRef,t0RMSRef,DTTimeUnits::counts);
59  if(!statusRef){
60  return DTT0Data(t0MeanRef,t0RMSRef);
61  } else{
62  //...
63  throw cms::Exception("[DTT0FillDefaultFromDB]") << "Could not find t0 entry in reference DB for"
64  << wireId << endl;
65  }
66  }
67 }
68 
69 } // namespace
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:67
virtual DTT0Data correction(const DTWireId &)
virtual void setES(const edm::EventSetup &setup)
const T & get() const
Definition: EventSetup.h:56
Definition: DTT0Rcd.h:9
HLT enums.
const std::string & version() const
access version
Definition: DTT0.cc:118