#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 reco::get(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
{ 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")); dbLabel = pset.getUntrackedParameter<string>("dbLabel", ""); }
DTTTrigCorrection::~DTTTrigCorrection | ( | ) | [virtual] |
Destructor.
Definition at line 46 of file DTTTrigCorrection.cc.
{ 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 edm::EventSetup::get().
{ // 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 ExpressReco_HICollisions_FallBack::e, cms::Exception::explainSelf(), DTTTrigData::kFactor, DTTTrigData::mean, DTTimeUnits::ns, record, DTTtrig::set(), DTTTrigData::sigma, and ntuplemaker::status.
{ // Create the object to be written to DB DTTtrig* tTrigNewMap = new DTTtrig(); //Get the superlayers list vector<DTSuperLayer*> dtSupLylist = muonGeom_->superLayers(); 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.
std::string DTTTrigCorrection::dbLabel [private] |
Definition at line 44 of file DTTTrigCorrection.h.
edm::ESHandle<DTGeometry> DTTTrigCorrection::muonGeom_ [private] |
Definition at line 42 of file DTTTrigCorrection.h.
const DTTtrig* DTTTrigCorrection::tTrigMap_ [private] |
Definition at line 41 of file DTTTrigCorrection.h.