CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTT0Correction Class Reference

#include <DTT0Correction.h>

Inheritance diagram for DTT0Correction:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void beginJob () override
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup) override
 
 DTT0Correction (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 
 ~DTT0Correction () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::unique_ptr< dtCalibration::DTT0BaseCorrectioncorrectionAlgo_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTT0t0Map_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Class that reads and corrects t0 DB

Definition at line 20 of file DTT0Correction.h.

Constructor & Destructor Documentation

◆ DTT0Correction()

DTT0Correction::DTT0Correction ( const edm::ParameterSet pset)

Constructor.

Definition at line 30 of file DTT0Correction.cc.

31  : correctionAlgo_{DTT0CorrectionFactory::get()->create(pset.getParameter<string>("correctionAlgo"),
32  pset.getParameter<ParameterSet>("correctionAlgoConfig"))} {
33  LogVerbatim("Calibration") << "[DTT0Correction] Constructor called" << endl;
34 }

References get, and muonDTDigis_cfi::pset.

◆ ~DTT0Correction()

DTT0Correction::~DTT0Correction ( )
override

Destructor.

Definition at line 36 of file DTT0Correction.cc.

36 { LogVerbatim("Calibration") << "[DTT0Correction] Destructor called" << endl; }

Member Function Documentation

◆ analyze()

void DTT0Correction::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 32 of file DTT0Correction.h.

32 {}

◆ beginJob()

void DTT0Correction::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 30 of file DTT0Correction.h.

30 {}

◆ beginRun()

void DTT0Correction::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file DTT0Correction.cc.

38  {
39  // Get t0 record from DB
40  ESHandle<DTT0> t0H;
41  setup.get<DTT0Rcd>().get(t0H);
42  t0Map_ = &*t0H;
43  LogVerbatim("Calibration") << "[DTT0Correction]: T0 version: " << t0H->version() << endl;
44 
45  // Get geometry from Event Setup
47 
48  // Pass EventSetup to correction Algo
49  correctionAlgo_->setES(setup);
50 }

References correctionAlgo_, get, muonGeom_, singleTopDQM_cfi::setup, t0Map_, and DTT0::version().

◆ endJob()

void DTT0Correction::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file DTT0Correction.cc.

52  {
53  // Create the object to be written to DB
54  DTT0* t0NewMap = new DTT0();
55 
56  // Loop over all channels
57  for (vector<const DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin();
58  sl != muonGeom_->superLayers().end();
59  ++sl) {
60  for (vector<const DTLayer*>::const_iterator layer = (*sl)->layers().begin(); layer != (*sl)->layers().end();
61  ++layer) {
62  // Access layer topology
63  const DTTopology& dtTopo = (*layer)->specificTopology();
64  const int firstWire = dtTopo.firstChannel();
65  const int lastWire = dtTopo.lastChannel();
66  //const int nWires = dtTopo.channels();
67 
68  //Loop on wires
69  for (int wire = firstWire; wire <= lastWire; ++wire) {
70  DTWireId wireId((*layer)->id(), wire);
71 
72  // Get old value from DB
73  float t0Mean, t0RMS;
74  int status = t0Map_->get(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
75 
76  // Compute new t0 for this wire
77  try {
78  dtCalibration::DTT0Data t0Corr = correctionAlgo_->correction(wireId);
79  float t0MeanNew = t0Corr.mean;
80  float t0RMSNew = t0Corr.rms;
81  t0NewMap->set(wireId, t0MeanNew, t0RMSNew, DTTimeUnits::counts);
82 
83  LogVerbatim("Calibration") << "New t0 for: " << wireId << " mean from " << t0Mean << " to " << t0MeanNew
84  << " rms from " << t0RMS << " to " << t0RMSNew << endl;
85  } catch (cms::Exception& e) {
86  LogError("Calibration") << e.explainSelf();
87  // Set db to the old value, if it was there in the first place
88  if (!status) {
89  t0NewMap->set(wireId, t0Mean, t0RMS, DTTimeUnits::counts);
90  LogVerbatim("Calibration") << "Keep old t0 for: " << wireId << " mean " << t0Mean << " rms " << t0RMS
91  << endl;
92  }
93  continue;
94  }
95  } // End of loop on wires
96  } // End of loop on layers
97  } // End of loop on superlayers
98 
99  //Write object to DB
100  LogVerbatim("Calibration") << "[DTT0Correction]: Writing t0 object to DB!" << endl;
101  string record = "DTT0Rcd";
102  DTCalibDBUtils::writeToDB<DTT0>(record, t0NewMap);
103 }

References correctionAlgo_, DTTimeUnits::counts, MillePedeFileConverter_cfg::e, DTTopology::firstChannel(), DTT0::get(), DTTopology::lastChannel(), dtCalibration::DTT0Data::mean, muonGeom_, GlobalPosition_Frontier_DevDB_cff::record, dtCalibration::DTT0Data::rms, DTT0::set(), mps_update::status, DTGeometry::superLayers(), and t0Map_.

Referenced by o2olib.O2ORunMgr::executeJob().

Member Data Documentation

◆ correctionAlgo_

std::unique_ptr<dtCalibration::DTT0BaseCorrection> DTT0Correction::correctionAlgo_
private

Definition at line 40 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

◆ muonGeom_

edm::ESHandle<DTGeometry> DTT0Correction::muonGeom_
private

Definition at line 38 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

◆ t0Map_

const DTT0* DTT0Correction::t0Map_
private

Definition at line 37 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

mps_update.status
status
Definition: mps_update.py:69
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
DTT0::version
const std::string & version() const
access version
Definition: DTT0.cc:82
DTT0Correction::muonGeom_
edm::ESHandle< DTGeometry > muonGeom_
Definition: DTT0Correction.h:38
DTT0Rcd
Definition: DTT0Rcd.h:9
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTTopology
Definition: DTTopology.h:28
DTT0Correction::t0Map_
const DTT0 * t0Map_
Definition: DTT0Correction.h:37
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
DTTopology::firstChannel
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
DTWireId
Definition: DTWireId.h:12
edm::ESHandle< DTT0 >
DTT0::set
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:97
dtCalibration::DTT0Data
Definition: DTT0BaseCorrection.h:18
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
DTGeometry::superLayers
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
edm::LogVerbatim
Definition: MessageLogger.h:297
get
#define get
DTTopology::lastChannel
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
dtCalibration::DTT0Data::rms
double rms
Definition: DTT0BaseCorrection.h:24
DTTimeUnits::counts
Definition: DTTimeUnits.h:32
DTT0
Definition: DTT0.h:48
DTT0Correction::correctionAlgo_
std::unique_ptr< dtCalibration::DTT0BaseCorrection > correctionAlgo_
Definition: DTT0Correction.h:40
dtCalibration::DTT0Data::mean
double mean
Definition: DTT0BaseCorrection.h:23
cms::Exception
Definition: Exception.h:70
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37