CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 
 DTVDriftWriter (const edm::ParameterSet &pset)
 
virtual void endJob ()
 
virtual ~DTVDriftWriter ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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

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 edm::hlt::Exception, reco::get(), edm::ParameterSet::getParameter(), granularity_, and vDriftAlgo_.

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

Definition at line 47 of file DTVDriftWriter.cc.

References vDriftAlgo_.

47  {
48  LogVerbatim("Calibration") << "[DTVDriftWriter]Destructor called!";
49  delete vDriftAlgo_;
50 }
dtCalibration::DTVDriftBaseAlgo * vDriftAlgo_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 31 of file DTVDriftWriter.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file DTVDriftWriter.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file DTVDriftWriter.cc.

References DTVelocityUnits::cm_per_ns, dtCalibration::DTVDriftBaseAlgo::compute(), dtGeom_, alignCSCRings::e, cms::Exception::explainSelf(), DTMtime::get(), granularity_, mTimeMap_, record, dtDQMClient_cfg::resolution, dtCalibration::DTVDriftData::resolution, DTMtime::set(), ntuplemaker::status, dtCalibration::DTVDriftData::vdrift, and vDriftAlgo_.

64  {
65  // Create the object to be written to DB
66  DTMtime* mTimeNewMap = new DTMtime();
67 
68  if(granularity_ == "bySL") {
69  // Get all the sls from the geometry
70  const vector<const DTSuperLayer*>& superLayers = dtGeom_->superLayers();
71  auto sl = superLayers.begin();
72  auto sl_end = superLayers.end();
73  for(; sl != sl_end; ++sl){
74  DTSuperLayerId slId = (*sl)->id();
75  // Get original value from DB
76  float vDrift = 0., resolution = 0.;
77  // vdrift is cm/ns , resolution is cm
79 
80  // Compute vDrift
81  try{
83  float vDriftNew = vDriftData.vdrift;
84  float resolutionNew = vDriftData.resolution;
85  // vdrift is cm/ns , resolution is cm
86  mTimeNewMap->set(slId,
87  vDriftNew,
88  resolutionNew,
90  LogVerbatim("Calibration") << "vDrift for: " << slId
91  << " Mean " << vDriftNew
92  << " Resolution " << resolutionNew;
93  } catch(cms::Exception& e){
94  LogError("Calibration") << e.explainSelf();
95  // Go back to original value in case of error
96  if(!status){
97  mTimeNewMap->set(slId,
98  vDrift,
99  resolution,
101  LogVerbatim("Calibration") << "Keep original vDrift for: " << slId
102  << " Mean " << vDrift
103  << " Resolution " << resolution;
104  }
105  }
106  } // End of loop on superlayers
107  }
108 
109  // Write the vDrift object to DB
110  LogVerbatim("Calibration") << "[DTVDriftWriter]Writing vdrift object to DB!";
111  string record = "DTMtimeRcd";
112  DTCalibDBUtils::writeToDB<DTMtime>(record, mTimeNewMap);
113 }
edm::ESHandle< DTGeometry > dtGeom_
JetCorrectorParameters::Record record
Definition: classes.h:7
virtual DTVDriftData compute(const DTSuperLayerId &)=0
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:146
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_
tuple status
Definition: ntuplemaker.py:245
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().

dtCalibration::DTVDriftBaseAlgo* DTVDriftWriter::vDriftAlgo_
private

Definition at line 40 of file DTVDriftWriter.h.

Referenced by beginRun(), DTVDriftWriter(), endJob(), and ~DTVDriftWriter().