#include <DTTTrigCorrection.h>
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. | |
virtual void | endJob () |
virtual | ~DTTTrigCorrection () |
Destructor. | |
Private Attributes | |
DTTTrigBaseCorrection * | correctionAlgo_ |
std::string | dbLabel_ |
edm::ESHandle< DTGeometry > | muonGeom_ |
const DTTtrig * | tTrigMap_ |
Class which read a ttrig DB and correct it with the near SL (or the global average)
Class which read a ttrig DB and correct it with the near SL (or the global average)
Definition at line 23 of file DTTTrigCorrection.h.
DTTTrigCorrection::DTTTrigCorrection | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 36 of file DTTTrigCorrection.cc.
References correctionAlgo_, reco::get(), and edm::ParameterSet::getParameter().
: dbLabel_( pset.getUntrackedParameter<string>("dbLabel", "") ) { LogVerbatim("Calibration") << "[DTTTrigCorrection] Constructor called" << endl; // Get the concrete algo from the factory string theAlgoName = pset.getParameter<string>("correctionAlgo"); correctionAlgo_ = DTTTrigCorrectionFactory::get()->create(theAlgoName,pset.getParameter<ParameterSet>("correctionAlgoConfig")); }
DTTTrigCorrection::~DTTTrigCorrection | ( | ) | [virtual] |
Destructor.
Definition at line 46 of file DTTTrigCorrection.cc.
References correctionAlgo_.
{ LogVerbatim("Calibration") << "[DTTTrigCorrection] Destructor called" << endl; delete correctionAlgo_; }
virtual void DTTTrigCorrection::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [inline, virtual] |
virtual void DTTTrigCorrection::beginJob | ( | void | ) | [inline, virtual] |
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_.
{ // Get tTrig record from DB ESHandle<DTTtrig> tTrig; setup.get<DTTtrigRcd>().get(dbLabel_,tTrig); tTrigMap_ = &*tTrig; LogVerbatim("Calibration") << "[DTTTrigCorrection]: TTrig version: " << tTrig->version() << endl; // Get geometry from Event Setup setup.get<MuonGeometryRecord>().get(muonGeom_); // Pass EventSetup to correction Algo correctionAlgo_->setES(setup); }
void DTTTrigCorrection::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 65 of file DTTTrigCorrection.cc.
References DTTTrigBaseCorrection::correction(), correctionAlgo_, alignCSCRings::e, cms::Exception::explainSelf(), DTTtrig::get(), DTTTrigData::kFactor, DTTTrigData::mean, muonGeom_, DTTimeUnits::ns, record, DTTtrig::set(), DTTTrigData::sigma, ntuplemaker::status, and tTrigMap_.
{ // Create the object to be written to DB DTTtrig* tTrigNewMap = new DTTtrig(); for(vector<DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin(); sl != muonGeom_->superLayers().end(); ++sl) { // Get old value from DB float tTrigMean,tTrigSigma,kFactor; int status = tTrigMap_->get((*sl)->id(),tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns); //Compute new ttrig try{ DTTTrigData tTrigCorr = correctionAlgo_->correction((*sl)->id()); float tTrigMeanNew = tTrigCorr.mean; float tTrigSigmaNew = tTrigCorr.sigma; float kFactorNew = tTrigCorr.kFactor; tTrigNewMap->set((*sl)->id(),tTrigMeanNew,tTrigSigmaNew,kFactorNew,DTTimeUnits::ns); LogVerbatim("Calibration") << "New tTrig for: " << (*sl)->id() << " mean from " << tTrigMean << " to " << tTrigMeanNew << " sigma from " << tTrigSigma << " to " << tTrigSigmaNew << " kFactor from " << kFactor << " to " << kFactorNew << endl; } catch(cms::Exception& e){ LogError("Calibration") << e.explainSelf(); // Set db to the old value, if it was there in the first place if(!status){ tTrigNewMap->set((*sl)->id(),tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns); LogVerbatim("Calibration") << "Keep old tTrig for: " << (*sl)->id() << " mean " << tTrigMean << " sigma " << tTrigSigma << " kFactor " << kFactor << endl; } continue; } }//End of loop on superlayers //Write object to DB LogVerbatim("Calibration") << "[DTTTrigCorrection]: Writing ttrig object to DB!" << endl; string record = "DTTtrigRcd"; DTCalibDBUtils::writeToDB<DTTtrig>(record, tTrigNewMap); }
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().