#include <DQM/DTMonitorClient/src/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 (const edm::EventSetup &c) |
BeginJob. | |
void | beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) |
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 |
Definition at line 43 of file DTDeadChannelTest.h.
DTDeadChannelTest::DTDeadChannelTest | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 39 of file DTDeadChannelTest.cc.
References dbe, edm::ParameterSet::getUntrackedParameter(), parameters, and prescaleFactor.
00039 { 00040 00041 edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor"; 00042 00043 parameters = ps; 00044 00045 dbe = edm::Service<DQMStore>().operator->(); 00046 00047 prescaleFactor = parameters.getUntrackedParameter<int>("diagnosticPrescale", 1); 00048 00049 }
DTDeadChannelTest::~DTDeadChannelTest | ( | ) | [virtual] |
Destructor.
Definition at line 51 of file DTDeadChannelTest.cc.
References nevents.
00051 { 00052 00053 edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events"; 00054 00055 }
void DTDeadChannelTest::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 82 of file DTDeadChannelTest.cc.
References nevents.
00082 { 00083 00084 nevents++; 00085 edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" events"; 00086 00087 }
void DTDeadChannelTest::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 58 of file DTDeadChannelTest.cc.
References edm::EventSetup::get(), muonGeom, and nevents.
00058 { 00059 00060 edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginJob"; 00061 00062 nevents = 0; 00063 00064 // Get the geometry 00065 context.get<MuonGeometryRecord>().get(muonGeom); 00066 00067 }
void DTDeadChannelTest::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, | |
edm::EventSetup const & | context | |||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 71 of file DTDeadChannelTest.cc.
References edm::LuminosityBlock::run(), and run.
00071 { 00072 00073 edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition"; 00074 00075 // Get the run number 00076 run = lumiSeg.run(); 00077 00078 }
void DTDeadChannelTest::bookHistos | ( | const DTLayerId & | ch, | |
int | firstWire, | |||
int | lastWire | |||
) | [protected] |
book the new ME
Definition at line 235 of file DTDeadChannelTest.cc.
References DQMStore::book1D(), dbe, DTLayerId::layer(), OccupancyDiffHistos, DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().
Referenced by endLuminosityBlock().
00235 { 00236 00237 stringstream wheel; wheel << lId.superlayerId().wheel(); 00238 stringstream station; station << lId.superlayerId().station(); 00239 stringstream sector; sector << lId.superlayerId().sector(); 00240 stringstream superLayer; superLayer << lId.superlayerId().superlayer(); 00241 stringstream layer; layer << lId.layer(); 00242 00243 string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); 00244 string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName; 00245 00246 dbe->setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() + 00247 "/Station" + station.str() + 00248 "/Sector" + sector.str()); 00249 00250 OccupancyDiffHistos[HistoName] = dbe->book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5); 00251 00252 }
Endjob.
Reimplemented from edm::EDAnalyzer.
Definition at line 204 of file DTDeadChannelTest.cc.
References dbe, and DQMStore::rmdir().
00204 { 00205 00206 edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest] endjob called!"; 00207 00208 dbe->rmdir("DT/Tests/DTDeadChannel"); 00209 00210 }
void DTDeadChannelTest::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, | |
edm::EventSetup const & | c | |||
) | [protected, virtual] |
DQM Client Diagnostic.
Reimplemented from edm::EDAnalyzer.
Definition at line 91 of file DTDeadChannelTest.cc.
References bookHistos(), DTTimeUnits::counts, dbe, edm::EventSetup::get(), DQMStore::get(), QReport::getBadChannels(), getMEName(), MonitorElement::getTH2F(), edm::ParameterSet::getUntrackedParameter(), edm::LuminosityBlock::id(), DTLayerId::layer(), edm::LuminosityBlockID::luminosityBlock(), muonGeom, nLumiSegs, OccupancyDiffHistos, parameters, prescaleFactor, DTChamberId::sector(), DTChamberId::station(), DTSuperLayerId::superlayer(), tTrigMap, muonGeometry::wheel, and DTChamberId::wheel().
00091 { 00092 00093 // counts number of updats (online mode) or number of events (standalone mode) 00094 //nevents++; 00095 // if running in standalone perform diagnostic only after a reasonalbe amount of events 00096 //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) && 00097 // nevents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return; 00098 //edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<<nevents<<" updates"; 00099 00100 00101 edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: End of LS transition, performing the DQM client operation"; 00102 00103 // counts number of lumiSegs 00104 nLumiSegs = lumiSeg.id().luminosityBlock(); 00105 00106 // prescale factor 00107 if ( nLumiSegs%prescaleFactor != 0 ) return; 00108 00109 edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: "<<nLumiSegs<<" updates"; 00110 00111 00112 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin(); 00113 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end(); 00114 00115 edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results"; 00116 00117 // Loop over the chambers 00118 for (; ch_it != ch_end; ++ch_it) { 00119 DTChamberId chID = (*ch_it)->id(); 00120 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); 00121 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end(); 00122 00123 stringstream wheel; wheel << chID.wheel(); 00124 stringstream station; station << chID.station(); 00125 stringstream sector; sector << chID.sector(); 00126 00127 context.get<DTTtrigRcd>().get(tTrigMap); 00128 00129 string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); 00130 00131 // Get the ME produced by DigiTask Source 00132 MonitorElement * noise_histo = dbe->get(getMEName("OccupancyNoise_perCh", chID)); 00133 MonitorElement * hitInTime_histo = dbe->get(getMEName("OccupancyInTimeHits_perCh", chID)); 00134 00135 // ME -> TH2F 00136 if(noise_histo && hitInTime_histo) { 00137 TH2F * noise_histo_root = noise_histo->getTH2F(); 00138 TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F(); 00139 00140 // Loop over the SuperLayers 00141 for(; sl_it != sl_end; ++sl_it) { 00142 DTSuperLayerId slID = (*sl_it)->id(); 00143 vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 00144 vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end(); 00145 00146 // ttrig and rms are counts 00147 float tTrig, tTrigRMS; 00148 tTrigMap->get(slID, tTrig, tTrigRMS, DTTimeUnits::counts); 00149 00150 // Loop over the layers 00151 for(; l_it != l_end; ++l_it) { 00152 DTLayerId lID = (*l_it)->id(); 00153 00154 //Parameters to fill histos 00155 stringstream superLayer; superLayer << slID.superlayer(); 00156 stringstream layer; layer << lID.layer(); 00157 string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); 00158 00159 const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel(); 00160 const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel(); 00161 00162 int entry=-1; 00163 if(slID.superlayer() == 1) entry=0; 00164 if(slID.superlayer() == 2) entry=4; 00165 if(slID.superlayer() == 3) entry=8; 00166 int YBinNumber = entry+lID.layer(); 00167 00168 00169 // Loop over the TH2F bin and fill the ME to be used for the Quality Test 00170 for(int bin=firstWire; bin <= lastWire; bin++) { 00171 if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(lID, firstWire, lastWire); 00172 // tMax default value 00173 float tMax = 450.0; 00174 00175 float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax) 00176 - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig); 00177 OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference); 00178 } 00179 } // loop on layers 00180 } // loop on superlayers 00181 } 00182 } // loop on chambers 00183 00184 // Occupancy Difference test 00185 string OccupancyDiffCriterionName = parameters.getUntrackedParameter<string>("OccupancyDiffTestName","OccupancyDiffInRange"); 00186 for(map<string, MonitorElement*>::const_iterator hOccDiff = OccupancyDiffHistos.begin(); 00187 hOccDiff != OccupancyDiffHistos.end(); 00188 hOccDiff++) { 00189 const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName); 00190 if(theOccupancyDiffQReport) { 00191 vector<dqm::me_util::Channel> badChannels = theOccupancyDiffQReport->getBadChannels(); 00192 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); 00193 channel != badChannels.end(); channel++) { 00194 edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); 00195 } 00196 // FIXME: getMessage() sometimes returns and invalid string (null pointer inside QReport data member) 00197 // edm::LogWarning("deadChannel")<< "-------- Layer : "<<(*hOccDiff).first<<" "<<theOccupancyDiffQReport->getMessage()<<" ------- "<<theOccupancyDiffQReport->getStatus(); 00198 } 00199 } 00200 00201 }
std::string DTDeadChannelTest::getMEName | ( | std::string | histoTag, | |
const DTChamberId & | chId | |||
) | [protected] |
DQMStore* DTDeadChannelTest::dbe [private] |
Definition at line 86 of file DTDeadChannelTest.h.
Referenced by bookHistos(), DTDeadChannelTest(), endJob(), and endLuminosityBlock().
edm::ESHandle<DTGeometry> DTDeadChannelTest::muonGeom [private] |
Definition at line 89 of file DTDeadChannelTest.h.
Referenced by beginJob(), and endLuminosityBlock().
int DTDeadChannelTest::nevents [private] |
Definition at line 81 of file DTDeadChannelTest.h.
Referenced by analyze(), beginJob(), and ~DTDeadChannelTest().
unsigned int DTDeadChannelTest::nLumiSegs [private] |
std::map< std::string , MonitorElement* > DTDeadChannelTest::OccupancyDiffHistos [private] |
Definition at line 92 of file DTDeadChannelTest.h.
Referenced by bookHistos(), and endLuminosityBlock().
Definition at line 88 of file DTDeadChannelTest.h.
Referenced by DTDeadChannelTest(), and endLuminosityBlock().
int DTDeadChannelTest::prescaleFactor [private] |
Definition at line 83 of file DTDeadChannelTest.h.
Referenced by DTDeadChannelTest(), and endLuminosityBlock().
int DTDeadChannelTest::run [private] |
edm::ESHandle<DTTtrig> DTDeadChannelTest::tTrigMap [private] |