28 " Creating SiStripQualityChecker " <<
"\n" ;
33 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIB",
"TIB"));
34 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TOB",
"TOB"));
35 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TECF",
"TEC/side_2"));
36 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TECB",
"TEC/side_1"));
37 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIDF",
"TID/side_2"));
38 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIDB",
"TID/side_1"));
43 "\n------------------------------------------"
44 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like"
45 "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")"
46 "\n------------------------------------------";
58 TrackingMEsMap.insert(std::pair<std::string, TrackingMEs>(
"Rate", tracking_mes));
65 TrackingMEsMap.insert(std::pair<std::string, TrackingMEs>(
"Chi2", tracking_mes));
72 TrackingMEsMap.insert(std::pair<std::string, TrackingMEs>(
"RecHits", tracking_mes));
104 " Deleting SiStripQualityChecker " <<
"\n" ;
115 if (strip_dir.size() == 0) strip_dir =
"SiStrip";
122 hname =
"detFractionReportMap";
123 htitle =
"SiStrip Report for Good Detector Fraction";
127 hname =
"sToNReportMap";
128 htitle =
"SiStrip Report for Signal-to-Noise";
136 hname =
"reportSummaryMap";
137 htitle =
"SiStrip Report Summary Map";
146 for (std::map<std::string, std::string>::const_iterator it =
SubDetFolderMap.begin();
157 else if (det ==
"TECB") local_mes.
detectorTag =
"TEC-";
158 else if (det ==
"TIDF") local_mes.
detectorTag =
"TID+";
159 else if (det ==
"TIDB") local_mes.
detectorTag =
"TID-";
163 me_name =
"SiStrip_" + det;
166 me_name =
"SiStrip_DetFraction_" + det;
169 me_name =
"SiStrip_SToNFlag_" + det;
171 SubDetMEsMap.insert(std::pair<std::string, SubDetMEs>(det, local_mes));
179 if (tracking_dir.size() == 0) tracking_dir =
"Tracking";
185 hname =
"reportSummaryMap";
186 htitle =
"Tracking Report Summary Map";
195 dqm_store->
setCurrentFolder(tracking_dir+
"/EventInfo/reportSummaryContents");
197 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
201 it->second.TrackingFlag = dqm_store->
bookFloat(
"Track"+name);
215 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
239 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
241 it->second.TrackingFlag->Fill(-1.0);
256 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
273 for (std::map<std::string, TrackingMEs>::iterator it =
TrackingMEsMap.begin();
275 it->second.TrackingFlag->Reset();
302 unsigned int xbin = 0;
303 float global_flag = 0;
310 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
313 std::map<std::string, std::string>::const_iterator cPos =
SubDetFolderMap.find(det);
315 std::string dname = mechanicalview_dir +
"/" + cPos->second;
316 if (!dqm_store->
dirExists(dname))
continue;
317 dqm_store->
cd(dname);
324 global_flag = global_flag/xbin*1.0;
336 dir =
"TrackParameters";
339 std::vector<MonitorElement*> meVec1;
340 std::vector<MonitorElement*> meVec2;
342 meVec1 = dqm_store->
getContents(dqm_store->
pwd()+
"/GeneralProperties/GoodTracks");
343 meVec2 = dqm_store->
getContents(dqm_store->
pwd()+
"/HitProperties/GoodTracks");
345 meVec1 = dqm_store->
getContents(dqm_store->
pwd()+
"/GeneralProperties");
346 meVec2 = dqm_store->
getContents(dqm_store->
pwd()+
"/HitProperties");
348 std::vector<MonitorElement*> meVec(meVec1.size() + meVec2.size());
349 std::merge(meVec1.begin(), meVec1.end(), meVec2.begin(), meVec2.end(), meVec.begin());
352 for (std::vector<MonitorElement*>::const_iterator itME = meVec.begin(); itME != meVec.end(); itME++) {
355 std::vector<QReport *> qt_reports = me->
getQReports();
356 if (qt_reports.size() == 0)
continue;
362 for (std::map<std::string, TrackingMEs>::const_iterator it =
TrackingMEsMap.begin();
366 if (name.find(hname) != std::string::npos) {
367 status = qt_reports[0]->getQTresult();
368 it->second.TrackingFlag->Fill(status);
373 gstatus = gstatus *
status;
383 SubDetMEs& mes,
unsigned int xbin,
float& gflag) {
386 if (status_flag < 1)
return;
388 std::vector<std::string> subDirVec = dqm_store->
getSubdirs();
390 unsigned int ybin = 0;
393 float tot_ston_stat = 0;
395 for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
396 ic != subDirVec.end(); ic++) {
398 if (dname.find(
"BadModuleList") != std::string::npos)
continue;
399 std::vector<MonitorElement*> meVec;
401 dqm_store->
cd((*ic));
407 int lnum = atoi(dname.substr(dname.find_last_of(
"_")+1).c_str());
408 ndet = cabling->connectedNumber(mes.
detectorTag, lnum);
412 for (std::vector<MonitorElement*>::const_iterator it = meVec.begin();
413 it != meVec.end(); it++) {
416 std::vector<QReport *> reports = me->
getQReports();
418 if (reports.size() == 0)
continue;
421 if( name.find(
"Summary_ClusterStoNCorr__OnTrack") != std::string::npos){
423 if (reports[0]->getQTresult() == -1) {
432 float eff_fac = 1 - (errdet*1.0/ndet);
439 tot_errdet += errdet;
440 tot_ston_stat += ston_stat;
442 dqm_store->
cd((*ic));
445 float tot_eff_fac = 1 - (tot_errdet*1.0/tot_ndet);
447 float tot_ston_fac = tot_ston_stat/ybin;
449 if (tot_ston_fac < 0){
452 gflag =
std::min(tot_eff_fac,tot_ston_fac);
461 std::ostringstream det_summary_str;
462 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
465 det_summary_str << std::setprecision(4);
466 det_summary_str << std::setiosflags(std::ios::fixed);
468 det_summary_str <<
" Printing Status for " << det <<
" : " << std::endl;
472 float fval1, fval2, fval3;
473 fval1 = fval2 = fval3 = -1.0;
477 if (sval.size() > 0) fval1 = atof(sval.c_str());
479 if (sval.size() > 0) fval2 = atof(sval.c_str());
481 if (sval.size() > 0) fval3 = atof(sval.c_str());
483 det_summary_str << std::setw(7) <<
" % of good detectors " << fval1
484 <<
" SToN Flag " << fval2
485 <<
" Summary Flag " << fval3 << std::endl;
494 std::map<uint32_t,uint16_t> bad_modules;
495 for (std::vector<MonitorElement*>::const_iterator it = layer_mes.begin();
496 it != layer_mes.end(); it++) {
499 std::vector<QReport *> qreports = me->
getQReports();
500 if (qreports.size() == 0)
continue;
502 std::vector<DQMChannel> bad_channels_me;
504 bad_channels_me = qreports[0]->getBadChannels();
507 bad_channels_me = qreports[0]->getBadChannels();
508 lname = name.substr(name.find(
"TkHMap_")+7);
509 lname = lname.substr(lname.find(
"_T")+1);
512 for (std::vector<DQMChannel>::iterator it = bad_channels_me.begin(); it != bad_channels_me.end(); it++){
513 int xval = (*it).getBinX();
514 int yval = (*it).getBinY();
516 std::map<uint32_t,uint16_t>::iterator iPos = bad_modules.find(detId);
518 if (iPos != bad_modules.end()){
526 std::ostringstream detid_str;
530 std::string thisMEpath = currentdir.substr( 0 , currentdir.rfind(
"/" ) ) +
"/BadModuleList/" + detid_str.str() ;
537 flag = atoi ( val_str.c_str() );
543 bad_modules.insert(std::pair<uint32_t,uint16_t>(detId,flag));
547 for(std::map<uint32_t,uint16_t>::const_iterator it = bad_modules.begin();
548 it != bad_modules.end(); it++) {
549 uint32_t detId = it->first;
550 uint16_t
flag = it->second;
551 std::map<uint32_t,uint16_t>::iterator iPos =
badModuleList.find(detId);
555 badModuleList.insert(std::pair<uint32_t,uint16_t>(detId,flag));
558 errdet = bad_modules.size();
566 th2d->SetBinContent(xbin, ybin, val);
587 uint32_t detId = it->first;
590 if (!dqm_store->
dirExists(subdet_folder)) {
591 subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(
"MechanicalView")+14);
592 if (!dqm_store->
dirExists(subdet_folder))
continue;
594 std::string bad_module_folder = subdet_folder +
"/" +
"BadModuleList";
597 std::ostringstream detid_str;
599 std::string full_path = bad_module_folder +
"/" + detid_str.str();
602 else me = dqm_store->
bookInt(detid_str.str());
603 me->
Fill(it->second);
632 +
"/FedSummary/PerLumiSection/"
633 +
"lumiErrorFraction";
637 float global_fraction = 0.0;
639 for (
int ibin = 1; ibin <= th1->GetNbinsX(); ibin++) {
641 std::map<std::string, SubDetMEs>::iterator iPos =
SubDetMEsMap.find(label);
643 float fraction = 1.0 - th1->GetBinContent(ibin);
644 global_fraction += fraction;
646 iPos->second.DetFraction->Fill(fraction);
647 iPos->second.SToNFlag->Fill(-1.0);
648 iPos->second.SummaryFlag->Fill(fraction);
651 global_fraction = global_fraction/dets;
663 dir =
"TrackParameters";
666 std::vector<MonitorElement*> meVec1;
667 std::vector<MonitorElement*> meVec2;
672 meVec1 = dqm_store->
getContents(dqm_store->
pwd()+
"/GeneralProperties");
673 meVec2 = dqm_store->
getContents(dqm_store->
pwd()+
"/HitProperties");
675 std::vector<MonitorElement*> meVec(meVec1.size() + meVec2.size());
676 std::merge(meVec1.begin(), meVec1.end(), meVec2.begin(), meVec2.end(), meVec.begin());
679 for (std::vector<MonitorElement*>::const_iterator itME = meVec.begin(); itME != meVec.end(); itME++) {
686 for (std::map<std::string, TrackingMEs>::const_iterator it =
TrackingMEsMap.begin();
689 std::string hname = it->second.HistoName+
"lumiFlag_";
690 float lower_cut = it->second.LowerCut;
691 float upper_cut = it->second.UpperCut;
692 if (name.find(hname) != std::string::npos) {
693 if (me->
getMean() <= lower_cut || me->
getMean() > upper_cut) status = 0.0;
695 it->second.TrackingFlag->Fill(status);
701 if (status == -1.0) gstatus = -1.0;
702 else gstatus = gstatus *
status;
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling, const edm::EventSetup &eSetup)
static void setBadModuleFlag(std::string &hname, uint16_t &flg)
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 * SToNFlag
uint32_t getDetFromBin(int layer, int ix, int iy)
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
bool bookedTrackingStatus_
void bookStatus(DQMStore *dqm_store)
void fillDetectorStatusAtLumi(DQMStore *dqm_store)
std::vector< std::string > getSubdirs(void) const
void fillDetectorStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling)
static void getMEValue(MonitorElement *me, std::string &val)
std::map< std::string, std::string > SubDetFolderMap
void cd(void)
go to top directory (ie. root)
MonitorElement * SummaryFlag
void getModuleStatus(DQMStore *dqm_store, std::vector< MonitorElement * > &layer_mes, int &errdet)
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)
tuple currentdir
parse figure configuration if found
void fillTrackingStatusAtLumi(DQMStore *dqm_store)
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void initialiseBadModuleList()
MonitorElement * bookFloat(const char *name)
Book float.
SiStripQualityChecker(edm::ParameterSet const &ps)
int getNbinsY(void) const
get # of bins in Y-axis
std::map< std::string, SubDetMEs > SubDetMEsMap
virtual ~SiStripQualityChecker()
void fillFaultyModuleStatus(DQMStore *dqm_store, const edm::EventSetup &eSetup)
Kind kind(void) const
Get the type of the monitor element.
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::vector< MonitorElement * > getContents(const std::string &path) const
MonitorElement * DetFractionReportMap
MonitorElement * TrackingFlag
bool dirExists(const std::string &path) const
true if directory exists
std::vector< QReport * > getQReports(void) const
get map of QReports
static int getMEStatus(MonitorElement *me)
MonitorElement * TrackSummaryReportGlobal
T const * product() const
TH1F * getTH1F(void) const
void fillStatusAtLumi(DQMStore *dqm_store)
MonitorElement * SummaryReportMap
MonitorElement * SummaryReportGlobal
MonitorElement * SToNReportMap
void fillTrackingStatus(DQMStore *dqm_store)
int getNbinsX(void) const
get # of bins in X-axis
static const int STATUS_OK
MonitorElement * TrackSummaryReportMap
std::map< uint32_t, uint16_t > badModuleList
std::map< std::string, TrackingMEs > TrackingMEsMap
TH2F * getTH2F(void) const
MonitorElement * bookInt(const char *name)
Book int.
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)
void fillSubDetStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling, SubDetMEs &mes, unsigned int xbin, float &gflag)
static bool goToDir(DQMStore *dqm_store, std::string name)
MonitorElement * DetFraction
void setCurrentFolder(const std::string &fullpath)
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)
const std::string & pwd(void) const
static void getTopFolderPath(DQMStore *dqm_store, std::string type, std::string &path)