#include <DTDeadChannelTest.h>
Public Member Functions | |
DTDeadChannelTest (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~DTDeadChannelTest () |
Destructor. | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
Analyze. | |
void | beginJob () |
BeginJob. | |
void | beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) |
void | beginRun (edm::Run const &run, edm::EventSetup const &context) |
BeginRun. | |
void | bookHistos (const DTLayerId &ch, int firstWire, int lastWire) |
book the new ME | |
void | endJob () |
Endjob. | |
void | endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) |
DQM Client Diagnostic. | |
std::string | getMEName (std::string histoTag, const DTChamberId &chId) |
Get the ME name. | |
Private Attributes | |
DQMStore * | dbe |
edm::ESHandle< DTGeometry > | muonGeom |
int | nevents |
unsigned int | nLumiSegs |
std::map< std::string, MonitorElement * > | OccupancyDiffHistos |
edm::ParameterSet | parameters |
int | prescaleFactor |
int | run |
edm::ESHandle< DTTtrig > | tTrigMap |
* DQM Test Client
Definition at line 43 of file DTDeadChannelTest.h.
DTDeadChannelTest::DTDeadChannelTest | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 39 of file DTDeadChannelTest.cc.
References cmsCodeRules::cppFunctionSkipper::operator, Parameters::parameters, and dtDQMClient_cfg::prescaleFactor.
{ edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor"; parameters = ps; dbe = edm::Service<DQMStore>().operator->(); prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1); }
DTDeadChannelTest::~DTDeadChannelTest | ( | ) | [virtual] |
Destructor.
Definition at line 51 of file DTDeadChannelTest.cc.
References nevents.
{ edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events"; }
void DTDeadChannelTest::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 87 of file DTDeadChannelTest.cc.
References nevents.
{ nevents++; edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" events"; }
void DTDeadChannelTest::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 58 of file DTDeadChannelTest.cc.
References nevents.
{ edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginJob"; nevents = 0; }
void DTDeadChannelTest::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
edm::EventSetup const & | context | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 76 of file DTDeadChannelTest.cc.
References edm::LuminosityBlockBase::run(), and DTTTrigCorrFirst::run.
{ edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition"; // Get the run number run = lumiSeg.run(); }
void DTDeadChannelTest::beginRun | ( | edm::Run const & | run, |
edm::EventSetup const & | context | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 66 of file DTDeadChannelTest.cc.
References edm::EventSetup::get().
{ edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun"; // Get the geometry context.get<MuonGeometryRecord>().get(muonGeom); }
void DTDeadChannelTest::bookHistos | ( | const DTLayerId & | ch, |
int | firstWire, | ||
int | lastWire | ||
) | [protected] |
book the new ME
Definition at line 240 of file DTDeadChannelTest.cc.
References DTLayerId::layer(), DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().
{ stringstream wheel; wheel << lId.superlayerId().wheel(); stringstream station; station << lId.superlayerId().station(); stringstream sector; sector << lId.superlayerId().sector(); stringstream superLayer; superLayer << lId.superlayerId().superlayer(); stringstream layer; layer << lId.layer(); string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName; dbe->setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" + sector.str()); OccupancyDiffHistos[HistoName] = dbe->book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5); }
void DTDeadChannelTest::endJob | ( | void | ) | [protected, virtual] |
Endjob.
Reimplemented from edm::EDAnalyzer.
Definition at line 209 of file DTDeadChannelTest.cc.
{ edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest] endjob called!"; dbe->rmdir("DT/Tests/DTDeadChannel"); }
void DTDeadChannelTest::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
edm::EventSetup const & | c | ||
) | [protected, virtual] |
DQM Client Diagnostic.
Reimplemented from edm::EDAnalyzer.
Definition at line 96 of file DTDeadChannelTest.cc.
References newFWLiteAna::bin, bookHistos(), DTTimeUnits::counts, edm::EventSetup::get(), QReport::getBadChannels(), MonitorElement::getTH2F(), edm::LuminosityBlockBase::id(), DTLayerId::layer(), edm::LuminosityBlockID::luminosityBlock(), Parameters::parameters, dtDQMClient_cfg::prescaleFactor, DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), DTSuperLayerId::superlayer(), and DTChamberId::wheel().
{ // counts number of updats (online mode) or number of events (standalone mode) //nevents++; // if running in standalone perform diagnostic only after a reasonalbe amount of events //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) && // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return; //edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" updates"; edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: End of LS transition, performing the DQM client operation"; // counts number of lumiSegs nLumiSegs = lumiSeg.id().luminosityBlock(); // prescale factor if ( nLumiSegs%prescaleFactor != 0 ) return; edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: "<<nLumiSegs<<" updates"; vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin(); vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end(); edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results"; // Loop over the chambers for (; ch_it != ch_end; ++ch_it) { DTChamberId chID = (*ch_it)->id(); vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end(); stringstream wheel; wheel << chID.wheel(); stringstream station; station << chID.station(); stringstream sector; sector << chID.sector(); context.get<DTTtrigRcd>().get(tTrigMap); string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); // Get the ME produced by DigiTask Source MonitorElement * noise_histo = dbe->get(getMEName("OccupancyNoise_perCh", chID)); MonitorElement * hitInTime_histo = dbe->get(getMEName("OccupancyInTimeHits_perCh", chID)); // ME -> TH2F if(noise_histo && hitInTime_histo) { TH2F * noise_histo_root = noise_histo->getTH2F(); TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F(); // Loop over the SuperLayers for(; sl_it != sl_end; ++sl_it) { DTSuperLayerId slID = (*sl_it)->id(); vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end(); // ttrig and rms are counts float tTrig, tTrigRMS, kFactor; tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); // Loop over the layers for(; l_it != l_end; ++l_it) { DTLayerId lID = (*l_it)->id(); //Parameters to fill histos stringstream superLayer; superLayer << slID.superlayer(); stringstream layer; layer << lID.layer(); string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel(); const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel(); int entry=-1; if(slID.superlayer() == 1) entry=0; if(slID.superlayer() == 2) entry=4; if(slID.superlayer() == 3) entry=8; int YBinNumber = entry+lID.layer(); // Loop over the TH2F bin and fill the ME to be used for the Quality Test for(int bin=firstWire; bin <= lastWire; bin++) { if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(lID, firstWire, lastWire); // tMax default value float tMax = 450.0; float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax) - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig); OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference); } } // loop on layers } // loop on superlayers } } // loop on chambers // Occupancy Difference test string OccupancyDiffCriterionName = parameters.getUntrackedParameter<string>("OccupancyDiffTestName","OccupancyDiffInRange"); for(map<string, MonitorElement*>::const_iterator hOccDiff = OccupancyDiffHistos.begin(); hOccDiff != OccupancyDiffHistos.end(); hOccDiff++) { const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName); if(theOccupancyDiffQReport) { vector<dqm::me_util::Channel> badChannels = theOccupancyDiffQReport->getBadChannels(); for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end(); channel++) { edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); } // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member) // edm::LogWarning("deadChannel")<< "-------- Layer : "<<(*hOccDiff).first<<" "<<theOccupancyDiffQReport->getMessage()<<" ------- "<<theOccupancyDiffQReport->getStatus(); } } }
std::string DTDeadChannelTest::getMEName | ( | std::string | histoTag, |
const DTChamberId & | chId | ||
) | [protected] |
Get the ME name.
DQMStore* DTDeadChannelTest::dbe [private] |
Definition at line 89 of file DTDeadChannelTest.h.
edm::ESHandle<DTGeometry> DTDeadChannelTest::muonGeom [private] |
Definition at line 92 of file DTDeadChannelTest.h.
int DTDeadChannelTest::nevents [private] |
Definition at line 84 of file DTDeadChannelTest.h.
unsigned int DTDeadChannelTest::nLumiSegs [private] |
Definition at line 85 of file DTDeadChannelTest.h.
std::map< std::string , MonitorElement* > DTDeadChannelTest::OccupancyDiffHistos [private] |
Definition at line 95 of file DTDeadChannelTest.h.
Definition at line 91 of file DTDeadChannelTest.h.
int DTDeadChannelTest::prescaleFactor [private] |
Definition at line 86 of file DTDeadChannelTest.h.
int DTDeadChannelTest::run [private] |
Definition at line 87 of file DTDeadChannelTest.h.
edm::ESHandle<DTTtrig> DTDeadChannelTest::tTrigMap [private] |
Definition at line 93 of file DTDeadChannelTest.h.