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 &, edm::ConsumesCollector cc)
 
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_
 
const DTT0t0Map_
 
const DTT0t0MapRef_
 
edm::ESGetToken< DTT0, DTT0Rcdt0RefToken_
 
edm::ESGetToken< DTT0, DTT0Rcdt0Token_
 

Detailed Description

Definition at line 28 of file DTT0FillChamberFromDB.h.

Constructor & Destructor Documentation

◆ DTT0FillChamberFromDB()

DTT0FillChamberFromDB::DTT0FillChamberFromDB ( const edm::ParameterSet pset,
edm::ConsumesCollector  cc 
)

Definition at line 27 of file DTT0FillChamberFromDB.cc.

References edm::BeginRun, chamberRef_, and chosenChamberId_.

28  : chamberRef_(pset.getParameter<string>("chamberId")),
29  t0Token_(cc.esConsumes<edm::Transition::BeginRun>()),
31  cc.esConsumes<edm::Transition::BeginRun>(edm::ESInputTag("", pset.getParameter<string>("dbLabelRef")))) {
32  //DTChamberId chosenChamberId;
33  if (!chamberRef_.empty() && chamberRef_ != "None") {
34  stringstream linestr;
35  int selWheel, selStation, selSector;
36  linestr << chamberRef_;
37  linestr >> selWheel >> selStation >> selSector;
38  chosenChamberId_ = DTChamberId(selWheel, selStation, selSector);
39  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Chosen chamber: " << chosenChamberId_ << endl;
40  }
41  //FIXME: Check if chosen chamber is valid.
42  }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< DTT0, DTT0Rcd > t0RefToken_

◆ ~DTT0FillChamberFromDB()

DTT0FillChamberFromDB::~DTT0FillChamberFromDB ( )
override

Definition at line 44 of file DTT0FillChamberFromDB.cc.

44 {}

Member Function Documentation

◆ correction()

DTT0Data DTT0FillChamberFromDB::correction ( const DTWireId wireId)
overridevirtual

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 58 of file DTT0FillChamberFromDB.cc.

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

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

◆ setES()

void DTT0FillChamberFromDB::setES ( const edm::EventSetup setup)
overridevirtual

Implements dtCalibration::DTT0BaseCorrection.

Definition at line 46 of file DTT0FillChamberFromDB.cc.

References singleTopDQM_cfi::setup, t0Map_, t0MapRef_, t0RefToken_, t0Token_, and DTT0::version().

46  {
47  // Get t0 record from DB
48  ESHandle<DTT0> t0H = setup.getHandle(t0Token_);
49  t0Map_ = &*t0H;
50  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] T0 version: " << t0H->version();
51 
52  // Get reference t0 DB
53  ESHandle<DTT0> t0RefH = setup.getHandle(t0RefToken_);
54  t0MapRef_ = &*t0RefH;
55  LogVerbatim("Calibration") << "[DTT0FillChamberFromDB] Reference T0 version: " << t0RefH->version();
56  }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
edm::ESGetToken< DTT0, DTT0Rcd > t0RefToken_
const std::string & version() const
access version
Definition: DTT0.cc:82

Member Data Documentation

◆ chamberRef_

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

Definition at line 40 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

◆ chosenChamberId_

DTChamberId dtCalibration::DTT0FillChamberFromDB::chosenChamberId_
private

Definition at line 42 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and DTT0FillChamberFromDB().

◆ t0Map_

const DTT0* dtCalibration::DTT0FillChamberFromDB::t0Map_
private

Definition at line 45 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().

◆ t0MapRef_

const DTT0* dtCalibration::DTT0FillChamberFromDB::t0MapRef_
private

Definition at line 44 of file DTT0FillChamberFromDB.h.

Referenced by correction(), and setES().

◆ t0RefToken_

edm::ESGetToken<DTT0, DTT0Rcd> dtCalibration::DTT0FillChamberFromDB::t0RefToken_
private

Definition at line 47 of file DTT0FillChamberFromDB.h.

Referenced by setES().

◆ t0Token_

edm::ESGetToken<DTT0, DTT0Rcd> dtCalibration::DTT0FillChamberFromDB::t0Token_
private

Definition at line 46 of file DTT0FillChamberFromDB.h.

Referenced by setES().