CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTT0FillDefaultFromDB.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/03/02 19:47:32 $
5  * $Revision: 1.1 $
6  * \author A. Vilela Pereira
7  */
8 
14 
18 
19 #include <string>
20 
21 using namespace std;
22 using namespace edm;
23 
24 namespace dtCalibration {
25 
26 DTT0FillDefaultFromDB::DTT0FillDefaultFromDB(const ParameterSet& pset):
27  dbLabelRef_( pset.getParameter<string>("dbLabelRef") ) {
28 }
29 
31 }
32 
34  // Get t0 record from DB
35  ESHandle<DTT0> t0H;
36  setup.get<DTT0Rcd>().get(t0H);
37  t0Map_ = &*t0H;
38  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] T0 version: " << t0H->version();
39 
40  // Get reference t0 DB
41  ESHandle<DTT0> t0RefH;
42  setup.get<DTT0Rcd>().get(dbLabelRef_,t0RefH);
43  t0MapRef_ = &*t0RefH;
44  LogVerbatim("Calibration") << "[DTT0FillDefaultFromDB] Reference T0 version: " << t0RefH->version();
45 
46 }
47 
49  // Try to access value in default DB
50  // If it does not exist return value from reference DB
51  // If it does not exist in reference DB, throw exception
52  // Could also set to default zero value
53  float t0Mean,t0RMS;
54  int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
55  if(!status){
56  return DTT0Data(t0Mean,t0RMS);
57  } else{
58  // Now access reference DB
59  float t0MeanRef,t0RMSRef;
60  int statusRef = t0MapRef_->get(wireId,t0MeanRef,t0RMSRef,DTTimeUnits::counts);
61  if(!statusRef){
62  return DTT0Data(t0MeanRef,t0RMSRef);
63  } else{
64  //...
65  throw cms::Exception("[DTT0FillDefaultFromDB]") << "Could not find t0 entry in reference DB for"
66  << wireId << endl;
67  }
68  }
69 }
70 
71 } // namespace
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:69
virtual DTT0Data correction(const DTWireId &)
virtual void setES(const edm::EventSetup &setup)
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
tuple status
Definition: ntuplemaker.py:245
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")