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 edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

dtCalibration::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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

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

Date:
2012/03/02 19:47:32
Revision:
1.9
Author
S. Maselli - INFN Torino

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.3
Author
S. Maselli - INFN Torino

Definition at line 25 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
dtCalibration::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 }
dtCalibration::DTTTrigBaseCorrection * correctionAlgo_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 37 of file DTTTrigCorrection.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file DTTTrigCorrection.h.

35 {}
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_, dtCalibration::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 }
virtual void setES(const edm::EventSetup &setup)=0
const DTTtrig * tTrigMap_
edm::ESHandle< DTGeometry > muonGeom_
const T & get() const
Definition: EventSetup.h:55
dtCalibration::DTTTrigBaseCorrection * correctionAlgo_
void DTTTrigCorrection::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file DTTTrigCorrection.cc.

References dtCalibration::DTTTrigBaseCorrection::correction(), correctionAlgo_, alignCSCRings::e, cms::Exception::explainSelf(), DTTtrig::get(), dtCalibration::DTTTrigData::kFactor, dtCalibration::DTTTrigData::mean, muonGeom_, DTTimeUnits::ns, record, DTTtrig::set(), dtCalibration::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  dtCalibration::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
virtual DTTTrigData correction(const DTSuperLayerId &)=0
JetCorrectorParameters::Record record
Definition: classes.h:13
virtual std::string explainSelf() const
Definition: Exception.cc:146
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_
dtCalibration::DTTTrigBaseCorrection * correctionAlgo_
tuple status
Definition: ntuplemaker.py:245

Member Data Documentation

dtCalibration::DTTTrigBaseCorrection* DTTTrigCorrection::correctionAlgo_
private

Definition at line 48 of file DTTTrigCorrection.h.

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

std::string DTTTrigCorrection::dbLabel_
private

Definition at line 43 of file DTTTrigCorrection.h.

Referenced by beginRun().

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

Definition at line 46 of file DTTTrigCorrection.h.

Referenced by beginRun(), and endJob().

const DTTtrig* DTTTrigCorrection::tTrigMap_
private

Definition at line 45 of file DTTTrigCorrection.h.

Referenced by beginRun(), and endJob().