CMS 3D CMS Logo

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

#include <DTVDriftWriter.h>

Inheritance diagram for DTVDriftWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup) override
 
 DTVDriftWriter (const edm::ParameterSet &pset)
 
void endJob () override
 
 ~DTVDriftWriter () override
 
- 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

edm::ESHandle< DTGeometrydtGeom_
 
std::string granularity_
 
const DTMtimemTimeMap_
 
std::unique_ptr< dtCalibration::DTVDriftBaseAlgovDriftAlgo_
 

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

Definition at line 24 of file DTVDriftWriter.h.

Constructor & Destructor Documentation

◆ DTVDriftWriter()

DTVDriftWriter::DTVDriftWriter ( const edm::ParameterSet pset)

Definition at line 33 of file DTVDriftWriter.cc.

34  : granularity_(pset.getUntrackedParameter<string>("calibGranularity", "bySL")),
35  vDriftAlgo_{DTVDriftPluginFactory::get()->create(pset.getParameter<string>("vDriftAlgo"),
36  pset.getParameter<ParameterSet>("vDriftAlgoConfig"))} {
37  LogVerbatim("Calibration") << "[DTVDriftWriter]Constructor called!";
38 
39  if (granularity_ != "bySL")
40  throw cms::Exception("Configuration")
41  << "[DTVDriftWriter] Check parameter calibGranularity: " << granularity_ << " option not available.";
42 }

References get, and muonDTDigis_cfi::pset.

◆ ~DTVDriftWriter()

DTVDriftWriter::~DTVDriftWriter ( )
override

Definition at line 44 of file DTVDriftWriter.cc.

44 { LogVerbatim("Calibration") << "[DTVDriftWriter]Destructor called!"; }

Member Function Documentation

◆ analyze()

void DTVDriftWriter::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 31 of file DTVDriftWriter.h.

31 {}

◆ beginRun()

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

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file DTVDriftWriter.cc.

46  {
47  // Get the map of ttrig from the Setup
48  ESHandle<DTMtime> mTime;
49  setup.get<DTMtimeRcd>().get(mTime);
50  mTimeMap_ = &*mTime;
51 
52  // Get geometry from Event Setup
54  // Pass EventSetup to concrete implementation
55  vDriftAlgo_->setES(setup);
56 }

References dtGeom_, get, mTimeMap_, singleTopDQM_cfi::setup, and vDriftAlgo_.

◆ endJob()

void DTVDriftWriter::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file DTVDriftWriter.cc.

58  {
59  // Create the object to be written to DB
60  DTMtime* mTimeNewMap = new DTMtime();
61 
62  if (granularity_ == "bySL") {
63  // Get all the sls from the geometry
64  const vector<const DTSuperLayer*>& superLayers = dtGeom_->superLayers();
65  auto sl = superLayers.begin();
66  auto sl_end = superLayers.end();
67  for (; sl != sl_end; ++sl) {
68  DTSuperLayerId slId = (*sl)->id();
69  // Get original value from DB
70  float vDrift = 0., resolution = 0.;
71  // vdrift is cm/ns , resolution is cm
73 
74  // Compute vDrift
75  try {
76  dtCalibration::DTVDriftData vDriftData = vDriftAlgo_->compute(slId);
77  float vDriftNew = vDriftData.vdrift;
78  float resolutionNew = vDriftData.resolution;
79  // vdrift is cm/ns , resolution is cm
80  mTimeNewMap->set(slId, vDriftNew, resolutionNew, DTVelocityUnits::cm_per_ns);
81  LogVerbatim("Calibration") << "vDrift for: " << slId << " Mean " << vDriftNew << " Resolution "
82  << resolutionNew;
83  } catch (cms::Exception& e) {
84  LogError("Calibration") << e.explainSelf();
85  // Go back to original value in case of error
86  if (!status) {
87  mTimeNewMap->set(slId, vDrift, resolution, DTVelocityUnits::cm_per_ns);
88  LogVerbatim("Calibration") << "Keep original vDrift for: " << slId << " Mean " << vDrift << " Resolution "
89  << resolution;
90  }
91  }
92  } // End of loop on superlayers
93  }
94 
95  // Write the vDrift object to DB
96  LogVerbatim("Calibration") << "[DTVDriftWriter]Writing vdrift object to DB!";
97  string record = "DTMtimeRcd";
98  DTCalibDBUtils::writeToDB<DTMtime>(record, mTimeNewMap);
99 }

References DTVelocityUnits::cm_per_ns, dtGeom_, MillePedeFileConverter_cfg::e, DTMtime::get(), granularity_, mTimeMap_, GlobalPosition_Frontier_DevDB_cff::record, dtCalibration::DTVDriftData::resolution, L1TObjectsTimingClient_cff::resolution, DTMtime::set(), mps_update::status, DTGeometry::superLayers(), dtCalibration::DTVDriftData::vdrift, and vDriftAlgo_.

Referenced by o2olib.O2ORunMgr::executeJob().

Member Data Documentation

◆ dtGeom_

edm::ESHandle<DTGeometry> DTVDriftWriter::dtGeom_
private

Definition at line 38 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().

◆ granularity_

std::string DTVDriftWriter::granularity_
private

Definition at line 35 of file DTVDriftWriter.h.

Referenced by endJob().

◆ mTimeMap_

const DTMtime* DTVDriftWriter::mTimeMap_
private

Definition at line 37 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().

◆ vDriftAlgo_

std::unique_ptr<dtCalibration::DTVDriftBaseAlgo> DTVDriftWriter::vDriftAlgo_
private

Definition at line 40 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().

DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTVDriftWriter::dtGeom_
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTVDriftWriter.h:38
DTVDriftWriter::mTimeMap_
const DTMtime * mTimeMap_
Definition: DTVDriftWriter.h:37
mps_update.status
status
Definition: mps_update.py:69
dtCalibration::DTVDriftData::vdrift
double vdrift
Definition: DTVDriftBaseAlgo.h:23
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
DTMtime
Definition: DTMtime.h:68
DTMtime::set
int set(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit)
Definition: DTMtime.cc:168
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
dtCalibration::DTVDriftData::resolution
double resolution
Definition: DTVDriftBaseAlgo.h:24
DTVDriftWriter::vDriftAlgo_
std::unique_ptr< dtCalibration::DTVDriftBaseAlgo > vDriftAlgo_
Definition: DTVDriftWriter.h:40
edm::ESHandle< DTMtime >
L1TObjectsTimingClient_cff.resolution
resolution
Definition: L1TObjectsTimingClient_cff.py:52
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
DTVelocityUnits::cm_per_ns
Definition: DTVelocityUnits.h:32
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
Exception
Definition: hltDiff.cc:246
cms::Exception
Definition: Exception.h:70
dtCalibration::DTVDriftData
Definition: DTVDriftBaseAlgo.h:19
DTVDriftWriter::granularity_
std::string granularity_
Definition: DTVDriftWriter.h:35
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTMtime::get
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:56
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
DTMtimeRcd
Definition: DTMtimeRcd.h:5