22 verbose_( pSet_.getUntrackedParameter<
bool>(
"verbose",
false))
24 edm::LogInfo(
"TrackingQualityChecker") <<
" Creating TrackingQualityChecker " <<
"\n" ;
32 std::vector<edm::ParameterSet> TrackingGlobalQualityMEs =
pSet_.
getParameter< std::vector<edm::ParameterSet> >(
"TrackingGlobalQualityPSets" );
33 for (
auto meQTset : TrackingGlobalQualityMEs ) {
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));
41 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] created TrackingMEsMap" << std::endl;
44 std::vector<edm::ParameterSet> TrackingLSQualityMEs =
pSet_.
getParameter< std::vector<edm::ParameterSet> >(
"TrackingLSQualityPSets" );
45 for (
auto meQTset : TrackingLSQualityMEs ) {
48 tracking_ls_mes.
HistoLSDir = meQTset.exists(
"LSdir") ? meQTset.getParameter<
std::string>(
"LSdir") :
"";
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.;
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));
57 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] created TrackingLSMEsMap" << std::endl;
64 edm::LogInfo(
"TrackingQualityChecker") <<
" Deleting TrackingQualityChecker " <<
"\n" ;
75 edm::LogInfo(
"TrackingQualityChecker") <<
" booking TrackingQualityStatus" <<
"\n";
84 hname =
"reportSummaryMap";
85 htitle =
"Tracking Report Summary Map";
88 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookGlobalStatus] nQT: " << nQT << std::endl;
100 for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
101 it != TrackingMEsMap.end(); it++) {
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;
119 edm::LogInfo(
"TrackingQualityChecker") <<
" booking TrackingQualityStatus" <<
"\n";
128 hname =
"reportSummaryMap";
129 htitle =
"Tracking Report Summary Map";
134 std::cout <<
"[TrackingQualityChecker::bookLSStatus] nQT: " << nQT << std::endl;
138 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
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;
155 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyGlobalStatus] starting ..." << std::endl;
167 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
169 it->second.TrackingFlag->Fill(-1.0);
170 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
175 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyLSStatus] starting ..." << std::endl;
182 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
184 it->second.TrackingFlag->Fill(-1.0);
185 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
201 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
204 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetGlobalStatus] " << it->second.HistoName <<
" exist ? " << ( it->second.TrackingFlag ==
nullptr ?
"nope" :
"yes" ) <<
" ---> " << me << std::endl;
207 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
217 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
220 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetLSStatus] " << it->second.HistoLSName <<
" exist ? " << ( it->second.TrackingFlag ==
nullptr ?
"nope" :
"yes" ) <<
" ---> " << me << std::endl;
223 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
238 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillGlobalStatus] DONE" << std::endl;
249 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillLSStatus] DONE" << std::endl;
265 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
268 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
275 std::vector<MonitorElement*> tmpMEvec = igetter.
getContents(ibooker.
pwd()+
"/"+localMEdirpath);
276 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] tmpMEvec: " << tmpMEvec.size() << std::endl;
280 for (
auto ime : tmpMEvec ) {
282 if (
verbose_)
std::cout <<
"name: " << name <<
" <-- --> " << MEname << std::endl;
283 if ( name.find(MEname) != std::string::npos) {
289 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] nMEs: " << nMEs << std::endl;
292 for (
auto ime : tmpMEvec ) {
294 if (
verbose_)
std::cout <<
"name: " << name <<
" [" << MEname <<
"]" << std::endl;
295 if ( name.find(MEname) != std::string::npos) {
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();
307 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
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;
316 status = status/
float(nQTme);
317 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << status << std::endl;
318 it->second.TrackingFlag->Fill(status);
323 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus <<
" x status: " << status << std::endl;
324 if ( status < 0. ) gstatus = -1.;
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;
331 for (
auto ime : tmpMEvec ) {
332 float tmp_status = 1.;
334 if ( name.find(MEname) != std::string::npos) {
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;
342 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
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;
351 tmp_status = tmp_status/
float(nQTme);
354 status = fminf(tmp_status,status);
356 if ( status < 0. ) gstatus = -1.;
358 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << status << std::endl;
359 it->second.TrackingFlag->Fill(status);
366 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus << std::endl;
368 if (gstatus < 1.) gstatus = -1.;
369 else gstatus = gstatus/
float(nQT);
371 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ===> gstatus: " << gstatus << std::endl;
375 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] DONE" << std::endl;
385 th2d->SetBinContent(xbin, ybin, val);
393 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] starting .. " << std::endl;
401 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
404 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
408 std::string localMEdirpath = it->second.HistoLSDir;
410 float lower_cut = it->second.HistoLSLowerCut;
411 float upper_cut = it->second.HistoLSUpperCut;
415 std::vector<MonitorElement*> tmpMEvec = igetter.
getContents(ibooker.
pwd()+
"/"+localMEdirpath);
416 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] tmpMEvec: " << tmpMEvec.size() << std::endl;
421 for (
auto ime : tmpMEvec ) {
423 if ( name.find(MEname) != std::string::npos) {
430 for (
auto ime : tmpMEvec ) {
432 if ( name.find(MEname) != std::string::npos) {
440 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] MEname: " << MEname <<
" x_mean: " << x_mean << std::endl;
441 if (x_mean <= lower_cut || x_mean > upper_cut) status = 0.0;
445 for (
auto ime : tmpMEvec ) {
446 float tmp_status = 1.;
448 if ( name.find(MEname) != std::string::npos) {
454 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] MEname: " << MEname <<
"[" << me->
getName() <<
"] x_mean: " << x_mean << std::endl;
455 if (x_mean <= lower_cut || x_mean > upper_cut) tmp_status = 0.0;
456 else tmp_status = 1.0;
457 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] tmp_status: " << tmp_status << std::endl;
460 status = fminf(tmp_status,status);
461 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ==> status: " << status << std::endl;
464 it->second.TrackingFlag->Fill(status);
465 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ===> status: " << status <<
" [" << gstatus <<
"]" << std::endl;
466 if (status == 0.0) gstatus = -1.0;
467 else gstatus = gstatus *
status;
468 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ===> gstatus: " << gstatus << std::endl;
469 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
474 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] DONE" << std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * TrackingFlag
MonitorElement * TrackGlobalSummaryReportMap
void fillDummyGlobalStatus()
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)
const std::string & getName() const
get name of ME
virtual ~TrackingQualityChecker()
std::string TopFolderName_
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
TrackingQualityChecker(edm::ParameterSet const &ps)
void fillGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
MonitorElement * TrackLSSummaryReportGlobal
void setCurrentFolder(std::string const &fullpath)
void fillLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
bool bookedTrackingGlobalStatus_
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)
void Reset()
reset ME (ie. contents, errors, etc)
std::vector< MonitorElement * > getContents(Args &&...args)
const std::string getFullname() const
get full name of ME including Pathname
MonitorElement * book2D(Args &&...args)
std::string const & pwd()
bool bookedTrackingLSStatus_
void bookLSStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
std::vector< QReport * > getQReports() const
get map of QReports
void bookGlobalStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void fillTrackingStatusAtLumi(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
MonitorElement * TrackGlobalSummaryReportGlobal
void fillTrackingStatus(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void Reset(std::vector< TH2F > &depth)
int getNbinsX() const
get # of bins in X-axis
MonitorElement * bookFloat(Args &&...args)
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)
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
Kind kind() const
Get the type of the monitor element.