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

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 
 DTT0Correction (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual void endJob ()
 
virtual ~DTT0Correction ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

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 &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Class that reads and corrects t0 DB

Author
A. Vilela Pereira

Definition at line 22 of file DTT0Correction.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTT0Correction.cc.

References reco::get(), and edm::ParameterSet::getParameter().

34  {
35 
36  LogVerbatim("Calibration") << "[DTT0Correction] Constructor called" << endl;
37 
38  // Get the concrete algo from the factory
39  string theAlgoName = pset.getParameter<string>("correctionAlgo");
40  correctionAlgo_ = DTT0CorrectionFactory::get()->create(theAlgoName,pset.getParameter<ParameterSet>("correctionAlgoConfig"));
41 }
T getParameter(std::string const &) const
dtCalibration::DTT0BaseCorrection * correctionAlgo_
T get(const Candidate &c)
Definition: component.h:55
DTT0Correction::~DTT0Correction ( )
virtual

Destructor.

Definition at line 43 of file DTT0Correction.cc.

43  {
44  LogVerbatim("Calibration") << "[DTT0Correction] Destructor called" << endl;
45  delete correctionAlgo_;
46 }
dtCalibration::DTT0BaseCorrection * correctionAlgo_

Member Function Documentation

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

Definition at line 34 of file DTT0Correction.h.

34 {}
virtual void DTT0Correction::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 32 of file DTT0Correction.h.

References findQualityFiles::run, and GeneralSetup::setup().

32 {}
void DTT0Correction::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Definition at line 48 of file DTT0Correction.cc.

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

48  {
49  // Get t0 record from DB
50  ESHandle<DTT0> t0H;
51  setup.get<DTT0Rcd>().get(t0H);
52  t0Map_ = &*t0H;
53  LogVerbatim("Calibration") << "[DTT0Correction]: T0 version: " << t0H->version() << endl;
54 
55  // Get geometry from Event Setup
56  setup.get<MuonGeometryRecord>().get(muonGeom_);
57 
58  // Pass EventSetup to correction Algo
59  correctionAlgo_->setES(setup);
60 }
const DTT0 * t0Map_
edm::ESHandle< DTGeometry > muonGeom_
dtCalibration::DTT0BaseCorrection * correctionAlgo_
virtual void setES(const edm::EventSetup &setup)=0
const T & get() const
Definition: EventSetup.h:55
Definition: DTT0Rcd.h:9
const std::string & version() const
access version
Definition: DTT0.cc:118
void DTT0Correction::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file DTT0Correction.cc.

References DTTimeUnits::counts, MillePedeFileConverter_cfg::e, cms::Exception::explainSelf(), DTTopology::firstChannel(), DTTopology::lastChannel(), dtCalibration::DTT0Data::mean, record, dtCalibration::DTT0Data::rms, DTT0::set(), and mps_update::status.

Referenced by o2olib.O2ORunMgr::executeJob().

62  {
63  // Create the object to be written to DB
64  DTT0* t0NewMap = new DTT0();
65 
66  // Loop over all channels
67  for(auto sl = muonGeom_->superLayers().begin();
68  sl != muonGeom_->superLayers().end(); ++sl) {
69  for(vector<const DTLayer*>::const_iterator layer = (*sl)->layers().begin();
70  layer != (*sl)->layers().end(); ++layer) {
71  // Access layer topology
72  const DTTopology& dtTopo = (*layer)->specificTopology();
73  const int firstWire = dtTopo.firstChannel();
74  const int lastWire = dtTopo.lastChannel();
75  //const int nWires = dtTopo.channels();
76 
77  //Loop on wires
78  for(int wire = firstWire; wire <= lastWire; ++wire){
79  DTWireId wireId((*layer)->id(),wire);
80 
81  // Get old value from DB
82  float t0Mean,t0RMS;
83  int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
84 
85  // Compute new t0 for this wire
86  try{
88  float t0MeanNew = t0Corr.mean;
89  float t0RMSNew = t0Corr.rms;
90  t0NewMap->set(wireId,t0MeanNew,t0RMSNew,DTTimeUnits::counts);
91 
92  LogVerbatim("Calibration") << "New t0 for: " << wireId
93  << " mean from " << t0Mean << " to " << t0MeanNew
94  << " rms from " << t0RMS << " to " << t0RMSNew << endl;
95  } catch(cms::Exception& e){
96  LogError("Calibration") << e.explainSelf();
97  // Set db to the old value, if it was there in the first place
98  if(!status){
99  t0NewMap->set(wireId,t0Mean,t0RMS,DTTimeUnits::counts);
100  LogVerbatim("Calibration") << "Keep old t0 for: " << wireId
101  << " mean " << t0Mean
102  << " rms " << t0RMS << endl;
103  }
104  continue;
105  }
106  } // End of loop on wires
107  } // End of loop on layers
108  } // End of loop on superlayers
109 
110  //Write object to DB
111  LogVerbatim("Calibration") << "[DTT0Correction]: Writing t0 object to DB!" << endl;
112  string record = "DTT0Rcd";
113  DTCalibDBUtils::writeToDB<DTT0>(record, t0NewMap);
114 }
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:140
const DTT0 * t0Map_
virtual DTT0Data correction(const DTWireId &)=0
JetCorrectorParameters::Record record
Definition: classes.h:7
virtual std::string explainSelf() const
Definition: Exception.cc:146
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:67
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:80
Definition: DTT0.h:53
dtCalibration::DTT0BaseCorrection * correctionAlgo_
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:89

Member Data Documentation

dtCalibration::DTT0BaseCorrection* DTT0Correction::correctionAlgo_
private

Definition at line 44 of file DTT0Correction.h.

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

Definition at line 42 of file DTT0Correction.h.

const DTT0* DTT0Correction::t0Map_
private

Definition at line 41 of file DTT0Correction.h.