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

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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 24 of file DTVDriftWriter.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file DTVDriftWriter.cc.

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

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

Definition at line 49 of file DTVDriftWriter.cc.

References vDriftAlgo_.

49  {
50  LogVerbatim("Calibration") << "[DTVDriftWriter]Destructor called!";
51  delete vDriftAlgo_;
52 }
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 54 of file DTVDriftWriter.cc.

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

54  {
55  // Get the map of ttrig from the Setup
56  ESHandle<DTMtime> mTime;
57  setup.get<DTMtimeRcd>().get(mTime);
58  mTimeMap_ = &*mTime;
59 
60  // Get geometry from Event Setup
61  setup.get<MuonGeometryRecord>().get(dtGeom_);
62  // Pass EventSetup to concrete implementation
63  vDriftAlgo_->setES(setup);
64 }
edm::ESHandle< DTGeometry > dtGeom_
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 66 of file DTVDriftWriter.cc.

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

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

DTVDriftBaseAlgo* DTVDriftWriter::vDriftAlgo_
private

Definition at line 40 of file DTVDriftWriter.h.

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