CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TrackingQualityChecker Class Reference

#include <TrackingQualityChecker.h>

Classes

struct  TrackingLSMEs
 
struct  TrackingMEs
 

Public Member Functions

void bookGlobalStatus (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void bookLSStatus (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void fillDummyGlobalStatus ()
 
void fillDummyLSStatus ()
 
void fillGlobalStatus (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void fillLSStatus (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void resetGlobalStatus ()
 
void resetLSStatus ()
 
 TrackingQualityChecker (edm::ParameterSet const &ps)
 
virtual ~TrackingQualityChecker ()
 

Private Member Functions

void fillStatusHistogram (MonitorElement *, int xbin, int ybin, float val)
 
void fillTrackingStatus (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 
void fillTrackingStatusAtLumi (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
 

Private Attributes

bool bookedTrackingGlobalStatus_
 
bool bookedTrackingLSStatus_
 
edm::ParameterSet pSet_
 
std::string TopFolderName_
 
MonitorElementTrackGlobalSummaryReportGlobal
 
MonitorElementTrackGlobalSummaryReportMap
 
std::map< std::string, TrackingLSMEsTrackingLSMEsMap
 
std::map< std::string, TrackingMEsTrackingMEsMap
 
MonitorElementTrackLSSummaryReportGlobal
 
bool verbose_
 

Detailed Description

Definition at line 20 of file TrackingQualityChecker.h.

Constructor & Destructor Documentation

TrackingQualityChecker::TrackingQualityChecker ( edm::ParameterSet const &  ps)

Definition at line 20 of file TrackingQualityChecker.cc.

References bookedTrackingGlobalStatus_, bookedTrackingLSStatus_, gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TrackingQualityChecker::TrackingLSMEs::HistoLSDir, TrackingQualityChecker::TrackingLSMEs::HistoLSLowerCut, TrackingQualityChecker::TrackingLSMEs::HistoLSName, TrackingQualityChecker::TrackingLSMEs::HistoLSUpperCut, pSet_, AlCaHLTBitMon_QueryRunRegistry::string, TopFolderName_, TrackingQualityChecker::TrackingLSMEs::TrackingFlag, TrackingLSMEsMap, TrackingMEsMap, and verbose_.

20  :
21  pSet_(ps),
22  verbose_( pSet_.getUntrackedParameter<bool>("verbose",false))
23 {
24  edm::LogInfo("TrackingQualityChecker") << " Creating TrackingQualityChecker " << "\n" ;
25 
28 
29  TopFolderName_ = pSet_.getUntrackedParameter<std::string>("TopFolderName","Tracking");
30 
31  TrackingMEs tracking_mes;
32  std::vector<edm::ParameterSet> TrackingGlobalQualityMEs = pSet_.getParameter< std::vector<edm::ParameterSet> >("TrackingGlobalQualityPSets" );
33  for ( auto meQTset : TrackingGlobalQualityMEs ) {
34 
35  std::string QTname = meQTset.getParameter<std::string>("QT");
36  tracking_mes.HistoDir = meQTset.getParameter<std::string>("dir");
37  tracking_mes.HistoName = meQTset.getParameter<std::string>("name");
38  if (verbose_) std::cout << "[TrackingQualityChecker::TrackingQualityChecker] inserting " << QTname << " in TrackingMEsMap" << std::endl;
39  TrackingMEsMap.insert(std::pair<std::string, TrackingMEs>(QTname, tracking_mes));
40  }
41  if (verbose_) std::cout << "[TrackingQualityChecker::TrackingQualityChecker] created TrackingMEsMap" << std::endl;
42 
43  TrackingLSMEs tracking_ls_mes;
44  std::vector<edm::ParameterSet> TrackingLSQualityMEs = pSet_.getParameter< std::vector<edm::ParameterSet> >("TrackingLSQualityPSets" );
45  for ( auto meQTset : TrackingLSQualityMEs ) {
46 
47  std::string QTname = meQTset.getParameter<std::string>("QT");
48  tracking_ls_mes.HistoLSDir = meQTset.exists("LSdir") ? meQTset.getParameter<std::string>("LSdir") : "";
49  tracking_ls_mes.HistoLSName = meQTset.exists("LSname") ? meQTset.getParameter<std::string>("LSname") : "";
50  tracking_ls_mes.HistoLSLowerCut = meQTset.exists("LSlowerCut") ? meQTset.getParameter<double>("LSlowerCut") : -1.;
51  tracking_ls_mes.HistoLSUpperCut = meQTset.exists("LSupperCut") ? meQTset.getParameter<double>("LSupperCut") : -1.;
52  tracking_ls_mes.TrackingFlag = nullptr;
53 
54  if (verbose_) std::cout << "[TrackingQualityChecker::TrackingQualityChecker] inserting " << QTname << " in TrackingMEsMap" << std::endl;
55  TrackingLSMEsMap.insert(std::pair<std::string, TrackingLSMEs>(QTname, tracking_ls_mes));
56  }
57  if (verbose_) std::cout << "[TrackingQualityChecker::TrackingQualityChecker] created TrackingLSMEsMap" << std::endl;
58 
59 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TrackingMEs > TrackingMEsMap
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
TrackingQualityChecker::~TrackingQualityChecker ( )
virtual

Definition at line 63 of file TrackingQualityChecker.cc.

63  {
64  edm::LogInfo("TrackingQualityChecker") << " Deleting TrackingQualityChecker " << "\n" ;
65 }

Member Function Documentation

void TrackingQualityChecker::bookGlobalStatus ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 69 of file TrackingQualityChecker.cc.

References DQMStore::IBooker::book2D(), bookedTrackingGlobalStatus_, DQMStore::IBooker::bookFloat(), DQMStore::IBooker::cd(), gather_cfg::cout, TrackingUtility::getTopFolderPath(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, TopFolderName_, TrackGlobalSummaryReportGlobal, TrackGlobalSummaryReportMap, TrackingMEsMap, and verbose_.

Referenced by TrackingActionExecutor::createGlobalStatus(), and fillGlobalStatus().

69  {
70 
71  if (verbose_) std::cout << "[TrackingQualityChecker::bookGlobalStatus] already booked ? " << (bookedTrackingGlobalStatus_ ? "yes" : "nope") << std::endl;
72 
74  ibooker.cd();
75  edm::LogInfo("TrackingQualityChecker") << " booking TrackingQualityStatus" << "\n";
76 
77  std::string tracking_dir = "";
78  TrackingUtility::getTopFolderPath(ibooker,igetter, TopFolderName_, tracking_dir);
79  ibooker.setCurrentFolder(TopFolderName_+"/EventInfo");
80 
81  TrackGlobalSummaryReportGlobal = ibooker.bookFloat("reportSummary");
82 
83  std::string hname, htitle;
84  hname = "reportSummaryMap";
85  htitle = "Tracking Report Summary Map";
86 
87  size_t nQT = TrackingMEsMap.size();
88  if (verbose_) std::cout << "[TrackingQualityChecker::bookGlobalStatus] nQT: " << nQT << std::endl;
89  TrackGlobalSummaryReportMap = ibooker.book2D(hname, htitle, nQT,0.5,float(nQT)+0.5,1,0.5,1.5);
90  TrackGlobalSummaryReportMap->setAxisTitle("Track Quality Type", 1);
91  TrackGlobalSummaryReportMap->setAxisTitle("QTest Flag", 2);
92  size_t ibin =0;
93  for ( auto meQTset : TrackingMEsMap ) {
94  TrackGlobalSummaryReportMap->setBinLabel(ibin+1,meQTset.first);
95  ibin++;
96  }
97 
98  ibooker.setCurrentFolder(TopFolderName_+"/EventInfo/reportSummaryContents");
99 
100  for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
101  it != TrackingMEsMap.end(); it++) {
102  std::string meQTname = it->first;
103  it->second.TrackingFlag = ibooker.bookFloat("Track"+meQTname);
104  if (verbose_) std::cout << "[TrackingQualityChecker::bookGlobalStatus] " << it->first << " exists ? " << it->second.TrackingFlag << std::endl;
105  if (verbose_) std::cout << "[TrackingQualityChecker::bookGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
106  }
107 
109  ibooker.cd();
110  }
111 }
MonitorElement * TrackGlobalSummaryReportMap
std::map< std::string, TrackingMEs > TrackingMEsMap
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * TrackGlobalSummaryReportGlobal
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:105
static void getTopFolderPath(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string top_dir, std::string &path)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void TrackingQualityChecker::bookLSStatus ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 113 of file TrackingQualityChecker.cc.

References bookedTrackingLSStatus_, DQMStore::IBooker::bookFloat(), DQMStore::IBooker::cd(), gather_cfg::cout, TrackingUtility::getTopFolderPath(), DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, TopFolderName_, TrackingLSMEsMap, TrackLSSummaryReportGlobal, and verbose_.

Referenced by TrackingActionExecutor::createLSStatus(), and fillLSStatus().

113  {
114 
115  if (verbose_) std::cout << "[TrackingQualityChecker::bookLSStatus] already booked ? " << (bookedTrackingLSStatus_ ? "yes" : "nope") << std::endl;
116 
118  ibooker.cd();
119  edm::LogInfo("TrackingQualityChecker") << " booking TrackingQualityStatus" << "\n";
120 
121  std::string tracking_dir = "";
122  TrackingUtility::getTopFolderPath(ibooker,igetter, TopFolderName_, tracking_dir);
123  ibooker.setCurrentFolder(TopFolderName_+"/EventInfo");
124 
125  TrackLSSummaryReportGlobal = ibooker.bookFloat("reportSummary");
126 
127  std::string hname, htitle;
128  hname = "reportSummaryMap";
129  htitle = "Tracking Report Summary Map";
130 
131 
132  if (verbose_) {
133  size_t nQT = TrackingLSMEsMap.size();
134  std::cout << "[TrackingQualityChecker::bookLSStatus] nQT: " << nQT << std::endl;
135  }
136 
137  ibooker.setCurrentFolder(TopFolderName_+"/EventInfo/reportSummaryContents");
138  for (std::map<std::string, TrackingLSMEs>::iterator it = TrackingLSMEsMap.begin();
139  it != TrackingLSMEsMap.end(); it++) {
140  std::string meQTname = it->first;
141  it->second.TrackingFlag = ibooker.bookFloat("Track"+meQTname);
142  if (verbose_) std::cout << "[TrackingQualityChecker::bookLSStatus] " << it->first << " exists ? " << it->second.TrackingFlag << std::endl;
143  if (verbose_) std::cout << "[TrackingQualityChecker::bookLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
144  }
145 
147  ibooker.cd();
148  }
149 }
MonitorElement * TrackLSSummaryReportGlobal
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:105
static void getTopFolderPath(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string top_dir, std::string &path)
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
void TrackingQualityChecker::fillDummyGlobalStatus ( )

Definition at line 154 of file TrackingQualityChecker.cc.

References bookedTrackingGlobalStatus_, gather_cfg::cout, MonitorElement::Fill(), fillStatusHistogram(), MonitorElement::getNbinsX(), resetGlobalStatus(), TrackGlobalSummaryReportGlobal, TrackGlobalSummaryReportMap, TrackingMEsMap, and verbose_.

Referenced by TrackingActionExecutor::fillDummyGlobalStatus(), and fillGlobalStatus().

154  {
155  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyGlobalStatus] starting ..." << std::endl;
156 
158  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyGlobalStatus] already booked ? " << (bookedTrackingGlobalStatus_ ? "yes" : "nope") << std::endl;
160 
162 
163  for (int ibin = 1; ibin < TrackGlobalSummaryReportMap->getNbinsX()+1; ibin++) {
165  }
166 
167  for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
168  it != TrackingMEsMap.end(); it++)
169  it->second.TrackingFlag->Fill(-1.0);
170  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
171 
172  }
173 }
MonitorElement * TrackGlobalSummaryReportMap
std::map< std::string, TrackingMEs > TrackingMEsMap
void Fill(long long x)
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)
MonitorElement * TrackGlobalSummaryReportGlobal
int getNbinsX() const
get # of bins in X-axis
void TrackingQualityChecker::fillDummyLSStatus ( )

