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"));
42 "\n------------------------------------------" 43 "\nUnAvailable Service TkHistoMap: please insert in the configuration file an instance like" 44 "\n\tprocess.TkDetMap = cms.Service(\"TkDetMap\")" 45 "\n------------------------------------------";
55 " Deleting SiStripQualityChecker " <<
"\n" ;
66 if (strip_dir.size() == 0) strip_dir =
"SiStrip";
73 hname =
"detFractionReportMap";
74 htitle =
"SiStrip Report for Good Detector Fraction";
79 hname =
"detFractionReportMap_hasBadChan";
80 htitle =
"SiStrip Report for Good Detector Fraction due to bad channels";
84 hname =
"detFractionReportMap_hasTooManyDigis";
85 htitle =
"SiStrip Report for Good Detector Fraction due to too many digis";
89 hname =
"detFractionReportMap_hasTooManyClu";
90 htitle =
"SiStrip Report for Good Detector Fraction due to too many clusters";
94 hname =
"detFractionReportMap_hasExclFed";
95 htitle =
"SiStrip Report for Good Detector Fraction due to excluded FEDs";
99 hname =
"detFractionReportMap_hasDcsErr";
100 htitle =
"SiStrip Report for Good Detector Fraction due to DCS errors";
105 hname =
"sToNReportMap";
106 htitle =
"SiStrip Report for Signal-to-Noise";
114 hname =
"reportSummaryMap";
115 htitle =
"SiStrip Report Summary Map";
124 for (std::map<std::string, std::string>::const_iterator it =
SubDetFolderMap.begin();
140 else if (det ==
"TECB") local_mes.
detectorTag =
"TEC-";
141 else if (det ==
"TIDF") local_mes.
detectorTag =
"TID+";
142 else if (det ==
"TIDB") local_mes.
detectorTag =
"TID-";
146 me_name =
"SiStrip_" + det;
149 me_name =
"SiStrip_DetFraction_" + det;
152 me_name =
"SiStrip_SToNFlag_" + det;
154 SubDetMEsMap.insert(std::pair<std::string, SubDetMEs>(det, local_mes));
166 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
194 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
229 unsigned int xbin = 0;
230 float global_flag = 0;
237 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
240 std::map<std::string, std::string>::const_iterator cPos =
SubDetFolderMap.find(det);
243 if (!dqm_store->
dirExists(dname))
continue;
244 dqm_store->
cd(dname);
251 global_flag = global_flag/xbin*1.0;
260 SubDetMEs& mes,
unsigned int xbin,
float& gflag) {
263 if (status_flag < 1)
return;
265 std::vector<std::string> subDirVec = dqm_store->
getSubdirs();
267 unsigned int ybin = 0;
270 float tot_ston_stat = 0;
272 for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
273 ic != subDirVec.end(); ic++) {
275 if (dname.find(
"BadModuleList") != std::string::npos)
continue;
276 if (dname.find(
"ring") !=std::string::npos)
continue;
277 std::vector<MonitorElement*> meVec;
280 dqm_store->
cd((*ic));
284 int errdet_hasBadChan = 0;
285 int errdet_hasTooManyDigis = 0;
286 int errdet_hasTooManyClu = 0;
287 int errdet_hasExclFed = 0;
288 int errdet_hasDcsErr = 0;
291 int lnum = atoi(dname.substr(dname.find_last_of(
"_")+1).c_str());
294 getModuleStatus(dqm_store, meVec, errdet, errdet_hasBadChan, errdet_hasTooManyDigis, errdet_hasTooManyClu, errdet_hasExclFed, errdet_hasDcsErr);
296 for (std::vector<MonitorElement*>::const_iterator it = meVec.begin();
297 it != meVec.end(); it++) {
300 std::vector<QReport *> reports = me->
getQReports();
302 if (reports.size() == 0)
continue;
305 if( name.find(
"Summary_ClusterStoNCorr__OnTrack") != std::string::npos){
307 if (reports[0]->getQTresult() == -1) {
316 float eff_fac = 1 - (errdet*1.0/ndet);
317 float eff_fac_hasBadChan = 1 - (errdet_hasBadChan *1.0/ndet);
318 float eff_fac_hasTooManyDigis = 1 - (errdet_hasTooManyDigis*1.0/ndet);
319 float eff_fac_hasTooManyClu = 1 - (errdet_hasTooManyClu *1.0/ndet);
320 float eff_fac_hasExclFed = 1 - (errdet_hasExclFed *1.0/ndet);
321 float eff_fac_hasDcsErr = 1 - (errdet_hasDcsErr *1.0/ndet);
333 tot_errdet += errdet;
334 tot_ston_stat += ston_stat;
336 dqm_store->
cd((*ic));
339 float tot_eff_fac = 1 - (tot_errdet*1.0/tot_ndet);
341 float tot_ston_fac = tot_ston_stat/ybin;
343 if (tot_ston_fac < 0){
346 gflag =
std::min(tot_eff_fac,tot_ston_fac);
355 std::ostringstream det_summary_str;
356 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
359 det_summary_str << std::setprecision(4);
362 det_summary_str <<
" Printing Status for " << det <<
" : " << std::endl;
366 float fval1, fval2, fval3;
367 fval1 = fval2 = fval3 = -1.0;
371 if (sval.size() > 0) fval1 = atof(sval.c_str());
373 if (sval.size() > 0) fval2 = atof(sval.c_str());
375 if (sval.size() > 0) fval3 = atof(sval.c_str());
377 det_summary_str << std::setw(7) <<
" % of good detectors " << fval1
378 <<
" SToN Flag " << fval2
379 <<
" Summary Flag " << fval3 << std::endl;
385 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) {
388 std::map<uint32_t,uint16_t> bad_modules;
389 for (std::vector<MonitorElement*>::const_iterator it = layer_mes.begin();
390 it != layer_mes.end(); it++) {
393 std::vector<QReport *> qreports = me->
getQReports();
394 if (qreports.size() == 0)
continue;
396 std::vector<DQMChannel> bad_channels_me;
398 bad_channels_me = qreports[0]->getBadChannels();
401 bad_channels_me = qreports[0]->getBadChannels();
402 lname = name.substr(name.find(
"TkHMap_")+7);
403 lname = lname.substr(lname.find(
"_T")+1);
406 for (std::vector<DQMChannel>::iterator it = bad_channels_me.begin(); it != bad_channels_me.end(); it++){
407 int xval = (*it).getBinX();
408 int yval = (*it).getBinY();
410 std::map<uint32_t,uint16_t>::iterator iPos = bad_modules.find(detId);
412 if (iPos != bad_modules.end()){
420 std::ostringstream detid_str;
424 std::string thisMEpath = currentdir.substr( 0 , currentdir.rfind(
"/" ) ) +
"/BadModuleList/" + detid_str.str() ;
431 flag = atoi ( val_str.c_str() );
437 bad_modules.insert(std::pair<uint32_t,uint16_t>(detId,flag));
441 for(std::map<uint32_t,uint16_t>::const_iterator it = bad_modules.begin();
442 it != bad_modules.end(); it++) {
443 uint32_t detId = it->first;
444 uint16_t
flag = it->second;
445 if (((flag >> 0) & 0x1) > 0) errdet_hasBadChan++;
446 if (((flag >> 1) & 0x1) > 0) errdet_hasTooManyDigis++;
447 if (((flag >> 2) & 0x1) > 0) errdet_hasTooManyClu++;
448 if (((flag >> 3) & 0x1) > 0) errdet_hasExclFed++;
449 if (((flag >> 4) & 0x1) > 0) errdet_hasDcsErr++;
450 std::map<uint32_t,uint16_t>::iterator iPos =
badModuleList.find(detId);
454 badModuleList.insert(std::pair<uint32_t,uint16_t>(detId,flag));
457 errdet = bad_modules.size();
465 th2d->SetBinContent(xbin, ybin, val);
486 uint32_t detId = it->first;
489 if (!dqm_store->
dirExists(subdet_folder)) {
490 subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(
"MechanicalView")+14);
491 if (!dqm_store->
dirExists(subdet_folder))
continue;
493 std::string bad_module_folder = subdet_folder +
"/" +
"BadModuleList";
496 std::ostringstream detid_str;
498 std::string full_path = bad_module_folder +
"/" + detid_str.str();
501 else me = dqm_store->
bookInt(detid_str.str());
502 me->
Fill(it->second);
535 +
"lumiErrorFraction";
539 float global_fraction = 0.0;
541 for (
int ibin = 1; ibin <= th1->GetNbinsX(); ibin++) {
543 std::map<std::string, SubDetMEs>::iterator iPos =
SubDetMEsMap.find(label);
545 float fraction = 1.0 - th1->GetBinContent(ibin);
548 iPos->second.DetFraction ->
Fill(fraction);
549 iPos->second.SToNFlag ->
Fill(-1.0);
550 iPos->second.SummaryFlag ->
Fill(fraction);
553 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
const std::string & getName(void) const
get name of ME
MonitorElement * SToNFlag
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
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
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)
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)
int getNbinsY(void) const
get # of bins in Y-axis
std::map< std::string, SubDetMEs > SubDetMEsMap
uint32_t getDetFromBin(int layer, int ix, int iy) const
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)
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 * 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
std::vector< QReport * > getQReports(void) const
get map of QReports
static int getMEStatus(MonitorElement *me)
MonitorElement * DetFractionReportMap_hasBadChan
TH1F * getTH1F(void) const
void fillStatusAtLumi(DQMStore *dqm_store)
MonitorElement * SummaryReportMap
MonitorElement * SummaryReportGlobal
MonitorElement * SToNReportMap
MonitorElement * DetFractionReportMap_hasExclFed
int getNbinsX(void) const
get # of bins in X-axis
static const int STATUS_OK
std::map< uint32_t, uint16_t > badModuleList
void Reset(std::vector< TH2F > &depth)
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)
T const * product() const
MonitorElement * DetFraction
MonitorElement * DetFractionReportMap_hasDcsErr
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)
const std::string & pwd(void) const