#include <DQM/DTMonitorClient/src/DTDataIntegrityTest.h>
Public Member Functions | |
DTDataIntegrityTest (const edm::ParameterSet &ps) | |
Constructor. | |
~DTDataIntegrityTest () | |
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 (std::string histoType, int dduId) |
Book the MEs. | |
void | bookTimeHistos (std::string histoType, int dduId, int evNumber) |
void | endJob () |
Endjob. | |
void | endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c) |
DQM Client Diagnostic. | |
std::string | getMEName (std::string histoType, int FEDId) |
Get the ME name. | |
Private Attributes | |
int | counter |
DQMStore * | dbe |
std::map< std::string, std::map< int, MonitorElement * > > | dduHistos |
std::map< std::string, std::map< int, std::vector < MonitorElement * > > > | dduVectorHistos |
bool | doTimeHisto |
int | nevents |
unsigned int | nLumiSegs |
int | nTimeBin |
int | nupdates |
std::string | outputFile |
int | prescaleFactor |
int | run |
MonitorElement * | summaryHisto |
bool | writeHisto |
Definition at line 22 of file DTDataIntegrityTest.h.
DTDataIntegrityTest::DTDataIntegrityTest | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 28 of file DTDataIntegrityTest.cc.
References doTimeHisto, edm::ParameterSet::getUntrackedParameter(), nTimeBin, outputFile, prescaleFactor, and writeHisto.
00028 : nevents(0) { 00029 00030 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: Constructor"; 00031 00032 //Number of bin in time histo 00033 nTimeBin = ps.getUntrackedParameter<int>("nTimeBin", 10); 00034 //If you want info VS time histos 00035 doTimeHisto = ps.getUntrackedParameter<bool>("doTimeHisto", false); 00036 // switch to write histos to file 00037 writeHisto = ps.getUntrackedParameter<bool>("writeHisto", false); 00038 // prefix of the name of the root file (lumi# and run# will be appended) 00039 outputFile = ps.getUntrackedParameter<string>("outputFile", "DTDataIntegrityTest"); 00040 // prescale on the # of LS to update the test 00041 prescaleFactor = ps.getUntrackedParameter<int>("diagnosticPrescale", 1); 00042 00043 00044 }
DTDataIntegrityTest::~DTDataIntegrityTest | ( | ) |
Destructor.
Definition at line 47 of file DTDataIntegrityTest.cc.
References nupdates.
00047 { 00048 00049 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "DataIntegrityTest: analyzed " << nupdates << " updates"; 00050 00051 }
void DTDataIntegrityTest::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 88 of file DTDataIntegrityTest.cc.
References nevents.
00088 { 00089 00090 nevents++; 00091 if(nevents%1000 == 0) 00092 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: "<<nevents<<" events"; 00093 00094 }
void DTDataIntegrityTest::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 54 of file DTDataIntegrityTest.cc.
References DQMStore::book2D(), dbe, nupdates, run, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), and summaryHisto.
00054 { 00055 00056 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") << "[DTDataIntegrityTest]: BeginJob"; 00057 00058 //nSTAEvents = 0; 00059 nupdates = 0; 00060 run=0; 00061 00062 dbe = Service<DQMStore>().operator->(); 00063 00064 // book the summary histogram 00065 dbe->setCurrentFolder("DT/00-DataIntegrity"); 00066 summaryHisto = dbe->book2D("DataIntegritySummary","Summary Data Integrity",12,1,13,5,770,775); 00067 summaryHisto->setAxisTitle("ROS",1); 00068 summaryHisto->setBinLabel(1,"FED770",2); 00069 summaryHisto->setBinLabel(2,"FED771",2); 00070 summaryHisto->setBinLabel(3,"FED772",2); 00071 summaryHisto->setBinLabel(4,"FED773",2); 00072 summaryHisto->setBinLabel(5,"FED774",2); 00073 }
void DTDataIntegrityTest::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, | |
edm::EventSetup const & | context | |||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 77 of file DTDataIntegrityTest.cc.
References edm::LuminosityBlock::run(), and run.
00077 { 00078 00079 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: Begin of LS transition"; 00080 00081 // Get the run number 00082 run = lumiSeg.run(); 00083 00084 }
void DTDataIntegrityTest::bookTimeHistos | ( | std::string | histoType, | |
int | dduId, | |||
int | evNumber | |||
) | [protected] |
Referenced by endLuminosityBlock().
Endjob.
Reimplemented from edm::EDAnalyzer.
Definition at line 306 of file DTDataIntegrityTest.cc.
00306 { 00307 00308 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest] endjob called!"; 00309 00310 // dbe->rmdir("DT/DTDataIntegrity"); 00311 }
void DTDataIntegrityTest::endLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, | |
edm::EventSetup const & | c | |||
) | [protected, virtual] |
DQM Client Diagnostic.
Reimplemented from edm::EDAnalyzer.
Definition at line 98 of file DTDataIntegrityTest.cc.
References bookHistos(), bookTimeHistos(), counter, dbe, dduHistos, dduVectorHistos, doTimeHisto, end, lat::endl(), find(), first, DQMStore::get(), MonitorElement::getBinContent(), FEDNumbering::getDTFEDIds(), MonitorElement::getEntries(), MonitorElement::getMean(), getMEName(), MonitorElement::getTH2F(), i, edm::LuminosityBlock::id(), edm::LuminosityBlockID::luminosityBlock(), nLumiSegs, nTimeBin, nupdates, outputFile, prescaleFactor, HLT_VtxMuL3::result, run, DQMStore::save(), MonitorElement::setBinContent(), summaryHisto, and writeHisto.
00098 { 00099 00100 //nSTAEvents++; 00101 // if running in standalone perform diagnostic only after a reasonalbe amount of events 00102 //if ( parameters.getUntrackedParameter<bool>("runningStandalone", false) && 00103 // nSTAEvents%parameters.getUntrackedParameter<int>("diagnosticPrescale", 1000) != 0 ) return; 00104 00105 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") 00106 <<"[DTDataIntegrityTest]: End of LS transition, performing the DQM client operation"; 00107 00108 // counts number of lumiSegs 00109 nLumiSegs = lumiSeg.id().luminosityBlock(); 00110 stringstream nLumiSegs_s; nLumiSegs_s << nLumiSegs; 00111 00112 // prescale factor 00113 if ( nLumiSegs%prescaleFactor != 0 ) return; 00114 00115 00116 // counts number of updats 00117 nupdates++; 00118 00119 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: "<<nupdates<<" updates"; 00120 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: "<<nLumiSegs<<" luminosity block number"; 00121 00122 if(writeHisto && nupdates%nTimeBin == 0){ 00123 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: saving all histos"; 00124 stringstream runNumber; runNumber << run; 00125 stringstream lumiNumber; lumiNumber << nLumiSegs; 00126 string rootFile = outputFile + "_" + lumiNumber.str() + "_" + runNumber.str() + ".root"; 00127 dbe->save(rootFile); 00128 } 00129 00130 //Counter for x bin in the timing histos 00131 counter++; 00132 00133 //Loop on FED id 00134 for (int dduId=FEDNumbering::getDTFEDIds().first; dduId<FEDNumbering::getDTFEDIds().second; ++dduId){ 00135 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:FED Id: "<<dduId; 00136 00137 //Each nTimeBin onUpdate remove timing histos and book a new bunch of them 00138 stringstream dduId_s; dduId_s << dduId; 00139 if(doTimeHisto && nupdates%nTimeBin == 1){ 00140 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]: booking a new bunch of time histos"; 00141 //if(nupdates>nTimeBin) 00142 //dbe->rmdir("DT/Tests/DTDataIntegrity/FED" + dduId_s.str() + "/TimeInfo"); //FIXME: it doesn't work anymore 00143 // (dduVectorHistos.find("TTSVSTime")->second).find(dduId)->second.clear(); 00144 bookTimeHistos("TTSVSTime",dduId, nLumiSegs); 00145 bookTimeHistos("ROSVSTime",dduId, nLumiSegs); 00146 bookTimeHistos("EvLenghtVSTime",dduId,nLumiSegs); 00147 bookTimeHistos("FIFOVSTime",dduId,nLumiSegs); 00148 } 00149 00150 string histoType; 00151 //1D histo: % of tts values 00152 MonitorElement * tts_histo = dbe->get(getMEName("TTSValues",dduId)); 00153 if (tts_histo) { 00154 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:histo DDUTTSValues found"; 00155 00156 histoType = "TTSValues_Percent"; 00157 if (dduHistos[histoType].find(dduId) == dduHistos[histoType].end()) { 00158 bookHistos(histoType,dduId); 00159 } 00160 //Loop on possible tts values 00161 for(int i=1;i<8;i++){ 00162 (dduHistos.find(histoType)->second).find(dduId)->second-> 00163 setBinContent(i,tts_histo->getBinContent(i)/tts_histo->getEntries()); 00164 00165 if(doTimeHisto){ 00166 //Fill timing histos and set x label with luminosity block number 00167 if( dduVectorHistos["TTSVSTime"].find(dduId) == dduVectorHistos["TTSVSTime"].end() ){ 00168 bookTimeHistos("TTSVSTime",dduId,nLumiSegs); 00169 } 00170 (dduVectorHistos.find("TTSVSTime")->second).find(dduId)->second[i-1]-> 00171 setBinContent(counter,tts_histo->getBinContent(i)/tts_histo->getEntries()); 00172 (dduVectorHistos.find("TTSVSTime")->second).find(dduId)->second[i-1]-> 00173 setBinLabel(counter, nLumiSegs_s.str(), 1); 00174 } 00175 } 00176 00177 //Check if there are too many events with wrong tts value 00178 double alert_tts1 = 0.5, alert_tts4 = 0.5, alert_tts20 = 0.5; 00179 if((dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(2) > alert_tts1) 00180 LogWarning ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:WARNING: "<< 00181 (dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(2)<<" % events with warning overflow"; 00182 00183 if(((dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(1) + 00184 (dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(3)) > alert_tts20 ) 00185 LogWarning ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:WARNING: "<< 00186 ((dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(1) + 00187 (dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(3))<<" % events with out of synch or disconnected"; 00188 00189 if((dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(4) > alert_tts4) 00190 LogWarning ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:WARNING: "<< 00191 (dduHistos.find(histoType)->second).find(dduId)->second->getBinContent(4)<<" % events with busy"; 00192 //FIXME: how to notify this warning in a LogFile? 00193 } 00194 00195 //Check if the list of ROS is compatible with the channels enabled 00196 MonitorElement * ros_histo = dbe->get(getMEName("ROSStatus",dduId)); 00197 if (ros_histo) { 00198 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:histo DDUChannelStatus found"; 00199 00200 for(int i=1;i<13;i++){ 00201 if(ros_histo->getBinContent(1,i) != ros_histo->getBinContent(9,i)) 00202 LogError ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:WARNING: ROS"<<i<<" in " 00203 <<ros_histo->getBinContent(9,i)<<" events"<<endl 00204 <<" but channel"<<i<<" enabled in " 00205 <<ros_histo->getBinContent(1,i)<<" events"; 00206 //FIXME: how to notify this warning in a LogFile? 00207 } 00208 } 00209 //Monitor the number of ROS VS time 00210 MonitorElement * rosNumber_histo = dbe->get(getMEName("ROSList",dduId)); 00211 if (rosNumber_histo && doTimeHisto) { 00212 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:histo DDUROSList found"; 00213 00214 double rosNumber_mean = rosNumber_histo->getMean(); 00215 //Fill timing histos and set x label with luminosity block number 00216 histoType = "ROSVSTime"; 00217 if (dduHistos[histoType].find(dduId) == dduHistos[histoType].end()) { 00218 bookTimeHistos(histoType,dduId,nLumiSegs); 00219 } 00220 (dduHistos.find(histoType)->second).find(dduId)->second->setBinContent(counter,rosNumber_mean); 00221 (dduHistos.find(histoType)->second).find(dduId)->second->setBinLabel(counter, nLumiSegs_s.str(), 1); 00222 } 00223 00224 //Monitor the event lenght VS time 00225 MonitorElement * evLenght_histo = dbe->get(getMEName("EventLenght",dduId)); 00226 if (evLenght_histo && doTimeHisto) { 00227 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:histo DDUEventLenght found"; 00228 00229 double evLenght_mean = evLenght_histo->getMean(); 00230 //Fill timing histos and set x label with luminosity block number 00231 histoType = "EvLenghtVSTime"; 00232 if (dduHistos[histoType].find(dduId) == dduHistos[histoType].end()) { 00233 bookTimeHistos(histoType,dduId,nLumiSegs); 00234 } 00235 (dduHistos.find(histoType)->second).find(dduId)->second->setBinContent(counter,evLenght_mean); 00236 (dduHistos.find(histoType)->second).find(dduId)->second->setBinLabel(counter, nLumiSegs_s.str(), 1); 00237 00238 } 00239 00240 //Monitor the FIFO occupancy VS time 00241 MonitorElement * fifo_histo = dbe->get(getMEName("FIFOStatus",dduId)); 00242 if (fifo_histo && doTimeHisto) { 00243 LogVerbatim ("DTDQM|DTRawToDigi|DTMonitorClient|DTDataIntegrityTest") <<"[DTDataIntegrityTest]:histo DDUFIFOStatus found"; 00244 00245 //Fill timing histos and set x label with luminosity block number 00246 histoType = "FIFOVSTime"; 00247 if (dduVectorHistos[histoType].find(dduId) == dduVectorHistos[histoType].end()) { 00248 bookTimeHistos(histoType,dduId,nLumiSegs); 00249 } 00250 for(int i=1;i<8;i++){ 00251 (dduVectorHistos.find("FIFOVSTime")->second).find(dduId)->second[i-1]-> 00252 setBinContent(counter,(fifo_histo->getBinContent(i,1) + 2*(fifo_histo->getBinContent(i,2)))/fifo_histo->getEntries()); 00253 (dduVectorHistos.find("FIFOVSTime")->second).find(dduId)->second[i-1]-> 00254 setBinLabel(counter, nLumiSegs_s.str(), 1); 00255 } 00256 } 00257 00258 // Fill the summary histo 00259 // Get the error summary histo 00260 string wheelSummaryName = "DT/00-DataIntegrity/FED" + dduId_s.str() + "_ROSSummary"; 00261 MonitorElement * FED_ROSSummary = dbe->get(wheelSummaryName); 00262 // Get the histos for FED integrity 00263 string fedIntegrityFolder = "DT/FEDIntegrity_SM/"; 00264 MonitorElement * hFEDEntry = dbe->get(fedIntegrityFolder+"FEDEntries"); 00265 MonitorElement * hFEDFatal = dbe->get(fedIntegrityFolder+"FEDFatal"); 00266 MonitorElement * hFEDNonFatal = dbe->get(fedIntegrityFolder+"FEDNonFatal"); 00267 00268 if(FED_ROSSummary) { 00269 TH2F * histo_FEDSummary = FED_ROSSummary->getTH2F(); 00270 for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) { // loop on the ROS 00271 int result = -2; 00272 if(histo_FEDSummary->Integral(1,11,rosNumber,rosNumber) == 0) { // no errors 00273 result = 0; 00274 } else { // there are errors 00275 result = 2; 00276 } 00277 summaryHisto->setBinContent(rosNumber,dduId-769,result); 00278 } 00279 // Check that the FED is in the ReadOut using the FEDIntegrity histos 00280 if(hFEDEntry->getBinContent(dduId-769) == 0 && 00281 hFEDFatal->getBinContent(dduId-769) == 0 && 00282 hFEDNonFatal->getBinContent(dduId-769) == 0) { 00283 // no data in this FED: it is off 00284 for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) { 00285 summaryHisto->setBinContent(rosNumber,dduId-769,1); 00286 } 00287 } 00288 00289 } else { // no data in this FED: it is off 00290 for(int rosNumber = 1; rosNumber <= 12; ++rosNumber) { 00291 summaryHisto->setBinContent(rosNumber,dduId-769,1); 00292 } 00293 } 00294 00295 } 00296 00297 00298 00299 00300 00301 00302 }
std::string DTDataIntegrityTest::getMEName | ( | std::string | histoType, | |
int | FEDId | |||
) | [protected] |
int DTDataIntegrityTest::counter [private] |
DQMStore* DTDataIntegrityTest::dbe [private] |
Definition at line 83 of file DTDataIntegrityTest.h.
Referenced by beginJob(), and endLuminosityBlock().
std::map<std::string, std::map<int, MonitorElement*> > DTDataIntegrityTest::dduHistos [private] |
std::map<std::string, std::map<int, std::vector <MonitorElement*> > > DTDataIntegrityTest::dduVectorHistos [private] |
bool DTDataIntegrityTest::doTimeHisto [private] |
Definition at line 65 of file DTDataIntegrityTest.h.
Referenced by DTDataIntegrityTest(), and endLuminosityBlock().
int DTDataIntegrityTest::nevents [private] |
unsigned int DTDataIntegrityTest::nLumiSegs [private] |
int DTDataIntegrityTest::nTimeBin [private] |
Definition at line 63 of file DTDataIntegrityTest.h.
Referenced by DTDataIntegrityTest(), and endLuminosityBlock().
int DTDataIntegrityTest::nupdates [private] |
Definition at line 58 of file DTDataIntegrityTest.h.
Referenced by beginJob(), endLuminosityBlock(), and ~DTDataIntegrityTest().
std::string DTDataIntegrityTest::outputFile [private] |
Definition at line 69 of file DTDataIntegrityTest.h.
Referenced by DTDataIntegrityTest(), and endLuminosityBlock().
int DTDataIntegrityTest::prescaleFactor [private] |
Definition at line 71 of file DTDataIntegrityTest.h.
Referenced by DTDataIntegrityTest(), and endLuminosityBlock().
int DTDataIntegrityTest::run [private] |
Definition at line 80 of file DTDataIntegrityTest.h.
Referenced by beginJob(), beginLuminosityBlock(), and endLuminosityBlock().
MonitorElement* DTDataIntegrityTest::summaryHisto [private] |
Definition at line 91 of file DTDataIntegrityTest.h.
Referenced by beginJob(), and endLuminosityBlock().
bool DTDataIntegrityTest::writeHisto [private] |
Definition at line 67 of file DTDataIntegrityTest.h.
Referenced by DTDataIntegrityTest(), and endLuminosityBlock().