Definition at line 174 of file TrackingQualityChecker.cc.

References bookedTrackingLSStatus_, gather_cfg::cout, MonitorElement::Fill(), resetLSStatus(), TrackingLSMEsMap, TrackLSSummaryReportGlobal, and verbose_.

Referenced by TrackingActionExecutor::fillDummyLSStatus(), and fillLSStatus().

174  {
175  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyLSStatus] starting ..." << std::endl;
176 
177  resetLSStatus();
178  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyLSStatus] already booked ? " << (bookedTrackingLSStatus_ ? "yes" : "nope") << std::endl;
180 
182  for (std::map<std::string, TrackingLSMEs>::iterator it = TrackingLSMEsMap.begin();
183  it != TrackingLSMEsMap.end(); it++)
184  it->second.TrackingFlag->Fill(-1.0);
185  if (verbose_) std::cout << "[TrackingQualityChecker::fillDummyLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
186 
187  }
188 }
void Fill(long long x)
MonitorElement * TrackLSSummaryReportGlobal
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
void TrackingQualityChecker::fillGlobalStatus ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 231 of file TrackingQualityChecker.cc.

References bookedTrackingGlobalStatus_, bookGlobalStatus(), DQMStore::IBooker::cd(), gather_cfg::cout, fillDummyGlobalStatus(), fillTrackingStatus(), and verbose_.

