CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
dtCalibration::DTT0FillChamberFromDB Class Reference

#include <DTT0FillChamberFromDB.h>

Inheritance diagram for dtCalibration::DTT0FillChamberFromDB:
dtCalibration::DTT0BaseCorrection

Public Member Functions

DTT0Data correction (const DTWireId &) override
 
 DTT0FillChamberFromDB (const edm::ParameterSet &)
 
void setES (const edm::EventSetup &setup) override
 
 ~DTT0FillChamberFromDB () override
 
- Public Member Functions inherited from dtCalibration::DTT0BaseCorrection
 DTT0BaseCorrection ()
 
virtual ~DTT0BaseCorrection ()
 

Private Attributes

std::string chamberRef_
 
DTChamberId chosenChamberId_
 
std::string dbLabelRef_
 
const DTT0t0Map_
 
const DTT0t0MapRef_
 

Detailed Description

Definition at line 25 of file DTT0FillChamberFromDB.h.

Constructor & Destructor Documentation

DTT0FillChamberFromDB::DTT0FillChamberFromDB ( const edm::ParameterSet pset)

Definition at line 27 of file DTT0FillChamberFromDB.cc.

References chamberRef_, and chosenChamberId_.

27  :
28  dbLabelRef_( pset.getParameter<string>("dbLabelRef") ),
29  chamberRef_( pset.getParameter<string>("chamberId") ) {
30 
31  //DTChamberId chosenChamberId;
32  if( chamberRef_ != "" && chamberRef_ != "None" ){
33  stringstream linestr;
34  int selWheel, selStation, selSector;
35  linestr << chamberRef_;
36  linestr >> selWheel >> selStation >> selSector;
37  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
38  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Chosen chamber: " << chosenChamberId_ << endl;
39  }
40  //FIXME: Check if chosen chamber is valid.
41 
42 }
T getParameter(std::string const &) const
DTT0FillChamberFromDB::~DTT0FillChamberFromDB ( )
override

Definition at line 44 of file DTT0FillChamberFromDB.cc.

44  {
45 }

Member Function Documentation

DTT0Data DTT0FillChamberFromDB::correction ( const DTWireId wireId)
overridevirtual

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 62 of file DTT0FillChamberFromDB.cc.

References DTSuperLayerId::chamberId(), chamberRef_, chosenChamberId_, DTTimeUnits::counts, Exception, DTT0::get(), DTWireId::layerId(), mps_update::status, DTLayerId::superlayerId(), t0Map_, and t0MapRef_.

62  {
63  // If wire belongs to chosen chamber, use t0 value from reference DB
64  // Otherwise use value from default DB
65 
66  DTChamberId chamberId = wireId.layerId().superlayerId().chamberId();
67 
68  if( chamberRef_ != "" && chamberRef_ != "None" && chamberId == chosenChamberId_ ){
69  // Access reference DB
70  float t0MeanRef,t0RMSRef;
71  int statusRef = t0MapRef_->get(wireId,t0MeanRef,t0RMSRef,DTTimeUnits::counts);
72  if(!statusRef){
73  return DTT0Data(t0MeanRef,t0RMSRef);
74  } else{
75  //...
76  throw cms::Exception("[DTT0FillChamberFromDB]") << "Could not find t0 entry in reference DB for"
77  << wireId << endl;
78  }
79  } else{
80  // Access default DB
81  float t0Mean,t0RMS;
82  int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
83  if(!status){
84  return DTT0Data(t0Mean,t0RMS);
85  } else{
86  //...
87  throw cms::Exception("[DTT0FillChamberFromDB]") << "Could not find t0 entry in DB for"
88  << wireId << endl;
89  }
90  }
91 }
DTChamberId chamberId() const
Return the corresponding ChamberId.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
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
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
Definition: DTT0.h:37
void DTT0FillChamberFromDB::setES ( const edm::EventSetup setup)
overridevirtual

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 47 of file DTT0FillChamberFromDB.cc.

References dbLabelRef_, edm::EventSetup::get(), t0Map_, t0MapRef_, and DTT0::version().

47  {
48  // Get t0 record from DB
49  ESHandle<DTT0> t0H;
50  setup.get<DTT0Rcd>().get(t0H);
51  t0Map_ = &*t0H;
52  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] T0 version: " << t0H->version();
53 
54  // Get reference t0 DB
55  ESHandle<DTT0> t0RefH;
56  setup.get<DTT0Rcd>().get(dbLabelRef_,t0RefH);
57  t0MapRef_ = &*t0RefH;
58  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Reference T0 version: " << t0RefH->version();
59 
60 }
Definition: DTT0Rcd.h:9
T get() const
Definition: EventSetup.h:68
const std::string & version() const
access version
Definition: DTT0.cc:118

Member Data Documentation

std::string dtCalibration::DTT0FillChamberFromDB::chamberRef_
private

Definition at line 38 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

DTChamberId dtCalibration::DTT0FillChamberFromDB::chosenChamberId_
private

Definition at line 40 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

std::string dtCalibration::DTT0FillChamberFromDB::dbLabelRef_
private

Definition at line 37 of file DTT0FillChamberFromDB.h.

Referenced by setES().

const DTT0* dtCalibration::DTT0FillChamberFromDB::t0Map_
private

Definition at line 43 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().

const DTT0* dtCalibration::DTT0FillChamberFromDB::t0MapRef_
private

Definition at line 42 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().