20 #include <TDirectory.h>
34 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Called constructor" << endl;}
45 mL1TOccupancyPath = ps.
getUntrackedParameter<
string>(
"L1TOccupancyPath",
"L1T/L1TOccupancy/Certification/");
53 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Called destructor" << endl;}
65 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Called beginRun" << endl;}
71 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TRate Module Monitoring" << endl;}
74 vector<string> histToMonitor = igetter.
getMEs();
75 int histLines = histToMonitor.size()+1;
78 mL1TRateMonitor = ibooker.
book2D(
"RateQualitySummary",
"L1T Rates Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
81 mL1TRateMonitor->setBinLabel(1,
"Summary",2);
82 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
83 string name = igetter.
get(mL1TRatePath+histToMonitor[
i])->
getTH1()->GetName();
84 mL1TRateMonitor->setBinLabel(i+2,name,2);
89 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TSync Module Monitoring" << endl;}
92 vector<string> histToMonitor = igetter.
getMEs();
93 int histLines = histToMonitor.size()+1;
96 mL1TSyncMonitor = ibooker.
book2D(
"SyncQualitySummary",
"L1T Synchronization Monitor Summary",maxLS,0.5,
double(maxLS)+0.5,histLines,0,histLines);
99 mL1TSyncMonitor->setBinLabel(1,
"Summary",2);
100 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
101 string name = igetter.
get(mL1TSyncPath+histToMonitor[
i])->
getTH1()->GetName();
102 mL1TSyncMonitor->setBinLabel(i+2,name,2);
106 if(mMonitorL1TOccupancy){
108 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TOccupancy Module Monitoring" << endl;}
111 vector<string> histToMonitor = igetter.
getMEs();
112 int histLines = histToMonitor.size()+1;
115 mL1TOccupancyMonitor = ibooker.
book2D(
"OccupancySummary",
"L1T Occupancy Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
118 mL1TOccupancyMonitor->setBinLabel(1,
"Summary",2);
119 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
120 string name = igetter.
get(mL1TOccupancyPath+histToMonitor[
i])->
getTH1()->GetName();
121 mL1TOccupancyMonitor->setBinLabel(i+2,name,2);
126 int testsToMonitor=1;
127 if(mMonitorL1TRate) {testsToMonitor++;}
128 if(mMonitorL1TSync) {testsToMonitor++;}
129 if(mMonitorL1TOccupancy){testsToMonitor++;}
133 mL1TSummary = ibooker.
book2D(
"L1TQualitySummary",
"L1 Tests Summary",maxLS,+0.5,
double(maxLS)+0.5,testsToMonitor,0,testsToMonitor);
135 mL1TSummary->setBinLabel(1,
"L1T Summary",2);
138 if(mMonitorL1TRate) {mL1TSummary->setBinLabel(it,
"Rates" ,2); binYRate =it; it++;}
139 if(mMonitorL1TSync) {mL1TSummary->setBinLabel(it,
"Synchronization",2); binYSync =it; it++;}
140 if(mMonitorL1TOccupancy){mL1TSummary->setBinLabel(it,
"Occupancy" ,2); binYOccpancy=it;}
153 book(ibooker, igetter);
155 if(
mVerbose){
cout <<
"[L1TTestsSummary:] Called endRun()" << endl;}
157 if(mMonitorL1TRate) {updateL1TRateMonitor(ibooker, igetter);}
158 if(mMonitorL1TSync) {updateL1TSyncMonitor(ibooker, igetter);}
159 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor(ibooker, igetter);}
160 updateL1TSummary(ibooker, igetter);
175 book(ibooker, igetter);
177 mProcessedLS.push_back(eventLS);
180 cout <<
"[L1TTestsSummary:] Called endLuminosityBlock()" << endl;
181 cout <<
"[L1TTestsSummary:] Lumisection: " << eventLS << endl;
184 if(mMonitorL1TRate) {updateL1TRateMonitor(ibooker, igetter);}
185 if(mMonitorL1TSync) {updateL1TSyncMonitor(ibooker, igetter);}
186 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor(ibooker, igetter);}
187 updateL1TSummary(ibooker, igetter);
198 vector<string> histToMonitor = igetter.
getMEs();
200 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
203 if(
mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
213 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
214 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
215 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
218 for(
unsigned int i=0 ; i<mProcessedLS.size()-1 ; i++){
219 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
220 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
221 mL1TRateMonitor->setBinContent(binx,biny,100);
224 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
225 for(
unsigned int b=0 ;
b<mProcessedLS.size()-1 ;
b++){
228 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
230 if(valueBinBad==(mProcessedLS[
b])){
231 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
232 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
233 mL1TRateMonitor->setBinContent(binx,biny,300);
241 int nBinX = mL1TRateMonitor->getTH2F()->GetXaxis()->GetNbins();
242 int nBinY = mL1TRateMonitor->getTH2F()->GetYaxis()->GetNbins();
243 for(
int binx=1; binx<=nBinX ; binx++){
245 for(
int biny=2; biny<=nBinY ; biny++){
246 double flag = mL1TRateMonitor->getBinContent(binx,biny);
247 if(GlobalStatus<flag){GlobalStatus=flag;}
251 mL1TRateMonitor->setBinContent(binx, 1,GlobalStatus);
252 mL1TSummary ->setBinContent(binx,binYRate,GlobalStatus);
265 vector<string> histToMonitor = igetter.
getMEs();
267 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
270 if(
mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
280 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
281 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
282 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
285 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
286 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
287 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
288 mL1TSyncMonitor->setBinContent(binx,biny,100);
291 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
292 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
295 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
297 if(valueBinBad==mProcessedLS[
b]){
298 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
299 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
300 mL1TSyncMonitor->setBinContent(binx,biny,300);
308 int nBinX = mL1TSyncMonitor->getTH2F()->GetXaxis()->GetNbins();
309 int nBinY = mL1TSyncMonitor->getTH2F()->GetYaxis()->GetNbins();
310 for(
int binx=1; binx<=nBinX ; binx++){
312 for(
int biny=2; biny<=nBinY ; biny++){
313 double flag = mL1TSyncMonitor->getBinContent(binx,biny);
314 if(GlobalStatus<flag){GlobalStatus=flag;}
318 mL1TSyncMonitor->setBinContent(binx, 1,GlobalStatus);
319 mL1TSummary ->setBinContent(binx,binYSync,GlobalStatus);
330 vector<string> histToMonitor = igetter.
getMEs();
332 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
335 if(
mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
345 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
346 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
347 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
350 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
351 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
352 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
353 mL1TOccupancyMonitor->setBinContent(binx,biny,100);
356 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
357 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
360 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
362 if(valueBinBad==mProcessedLS[
b]){
363 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
364 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
365 mL1TOccupancyMonitor->setBinContent(binx,biny,300);
373 int nBinX = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->GetNbins();
374 int nBinY = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->GetNbins();
375 for(
int binx=1; binx<=nBinX ; binx++){
377 for(
int biny=2; biny<=nBinY ; biny++){
378 double flag = mL1TOccupancyMonitor->getBinContent(binx,biny);
379 if(GlobalStatus<flag){GlobalStatus=flag;}
383 mL1TOccupancyMonitor->setBinContent(binx, 1,GlobalStatus);
384 mL1TSummary ->setBinContent(binx,binYOccpancy,GlobalStatus);
394 int nBinX = mL1TSummary->getTH2F()->GetXaxis()->GetNbins();
395 for(
int binx=1; binx<=nBinX ; binx++){
398 if(mL1TSummary->getBinContent(binx,binYRate)>GlobalStatus){
399 GlobalStatus=mL1TSummary->getBinContent(binx,binYRate);
402 if(mMonitorL1TSync) {
403 if(mL1TSummary->getBinContent(binx,binYSync)>GlobalStatus){
404 GlobalStatus=mL1TSummary->getBinContent(binx,binYSync);
407 if(mMonitorL1TOccupancy){
408 if(mL1TSummary->getBinContent(binx,binYOccpancy)>GlobalStatus){
409 GlobalStatus=mL1TSummary->getBinContent(binx,binYOccpancy);
412 mL1TSummary->setBinContent(binx,1,GlobalStatus);
LuminosityBlockID id() const
void updateL1TRateMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
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)
virtual void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
void updateL1TSummary(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
MonitorElement * get(const std::string &path)
#define DEFINE_FWK_MODULE(type)
virtual void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void updateL1TOccupancyMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
const std::string & getMessage(void) const
get message attached to test
int getStatus(void) const
get test status (see Core/interface/QTestStatus.h)
int getBin(double x, std::vector< double > boundaries)
void updateL1TSyncMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
std::vector< std::string > getMEs(void)
const std::vector< DQMChannel > & getBadChannels(void) const
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
LuminosityBlockNumber_t luminosityBlock() const
float getQTresult(void) const
get test result i.e. prob value
void setCurrentFolder(const std::string &fullpath)
L1TTestsSummary(const edm::ParameterSet &ps)
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
virtual ~L1TTestsSummary()
virtual void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)