Referenced by TrackingActionExecutor::fillGlobalStatus().

231  {
232 
233  if (verbose_) std::cout << "[TrackingQualityChecker::fillGlobalStatus] already booked ? " << (bookedTrackingGlobalStatus_ ? "yes" : "nope") << std::endl;
234  if (!bookedTrackingGlobalStatus_) bookGlobalStatus(ibooker,igetter);
235 
237  fillTrackingStatus(ibooker,igetter);
238  if (verbose_) std::cout << "[TrackingQualityChecker::fillGlobalStatus] DONE" << std::endl;
239  ibooker.cd();
240 }
void bookGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void fillTrackingStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void TrackingQualityChecker::fillLSStatus ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)

Definition at line 242 of file TrackingQualityChecker.cc.

References bookedTrackingLSStatus_, bookLSStatus(), DQMStore::IBooker::cd(), gather_cfg::cout, fillDummyLSStatus(), fillTrackingStatusAtLumi(), and verbose_.

Referenced by TrackingActionExecutor::fillStatusAtLumi().

242  {
243 
244  if (verbose_) std::cout << "[TrackingQualityChecker::fillLSStatus] already booked ? " << (bookedTrackingLSStatus_ ? "yes" : "nope") << std::endl;
245  if (!bookedTrackingLSStatus_) bookLSStatus(ibooker,igetter);
246 
248  fillTrackingStatusAtLumi(ibooker,igetter);
249  if (verbose_) std::cout << "[TrackingQualityChecker::fillLSStatus] DONE" << std::endl;
250  ibooker.cd();
251 }
void bookLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void fillTrackingStatusAtLumi(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void TrackingQualityChecker::fillStatusHistogram ( MonitorElement me,
int  xbin,
int  ybin,
float  val 
)
private

Definition at line 395 of file TrackingQualityChecker.cc.

References MonitorElement::DQM_KIND_TH2F, MonitorElement::getTH2F(), and MonitorElement::kind().

Referenced by fillDummyGlobalStatus(), and fillTrackingStatus().

395  {
396  if (me && me->kind() == MonitorElement::DQM_KIND_TH2F) {
397  TH2F* th2d = me->getTH2F();
398  th2d->SetBinContent(xbin, ybin, val);
399  }
400  }
TH2F * getTH2F() const
Kind kind() const
Get the type of the monitor element.
void TrackingQualityChecker::fillTrackingStatus ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 256 of file TrackingQualityChecker.cc.

References DQMStore::IBooker::cd(), gather_cfg::cout, MonitorElement::Fill(), fillStatusHistogram(), objects.autophobj::float, DQMStore::IGetter::getContents(), MonitorElement::getFullname(), MonitorElement::getName(), MonitorElement::getQReports(), TrackingUtility::goToDir(), dataset::name, DQMStore::IBooker::pwd(), mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, TopFolderName_, TrackGlobalSummaryReportGlobal, TrackGlobalSummaryReportMap, TrackingMEsMap, and verbose_.

Referenced by fillGlobalStatus().

256  {
257 
258  float gstatus = 0.0;
259 
260  ibooker.cd();
261  if (!TrackingUtility::goToDir(ibooker,igetter, TopFolderName_)) return;
262 
263 
264  int ibin = 0;
265  for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
266  it != TrackingMEsMap.end(); it++) {
267 
268  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] ME: " << it->first << " [" << it->second.TrackingFlag->getFullname() << "] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
269 
270  ibin++;
271 
272  std::string localMEdirpath = it->second.HistoDir;
273  std::string MEname = it->second.HistoName;
274 
275  std::vector<MonitorElement*> tmpMEvec = igetter.getContents(ibooker.pwd()+"/"+localMEdirpath);
276  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] tmpMEvec: " << tmpMEvec.size() << std::endl;
277  MonitorElement* me = nullptr;
278 
279  size_t nMEs = 0;
280  for ( auto ime : tmpMEvec ) {
281  std::string name = ime->getName();
282  if (verbose_) std::cout << "name: " << name << " <-- --> " << MEname << std::endl;
283  if ( name.find(MEname) != std::string::npos) {
284  me = ime;
285  nMEs++;
286  }
287  }
288  // only one ME found
289  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] nMEs: " << nMEs << std::endl;
290  if (nMEs == 1) {
291  float status = 0.;
292  for ( auto ime : tmpMEvec ) {
293  std::string name = ime->getName();
294  if (verbose_) std::cout << "name: " << name << " [" << MEname << "]" << std::endl;
295  if ( name.find(MEname) != std::string::npos) {
296  me = ime;
297  if (verbose_) std::cout << "inside the loop nQTme: " << me->getQReports().size() << "[" << ime->getFullname() << "]" << std::endl;
298  }
299  }
300  if (verbose_) std::cout << "me: " << me << "[" << me->getName() << ", " << me->getFullname() << "]" << std::endl;
301  if (!me) continue;
302  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] status: " << status << std::endl;
303  std::vector<QReport *> qt_reports = me->getQReports();
304  size_t nQTme = qt_reports.size();
305  if (verbose_) std::cout << "nQTme: " << nQTme << std::endl;
306  if (nQTme != 0) {
307  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
308  // loop on possible QTs
309  for ( auto iQT : qt_reports ) {
310  status += iQT->getQTresult();
311  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT: " << iQT->getQRName() << std::endl;
312  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname << " status: " << iQT->getQTresult() << " exists ? " << (it->second.TrackingFlag ? "yes " : "no ") << it->second.TrackingFlag << std::endl;
313  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT message: " << iQT->getMessage() << std::endl;
314  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT status: " << iQT->getStatus() << std::endl;
315  }
316  status = status/float(nQTme);
317  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname << " status: " << status << std::endl;
318  it->second.TrackingFlag->Fill(status);
319  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] TrackGlobalSummaryReportMap: " << TrackGlobalSummaryReportMap << std::endl;
321  }
322 
323  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus << " x status: " << status << std::endl;
324  if ( status < 0. ) gstatus = -1.;
325  else gstatus += status;
326  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] ===> gstatus: " << gstatus << std::endl;
327  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] ME: " << it->first << " [" << it->second.TrackingFlag->getFullname() << "] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
328 
329  } else { // more than 1 ME w/ the same root => they need to be considered together
330  float status = 1.;
331  for ( auto ime : tmpMEvec ) {
332  float tmp_status = 1.;
333  std::string name = ime->getName();
334  if ( name.find(MEname) != std::string::npos) {
335  me = ime;
336 
337  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] status: " << status << std::endl;
338  std::vector<QReport *> qt_reports = me->getQReports();
339  size_t nQTme = qt_reports.size();
340  if (verbose_) std::cout << "nQTme: " << nQTme << "[" << name << ", " << ime->getFullname() << "]" << std::endl;
341  if (nQTme != 0) {
342  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
343  // loop on possible QTs
344  for ( auto iQT : qt_reports ) {
345  tmp_status += iQT->getQTresult();
346  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT: " << iQT->getQRName() << std::endl;
347  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname << " status: " << iQT->getQTresult() << " exists ? " << (it->second.TrackingFlag ? "yes " : "no ") << it->second.TrackingFlag << std::endl;
348  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT message: " << iQT->getMessage() << std::endl;
349  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] iQT status: " << iQT->getStatus() << std::endl;
350  }
351  tmp_status = tmp_status/float(nQTme);
352  }
353  }
354  status = fminf(tmp_status,status);
355  }
356  if ( status < 0. ) gstatus = -1.;
357  else gstatus += status;
358  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname << " status: " << status << std::endl;
359  it->second.TrackingFlag->Fill(status);
360  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] TrackGlobalSummaryReportMap: " << TrackGlobalSummaryReportMap << std::endl;
361 
363  }
364  }
365 
366  // After harvesting, all per-lumi MEs are reset, to make sure we only get
367  // events of the new lumisection next time.
368  for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
369  it != TrackingMEsMap.end(); it++) {
370  std::string localMEdirpath = it->second.HistoDir;
371  std::vector<MonitorElement*> tmpMEvec = igetter.getContents(ibooker.pwd()+"/"+localMEdirpath);
372  for ( auto ime : tmpMEvec ) {
373  if (ime->getLumiFlag()) {
374  ime->Reset();
375  }
376  }
377  }
378 
379  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus << std::endl;
380  size_t nQT = TrackingMEsMap.size();
381  if (gstatus < 1.) gstatus = -1.;
382  else gstatus = gstatus/float(nQT);
383 
384  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] ===> gstatus: " << gstatus << std::endl;
386  ibooker.cd();
387 
388  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatus] DONE" << std::endl;
389 
390 }
MonitorElement * TrackGlobalSummaryReportMap
std::map< std::string, TrackingMEs > TrackingMEsMap
const std::string & getName() const
get name of ME
void Fill(long long x)
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:192
const std::string getFullname() const
get full name of ME including Pathname
std::string const & pwd()
Definition: DQMStore.cc:278
std::vector< QReport * > getQReports() const
get map of QReports
MonitorElement * TrackGlobalSummaryReportGlobal
void TrackingQualityChecker::fillTrackingStatusAtLumi ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 404 of file TrackingQualityChecker.cc.

