27 verbose_( pSet_.getUntrackedParameter<bool>(
"verbose",
false))
29 edm::LogInfo(
"TrackingQualityChecker") <<
" Creating TrackingQualityChecker " <<
"\n" ;
36 "\n------------------------------------------"
37 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
38 "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
39 "\n------------------------------------------";
45 std::vector<edm::ParameterSet> TrackingGlobalQualityMEs =
pSet_.
getParameter< std::vector<edm::ParameterSet> >(
"TrackingGlobalQualityPSets" );
46 for (
auto meQTset : TrackingGlobalQualityMEs ) {
49 tracking_mes.HistoDir = meQTset.getParameter<
std::string>(
"dir");
50 tracking_mes.HistoName = meQTset.getParameter<
std::string>(
"name");
51 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] inserting " << QTname <<
" in TrackingMEsMap" << std::endl;
52 TrackingMEsMap.insert(std::pair<std::string, TrackingMEs>(QTname, tracking_mes));
54 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] created TrackingMEsMap" << std::endl;
57 std::vector<edm::ParameterSet> TrackingLSQualityMEs =
pSet_.
getParameter< std::vector<edm::ParameterSet> >(
"TrackingLSQualityPSets" );
58 for (
auto meQTset : TrackingLSQualityMEs ) {
61 tracking_ls_mes.
HistoLSDir = meQTset.exists(
"LSdir") ? meQTset.getParameter<
std::string>(
"LSdir") :
"";
63 tracking_ls_mes.
HistoLSLowerCut = meQTset.exists(
"LSlowerCut") ? meQTset.getParameter<
double>(
"LSlowerCut") : -1.;
64 tracking_ls_mes.
HistoLSUpperCut = meQTset.exists(
"LSupperCut") ? meQTset.getParameter<
double>(
"LSupperCut") : -1.;
67 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] inserting " << QTname <<
" in TrackingMEsMap" << std::endl;
68 TrackingLSMEsMap.insert(std::pair<std::string, TrackingLSMEs>(QTname, tracking_ls_mes));
70 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::TrackingQualityChecker] created TrackingLSMEsMap" << std::endl;
77 edm::LogInfo(
"TrackingQualityChecker") <<
" Deleting TrackingQualityChecker " <<
"\n" ;
88 edm::LogInfo(
"TrackingQualityChecker") <<
" booking TrackingQualityStatus" <<
"\n";
97 hname =
"reportSummaryMap";
98 htitle =
"Tracking Report Summary Map";
101 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookGlobalStatus] nQT: " << nQT << std::endl;
113 for (std::map<std::string, TrackingMEs>::iterator it = TrackingMEsMap.begin();
114 it != TrackingMEsMap.end(); it++) {
116 it->second.TrackingFlag = dqm_store->
bookFloat(
"Track"+meQTname);
117 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookGlobalStatus] " << it->first <<
" exists ? " << it->second.TrackingFlag << std::endl;
118 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
132 edm::LogInfo(
"TrackingQualityChecker") <<
" booking TrackingQualityStatus" <<
"\n";
141 hname =
"reportSummaryMap";
142 htitle =
"Tracking Report Summary Map";
147 std::cout <<
"[TrackingQualityChecker::bookLSStatus] nQT: " << nQT << std::endl;
151 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
154 it->second.TrackingFlag = dqm_store->
bookFloat(
"Track"+meQTname);
155 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookLSStatus] " << it->first <<
" exists ? " << it->second.TrackingFlag << std::endl;
156 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::bookLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
168 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyGlobalStatus] starting ..." << std::endl;
180 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
182 it->second.TrackingFlag->Fill(-1.0);
183 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
188 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyLSStatus] starting ..." << std::endl;
195 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
197 it->second.TrackingFlag->Fill(-1.0);
198 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillDummyLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
214 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
217 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetGlobalStatus] " << it->second.HistoName <<
" exist ? " << ( it->second.TrackingFlag ==
NULL ?
"nope" :
"yes" ) <<
" ---> " << me << std::endl;
220 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetGlobalStatus] DONE w/ TrackingMEsMap" << std::endl;
230 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
233 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetLSStatus] " << it->second.HistoLSName <<
" exist ? " << ( it->second.TrackingFlag ==
NULL ?
"nope" :
"yes" ) <<
" ---> " << me << std::endl;
236 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::resetLSStatus] DONE w/ TrackingLSMEsMap" << std::endl;
251 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillGlobalStatus] DONE" << std::endl;
262 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillLSStatus] DONE" << std::endl;
278 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
281 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
288 std::vector<MonitorElement*> tmpMEvec = dqm_store->
getContents(dqm_store->
pwd()+
"/"+localMEdirpath);
289 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] tmpMEvec: " << tmpMEvec.size() << std::endl;
293 for (
auto ime : tmpMEvec ) {
295 if (
verbose_)
std::cout <<
"name: " << name <<
" <-- --> " << MEname << std::endl;
296 if ( name.find(MEname) != std::string::npos) {
302 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] nMEs: " << nMEs << std::endl;
305 for (
auto ime : tmpMEvec ) {
307 if (
verbose_)
std::cout <<
"name: " << name <<
" [" << MEname <<
"]" << std::endl;
308 if ( name.find(MEname) != std::string::npos) {
315 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] status: " << status << std::endl;
316 std::vector<QReport *> qt_reports = me->
getQReports();
317 size_t nQTme = qt_reports.size();
320 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
322 for (
auto iQT : qt_reports ) {
323 status += iQT->getQTresult();
324 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT: " << iQT->getQRName() << std::endl;
325 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << iQT->getQTresult() <<
" exists ? " << (it->second.TrackingFlag ?
"yes " :
"no ") << it->second.TrackingFlag << std::endl;
326 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT message: " << iQT->getMessage() << std::endl;
327 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT status: " << iQT->getStatus() << std::endl;
329 status = status/float(nQTme);
330 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << status << std::endl;
331 it->second.TrackingFlag->Fill(status);
336 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus <<
" x status: " << status << std::endl;
337 if ( status < 0. ) gstatus = -1.;
339 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ===> gstatus: " << gstatus << std::endl;
340 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
344 for (
auto ime : tmpMEvec ) {
345 float tmp_status = 1.;
347 if ( name.find(MEname) != std::string::npos) {
350 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] status: " << status << std::endl;
351 std::vector<QReport *> qt_reports = me->
getQReports();
352 size_t nQTme = qt_reports.size();
353 if (
verbose_)
std::cout <<
"nQTme: " << nQTme <<
"[" << name <<
", " << ime->getFullname() <<
"]" << std::endl;
355 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] qt_reports: " << qt_reports.size() << std::endl;
357 for (
auto iQT : qt_reports ) {
358 tmp_status += iQT->getQTresult();
359 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT: " << iQT->getQRName() << std::endl;
360 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << iQT->getQTresult() <<
" exists ? " << (it->second.TrackingFlag ?
"yes " :
"no ") << it->second.TrackingFlag << std::endl;
361 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT message: " << iQT->getMessage() << std::endl;
362 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] iQT status: " << iQT->getStatus() << std::endl;
364 tmp_status = tmp_status/float(nQTme);
367 status = fminf(tmp_status,status);
369 if ( status < 0. ) gstatus = -1.;
371 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] MEname: " << MEname <<
" status: " << status << std::endl;
372 it->second.TrackingFlag->Fill(status);
379 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] gstatus: " << gstatus << std::endl;
381 if (gstatus < 1.) gstatus = -1.;
382 else gstatus = gstatus/float(nQT);
384 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] ===> gstatus: " << gstatus << std::endl;
388 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatus] DONE" << std::endl;
398 th2d->SetBinContent(xbin, ybin, val);
406 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] starting .. " << std::endl;
414 for (std::map<std::string, TrackingLSMEs>::iterator it =
TrackingLSMEsMap.begin();
417 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ME: " << it->first <<
" [" << it->second.TrackingFlag->getFullname() <<
"] flag: " << it->second.TrackingFlag->getFloatValue() << std::endl;
421 std::string localMEdirpath = it->second.HistoLSDir;
423 float lower_cut = it->second.HistoLSLowerCut;
424 float upper_cut = it->second.HistoLSUpperCut;
428 std::vector<MonitorElement*> tmpMEvec = dqm_store->
getContents(dqm_store->
pwd()+
"/"+localMEdirpath);
429 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] tmpMEvec: " << tmpMEvec.size() << std::endl;
434 for (
auto ime : tmpMEvec ) {
436 if ( name.find(MEname) != std::string::npos) {
443 for (
auto ime : tmpMEvec ) {
445 if ( name.find(MEname) != std::string::npos) {
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;
458 for (
auto ime : tmpMEvec ) {
459 float tmp_status = 1.;
461 if ( name.find(MEname) != std::string::npos) {
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;
473 status = fminf(tmp_status,status);
474 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] ==> status: " << status << std::endl;
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;
487 if (
verbose_)
std::cout <<
"[TrackingQualityChecker::fillTrackingStatusAtLumi] DONE" << std::endl;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
MonitorElement * TrackingFlag
void fillTrackingStatus(DQMStore *dqm_store)
MonitorElement * TrackGlobalSummaryReportMap
void fillDummyGlobalStatus()
static bool goToDir(DQMStore *dqm_store, std::string name)
void fillGlobalStatus(DQMStore *dqm_store)
void cd(void)
go to top directory (ie. root)
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 bookLSStatus(DQMStore *dqm_store)
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)
static void getTopFolderPath(DQMStore *dqm_store, std::string top_dir, std::string &path)
MonitorElement * bookFloat(const char *name)
Book float.
TrackingQualityChecker(edm::ParameterSet const &ps)
MonitorElement * TrackLSSummaryReportGlobal
bool bookedTrackingGlobalStatus_
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)
Kind kind(void) const
Get the type of the monitor element.
const std::string getFullname(void) const
get full name of ME including Pathname
std::vector< MonitorElement * > getContents(const std::string &path) const
void bookGlobalStatus(DQMStore *dqm_store)
std::vector< QReport * > getQReports(void) const
get map of QReports
void fillTrackingStatusAtLumi(DQMStore *dqm_store)
bool bookedTrackingLSStatus_
void fillLSStatus(DQMStore *dqm_store)
int getNbinsX(void) const
get # of bins in X-axis
MonitorElement * TrackGlobalSummaryReportGlobal
void Reset(std::vector< TH2F > &depth)
volatile std::atomic< bool > shutdown_flag false
TH2F * getTH2F(void) const
if(conf.exists("allCellsPositionCalc"))
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
std::map< std::string, TrackingLSMEs > TrackingLSMEsMap
void setCurrentFolder(const std::string &fullpath)
const std::string & pwd(void) const