CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::DTT0BaseCorrection
correctionAlgo_
 
const edm::ESGetToken
< DTGeometry,
MuonGeometryRecord
dtGeomToken_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTT0t0Map_
 
edm::ESGetToken< DTT0, DTT0Rcdt0Token_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Class that reads and corrects t0 DB

Definition at line 23 of file DTT0Correction.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 31 of file DTT0Correction.cc.

References edm::EDConsumerBase::consumesCollector(), get, and edm::ParameterSet::getParameter().

32  : correctionAlgo_{DTT0CorrectionFactory::get()->create(pset.getParameter<string>("correctionAlgo"),
33  pset.getParameter<ParameterSet>("correctionAlgoConfig"),
35  dtGeomToken_(esConsumes<edm::Transition::BeginRun>()),
36  t0Token_(esConsumes<edm::Transition::BeginRun>()) {
37  LogVerbatim("Calibration") << "[DTT0Correction] Constructor called" << endl;
38 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
std::unique_ptr< dtCalibration::DTT0BaseCorrection > correctionAlgo_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
DTT0Correction::~DTT0Correction ( )
override

Destructor.

Definition at line 40 of file DTT0Correction.cc.

40 { LogVerbatim("Calibration") << "[DTT0Correction] Destructor called" << endl; }
Log< level::Info, true > LogVerbatim

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 35 of file DTT0Correction.h.

35 {}
void DTT0Correction::beginJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file DTT0Correction.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 42 of file DTT0Correction.cc.

References correctionAlgo_, dtGeomToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), muonGeom_, t0Map_, and t0Token_.

42  {
43  // Get t0 record from DB
44  ESHandle<DTT0> t0H;
45  t0H = setup.getHandle(t0Token_);
46  t0Map_ = &setup.getData(t0Token_);
47  LogVerbatim("Calibration") << "[DTT0Correction]: T0 version: " << t0H->version() << endl;
48 
49  // Get geometry from Event Setup
51 
52  // Pass EventSetup to correction Algo
53  correctionAlgo_->setES(setup);
54 }
Log< level::Info, true > LogVerbatim
const DTT0 * t0Map_
edm::ESGetToken< DTT0, DTT0Rcd > t0Token_
std::unique_ptr< dtCalibration::DTT0BaseCorrection > correctionAlgo_
edm::ESHandle< DTGeometry > muonGeom_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
void DTT0Correction::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DTT0Correction.cc.

References correctionAlgo_, DTTimeUnits::counts, alignCSCRings::e, cms::Exception::explainSelf(), DTTopology::firstChannel(), DTT0::get(), DTTopology::lastChannel(), phase1PixelTopology::layer, dtCalibration::DTT0Data::mean, muonGeom_, GlobalPosition_Frontier_DevDB_cff::record, dtCalibration::DTT0Data::rms, DTT0::set(), mps_update::status, and t0Map_.

Referenced by o2olib.O2ORunMgr::executeJob().

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

Member Data Documentation

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

Definition at line 40 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

const edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTT0Correction::dtGeomToken_
private

Definition at line 43 of file DTT0Correction.h.

Referenced by beginRun().

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

Definition at line 42 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

const DTT0* DTT0Correction::t0Map_
private

Definition at line 45 of file DTT0Correction.h.

Referenced by beginRun(), and endJob().

edm::ESGetToken<DTT0, DTT0Rcd> DTT0Correction::t0Token_
private

Definition at line 46 of file DTT0Correction.h.

Referenced by beginRun().