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";
78 hname =
"sToNReportMap";
79 htitle =
"SiStrip Report for Signal-to-Noise";
87 hname =
"reportSummaryMap";
88 htitle =
"SiStrip Report Summary Map";
97 for (std::map<std::string, std::string>::const_iterator it =
SubDetFolderMap.begin();
108 else if (det ==
"TECB") local_mes.
detectorTag =
"TEC-";
109 else if (det ==
"TIDF") local_mes.
detectorTag =
"TID+";
110 else if (det ==
"TIDB") local_mes.
detectorTag =
"TID-";
114 me_name =
"SiStrip_" + det;
117 me_name =
"SiStrip_DetFraction_" + det;
120 me_name =
"SiStrip_SToNFlag_" + det;
122 SubDetMEsMap.insert(std::pair<std::string, SubDetMEs>(det, local_mes));
134 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
157 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
187 unsigned int xbin = 0;
188 float global_flag = 0;
195 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
198 std::map<std::string, std::string>::const_iterator cPos =
SubDetFolderMap.find(det);
201 if (!dqm_store->
dirExists(dname))
continue;
202 dqm_store->
cd(dname);
209 global_flag = global_flag/xbin*1.0;
218 SubDetMEs& mes,
unsigned int xbin,
float& gflag) {
221 if (status_flag < 1)
return;
223 std::vector<std::string> subDirVec = dqm_store->
getSubdirs();
225 unsigned int ybin = 0;
228 float tot_ston_stat = 0;
230 for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
231 ic != subDirVec.end(); ic++) {
233 if (dname.find(
"BadModuleList") != std::string::npos)
continue;
234 std::vector<MonitorElement*> meVec;
235 if (dname.find(
"ring") !=std::string::npos)
continue;
238 dqm_store->
cd((*ic));
244 int lnum = atoi(dname.substr(dname.find_last_of(
"_")+1).c_str());
245 ndet = cabling->connectedNumber(mes.
detectorTag, lnum);
249 for (std::vector<MonitorElement*>::const_iterator it = meVec.begin();
250 it != meVec.end(); it++) {
253 std::vector<QReport *> reports = me->
getQReports();
255 if (reports.size() == 0)
continue;
258 if( name.find(
"Summary_ClusterStoNCorr__OnTrack") != std::string::npos){
260 if (reports[0]->getQTresult() == -1) {
269 float eff_fac = 1 - (errdet*1.0/ndet);
276 tot_errdet += errdet;
277 tot_ston_stat += ston_stat;
279 dqm_store->
cd((*ic));
282 float tot_eff_fac = 1 - (tot_errdet*1.0/tot_ndet);
284 float tot_ston_fac = tot_ston_stat/ybin;
286 if (tot_ston_fac < 0){
289 gflag =
std::min(tot_eff_fac,tot_ston_fac);
298 std::ostringstream det_summary_str;
299 for (std::map<std::string, SubDetMEs>::const_iterator it =
SubDetMEsMap.begin();
302 det_summary_str << std::setprecision(4);
303 det_summary_str << std::setiosflags(std::ios::fixed);
305 det_summary_str <<
" Printing Status for " << det <<
" : " << std::endl;
309 float fval1, fval2, fval3;
310 fval1 = fval2 = fval3 = -1.0;
314 if (sval.size() > 0) fval1 = atof(sval.c_str());
316 if (sval.size() > 0) fval2 = atof(sval.c_str());
318 if (sval.size() > 0) fval3 = atof(sval.c_str());
320 det_summary_str << std::setw(7) <<
" % of good detectors " << fval1
321 <<
" SToN Flag " << fval2
322 <<
" Summary Flag " << fval3 << std::endl;
331 std::map<uint32_t,uint16_t> bad_modules;
332 for (std::vector<MonitorElement*>::const_iterator it = layer_mes.begin();
333 it != layer_mes.end(); it++) {
336 std::vector<QReport *> qreports = me->
getQReports();
337 if (qreports.size() == 0)
continue;
339 std::vector<DQMChannel> bad_channels_me;
341 bad_channels_me = qreports[0]->getBadChannels();
344 bad_channels_me = qreports[0]->getBadChannels();
345 lname = name.substr(name.find(
"TkHMap_")+7);
346 lname = lname.substr(lname.find(
"_T")+1);
349 for (std::vector<DQMChannel>::iterator it = bad_channels_me.begin(); it != bad_channels_me.end(); it++){
350 int xval = (*it).getBinX();
351 int yval = (*it).getBinY();
353 std::map<uint32_t,uint16_t>::iterator iPos = bad_modules.find(detId);
355 if (iPos != bad_modules.end()){
363 std::ostringstream detid_str;
367 std::string thisMEpath = currentdir.substr( 0 , currentdir.rfind(
"/" ) ) +
"/BadModuleList/" + detid_str.str() ;
374 flag = atoi ( val_str.c_str() );
380 bad_modules.insert(std::pair<uint32_t,uint16_t>(detId,flag));
384 for(std::map<uint32_t,uint16_t>::const_iterator it = bad_modules.begin();
385 it != bad_modules.end(); it++) {
386 uint32_t detId = it->first;
387 uint16_t
flag = it->second;
388 std::map<uint32_t,uint16_t>::iterator iPos =
badModuleList.find(detId);
392 badModuleList.insert(std::pair<uint32_t,uint16_t>(detId,flag));
395 errdet = bad_modules.size();
403 th2d->SetBinContent(xbin, ybin, val);
424 uint32_t detId = it->first;
427 if (!dqm_store->
dirExists(subdet_folder)) {
428 subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(
"MechanicalView")+14);
429 if (!dqm_store->
dirExists(subdet_folder))
continue;
431 std::string bad_module_folder = subdet_folder +
"/" +
"BadModuleList";
434 std::ostringstream detid_str;
436 std::string full_path = bad_module_folder +
"/" + detid_str.str();
439 else me = dqm_store->
bookInt(detid_str.str());
440 me->
Fill(it->second);
473 +
"lumiErrorFraction";
477 float global_fraction = 0.0;
479 for (
int ibin = 1; ibin <= th1->GetNbinsX(); ibin++) {
481 std::map<std::string, SubDetMEs>::iterator iPos =
SubDetMEsMap.find(label);
483 float fraction = 1.0 - th1->GetBinContent(ibin);
486 iPos->second.DetFraction ->
Fill(fraction);
487 iPos->second.SToNFlag ->
Fill(-1.0);
488 iPos->second.SummaryFlag ->
Fill(fraction);
491 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
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 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
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
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)
T const * product() const
TH1F * getTH1F(void) const
void fillStatusAtLumi(DQMStore *dqm_store)
MonitorElement * SummaryReportMap
MonitorElement * SummaryReportGlobal
MonitorElement * SToNReportMap
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)
MonitorElement * DetFraction
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