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
DTTTrigCorrection Class Reference

#include <DTTTrigCorrection.h>

Inheritance diagram for DTTTrigCorrection:
edm::EDAnalyzer

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)
 
 DTTTrigCorrection (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual void endJob ()
 
virtual ~DTTTrigCorrection ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

DTTTrigBaseCorrectioncorrectionAlgo_
 
std::string dbLabel_
 
edm::ESHandle< DTGeometrymuonGeom_
 
const DTTtrigtTrigMap_
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Class which read a ttrig DB and correct it with the near SL (or the global average)

Date:
2010/02/16 10:03:23
Revision:
1.7
Author
S. Maselli - INFN Torino

Class which read a ttrig DB and correct it with the near SL (or the global average)

Date:
2010/01/19 09:51:31
Revision:
1.2
Author
S. Maselli - INFN Torino

Definition at line 23 of file DTTTrigCorrection.h.

Constructor & Destructor Documentation

DTTTrigCorrection::DTTTrigCorrection ( const edm::ParameterSet pset)

Constructor.

Definition at line 36 of file DTTTrigCorrection.cc.

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

36  :
37  dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ) {
38 
39  LogVerbatim("Calibration") << "[DTTTrigCorrection] Constructor called" << endl;
40 
41  // Get the concrete algo from the factory
42  string theAlgoName = pset.getParameter<string>("correctionAlgo");
43  correctionAlgo_ = DTTTrigCorrectionFactory::get()->create(theAlgoName,pset.getParameter<ParameterSet>("correctionAlgoConfig"));
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTTTrigBaseCorrection * correctionAlgo_
T get(const Candidate &c)
Definition: component.h:56
DTTTrigCorrection::~DTTTrigCorrection ( )
virtual

Destructor.

Definition at line 46 of file DTTTrigCorrection.cc.

References correctionAlgo_.

46  {
47  LogVerbatim("Calibration") << "[DTTTrigCorrection] Destructor called" << endl;
48  delete correctionAlgo_;
49 }
DTTTrigBaseCorrection * correctionAlgo_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 35 of file DTTTrigCorrection.h.

35 {}
virtual void DTTTrigCorrection::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 33 of file DTTTrigCorrection.h.

33 {}
void DTTTrigCorrection::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file DTTTrigCorrection.cc.

References correctionAlgo_, dbLabel_, edm::EventSetup::get(), muonGeom_, DTTTrigBaseCorrection::setES(), and tTrigMap_.

51  {
52  // Get tTrig record from DB
53  ESHandle<DTTtrig> tTrig;
54  setup.get<DTTtrigRcd>().get(dbLabel_,tTrig);
55  tTrigMap_ = &*tTrig;
56  LogVerbatim("Calibration") << "[DTTTrigCorrection]: TTrig version: " << tTrig->version() << endl;
57 
58  // Get geometry from Event Setup
59  setup.get<MuonGeometryRecord>().get(muonGeom_);
60 
61  // Pass EventSetup to correction Algo
62  correctionAlgo_->setES(setup);
63 }
DTTTrigBaseCorrection * correctionAlgo_
virtual void setES(const edm::EventSetup &setup)=0
const DTTtrig * tTrigMap_
edm::ESHandle< DTGeometry > muonGeom_
const T & get() const
Definition: EventSetup.h:55
void DTTTrigCorrection::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file DTTTrigCorrection.cc.

References DTTTrigBaseCorrection::correction(), correctionAlgo_, cms::Exception::explainSelf(), DTTtrig::get(), DTTTrigData::kFactor, DTTTrigData::mean, muonGeom_, DTTimeUnits::ns, record, DTTtrig::set(), DTTTrigData::sigma, ntuplemaker::status, and tTrigMap_.

65  {
66  // Create the object to be written to DB
67  DTTtrig* tTrigNewMap = new DTTtrig();
68 
69  for(vector<DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin();
70  sl != muonGeom_->superLayers().end(); ++sl) {
71  // Get old value from DB
72  float tTrigMean,tTrigSigma,kFactor;
73  int status = tTrigMap_->get((*sl)->id(),tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
74 
75  //Compute new ttrig
76  try{
77  DTTTrigData tTrigCorr = correctionAlgo_->correction((*sl)->id());
78  float tTrigMeanNew = tTrigCorr.mean;
79  float tTrigSigmaNew = tTrigCorr.sigma;
80  float kFactorNew = tTrigCorr.kFactor;
81  tTrigNewMap->set((*sl)->id(),tTrigMeanNew,tTrigSigmaNew,kFactorNew,DTTimeUnits::ns);
82 
83  LogVerbatim("Calibration") << "New tTrig for: " << (*sl)->id()
84  << " mean from " << tTrigMean << " to " << tTrigMeanNew
85  << " sigma from " << tTrigSigma << " to " << tTrigSigmaNew
86  << " kFactor from " << kFactor << " to " << kFactorNew << endl;
87  } catch(cms::Exception& e){
88  LogError("Calibration") << e.explainSelf();
89  // Set db to the old value, if it was there in the first place
90  if(!status){
91  tTrigNewMap->set((*sl)->id(),tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns);
92  LogVerbatim("Calibration") << "Keep old tTrig for: " << (*sl)->id()
93  << " mean " << tTrigMean
94  << " sigma " << tTrigSigma
95  << " kFactor " << kFactor << endl;
96  }
97  continue;
98  }
99  }//End of loop on superlayers
100 
101  //Write object to DB
102  LogVerbatim("Calibration") << "[DTTTrigCorrection]: Writing ttrig object to DB!" << endl;
103  string record = "DTTtrigRcd";
104  DTCalibDBUtils::writeToDB<DTTtrig>(record, tTrigNewMap);
105 }
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
Definition: DTTtrig.cc:262
JetCorrectorParameters::Record record
Definition: classes.h:11
DTTTrigBaseCorrection * correctionAlgo_
virtual std::string explainSelf() const
Definition: Exception.cc:56
const DTTtrig * tTrigMap_
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:87
edm::ESHandle< DTGeometry > muonGeom_
virtual DTTTrigData correction(const DTSuperLayerId &)=0
tuple status
Definition: ntuplemaker.py:245

Member Data Documentation

DTTTrigBaseCorrection* DTTTrigCorrection::correctionAlgo_
private

Definition at line 46 of file DTTTrigCorrection.h.

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

std::string DTTTrigCorrection::dbLabel_
private

Definition at line 41 of file DTTTrigCorrection.h.

Referenced by beginRun().

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

Definition at line 44 of file DTTTrigCorrection.h.

Referenced by beginRun(), and endJob().

const DTTtrig* DTTTrigCorrection::tTrigMap_
private

Definition at line 43 of file DTTTrigCorrection.h.

Referenced by beginRun(), and endJob().