References DQMStore::IBooker::cd(), gather_cfg::cout, MonitorElement::DQM_KIND_TH1F, MonitorElement::Fill(), DQMStore::IGetter::getContents(), MonitorElement::getMean(), MonitorElement::getName(), TrackingUtility::goToDir(), MonitorElement::kind(), dataset::name, DQMStore::IBooker::pwd(), mps_update::status, AlCaHLTBitMon_QueryRunRegistry::string, TopFolderName_, TrackingLSMEsMap, TrackLSSummaryReportGlobal, and verbose_.

Referenced by fillLSStatus().

404  {
405 
406  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] starting .. " << std::endl;
407  float gstatus = 1.0;
408 
409  ibooker.cd();
410  if (!TrackingUtility::goToDir(ibooker,igetter, TopFolderName_)) return;
411 
412 
413  int ibin = 0;
414  for (std::map<std::string, TrackingLSMEs>::iterator it = TrackingLSMEsMap.begin();
415  it != TrackingLSMEsMap.end(); it++) {
416 
417  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] ME: " << it->first << " [" << it->second.TrackingFlag->getFullname() << "] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
418 
419  ibin++;
420 
421  std::string localMEdirpath = it->second.HistoLSDir;
422  std::string MEname = it->second.HistoLSName;
423  float lower_cut = it->second.HistoLSLowerCut;
424  float upper_cut = it->second.HistoLSUpperCut;
425 
426  float status = 1.0;
427 
428  std::vector<MonitorElement*> tmpMEvec = igetter.getContents(ibooker.pwd()+"/"+localMEdirpath);
429  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] tmpMEvec: " << tmpMEvec.size() << std::endl;
430 
431  MonitorElement* me = nullptr;
432 
433  size_t nMEs = 0;
434  for ( auto ime : tmpMEvec ) {
435  std::string name = ime->getName();
436  if ( name.find(MEname) != std::string::npos) {
437  me = ime;
438  nMEs++;
439  }
440  }
441  // only one ME found
442  if (nMEs == 1) {
443  for ( auto ime : tmpMEvec ) {
444  std::string name = ime->getName();
445  if ( name.find(MEname) != std::string::npos) {
446  me = ime;
447  }
448  }
449  if (!me) continue;
450 
451  if (me->kind() == MonitorElement::DQM_KIND_TH1F) {
452  float x_mean = me->getMean();
453  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] MEname: " << MEname << " x_mean: " << x_mean << std::endl;
454  if (x_mean <= lower_cut || x_mean > upper_cut) status = 0.0;
455  else status = 1.0;
456  }
457  } else { // more than 1 ME w/ the same root => they need to be considered together
458  for ( auto ime : tmpMEvec ) {
459  float tmp_status = 1.;
460  std::string name = ime->getName();
461  if ( name.find(MEname) != std::string::npos) {
462  me = ime;
463  if (!me) continue;
464 
465  if (me->kind() == MonitorElement::DQM_KIND_TH1F) {
466  float x_mean = me->getMean();
467  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] MEname: " << MEname << "[" << me->getName() << "] x_mean: " << x_mean << std::endl;
468  if (x_mean <= lower_cut || x_mean > upper_cut) tmp_status = 0.0;
469  else tmp_status = 1.0;
470  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] tmp_status: " << tmp_status << std::endl;
471  }
472  }
473  status = fminf(tmp_status,status);
474  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] ==> status: " << status << std::endl;
475  } // loop on tmpMEvec
476  }
477  it->second.TrackingFlag->Fill(status);
478  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] ===> status: " << status << " [" << gstatus << "]" << std::endl;
479  if (status == 0.0) gstatus = -1.0;
480  else gstatus = gstatus * status;
481  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] ===> gstatus: " << gstatus << std::endl;
482  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] ME: " << it->first << " [" << it->second.TrackingFlag->getFullname() << "] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
483  }
485  ibooker.cd();
486 
487  if (verbose_) std::cout << "[TrackingQualityChecker::fillTrackingStatusAtLumi] DONE" << std::endl;
488 }
const std::string & getName() const
get name of ME
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void Fill(long long x)
MonitorElement * TrackLSSummaryReportGlobal
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
std::vector< MonitorElement * > getContents(Args &&...args)
Definition: DQMStore.h:192
std::string const & pwd()
Definition: DQMStore.cc:278
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
Kind kind() const
Get the type of the monitor element.
void TrackingQualityChecker::resetGlobalStatus ( )

