28 " Creating SiStripQualityChecker " <<
"\n" ;
32 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIB",
"TIB"));
33 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TOB",
"TOB"));
34 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TECF",
"TEC/PLUS"));
35 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TECB",
"TEC/MINUS"));
36 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIDF",
"TID/PLUS"));
37 SubDetFolderMap.insert(std::pair<std::string, std::string>(
"TIDB",
"TID/MINUS"));
45 " Deleting SiStripQualityChecker " <<
"\n" ;
56 if (strip_dir.empty()) strip_dir =
"SiStrip";
63 hname =
"detFractionReportMap";
64 htitle =
"SiStrip Report for Good Detector Fraction";
69 hname =
"detFractionReportMap_hasBadChan";
70 htitle =
"SiStrip Report for Good Detector Fraction due to bad channels";
74 hname =
"detFractionReportMap_hasTooManyDigis";
75 htitle =
"SiStrip Report for Good Detector Fraction due to too many digis";
79 hname =
"detFractionReportMap_hasTooManyClu";
80 htitle =
"SiStrip Report for Good Detector Fraction due to too many clusters";
84 hname =
"detFractionReportMap_hasExclFed";
85 htitle =
"SiStrip Report for Good Detector Fraction due to excluded FEDs";
89 hname =
"detFractionReportMap_hasDcsErr";
90 htitle =
"SiStrip Report for Good Detector Fraction due to DCS errors";
95 hname =
"sToNReportMap";
96 htitle =
"SiStrip Report for Signal-to-Noise";
104 hname =
"reportSummaryMap";
105 htitle =
"SiStrip Report Summary Map";
114 for (std::map<std::string, std::string>::const_iterator it =
SubDetFolderMap.begin();
130 else if (det ==
"TECB") local_mes.
detectorTag =
"TEC-";
131 else if (det ==
"TIDF") local_mes.
detectorTag =
"TID+";
132 else if (det ==
"TIDB") local_mes.
detectorTag =
"TID-";
136 me_name =
"SiStrip_" + det;
139 me_name =
"SiStrip_DetFraction_" + det;
142 me_name =
"SiStrip_SToNFlag_" + det;
144 SubDetMEsMap.insert(std::pair<std::string, SubDetMEs>(det, local_mes));
156 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
184 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
223 unsigned int xbin = 0;
224 float global_flag = 0;
231 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
234 std::map<std::string, std::string>::const_iterator cPos =
SubDetFolderMap.find(det);
237 if (!dqm_store->
dirExists(dname))
continue;
238 dqm_store->
cd(dname);
245 global_flag = global_flag/xbin*1.0;
254 SubDetMEs& mes,
unsigned int xbin,
float& gflag) {
257 if (status_flag < 1)
return;
259 std::vector<std::string> subDirVec = dqm_store->
getSubdirs();
261 unsigned int ybin = 0;
264 float tot_ston_stat = 0;
266 for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
267 ic != subDirVec.end(); ic++) {
269 if (dname.find(
"BadModuleList") != std::string::npos)
continue;
270 if (dname.find(
"ring") !=std::string::npos)
continue;
271 std::vector<MonitorElement*> meVec;
274 dqm_store->
cd((*ic));
278 int errdet_hasBadChan = 0;
279 int errdet_hasTooManyDigis = 0;
280 int errdet_hasTooManyClu = 0;
281 int errdet_hasExclFed = 0;
282 int errdet_hasDcsErr = 0;
285 int lnum = atoi(dname.substr(dname.find_last_of(
"_")+1).c_str());
288 getModuleStatus(dqm_store, meVec, errdet, errdet_hasBadChan, errdet_hasTooManyDigis, errdet_hasTooManyClu, errdet_hasExclFed, errdet_hasDcsErr);
290 for (std::vector<MonitorElement*>::const_iterator it = meVec.begin();
291 it != meVec.end(); it++) {
294 std::vector<QReport *> reports = me->
getQReports();
296 if (reports.empty())
continue;
299 if( name.find(
"Summary_ClusterStoNCorr__OnTrack") != std::string::npos){
301 if (reports[0]->getQTresult() == -1) {
310 float eff_fac = 1 - (errdet*1.0/ndet);
311 float eff_fac_hasBadChan = 1 - (errdet_hasBadChan *1.0/ndet);
312 float eff_fac_hasTooManyDigis = 1 - (errdet_hasTooManyDigis*1.0/ndet);
313 float eff_fac_hasTooManyClu = 1 - (errdet_hasTooManyClu *1.0/ndet);
314 float eff_fac_hasExclFed = 1 - (errdet_hasExclFed *1.0/ndet);
315 float eff_fac_hasDcsErr = 1 - (errdet_hasDcsErr *1.0/ndet);
327 tot_errdet += errdet;
328 tot_ston_stat += ston_stat;
330 dqm_store->
cd((*ic));
333 float tot_eff_fac = 1 - (tot_errdet*1.0/tot_ndet);
335 float tot_ston_fac = tot_ston_stat/ybin;
337 if (tot_ston_fac < 0){
340 gflag =
std::min(tot_eff_fac,tot_ston_fac);
349 std::ostringstream det_summary_str;
350 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
353 det_summary_str << std::setprecision(4);
356 det_summary_str <<
" Printing Status for " << det <<
" : " << std::endl;
360 float fval1, fval2, fval3;
361 fval1 = fval2 = fval3 = -1.0;
365 if (!sval.empty()) fval1 = atof(sval.c_str());
367 if (!sval.empty()) fval2 = atof(sval.c_str());
369 if (!sval.empty()) fval3 = atof(sval.c_str());
371 det_summary_str << std::setw(7) <<
" % of good detectors " << fval1
372 <<
" SToN Flag " << fval2
373 <<
" Summary Flag " << fval3 << std::endl;
379 void SiStripQualityChecker::getModuleStatus(
DQMStore* dqm_store, std::vector<MonitorElement*>& layer_mes,
int& errdet,
int& errdet_hasBadChan,
int& errdet_hasTooManyDigis,
int& errdet_hasTooManyClu,
int& errdet_hasExclFed,
int& errdet_hasDcsErr) {
382 std::map<uint32_t,uint16_t> bad_modules;
383 for (std::vector<MonitorElement*>::const_iterator it = layer_mes.begin();
384 it != layer_mes.end(); it++) {
387 std::vector<QReport *> qreports = me->
getQReports();
388 if (qreports.empty())
continue;
390 std::vector<DQMChannel> bad_channels_me;
392 bad_channels_me = qreports[0]->getBadChannels();
395 bad_channels_me = qreports[0]->getBadChannels();
396 lname = name.substr(name.find(
"TkHMap_")+7);
397 lname = lname.substr(lname.find(
"_T")+1);
400 for (std::vector<DQMChannel>::iterator it = bad_channels_me.begin(); it != bad_channels_me.end(); it++){
401 int xval = (*it).getBinX();
402 int yval = (*it).getBinY();
404 std::map<uint32_t,uint16_t>::iterator iPos = bad_modules.find(detId);
406 if (iPos != bad_modules.end()){
414 std::ostringstream detid_str;
418 std::string thisMEpath = currentdir.substr( 0 , currentdir.rfind(
"/" ) ) +
"/BadModuleList/" + detid_str.str() ;
425 flag = atoi ( val_str.c_str() );
431 bad_modules.insert(std::pair<uint32_t,uint16_t>(detId,flag));
435 for(std::map<uint32_t,uint16_t>::const_iterator it = bad_modules.begin();
436 it != bad_modules.end(); it++) {
437 uint32_t detId = it->first;
438 uint16_t
flag = it->second;
439 if (((flag >> 0) & 0
x1) > 0) errdet_hasBadChan++;
440 if (((flag >> 1) & 0
x1) > 0) errdet_hasTooManyDigis++;
441 if (((flag >> 2) & 0
x1) > 0) errdet_hasTooManyClu++;
442 if (((flag >> 3) & 0
x1) > 0) errdet_hasExclFed++;
443 if (((flag >> 4) & 0
x1) > 0) errdet_hasDcsErr++;
444 std::map<uint32_t,uint16_t>::iterator iPos =
badModuleList.find(detId);
448 badModuleList.insert(std::pair<uint32_t,uint16_t>(detId,flag));
451 errdet = bad_modules.size();
459 th2d->SetBinContent(xbin, ybin, val);
480 uint32_t detId = it->first;
483 if (!dqm_store->
dirExists(subdet_folder)) {
484 subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(
"MechanicalView")+14);
485 if (!dqm_store->
dirExists(subdet_folder))
continue;
487 std::string bad_module_folder = subdet_folder +
"/" +
"BadModuleList";
490 std::ostringstream detid_str;
492 std::string full_path = bad_module_folder +
"/" + detid_str.str();
495 else me = dqm_store->
bookInt(detid_str.str());
496 me->
Fill(it->second);
529 +
"lumiErrorFraction";
533 float global_fraction = 0.0;
535 for (
int ibin = 1; ibin <= th1->GetNbinsX(); ibin++) {
537 std::map<std::string, SubDetMEs>::iterator iPos =
SubDetMEsMap.find(label);
539 float fraction = 1.0 - th1->GetBinContent(ibin);
542 iPos->second.DetFraction ->
Fill(fraction);
543 iPos->second.SToNFlag ->
Fill(-1.0);
544 iPos->second.SummaryFlag ->
Fill(fraction);
547 global_fraction = global_fraction/dets;
void fillStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling, const edm::EventSetup &eSetup)
static void setBadModuleFlag(std::string &hname, uint16_t &flg)
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * SToNFlag
const std::string & pwd() const
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
void bookStatus(DQMStore *dqm_store)
void fillDetectorStatusAtLumi(DQMStore *dqm_store)
void fillDetectorStatus(DQMStore *dqm_store, const edm::ESHandle< SiStripDetCabling > &cabling)
const TkDetMap * tkDetMap_
static void getMEValue(MonitorElement *me, std::string &val)
std::map< std::string, std::string > SubDetFolderMap
MonitorElement * SummaryFlag
MonitorElement * DetFractionReportMap_hasTooManyDigis
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
uint32_t connectedNumber(const std::string &subDet, const uint16_t layer) const
void initialiseBadModuleList()
MonitorElement * bookFloat(const char *name)
Book float.
SiStripQualityChecker(edm::ParameterSet const &ps)
std::map< std::string, SubDetMEs > SubDetMEsMap
currentdir
parse figure configuration if found
virtual ~SiStripQualityChecker()
void fillFaultyModuleStatus(DQMStore *dqm_store, const edm::EventSetup &eSetup)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
void Reset()
reset ME (ie. contents, errors, etc)
std::vector< MonitorElement * > getContents(const std::string &path) const
std::vector< std::string > getSubdirs() const
MonitorElement * DetFractionReportMap
MonitorElement * DetFractionReportMap_hasTooManyClu
void getModuleStatus(DQMStore *dqm_store, std::vector< MonitorElement * > &layer_mes, int &errdet, int &errdet_hasBadChan, int &errdet_hasTooManyDigis, int &errdet_hasTooManyClu, int &errdet_hasExclFed, int &errdet_hasDcsErr)
bool dirExists(const std::string &path) const
true if directory exists
void cd()
go to top directory (ie. root)
static int getMEStatus(MonitorElement *me)
MonitorElement * DetFractionReportMap_hasBadChan
std::vector< QReport * > getQReports() const
get map of QReports
void fillStatusAtLumi(DQMStore *dqm_store)
MonitorElement * SummaryReportMap
int getNbinsY() const
get # of bins in Y-axis
MonitorElement * SummaryReportGlobal
MonitorElement * SToNReportMap
MonitorElement * DetFractionReportMap_hasExclFed
DetId getDetFromBin(int layer, int ix, int iy) const
static const int STATUS_OK
std::map< uint32_t, uint16_t > badModuleList
void Reset(std::vector< TH2F > &depth)
int getNbinsX() const
get # of bins in X-axis
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 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)
T const * product() const
MonitorElement * DetFraction
MonitorElement * DetFractionReportMap_hasDcsErr
Kind kind() const
Get the type of the monitor element.
static void getTopFolderPath(DQMStore *dqm_store, std::string top_dir, std::string &path)
void setCurrentFolder(const std::string &fullpath)
void fillStatusHistogram(MonitorElement *, int xbin, int ybin, float val)