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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Definition at line 24 of file DTVDriftWriter.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file DTVDriftWriter.cc.

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

33  :
34  granularity_( pset.getUntrackedParameter<string>("calibGranularity","bySL") ),
35  vDriftAlgo_{DTVDriftPluginFactory::get()->create(pset.getParameter<string>("vDriftAlgo"),
36  pset.getParameter<ParameterSet>("vDriftAlgoConfig"))}
37  {
38 
39  LogVerbatim("Calibration") << "[DTVDriftWriter]Constructor called!";
40 
41  if(granularity_ != "bySL")
42  throw cms::Exception("Configuration") << "[DTVDriftWriter] Check parameter calibGranularity: " << granularity_ << " option not available.";
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< dtCalibration::DTVDriftBaseAlgo > vDriftAlgo_
T get(const Candidate &c)
Definition: component.h:55
std::string granularity_
DTVDriftWriter::~DTVDriftWriter ( )
override

Definition at line 45 of file DTVDriftWriter.cc.

45  {
46  LogVerbatim("Calibration") << "[DTVDriftWriter]Destructor called!";
47 }

Member Function Documentation

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

Definition at line 31 of file DTVDriftWriter.h.

31 {}
void DTVDriftWriter::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Definition at line 49 of file DTVDriftWriter.cc.

References dtGeom_, edm::EventSetup::get(), mTimeMap_, and vDriftAlgo_.

49  {
50  // Get the map of ttrig from the Setup
51  ESHandle<DTMtime> mTime;
52  setup.get<DTMtimeRcd>().get(mTime);
53  mTimeMap_ = &*mTime;
54 
55  // Get geometry from Event Setup
56  setup.get<MuonGeometryRecord>().get(dtGeom_);
57  // Pass EventSetup to concrete implementation
58  vDriftAlgo_->setES(setup);
59 }
edm::ESHandle< DTGeometry > dtGeom_
std::unique_ptr< dtCalibration::DTVDriftBaseAlgo > vDriftAlgo_
T get() const
Definition: EventSetup.h:71
const DTMtime * mTimeMap_
void DTVDriftWriter::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file DTVDriftWriter.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

61  {
62  // Create the object to be written to DB
63  DTMtime* mTimeNewMap = new DTMtime();
64 
65  if(granularity_ == "bySL") {
66  // Get all the sls from the geometry
67  const vector<const DTSuperLayer*>& superLayers = dtGeom_->superLayers();
68  auto sl = superLayers.begin();
69  auto sl_end = superLayers.end();
70  for(; sl != sl_end; ++sl){
71  DTSuperLayerId slId = (*sl)->id();
72  // Get original value from DB
73  float vDrift = 0., resolution = 0.;
74  // vdrift is cm/ns , resolution is cm
76 
77  // Compute vDrift
78  try{
79  dtCalibration::DTVDriftData vDriftData = vDriftAlgo_->compute(slId);
80  float vDriftNew = vDriftData.vdrift;
81  float resolutionNew = vDriftData.resolution;
82  // vdrift is cm/ns , resolution is cm
83  mTimeNewMap->set(slId,
84  vDriftNew,
85  resolutionNew,
87  LogVerbatim("Calibration") << "vDrift for: " << slId
88  << " Mean " << vDriftNew
89  << " Resolution " << resolutionNew;
90  } catch(cms::Exception& e){
91  LogError("Calibration") << e.explainSelf();
92  // Go back to original value in case of error
93  if(!status){
94  mTimeNewMap->set(slId,
95  vDrift,
96  resolution,
98  LogVerbatim("Calibration") << "Keep original vDrift for: " << slId
99  << " Mean " << vDrift
100  << " Resolution " << resolution;
101  }
102  }
103  } // End of loop on superlayers
104  }
105 
106  // Write the vDrift object to DB
107  LogVerbatim("Calibration") << "[DTVDriftWriter]Writing vdrift object to DB!";
108  string record = "DTMtimeRcd";
109  DTCalibDBUtils::writeToDB<DTMtime>(record, mTimeNewMap);
110 }
edm::ESHandle< DTGeometry > dtGeom_
JetCorrectorParameters::Record record
Definition: classes.h:7
int set(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit)
Definition: DTMtime.cc:250
virtual std::string explainSelf() const
Definition: Exception.cc:108
std::unique_ptr< dtCalibration::DTVDriftBaseAlgo > vDriftAlgo_
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
Definition: DTMtime.cc:82
const DTMtime * mTimeMap_
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:107
std::string granularity_

Member Data Documentation

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

Definition at line 38 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().

std::string DTVDriftWriter::granularity_
private

Definition at line 35 of file DTVDriftWriter.h.

Referenced by DTVDriftWriter(), and endJob().

const DTMtime* DTVDriftWriter::mTimeMap_
private

Definition at line 37 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().

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

Definition at line 40 of file DTVDriftWriter.h.

Referenced by beginRun(), and endJob().