Definition at line 193 of file TrackingQualityChecker.cc.

References bookedTrackingGlobalStatus_, gather_cfg::cout, MonitorElement::Reset(), HcalObjRepresent::Reset(), TrackGlobalSummaryReportGlobal, TrackGlobalSummaryReportMap, TrackingMEsMap, and verbose_.

Referenced by fillDummyGlobalStatus().

193  {
194 
195  if (verbose_) std::cout << "[TrackingQualityChecker::resetGlobalStatus] already booked ? " << (bookedTrackingGlobalStatus_ ? "yes" : "nope") << std::endl;
197 
200 
201  for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
202  it != TrackingMEsMap.end(); it++) {
203  MonitorElement* me = it->second.TrackingFlag;
204  if (verbose_) std::cout << "[TrackingQualityChecker::resetGlobalStatus] " << it->second.HistoName << " exist ? " << ( it->second.TrackingFlag == nullptr ? "nope" : "yes" ) << " ---> " << me << std::endl;
205  me->Reset();
206  }
207  if (verbose_) std::cout << "[TrackingQualityChecker::resetGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
208 
209  }
210 }
MonitorElement * TrackGlobalSummaryReportMap
std::map< std::string, TrackingMEs > TrackingMEsMap
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * TrackGlobalSummaryReportGlobal
void Reset(std::vector< TH2F > &depth)
void TrackingQualityChecker::resetLSStatus ( )

