#include <DTtTrigDBValidation.h>
Public Member Functions | |
void | analyze (edm::Event const &, edm::EventSetup const &) |
void | beginRun (edm::Run const &, edm::EventSetup const &) |
Operations. | |
DTtTrigDBValidation (const edm::ParameterSet &pset) | |
Constructor. | |
void | endJob () |
void | endRun (edm::Run const &, edm::EventSetup const &) |
virtual | ~DTtTrigDBValidation () |
Destructor. | |
Private Member Functions | |
void | bookHistos (int, int) |
void | bookHistos (int wheel) |
int | slFromBin (int bin) const |
int | stationFromBin (int bin) const |
Private Attributes | |
DQMStore * | dbe_ |
edm::ESHandle< DTGeometry > | dtGeom_ |
int | higherLimit_ |
std::string | labelDB_ |
std::string | labelDBRef_ |
int | lowerLimit_ |
std::string | metname_ |
std::string | outputFileName_ |
bool | outputMEsInRootFile_ |
std::map< std::pair< int, int > , MonitorElement * > | tTrigDiffHistos_ |
std::map< int, MonitorElement * > | tTrigDiffWheel_ |
std::map< DTSuperLayerId, std::pair< float, float > > | tTrigMap_ |
std::map< DTSuperLayerId, std::pair< float, float > > | tTrigRefMap_ |
Definition at line 24 of file DTtTrigDBValidation.h.
DTtTrigDBValidation::DTtTrigDBValidation | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 33 of file DTtTrigDBValidation.cc.
References dbe_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), metname_, cppFunctionSkipper::operator, outputFileName_, outputMEsInRootFile_, and DQMStore::setCurrentFolder().
: metname_("TTrigDBValidation"), labelDBRef_(pset.getParameter<string>("labelDBRef")), labelDB_(pset.getParameter<string>("labelDB")), lowerLimit_(pset.getUntrackedParameter<int>("lowerLimit",1)), higherLimit_(pset.getUntrackedParameter<int>("higherLimit",3)) { LogVerbatim(metname_) << "[DTtTrigDBValidation] Constructor called!"; // Get the DQM needed services dbe_ = edm::Service<DQMStore>().operator->(); dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation"); outputMEsInRootFile_ = false; if( pset.exists("OutputFileName") ){ outputMEsInRootFile_ = true; outputFileName_ = pset.getParameter<std::string>("OutputFileName"); } }
DTtTrigDBValidation::~DTtTrigDBValidation | ( | ) | [virtual] |
void DTtTrigDBValidation::analyze | ( | edm::Event const & | , |
edm::EventSetup const & | |||
) | [inline, virtual] |
void DTtTrigDBValidation::beginRun | ( | edm::Run const & | run, |
edm::EventSetup const & | setup | ||
) | [virtual] |
Operations.
Reimplemented from edm::EDAnalyzer.
Definition at line 56 of file DTtTrigDBValidation.cc.
References abs, DTTtrig::begin(), bookHistos(), dtGeom_, DTTtrig::end(), edm::EventSetup::get(), DTTtrig::get(), higherLimit_, labelDB_, labelDBRef_, LogTrace, lowerLimit_, metname_, DTTimeUnits::ns, relativeConstraints::station, tTrigDiffHistos_, tTrigDiffWheel_, tTrigMap_, and tTrigRefMap_.
{ LogVerbatim(metname_) << "[DTtTrigDBValidation] Parameters initialization"; ESHandle<DTTtrig> tTrig_Ref; setup.get<DTTtrigRcd>().get(labelDBRef_, tTrig_Ref); const DTTtrig* DTTtrigRefMap = &*tTrig_Ref; LogVerbatim(metname_) << "[DTtTrigDBValidation] reference Ttrig version: " << tTrig_Ref->version(); ESHandle<DTTtrig> tTrig; setup.get<DTTtrigRcd>().get(labelDB_, tTrig); const DTTtrig* DTTtrigMap = &*tTrig; LogVerbatim(metname_) << "[DTtTrigDBValidation] Ttrig to validate version: " << tTrig->version(); //book&reset the summary histos for(int wheel=-2; wheel<=2; wheel++){ bookHistos(wheel); tTrigDiffWheel_[wheel]->Reset(); } // Get the geometry setup.get<MuonGeometryRecord>().get(dtGeom_); // Loop over Ref DB entries for(DTTtrig::const_iterator it = DTTtrigRefMap->begin(); it != DTTtrigRefMap->end(); ++it) { DTSuperLayerId slId((*it).first.wheelId, (*it).first.stationId, (*it).first.sectorId, (*it).first.slId); float tTrigMean; float tTrigRms; float kFactor; DTTtrigRefMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns); float tTrigCorr = tTrigMean + kFactor*tTrigRms; LogTrace(metname_)<< "Ref Superlayer: " << slId << "\n" << " Ttrig mean (ns): " << tTrigMean << " Ttrig rms (ns): " << tTrigRms << " Ttrig k-Factor: " << kFactor << " Ttrig value (ns): " << tTrigCorr; //tTrigRefMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms); tTrigRefMap_[slId] = pair<float,float>(tTrigCorr,tTrigRms); } // Loop over Ref DB entries for(DTTtrig::const_iterator it = DTTtrigMap->begin(); it != DTTtrigMap->end(); ++it) { DTSuperLayerId slId((*it).first.wheelId, (*it).first.stationId, (*it).first.sectorId, (*it).first.slId); float tTrigMean; float tTrigRms; float kFactor; DTTtrigMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns); float tTrigCorr = tTrigMean + kFactor*tTrigRms; LogTrace(metname_)<< "Superlayer: " << slId << "\n" << " Ttrig mean (ns): " << tTrigMean << " Ttrig rms (ns): " << tTrigRms << " Ttrig k-Factor: " << kFactor << " Ttrig value (ns): " << tTrigCorr; //tTrigMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms); tTrigMap_[slId] = pair<float,float>(tTrigCorr,tTrigRms); } for(map<DTSuperLayerId, pair<float,float> >::const_iterator it = tTrigRefMap_.begin(); it != tTrigRefMap_.end(); ++it) { if(tTrigMap_.find((*it).first) == tTrigMap_.end()) continue; // compute the difference float difference = tTrigMap_[(*it).first].first - (*it).second.first; //book histo int wheel = (*it).first.chamberId().wheel(); int sector = (*it).first.chamberId().sector(); if(tTrigDiffHistos_.find(make_pair(wheel,sector)) == tTrigDiffHistos_.end()) bookHistos(wheel,sector); LogTrace(metname_) << "Filling histos for super-layer: " << (*it).first << " difference: " << difference; // Fill the test histos int entry = -1; int station = (*it).first.chamberId().station(); if(station == 1) entry=0; if(station == 2) entry=3; if(station == 3) entry=6; if(station == 4) entry=9; int slBin = entry + (*it).first.superLayer(); if(slBin == 12) slBin=11; tTrigDiffHistos_[make_pair(wheel,sector)]->setBinContent(slBin, difference); if(abs(difference) < lowerLimit_){ tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,1); }else if(abs(difference) < higherLimit_){ tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,2); }else{ tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,3); } } // Loop over the tTrig map reference }
void DTtTrigDBValidation::bookHistos | ( | int | wheel, |
int | sector | ||
) | [private] |
Definition at line 172 of file DTtTrigDBValidation.cc.
References DQMStore::book1D(), dbe_, LogTrace, metname_, DQMStore::setCurrentFolder(), and tTrigDiffHistos_.
Referenced by beginRun().
{ LogTrace(metname_) << " Booking histos for Wheel, Sector: " << wheel << ", " << sector; // Compose the chamber name stringstream str_wheel; str_wheel << wheel; stringstream str_sector; str_sector << sector; string lHistoName = "_W" + str_wheel.str() + "_Sec" + str_sector.str(); dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation/Wheel" + str_wheel.str()); // Create the monitor elements MonitorElement * hDifference; hDifference = dbe_->book1D("TTrigDifference"+lHistoName, "difference between the two tTrig values",11,0,11); pair<int,int> mypair(wheel,sector); tTrigDiffHistos_[mypair] = hDifference; (tTrigDiffHistos_[mypair])->setBinLabel(1,"MB1_SL1",1); (tTrigDiffHistos_[mypair])->setBinLabel(2,"MB1_SL2",1); (tTrigDiffHistos_[mypair])->setBinLabel(3,"MB1_SL3",1); (tTrigDiffHistos_[mypair])->setBinLabel(4,"MB2_SL1",1); (tTrigDiffHistos_[mypair])->setBinLabel(5,"MB2_SL2",1); (tTrigDiffHistos_[mypair])->setBinLabel(6,"MB2_SL3",1); (tTrigDiffHistos_[mypair])->setBinLabel(7,"MB3_SL1",1); (tTrigDiffHistos_[mypair])->setBinLabel(8,"MB3_SL2",1); (tTrigDiffHistos_[mypair])->setBinLabel(9,"MB3_SL3",1); (tTrigDiffHistos_[mypair])->setBinLabel(10,"MB4_SL1",1); (tTrigDiffHistos_[mypair])->setBinLabel(11,"MB4_SL3",1); }
void DTtTrigDBValidation::bookHistos | ( | int | wheel | ) | [private] |
Definition at line 206 of file DTtTrigDBValidation.cc.
References DQMStore::book2D(), dbe_, DQMStore::setCurrentFolder(), and tTrigDiffWheel_.
{ stringstream wh; wh << wheel; dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation"); tTrigDiffWheel_[wheel] = dbe_->book2D("TTrigDifference_W"+wh.str(), "W"+wh.str()+": summary of tTrig differences",11,1,12,14,1,15); tTrigDiffWheel_[wheel]->setBinLabel(1,"MB1_SL1",1); tTrigDiffWheel_[wheel]->setBinLabel(2,"MB1_SL2",1); tTrigDiffWheel_[wheel]->setBinLabel(3,"MB1_SL3",1); tTrigDiffWheel_[wheel]->setBinLabel(4,"MB2_SL1",1); tTrigDiffWheel_[wheel]->setBinLabel(5,"MB2_SL2",1); tTrigDiffWheel_[wheel]->setBinLabel(6,"MB2_SL3",1); tTrigDiffWheel_[wheel]->setBinLabel(7,"MB3_SL1",1); tTrigDiffWheel_[wheel]->setBinLabel(8,"MB3_SL2",1); tTrigDiffWheel_[wheel]->setBinLabel(9,"MB3_SL3",1); tTrigDiffWheel_[wheel]->setBinLabel(10,"MB4_SL1",1); tTrigDiffWheel_[wheel]->setBinLabel(11,"MB4_SL3",1); }
void DTtTrigDBValidation::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 164 of file DTtTrigDBValidation.cc.
References dbe_, outputFileName_, outputMEsInRootFile_, and DQMStore::save().
{ if(outputMEsInRootFile_){ // write the histos on a file dbe_->save(outputFileName_); } }
void DTtTrigDBValidation::endRun | ( | edm::Run const & | run, |
edm::EventSetup const & | setup | ||
) | [virtual] |
int DTtTrigDBValidation::slFromBin | ( | int | bin | ) | const [private] |
Definition at line 231 of file DTtTrigDBValidation.cc.
References run_regression::ret.
int DTtTrigDBValidation::stationFromBin | ( | int | bin | ) | const [private] |
Definition at line 227 of file DTtTrigDBValidation.cc.
{ return (int) (bin /3.1)+1; }
DQMStore* DTtTrigDBValidation::dbe_ [private] |
Definition at line 54 of file DTtTrigDBValidation.h.
Referenced by bookHistos(), DTtTrigDBValidation(), and endJob().
edm::ESHandle<DTGeometry> DTtTrigDBValidation::dtGeom_ [private] |
Definition at line 56 of file DTtTrigDBValidation.h.
Referenced by beginRun().
int DTtTrigDBValidation::higherLimit_ [private] |
Definition at line 48 of file DTtTrigDBValidation.h.
Referenced by beginRun().
std::string DTtTrigDBValidation::labelDB_ [private] |
Definition at line 45 of file DTtTrigDBValidation.h.
Referenced by beginRun().
std::string DTtTrigDBValidation::labelDBRef_ [private] |
Definition at line 44 of file DTtTrigDBValidation.h.
Referenced by beginRun().
int DTtTrigDBValidation::lowerLimit_ [private] |
Definition at line 47 of file DTtTrigDBValidation.h.
Referenced by beginRun().
std::string DTtTrigDBValidation::metname_ [private] |
Definition at line 42 of file DTtTrigDBValidation.h.
Referenced by beginRun(), bookHistos(), and DTtTrigDBValidation().
std::string DTtTrigDBValidation::outputFileName_ [private] |
Definition at line 52 of file DTtTrigDBValidation.h.
Referenced by DTtTrigDBValidation(), and endJob().
bool DTtTrigDBValidation::outputMEsInRootFile_ [private] |
Definition at line 51 of file DTtTrigDBValidation.h.
Referenced by DTtTrigDBValidation(), and endJob().
std::map<std::pair<int,int>, MonitorElement* > DTtTrigDBValidation::tTrigDiffHistos_ [private] |
Definition at line 63 of file DTtTrigDBValidation.h.
Referenced by beginRun(), and bookHistos().
std::map<int, MonitorElement* > DTtTrigDBValidation::tTrigDiffWheel_ [private] |
Definition at line 64 of file DTtTrigDBValidation.h.
Referenced by beginRun(), and bookHistos().
std::map<DTSuperLayerId, std::pair<float,float> > DTtTrigDBValidation::tTrigMap_ [private] |
Definition at line 60 of file DTtTrigDBValidation.h.
Referenced by beginRun().
std::map<DTSuperLayerId, std::pair<float,float> > DTtTrigDBValidation::tTrigRefMap_ [private] |
Definition at line 59 of file DTtTrigDBValidation.h.
Referenced by beginRun().