#include <DTTTrigFillWithAverage.h>
Public Member Functions | |
virtual DTTTrigData | correction (const DTSuperLayerId &) |
DTTTrigFillWithAverage (const edm::ParameterSet &) | |
virtual void | setES (const edm::EventSetup &setup) |
virtual | ~DTTTrigFillWithAverage () |
Private Member Functions | |
void | getAverage () |
Private Attributes | |
std::string | dbLabel |
bool | foundAverage_ |
struct { | |
float aveKFactor | |
float aveMean | |
float aveSigma | |
float rmsMean | |
float rmsSigma | |
} | initialTTrig_ |
edm::ESHandle< DTGeometry > | muonGeom_ |
const DTTtrig * | tTrigMap_ |
Concrete implementation of a DTTTrigBaseCorrection. Fills missing tTrig values in DB
Definition at line 22 of file DTTTrigFillWithAverage.h.
DTTTrigFillWithAverage::DTTTrigFillWithAverage | ( | const edm::ParameterSet & | pset | ) |
Definition at line 21 of file DTTTrigFillWithAverage.cc.
References dbLabel, and edm::ParameterSet::getUntrackedParameter().
:foundAverage_(false) { dbLabel = pset.getUntrackedParameter<string>("dbLabel", ""); }
DTTTrigFillWithAverage::~DTTTrigFillWithAverage | ( | ) | [virtual] |
Definition at line 25 of file DTTTrigFillWithAverage.cc.
{}
DTTTrigData DTTTrigFillWithAverage::correction | ( | const DTSuperLayerId & | slId | ) | [virtual] |
Implements DTTTrigBaseCorrection.
Definition at line 37 of file DTTTrigFillWithAverage.cc.
References foundAverage_, DTTtrig::get(), getAverage(), initialTTrig_, DTTimeUnits::ns, ntuplemaker::status, and tTrigMap_.
{ float tTrigMean,tTrigSigma, kFactor; int status = tTrigMap_->get(slId,tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns); if(!status){ return DTTTrigData(tTrigMean,tTrigSigma,kFactor); } else { if(!foundAverage_) getAverage(); float corrMean = initialTTrig_.aveMean; float corrSigma = initialTTrig_.aveSigma; float corrKFactor = initialTTrig_.aveKFactor; return DTTTrigData(corrMean,corrSigma,corrKFactor); //FIXME: kFactor is not anymore a unique one } }
void DTTTrigFillWithAverage::getAverage | ( | ) | [private] |
Definition at line 51 of file DTTTrigFillWithAverage.cc.
References aveKFactor, aveMean, aveSigma, foundAverage_, DTTtrig::get(), initialTTrig_, muonGeom_, DTTimeUnits::ns, rmsMean, rmsSigma, mathSSE::sqrt(), ntuplemaker::status, and tTrigMap_.
Referenced by correction().
{ //Get the superlayers list vector<DTSuperLayer*> dtSupLylist = muonGeom_->superLayers(); float aveMean = 0.; float ave2Mean = 0.; float aveSigma = 0.; float ave2Sigma = 0.; float aveKFactor = 0.; int nIter = 0; for(vector<DTSuperLayer*>::const_iterator sl = muonGeom_->superLayers().begin(); sl != muonGeom_->superLayers().end(); ++sl) { float tTrigMean,tTrigSigma,kFactor; int status = tTrigMap_->get((*sl)->id(),tTrigMean,tTrigSigma,kFactor,DTTimeUnits::ns); if(!status){ ++nIter; aveMean += tTrigMean; ave2Mean += tTrigMean*tTrigMean; aveSigma += tTrigSigma; ave2Sigma += tTrigSigma*tTrigSigma; aveKFactor += kFactor; } } // Compute average aveMean /= nIter; float rmsMean = ave2Mean/(nIter - 1) - aveMean*aveMean; rmsMean = sqrt(rmsMean); aveSigma /= nIter; float rmsSigma = ave2Sigma/(nIter - 1) - aveSigma*aveSigma; rmsSigma = sqrt(rmsSigma); aveKFactor /= nIter; initialTTrig_.aveMean = aveMean; initialTTrig_.rmsMean = rmsMean; initialTTrig_.aveSigma = aveSigma; initialTTrig_.rmsSigma = rmsSigma; initialTTrig_.aveKFactor = aveKFactor; LogVerbatim("Calibration") << "[DTTTrigFillWithAverage] Found from " << nIter << " SL's\n" << " average tTrig mean: " << aveMean << "\n" << " tTrig mean RMS: " << rmsMean << "\n" << " average tTrig sigma: " << aveSigma << "\n" << " tTrig sigma RMS: " << rmsSigma << "\n" << " kFactor mean: " << aveKFactor; foundAverage_ = true; }
void DTTTrigFillWithAverage::setES | ( | const edm::EventSetup & | setup | ) | [virtual] |
Implements DTTTrigBaseCorrection.
Definition at line 27 of file DTTTrigFillWithAverage.cc.
References dbLabel, edm::EventSetup::get(), muonGeom_, and tTrigMap_.
{ // Get tTrig record from DB ESHandle<DTTtrig> tTrig; setup.get<DTTtrigRcd>().get(dbLabel,tTrig); tTrigMap_ = &*tTrig; // Get geometry from Event Setup setup.get<MuonGeometryRecord>().get(muonGeom_); }
Definition at line 46 of file DTTTrigFillWithAverage.h.
Referenced by getAverage().
Definition at line 42 of file DTTTrigFillWithAverage.h.
Referenced by getAverage().
Definition at line 44 of file DTTTrigFillWithAverage.h.
Referenced by getAverage().
std::string DTTTrigFillWithAverage::dbLabel [private] |
Definition at line 39 of file DTTTrigFillWithAverage.h.
Referenced by DTTTrigFillWithAverage(), and setES().
bool DTTTrigFillWithAverage::foundAverage_ [private] |
Definition at line 49 of file DTTTrigFillWithAverage.h.
Referenced by correction(), and getAverage().
struct { ... } DTTTrigFillWithAverage::initialTTrig_ [private] |
Referenced by correction(), and getAverage().
Definition at line 37 of file DTTTrigFillWithAverage.h.
Referenced by getAverage(), and setES().
Definition at line 43 of file DTTTrigFillWithAverage.h.
Referenced by getAverage().
Definition at line 45 of file DTTTrigFillWithAverage.h.
Referenced by getAverage().
const DTTtrig* DTTTrigFillWithAverage::tTrigMap_ [private] |
Definition at line 36 of file DTTTrigFillWithAverage.h.
Referenced by correction(), getAverage(), and setES().