Definition at line 211 of file TrackingQualityChecker.cc.

References bookedTrackingLSStatus_, gather_cfg::cout, MonitorElement::Reset(), HcalObjRepresent::Reset(), TrackingLSMEsMap, TrackLSSummaryReportGlobal, and verbose_.

Referenced by fillDummyLSStatus().

211  {
212 
213  if (verbose_) std::cout << "[TrackingQualityChecker::resetLSStatus] already booked ? " << (bookedTrackingLSStatus_ ? "yes" : "nope") << std::endl;
215 
217  for (std::map<std::string, TrackingLSMEs>::iterator it = TrackingLSMEsMap.begin();
218  it != TrackingLSMEsMap.end(); it++) {
219  MonitorElement* me = it->second.TrackingFlag;
220  if (verbose_) std::cout << "[TrackingQualityChecker::resetLSStatus] " << it->second.HistoLSName << " exist ? " << ( it->second.TrackingFlag == nullptr ? "nope" : "yes" ) << " ---> " << me << std::endl;
221  me->Reset();
222  }
223  if (verbose_) std::cout << "[TrackingQualityChecker::resetLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
224 
225  }
226 }
MonitorElement * TrackLSSummaryReportGlobal
void Reset()
reset ME (ie. contents, errors, etc)
void Reset(std::vector< TH2F > &depth)
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap

Member Data Documentation

bool TrackingQualityChecker::bookedTrackingGlobalStatus_
private
bool TrackingQualityChecker::bookedTrackingLSStatus_
private
edm::ParameterSet TrackingQualityChecker::pSet_
private

Definition at line 68 of file TrackingQualityChecker.h.

Referenced by TrackingQualityChecker().

std::string TrackingQualityChecker::TopFolderName_
private
MonitorElement* TrackingQualityChecker::TrackGlobalSummaryReportGlobal
private
MonitorElement* TrackingQualityChecker::TrackGlobalSummaryReportMap
private
std::map<std::string, TrackingLSMEs> TrackingQualityChecker::TrackingLSMEsMap
private
std::map<std::string, TrackingMEs> TrackingQualityChecker::TrackingMEsMap
private
MonitorElement* TrackingQualityChecker::TrackLSSummaryReportGlobal
private
bool TrackingQualityChecker::verbose_
private