20 #include <TDirectory.h>
34 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called constructor" << endl;}
45 mL1TOccupancyPath = ps.
getUntrackedParameter<
string>(
"L1TOccupancyPath",
"L1T/L1TOccupancy/Certification/");
57 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called destructor" << endl;}
66 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called BeginJob" << endl;}
72 mDBE->setCurrentFolder(
"L1T/L1TOccupancy");
73 mDBE->rmdir(
"L1T/L1TOccupancy");
82 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called endJob" << endl;}
94 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called beginRun" << endl;}
100 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TRate Module Monitoring" << endl;}
102 mDBE->setCurrentFolder(mL1TRatePath);
103 vector<string> histToMonitor = mDBE->getMEs();
104 int histLines = histToMonitor.size()+1;
106 mDBE->setCurrentFolder(
"L1T/L1TTestsSummary/");
107 mL1TRateMonitor = mDBE->book2D(
"RateQualitySummary",
"L1T Rates Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
108 mL1TRateMonitor->setAxisTitle(
"Lumi Section" ,1);
110 mL1TRateMonitor->setBinLabel(1,
"Summary",2);
111 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
112 string name = mDBE->get(mL1TRatePath+histToMonitor[
i])->getTH1()->GetName();
113 mL1TRateMonitor->setBinLabel(i+2,name,2);
118 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TSync Module Monitoring" << endl;}
120 mDBE->setCurrentFolder(mL1TSyncPath);
121 vector<string> histToMonitor = mDBE->getMEs();
122 int histLines = histToMonitor.size()+1;
124 mDBE->setCurrentFolder(
"L1T/L1TTestsSummary/");
125 mL1TSyncMonitor = mDBE->book2D(
"SyncQualitySummary",
"L1T Synchronization Monitor Summary",maxLS,0.5,
double(maxLS)+0.5,histLines,0,histLines);
126 mL1TSyncMonitor->setAxisTitle(
"Lumi Section" ,1);
128 mL1TSyncMonitor->setBinLabel(1,
"Summary",2);
129 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
130 string name = mDBE->get(mL1TSyncPath+histToMonitor[
i])->getTH1()->GetName();
131 mL1TSyncMonitor->setBinLabel(i+2,name,2);
135 if(mMonitorL1TOccupancy){
137 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TOccupancy Module Monitoring" << endl;}
139 mDBE->setCurrentFolder(mL1TOccupancyPath);
140 vector<string> histToMonitor = mDBE->getMEs();
141 int histLines = histToMonitor.size()+1;
143 mDBE->setCurrentFolder(
"L1T/L1TTestsSummary/");
144 mL1TOccupancyMonitor = mDBE->book2D(
"OccupancySummary",
"L1T Occupancy Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
145 mL1TOccupancyMonitor->setAxisTitle(
"Lumi Section" ,1);
147 mL1TOccupancyMonitor->setBinLabel(1,
"Summary",2);
148 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
149 string name = mDBE->get(mL1TOccupancyPath+histToMonitor[
i])->getTH1()->GetName();
150 mL1TOccupancyMonitor->setBinLabel(i+2,name,2);
155 int testsToMonitor=1;
156 if(mMonitorL1TRate) {testsToMonitor++;}
157 if(mMonitorL1TSync) {testsToMonitor++;}
158 if(mMonitorL1TOccupancy){testsToMonitor++;}
161 mDBE->setCurrentFolder(
"L1T/L1TTestsSummary/");
162 mL1TSummary = mDBE->book2D(
"L1TQualitySummary",
"L1 Tests Summary",maxLS,+0.5,
double(maxLS)+0.5,testsToMonitor,0,testsToMonitor);
163 mL1TSummary->setAxisTitle(
"Lumi Section" ,1);
164 mL1TSummary->setBinLabel(1,
"L1T Summary",2);
167 if(mMonitorL1TRate) {mL1TSummary->setBinLabel(it,
"Rates" ,2); binYRate =it; it++;}
168 if(mMonitorL1TSync) {mL1TSummary->setBinLabel(it,
"Synchronization",2); binYSync =it; it++;}
169 if(mMonitorL1TOccupancy){mL1TSummary->setBinLabel(it,
"Occupancy" ,2); binYOccpancy=it;}
182 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called endRun()" << endl;}
184 if(mMonitorL1TRate) {updateL1TRateMonitor();}
185 if(mMonitorL1TSync) {updateL1TSyncMonitor();}
186 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor();}
199 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called beginLuminosityBlock()" << endl;}
213 mProcessedLS.push_back(eventLS);
216 cout <<
"[L1TTestsSummary:] Called endLuminosityBlock()" << endl;
217 cout <<
"[L1TTestsSummary:] Lumisection: " << eventLS << endl;
220 if(mMonitorL1TRate) {updateL1TRateMonitor();}
221 if(mMonitorL1TSync) {updateL1TSyncMonitor();}
222 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor();}
242 mDBE->setCurrentFolder(mL1TRatePath);
243 vector<string> histToMonitor = mDBE->getMEs();
245 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
248 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
258 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
259 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
260 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
263 for(
unsigned int i=0 ; i<mProcessedLS.size()-1 ; i++){
264 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
265 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
266 mL1TRateMonitor->setBinContent(binx,biny,100);
269 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
270 for(
unsigned int b=0 ;
b<mProcessedLS.size()-1 ;
b++){
273 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
275 if(valueBinBad==(mProcessedLS[
b])){
276 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
277 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
278 mL1TRateMonitor->setBinContent(binx,biny,300);
286 int nBinX = mL1TRateMonitor->getTH2F()->GetXaxis()->GetNbins();
287 int nBinY = mL1TRateMonitor->getTH2F()->GetYaxis()->GetNbins();
288 for(
int binx=1; binx<=nBinX ; binx++){
290 for(
int biny=2; biny<=nBinY ; biny++){
291 double flag = mL1TRateMonitor->getBinContent(binx,biny);
292 if(GlobalStatus<flag){GlobalStatus=
flag;}
296 mL1TRateMonitor->setBinContent(binx, 1,GlobalStatus);
297 mL1TSummary ->setBinContent(binx,binYRate,GlobalStatus);
309 mDBE->setCurrentFolder(mL1TSyncPath);
310 vector<string> histToMonitor = mDBE->getMEs();
312 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
315 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
325 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
326 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
327 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
330 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
331 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
332 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
333 mL1TSyncMonitor->setBinContent(binx,biny,100);
336 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
337 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
340 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
342 if(valueBinBad==mProcessedLS[
b]){
343 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
344 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
345 mL1TSyncMonitor->setBinContent(binx,biny,300);
353 int nBinX = mL1TSyncMonitor->getTH2F()->GetXaxis()->GetNbins();
354 int nBinY = mL1TSyncMonitor->getTH2F()->GetYaxis()->GetNbins();
355 for(
int binx=1; binx<=nBinX ; binx++){
357 for(
int biny=2; biny<=nBinY ; biny++){
358 double flag = mL1TSyncMonitor->getBinContent(binx,biny);
359 if(GlobalStatus<flag){GlobalStatus=
flag;}
363 mL1TSyncMonitor->setBinContent(binx, 1,GlobalStatus);
364 mL1TSummary ->setBinContent(binx,binYSync,GlobalStatus);
374 mDBE->setCurrentFolder(mL1TOccupancyPath);
375 vector<string> histToMonitor = mDBE->getMEs();
377 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
380 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
390 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
391 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
392 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
395 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
396 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
397 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
398 mL1TOccupancyMonitor->setBinContent(binx,biny,100);
401 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
402 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
405 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
407 if(valueBinBad==mProcessedLS[
b]){
408 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
409 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
410 mL1TOccupancyMonitor->setBinContent(binx,biny,300);
418 int nBinX = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->GetNbins();
419 int nBinY = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->GetNbins();
420 for(
int binx=1; binx<=nBinX ; binx++){
422 for(
int biny=2; biny<=nBinY ; biny++){
423 double flag = mL1TOccupancyMonitor->getBinContent(binx,biny);
424 if(GlobalStatus<flag){GlobalStatus=
flag;}
428 mL1TOccupancyMonitor->setBinContent(binx, 1,GlobalStatus);
429 mL1TSummary ->setBinContent(binx,binYOccpancy,GlobalStatus);
439 int nBinX = mL1TSummary->getTH2F()->GetXaxis()->GetNbins();
440 for(
int binx=1; binx<=nBinX ; binx++){
443 if(mL1TSummary->getBinContent(binx,binYRate)>GlobalStatus){
444 GlobalStatus=mL1TSummary->getBinContent(binx,binYRate);
447 if(mMonitorL1TSync) {
448 if(mL1TSummary->getBinContent(binx,binYSync)>GlobalStatus){
449 GlobalStatus=mL1TSummary->getBinContent(binx,binYSync);
452 if(mMonitorL1TOccupancy){
453 if(mL1TSummary->getBinContent(binx,binYOccpancy)>GlobalStatus){
454 GlobalStatus=mL1TSummary->getBinContent(binx,binYOccpancy);
457 mL1TSummary->setBinContent(binx,1,GlobalStatus);
LuminosityBlockID id() const
T getUntrackedParameter(std::string const &, T const &) const
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to <qtname> (null pointer if QReport does not exist)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
void updateL1TSyncMonitor()
#define DEFINE_FWK_MODULE(type)
const std::string & getMessage(void) const
get message attached to test
void updateL1TRateMonitor()
void analyze(const edm::Event &e, const edm::EventSetup &c)
int getStatus(void) const
get test status (see Core/interface/QTestStatus.h)
int getBin(double x, std::vector< double > boundaries)
const std::vector< DQMChannel > & getBadChannels(void) const
LuminosityBlockNumber_t luminosityBlock() const
void endRun(const edm::Run &r, const edm::EventSetup &c)
float getQTresult(void) const
get test result i.e. prob value
L1TTestsSummary(const edm::ParameterSet &ps)
virtual ~L1TTestsSummary()
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
void updateL1TOccupancyMonitor()
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)