19 #include <TDirectory.h> 33 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called constructor" << endl;}
44 mL1TOccupancyPath = ps.
getUntrackedParameter<
string>(
"L1TOccupancyPath",
"L1T/L1TOccupancy/Certification/");
52 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called destructor" << endl;}
64 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called beginRun" << endl;}
70 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TRate Module Monitoring" << endl;}
73 vector<string> histToMonitor = igetter.
getMEs();
74 int histLines = histToMonitor.size()+1;
77 mL1TRateMonitor = ibooker.
book2D(
"RateQualitySummary",
"L1T Rates Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
80 mL1TRateMonitor->setBinLabel(1,
"Summary",2);
81 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
82 string name = igetter.
get(mL1TRatePath+histToMonitor[
i])->
getTH1()->GetName();
83 mL1TRateMonitor->setBinLabel(i+2,name,2);
88 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TSync Module Monitoring" << endl;}
91 vector<string> histToMonitor = igetter.
getMEs();
92 int histLines = histToMonitor.size()+1;
95 mL1TSyncMonitor = ibooker.
book2D(
"SyncQualitySummary",
"L1T Synchronization Monitor Summary",maxLS,0.5,
double(maxLS)+0.5,histLines,0,histLines);
98 mL1TSyncMonitor->setBinLabel(1,
"Summary",2);
99 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
100 string name = igetter.
get(mL1TSyncPath+histToMonitor[
i])->
getTH1()->GetName();
101 mL1TSyncMonitor->setBinLabel(i+2,name,2);
105 if(mMonitorL1TOccupancy){
107 if(mVerbose){
cout <<
"[L1TTestsSummary:] Initializing L1TOccupancy Module Monitoring" << endl;}
110 vector<string> histToMonitor = igetter.
getMEs();
111 int histLines = histToMonitor.size()+1;
114 mL1TOccupancyMonitor = ibooker.
book2D(
"OccupancySummary",
"L1T Occupancy Monitor Summary",maxLS,+0.5,
double(maxLS)+0.5,histLines,0,histLines);
117 mL1TOccupancyMonitor->setBinLabel(1,
"Summary",2);
118 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
119 string name = igetter.
get(mL1TOccupancyPath+histToMonitor[
i])->
getTH1()->GetName();
120 mL1TOccupancyMonitor->setBinLabel(i+2,name,2);
125 int testsToMonitor=1;
126 if(mMonitorL1TRate) {testsToMonitor++;}
127 if(mMonitorL1TSync) {testsToMonitor++;}
128 if(mMonitorL1TOccupancy){testsToMonitor++;}
132 mL1TSummary = ibooker.
book2D(
"L1TQualitySummary",
"L1 Tests Summary",maxLS,+0.5,
double(maxLS)+0.5,testsToMonitor,0,testsToMonitor);
134 mL1TSummary->setBinLabel(1,
"L1T Summary",2);
137 if(mMonitorL1TRate) {mL1TSummary->setBinLabel(it,
"Rates" ,2); binYRate =it; it++;}
138 if(mMonitorL1TSync) {mL1TSummary->setBinLabel(it,
"Synchronization",2); binYSync =it; it++;}
139 if(mMonitorL1TOccupancy){mL1TSummary->setBinLabel(it,
"Occupancy" ,2); binYOccpancy=it;}
152 book(ibooker, igetter);
154 if(mVerbose){
cout <<
"[L1TTestsSummary:] Called endRun()" << endl;}
156 if(mMonitorL1TRate) {updateL1TRateMonitor(ibooker, igetter);}
157 if(mMonitorL1TSync) {updateL1TSyncMonitor(ibooker, igetter);}
158 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor(ibooker, igetter);}
159 updateL1TSummary(ibooker, igetter);
174 book(ibooker, igetter);
176 mProcessedLS.push_back(eventLS);
179 cout <<
"[L1TTestsSummary:] Called endLuminosityBlock()" << endl;
180 cout <<
"[L1TTestsSummary:] Lumisection: " << eventLS << endl;
183 if(mMonitorL1TRate) {updateL1TRateMonitor(ibooker, igetter);}
184 if(mMonitorL1TSync) {updateL1TSyncMonitor(ibooker, igetter);}
185 if(mMonitorL1TOccupancy){updateL1TOccupancyMonitor(ibooker, igetter);}
186 updateL1TSummary(ibooker, igetter);
197 vector<string> histToMonitor = igetter.
getMEs();
199 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
202 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
208 const string& qtmessage = myQReport->
getMessage() ;
212 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
213 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
214 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
217 for(
unsigned int i=0 ; i<mProcessedLS.size()-1 ; i++){
218 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
219 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
220 mL1TRateMonitor->setBinContent(binx,biny,100);
223 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
224 for(
unsigned int b=0 ;
b<mProcessedLS.size()-1 ;
b++){
227 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
229 if(valueBinBad==(mProcessedLS[
b])){
230 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
231 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
232 mL1TRateMonitor->setBinContent(binx,biny,300);
240 int nBinX = mL1TRateMonitor->getTH2F()->GetXaxis()->GetNbins();
241 int nBinY = mL1TRateMonitor->getTH2F()->GetYaxis()->GetNbins();
242 for(
int binx=1; binx<=
nBinX ; binx++){
244 for(
int biny=2; biny<=
nBinY ; biny++){
245 double flag = mL1TRateMonitor->getBinContent(binx,biny);
246 if(GlobalStatus<flag){GlobalStatus=
flag;}
250 mL1TRateMonitor->setBinContent(binx, 1,GlobalStatus);
251 mL1TSummary ->setBinContent(binx,binYRate,GlobalStatus);
264 vector<string> histToMonitor = igetter.
getMEs();
266 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
269 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
275 const string& qtmessage = myQReport->
getMessage() ;
279 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
280 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
281 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
284 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
285 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
286 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
287 mL1TSyncMonitor->setBinContent(binx,biny,100);
290 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
291 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
294 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
296 if(valueBinBad==mProcessedLS[
b]){
297 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
298 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
299 mL1TSyncMonitor->setBinContent(binx,biny,300);
307 int nBinX = mL1TSyncMonitor->getTH2F()->GetXaxis()->GetNbins();
308 int nBinY = mL1TSyncMonitor->getTH2F()->GetYaxis()->GetNbins();
309 for(
int binx=1; binx<=
nBinX ; binx++){
311 for(
int biny=2; biny<=
nBinY ; biny++){
312 double flag = mL1TSyncMonitor->getBinContent(binx,biny);
313 if(GlobalStatus<flag){GlobalStatus=
flag;}
317 mL1TSyncMonitor->setBinContent(binx, 1,GlobalStatus);
318 mL1TSummary ->setBinContent(binx,binYSync,GlobalStatus);
329 vector<string> histToMonitor = igetter.
getMEs();
331 for(
unsigned int i=0 ;
i<histToMonitor.size() ;
i++){
334 if(mVerbose) {
cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;}
340 const string& qtmessage = myQReport->
getMessage() ;
344 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
345 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
346 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
349 for(
unsigned int i=0 ; i<mProcessedLS.size() ; i++){
350 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
351 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
352 mL1TOccupancyMonitor->setBinContent(binx,biny,100);
355 for(
unsigned int a=0 ;
a<qtBadChannels.size() ;
a++){
356 for(
unsigned int b=0 ;
b<mProcessedLS.size() ;
b++){
359 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
361 if(valueBinBad==mProcessedLS[
b]){
362 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
363 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
364 mL1TOccupancyMonitor->setBinContent(binx,biny,300);
372 int nBinX = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->GetNbins();
373 int nBinY = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->GetNbins();
374 for(
int binx=1; binx<=
nBinX ; binx++){
376 for(
int biny=2; biny<=
nBinY ; biny++){
377 double flag = mL1TOccupancyMonitor->getBinContent(binx,biny);
378 if(GlobalStatus<flag){GlobalStatus=
flag;}
382 mL1TOccupancyMonitor->setBinContent(binx, 1,GlobalStatus);
383 mL1TSummary ->setBinContent(binx,binYOccpancy,GlobalStatus);
393 int nBinX = mL1TSummary->getTH2F()->GetXaxis()->GetNbins();
394 for(
int binx=1; binx<=
nBinX ; binx++){
397 if(mL1TSummary->getBinContent(binx,binYRate)>GlobalStatus){
398 GlobalStatus=mL1TSummary->getBinContent(binx,binYRate);
401 if(mMonitorL1TSync) {
402 if(mL1TSummary->getBinContent(binx,binYSync)>GlobalStatus){
403 GlobalStatus=mL1TSummary->getBinContent(binx,binYSync);
406 if(mMonitorL1TOccupancy){
407 if(mL1TSummary->getBinContent(binx,binYOccpancy)>GlobalStatus){
408 GlobalStatus=mL1TSummary->getBinContent(binx,binYOccpancy);
411 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)
~L1TTestsSummary() override
const std::vector< DQMChannel > & getBadChannels() const
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
void updateL1TSummary(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
#define DEFINE_FWK_MODULE(type)
void setCurrentFolder(std::string const &fullpath)
virtual void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void updateL1TOccupancyMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void setCurrentFolder(std::string const &fullpath)
const std::string & getMessage() const
get message attached to test
int getBin(double x, std::vector< double > boundaries)
void updateL1TSyncMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
MonitorElement * get(std::string const &path)
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * book2D(Args &&...args)
LuminosityBlockNumber_t luminosityBlock() const
int getStatus() const
get test status (see Core/interface/QTestStatus.h)
L1TTestsSummary(const edm::ParameterSet &ps)
float getQTresult() const
get test result i.e. prob value
std::vector< std::string > getMEs()
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)