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 
10 
14 
15 #include <string>
16 
17 using namespace std;
18 using namespace edm;
19 
20 namespace dtCalibration {
21 
22  DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(const ParameterSet& pset)
23  : dbLabelRef_(pset.getParameter<string>("dbLabelRef")) {}
24 
26 
28  // Get t0 record from DB
29  ESHandle<DTT0> t0H;
30  setup.get<DTT0Rcd>().get(t0H);
31  t0Map_ = &*t0H;
32  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] T0 version: " << t0H->version();
33 
34  // Get reference t0 DB
35  ESHandle<DTT0> t0RefH;
36  setup.get<DTT0Rcd>().get(dbLabelRef_, t0RefH);
37  t0MapRef_ = &*t0RefH;
38  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] Reference T0 version: " << t0RefH->version();
39  }
40 
42  // Try to access value in default DB
43  // If it does not exist return value from reference DB
44  // If it does not exist in reference DB, throw exception
45  // Could also set to default zero value
46  float t0Mean, t0RMS;
47  int status = t0Map_->get(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
48  if (!status) {
49  return DTT0Data(t0Mean, t0RMS);
50  } else {
51  // Now access reference DB
52  float t0MeanRef, t0RMSRef;
53  int statusRef = t0MapRef_->get(wireId, t0MeanRef, t0RMSRef, DTTimeUnits::counts);
54  if (!statusRef) {
55  return DTT0Data(t0MeanRef, t0RMSRef);
56  } else {
57  //...
58  throw cms::Exception("[DTT0FillDefaultFromDB]")
59  << "Could not find t0 entry in reference DB for" << wireId << endl;
60  }
61  }
62  }
63 
64 } // namespace dtCalibration
dtCalibration::DTT0FillDefaultFromDB::setES
void setES(const edm::EventSetup &setup) override
Definition: DTT0FillDefaultFromDB.cc:27
MessageLogger.h
ESHandle.h
dtCalibration::DTT0FillDefaultFromDB::correction
DTT0Data correction(const DTWireId &) override
Definition: DTT0FillDefaultFromDB.cc:41
dtCalibration::DTT0FillDefaultFromDB::dbLabelRef_
std::string dbLabelRef_
Definition: DTT0FillDefaultFromDB.h:36
mps_update.status
status
Definition: mps_update.py:68
edm
HLT enums.
Definition: AlignableModifier.h:19
dtCalibration::DTT0FillDefaultFromDB::t0Map_
const DTT0 * t0Map_
Definition: DTT0FillDefaultFromDB.h:39
DTT0.h
DTT0::version
const std::string & version() const
access version
Definition: DTT0.cc:82
DTT0Rcd
Definition: DTT0Rcd.h:9
dtCalibration::DTT0FillDefaultFromDB::~DTT0FillDefaultFromDB
~DTT0FillDefaultFromDB() override
Definition: DTT0FillDefaultFromDB.cc:25
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTT0FillDefaultFromDB.h
DTT0::get
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:48
DTWireId
Definition: DTWireId.h:12
edm::ESHandle
Definition: DTSurvey.h:22
dtCalibration::DTT0Data
Definition: DTT0BaseCorrection.h:18
edm::ParameterSet
Definition: ParameterSet.h:47
DTT0Rcd.h
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dtCalibration
Definition: DTT0BaseCorrection.h:16
std
Definition: JetResolutionObject.h:76
DTWireId.h
DTTimeUnits::counts
Definition: DTTimeUnits.h:32
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:245
EventSetup.h
dtCalibration::DTT0FillDefaultFromDB::t0MapRef_
const DTT0 * t0MapRef_
Definition: DTT0FillDefaultFromDB.h:38
ParameterSet.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27