#include <DTT0Correction.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) |
DTT0Correction (const edm::ParameterSet &pset) | |
Constructor. | |
virtual void | endJob () |
virtual | ~DTT0Correction () |
Destructor. | |
Private Attributes | |
dtCalibration::DTT0BaseCorrection * | correctionAlgo_ |
edm::ESHandle< DTGeometry > | muonGeom_ |
const DTT0 * | t0Map_ |
Class that reads and corrects t0 DB
Definition at line 24 of file DTT0Correction.h.
DTT0Correction::DTT0Correction | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 36 of file DTT0Correction.cc.
References reco::get(), and edm::ParameterSet::getParameter().
{ LogVerbatim("Calibration") << "[DTT0Correction] Constructor called" << endl; // Get the concrete algo from the factory string theAlgoName = pset.getParameter<string>("correctionAlgo"); correctionAlgo_ = DTT0CorrectionFactory::get()->create(theAlgoName,pset.getParameter<ParameterSet>("correctionAlgoConfig")); }
DTT0Correction::~DTT0Correction | ( | ) | [virtual] |
Destructor.
Definition at line 45 of file DTT0Correction.cc.
{ LogVerbatim("Calibration") << "[DTT0Correction] Destructor called" << endl; delete correctionAlgo_; }
virtual void DTT0Correction::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | setup | ||
) | [inline, virtual] |
virtual void DTT0Correction::beginJob | ( | void | ) | [inline, virtual] |
void DTT0Correction::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | setup | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 50 of file DTT0Correction.cc.
References edm::EventSetup::get().
{ // Get t0 record from DB ESHandle<DTT0> t0H; setup.get<DTT0Rcd>().get(t0H); t0Map_ = &*t0H; LogVerbatim("Calibration") << "[DTT0Correction]: T0 version: " << t0H->version() << endl; // Get geometry from Event Setup setup.get<MuonGeometryRecord>().get(muonGeom_); // Pass EventSetup to correction Algo correctionAlgo_->setES(setup); }
void DTT0Correction::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 64 of file DTT0Correction.cc.
References DTTimeUnits::counts, alignCSCRings::e, cms::Exception::explainSelf(), DTTopology::firstChannel(), DTTopology::lastChannel(), dtCalibration::DTT0Data::mean, record, dtCalibration::DTT0Data::rms, DTT0::set(), and ntuplemaker::status.
{ // Create the object to be written to DB DTT0* t0NewMap = new DTT0(); // Loop over all channels for(vector<DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin(); sl != muonGeom_->superLayers().end(); ++sl) { for(vector<const DTLayer*>::const_iterator layer = (*sl)->layers().begin(); layer != (*sl)->layers().end(); ++layer) { // Access layer topology const DTTopology& dtTopo = (*layer)->specificTopology(); const int firstWire = dtTopo.firstChannel(); const int lastWire = dtTopo.lastChannel(); //const int nWires = dtTopo.channels(); //Loop on wires for(int wire = firstWire; wire <= lastWire; ++wire){ DTWireId wireId((*layer)->id(),wire); // Get old value from DB float t0Mean,t0RMS; int status = t0Map_->get(wireId,t0Mean,t0RMS,DTTimeUnits::counts); // Compute new t0 for this wire try{ dtCalibration::DTT0Data t0Corr = correctionAlgo_->correction( wireId ); float t0MeanNew = t0Corr.mean; float t0RMSNew = t0Corr.rms; t0NewMap->set(wireId,t0MeanNew,t0RMSNew,DTTimeUnits::counts); LogVerbatim("Calibration") << "New t0 for: " << wireId << " mean from " << t0Mean << " to " << t0MeanNew << " rms from " << t0RMS << " to " << t0RMSNew << 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){ t0NewMap->set(wireId,t0Mean,t0RMS,DTTimeUnits::counts); LogVerbatim("Calibration") << "Keep old t0 for: " << wireId << " mean " << t0Mean << " rms " << t0RMS << endl; } continue; } } // End of loop on wires } // End of loop on layers } // End of loop on superlayers //Write object to DB LogVerbatim("Calibration") << "[DTT0Correction]: Writing t0 object to DB!" << endl; string record = "DTT0Rcd"; DTCalibDBUtils::writeToDB<DTT0>(record, t0NewMap); }
Definition at line 46 of file DTT0Correction.h.
edm::ESHandle<DTGeometry> DTT0Correction::muonGeom_ [private] |
Definition at line 44 of file DTT0Correction.h.
const DTT0* DTT0Correction::t0Map_ [private] |
Definition at line 43 of file DTT0Correction.h.