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
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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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
 
- 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 &)
 
- 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)

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 34 of file DTTTrigCorrection.cc.

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

34  :
35  dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ) {
36 
37  LogVerbatim("Calibration") << "[DTTTrigCorrection] Constructor called" << endl;
38 
39  // Get the concrete algo from the factory
40  string theAlgoName = pset.getParameter<string>("correctionAlgo");
41  correctionAlgo_ = DTTTrigCorrectionFactory::get()->create(theAlgoName,pset.getParameter<ParameterSet>("correctionAlgoConfig"));
42 }
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:55
DTTTrigCorrection::~DTTTrigCorrection ( )
virtual

Destructor.

Definition at line 44 of file DTTTrigCorrection.cc.

References correctionAlgo_.

44  {
45  LogVerbatim("Calibration") << "[DTTTrigCorrection] Destructor called" << endl;
46  delete correctionAlgo_;
47 }
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 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 49 of file DTTTrigCorrection.cc.

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

49  {
50  // Get tTrig record from DB
51  ESHandle<DTTtrig> tTrig;
52  setup.get<DTTtrigRcd>().get(dbLabel_,tTrig);
53  tTrigMap_ = &*tTrig;
54  LogVerbatim("Calibration") << "[DTTTrigCorrection]: TTrig version: " << tTrig->version() << endl;
55 
56  // Get geometry from Event Setup
57  setup.get<MuonGeometryRecord>().get(muonGeom_);
58 
59  // Pass EventSetup to correction Algo
60  correctionAlgo_->setES(setup);
61 }
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 63 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_.

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

Member Data Documentation

dtCalibration::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().