CMS 3D CMS Logo

SiStripTrackerMapCreator.cc
Go to the documentation of this file.
8 
11 
14 
20 
21 #include <iostream>
22 
24  eSetup_.get<SiStripDetCablingRcd>().get(detCabling_);
25  edm::ESHandle<TkDetMap> tkDetMapHandle;
26  eSetup_.get<TrackerTopologyRcd>().get(tkDetMapHandle);
27  tkDetMap_ = tkDetMapHandle.product();
28 }
29 
30 //
31 // -- Create Geometric and Fed Tracker Map
32 //
34  DQMStore& dqm_store,
35  std::string const& map_type,
36  const edm::EventSetup& eSetup) {
37  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
38 
39  if (!fedcabling)
40  return;
41 
43  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
44  const TrackerTopology* const tTopo = tTopoHandle.product();
45 
46  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
47  std::string tmap_title = " Tracker Map from " + map_type;
48  trackerMap_->setTitle(tmap_title);
49 
50  nDet_ = 0;
51  tkMapMax_ = 0.0;
52  tkMapMin_ = 0.0;
53  meanToMaxFactor_ = 2.5;
54  useSSQuality_ = false;
55  ssqLabel_ = "";
56  stripTopLevelDir_ = "SiStrip";
57 
58  if (map_type == "QTestAlarm") {
59  setTkMapFromAlarm(dqm_store, eSetup);
60  } else {
61  trackerMap_->fill_all_blank();
62  setTkMapFromHistogram(dqm_store, map_type, eSetup);
63  setTkMapRange(map_type);
64  }
65  trackerMap_->printonline();
66  trackerMap_.reset();
67 }
68 
70  DQMStore& dqm_store,
71  std::string& map_type,
72  const edm::EventSetup& eSetup) {
73  // Determine the strip top level dirctory in the DQM file: it is the
74  // path where MechanicalView is minus one directory
75  std::string const mdir{"MechanicalView"};
76  dqm_store.cd();
77  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
78  edm::LogError("SiStripTopLevelDirNotFound") << "I cannot find the SiStrip top level directory in the DQM file";
79  } else {
80  const std::string& mechanicalview_dir = dqm_store.pwd();
81  stripTopLevelDir_ = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of('/'));
82  edm::LogInfo("SiStripTopLevelDirFound") << "SiStrip top level directory is " << stripTopLevelDir_;
83  }
84  dqm_store.cd();
85 
86  //
87  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
88 
89  if (!fedcabling)
90  return;
91 
93  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
94  const TrackerTopology* const tTopo = tTopoHandle.product();
95 
96  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
97 
98  meanToMaxFactor_ = tkmapPset.getUntrackedParameter<double>("meanToMaxFact", 2.5);
99  useSSQuality_ = tkmapPset.getUntrackedParameter<bool>("useSSQuality", false);
100  ssqLabel_ = tkmapPset.getUntrackedParameter<std::string>("ssqLabel", "");
101  bool tkMapPSU = tkmapPset.getUntrackedParameter<bool>("psuMap", false);
102  bool tkMapFED = tkmapPset.getUntrackedParameter<bool>("fedMap", false);
103  std::string namesuffix = tkmapPset.getUntrackedParameter<std::string>("mapSuffix", "");
104 
105  // std::string tmap_title = " Tracker Map from " + map_type;
106  unsigned int runNumber_ = tkmapPset.getUntrackedParameter<unsigned int>("RunNumber", 1);
107  std::stringstream ss;
108  ss << runNumber_;
109  sRunNumber = ss.str();
110  std::cout << sRunNumber << "\n\n\n\n\n\n";
111  std::string tmap_title;
112  if (runNumber_ > 0) {
113  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
114  } else {
115  tmap_title = " Tracker Map from " + map_type;
116  }
117  trackerMap_->setTitle(tmap_title);
118 
119  if (tkmapPset.exists("TopModules"))
120  topModules_ = tkmapPset.getUntrackedParameter<bool>("TopModules");
121  else
122  topModules_ = false;
123 
124  if (tkmapPset.exists("numberTopModules"))
125  numTopModules_ = tkmapPset.getUntrackedParameter<uint32_t>("numberTopModules");
126  else
127  numTopModules_ = 20;
128 
129  if (tkmapPset.exists("topModLabel"))
130  topModLabel_ = tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
131  else
132  topModLabel_ = " top Modules " + map_type;
133 
134  if (map_type == "QTestAlarm") {
135  setTkMapFromAlarm(dqm_store, eSetup);
136  } else {
137  setTkMapFromHistogram(dqm_store, map_type, eSetup);
138  }
139  // if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
141 
142  // check manual setting
143 
144  if (tkmapPset.exists("mapMax"))
145  tkMapMax_ = tkmapPset.getUntrackedParameter<double>("mapMax");
146  if (tkmapPset.exists("mapMin"))
147  tkMapMin_ = tkmapPset.getUntrackedParameter<double>("mapMin");
148 
149  if (map_type == "ResidualsMean") {
150  ResidualsRMS_ = false;
151  setTkMapFromHistogram(dqm_store, map_type, eSetup);
152  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to "
153  << tkMapMin_ << " - " << tkMapMax_;
154  trackerMap_->save(true, 0.0000000001, 0.005, map_type + namesuffix + ".svg");
155  trackerMap_->save(true, 0.0000000001, 0.005, map_type + namesuffix + ".png", 4500, 2400);
156  ResidualsRMS_ = true;
157  map_type = "ResidualsRMS";
158  if (runNumber_ > 0) {
159  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
160  } else {
161  tmap_title = " Tracker Map from " + map_type;
162  }
163  trackerMap_->setTitle(tmap_title);
164  setTkMapFromHistogram(dqm_store, map_type, eSetup);
165  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix
166  << " with range set to 0.0 - 1.0";
167  trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".svg");
168  trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".png", 4500, 2400);
169  } else {
170  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to "
171  << tkMapMin_ << " - " << tkMapMax_;
172  trackerMap_->save(true, tkMapMin_, tkMapMax_, map_type + namesuffix + ".svg");
173  trackerMap_->save(true, tkMapMin_, tkMapMax_, map_type + namesuffix + ".png", 4500, 2400);
174  }
175 
176  if (tkMapPSU) {
177  edm::LogInfo("PSUMapToBeSaved") << "Ready to save PSU TkMap " << map_type << namesuffix << " with range set to "
178  << tkMapMin_ << " - " << tkMapMax_;
179  trackerMap_->save_as_psutrackermap(true, tkMapMin_, tkMapMax_, map_type + namesuffix + "_psu.png");
180  }
181 
182  if (tkMapFED) {
183  edm::LogInfo("FEDMapToBeSaved") << "Ready to save FED TkMap " << map_type << namesuffix << " with range set to "
184  << tkMapMin_ << " - " << tkMapMax_;
185  trackerMap_->save_as_fedtrackermap(true, tkMapMin_, tkMapMax_, map_type + namesuffix + "_fed.png");
186  }
187  trackerMap_.reset();
188 }
189 
190 //
191 // -- Fill Tracker Map with QTest Alarms and SiStripQuality bad modules
192 //
194  //Retrieve tracker topology from geometry
195  edm::ESHandle<TrackerTopology> tTopoHandle;
196  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
197  const TrackerTopology* const tTopo = tTopoHandle.product();
198 
199  nDet_ = 0;
200  tkMapMax_ = 0.0;
201  tkMapMin_ = 0.0;
202 
204 
205  if (useSSQuality_) {
207  }
208 
209  trackerMap_->fillc_all_blank();
210 
211  std::map<unsigned int, std::string> badmodmap;
212 
213  // used to avoid multiple checks on the same detid since the loop is done on the FED channels
214  uint32_t detId_save = 0;
215  // example of loop using SiStripDetCabling
216  for (auto const& module : detCabling_->getDetCabling()) {
217  uint32_t detId = module.first;
218  if (detId == 0 || detId == 0xFFFFFFFF)
219  continue;
220  if (detId_save != detId) {
221  detId_save = detId;
222  bool isBad = useSSQuality_ && ssq->IsModuleBad(detId);
223  paintTkMapFromAlarm(detId, tTopo, dqm_store, isBad, badmodmap);
224  } else {
225  edm::LogWarning("TwiceTheSameDetId")
226  << "The detid " << detId << " was found already in the loop on SiStripDetCabling";
227  }
228  }
229  printBadModuleList(badmodmap, eSetup);
230 }
231 //
232 //
233 // -- Paint Tracker Map with QTest Alarms
234 //
236  TrackerTopology const* tTopo,
237  DQMStore& dqm_store,
238  bool const isBad,
239  std::map<unsigned int, std::string>& badmodmap) {
240  std::ostringstream comment;
241  uint16_t flag = 0;
242  flag = getDetectorFlagAndComment(&dqm_store, det_id, tTopo, comment);
243 
244  int rval, gval, bval;
245  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
246  if (isBad) {
247  rval = 255;
248  gval = 255;
249  bval = 0;
250  comment << " PCLBadModule ";
251  }
252  trackerMap_->setText(det_id, comment.str());
253  trackerMap_->fillc(det_id, rval, gval, bval);
254 
255  if (flag != 0 || isBad) {
256  uint lay = tTopo->layer(SiStripDetId(det_id));
257  std::string layer = " Layer " + std::to_string(lay);
258  badmodmap[det_id] = comment.str() + layer;
259  }
260 
261  detFlag_[det_id] = flag;
262 }
263 
264 //
265 // -- Paint Tracker Map from TkHistoMap Histograms
267  std::string const& htype,
268  edm::EventSetup const& eSetup) {
269  dqm_store.cd();
270 
271  std::string const mdir{"MechanicalView"};
272  if (!SiStripUtility::goToDir(dqm_store, mdir))
273  return;
274  std::string mechanicalview_dir = dqm_store.pwd();
275 
276  std::vector<std::string> subdet_folder;
277  subdet_folder.push_back("TIB");
278  subdet_folder.push_back("TOB");
279  subdet_folder.push_back("TEC/MINUS");
280  subdet_folder.push_back("TEC/PLUS");
281  subdet_folder.push_back("TID/MINUS");
282  subdet_folder.push_back("TID/PLUS");
283 
284  nDet_ = 0;
285  tkMapMax_ = 0.0;
286  tkMapMin_ = 0.0;
287 
288  auto topNmodVec = topModules_ ? new std::vector<std::pair<float, uint32_t>>{} : nullptr;
289  for (auto const& sd : subdet_folder) {
290  std::string dname = mechanicalview_dir + "/" + sd;
291  if (!dqm_store.dirExists(dname))
292  continue;
293  dqm_store.cd(dname);
294  std::vector<std::string> layerVec = dqm_store.getSubdirs();
295  for (auto const& layer : layerVec) {
296  if (layer.find("BadModuleList") != std::string::npos)
297  continue;
298  std::vector<MonitorElement*> meVec = dqm_store.getContents(layer);
299  MonitorElement* tkhmap_me{nullptr};
301  for (auto tkh : meVec) {
302  name = tkh->getName();
303  if (name.find("TkHMap") == std::string::npos)
304  continue;
305  if (htype == "QTestAlarm") {
306  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
307  tkhmap_me = tkh;
308  break;
309  } else if (name.find(htype) != std::string::npos) {
310  tkhmap_me = tkh;
311  break;
312  }
313  }
314  if (tkhmap_me != nullptr) {
315  paintTkMapFromHistogram(tkhmap_me, htype, topNmodVec);
316  }
317  }
318  dqm_store.cd(mechanicalview_dir);
319  }
320  dqm_store.cd();
321  if (topNmodVec)
322  printTopModules(*topNmodVec, eSetup);
323 }
324 
326  std::string const& htype,
327  std::vector<std::pair<float, uint32_t>>* topNmodVec) {
328  const std::string& name = me->getName();
329  std::string lname = name.substr(name.find("TkHMap_") + 7);
330  lname = lname.substr(lname.find("_T") + 1);
331  for (DetId det_id : tkDetMap_->getDetsForLayer(TkDetMap::getLayerNum(lname))) {
332  if (det_id.rawId() <= 0)
333  continue;
334  nDet_++;
336  float fval = 0.0;
337  if (name.find("Residuals") != std::string::npos) {
338  if (ResidualsRMS_ == true) {
339  if (me->kind() == MonitorElement::Kind::TPROFILE2D) {
340  TProfile2D* tp = me->getTProfile2D();
341  float fval_prov =
342  tp->GetBinError(xyval.ix, xyval.iy) * sqrt(tp->GetBinEntries(tp->GetBin(xyval.ix, xyval.iy)));
343  fval = fval_prov;
344  }
345  } else {
346  float fval_prov = me->getBinContent(xyval.ix, xyval.iy);
347  fval = std::abs(fval_prov);
348  }
349  } else
350  fval = me->getBinContent(xyval.ix, xyval.iy);
351  if (htype == "QTestAlarm") {
352  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
353  } else {
354  if (fval == 0.0)
355  trackerMap_->fillc(det_id, 255, 255, 255);
356  else {
357  trackerMap_->fill_current_val(det_id, fval);
358  if (topNmodVec) {
359  topNmodVec->emplace_back(fval, det_id);
360  }
361  }
362  tkMapMax_ += fval;
363  }
364  }
365 }
366 //
367 // -- Get Flag and status Comment
368 //
370  uint32_t const det_id,
371  const TrackerTopology* tTopo,
372  std::ostringstream& comment) {
373  comment << "Module " << det_id;
374  uint16_t flag = 0;
375 
376  // get FED channels corresponding to the det_id
377 
378  comment << " FEDCHs ";
379  constexpr std::size_t indent_width{7ull};
380  std::vector<const FedChannelConnection*> conns = detCabling_->getConnections(det_id);
381  for (auto const conn : conns) {
382  if (conn) {
383  comment << std::setw(3) << conn->fedId() << "/" << std::setw(2) << conn->fedCh() << " ";
384  } else {
385  comment << std::string(indent_width, ' ');
386  }
387  }
388  if (conns.empty()) {
389  comment << std::string(indent_width * 3, ' ');
390  } else if (conns.size() == 1) {
391  comment << std::string(indent_width * 2, ' ');
392  } else if (conns.size() == 2) {
393  comment << std::string(indent_width, ' ');
394  }
395 
396  if (!dqm_store)
397  return flag;
398 
399  SiStripFolderOrganizer folder_organizer;
400  std::string subdet_folder, badmodule_folder;
401 
402  dqm_store->cd();
403 
404  folder_organizer.setSiStripFolderName(stripTopLevelDir_);
405  folder_organizer.getSubDetFolder(det_id, tTopo, subdet_folder);
406 
407  LogDebug("SearchBadModule") << det_id << " " << subdet_folder << " " << stripTopLevelDir_;
408 
409  if (dqm_store->dirExists(subdet_folder)) {
410  badmodule_folder = subdet_folder + "/BadModuleList";
411  LogDebug("SearchBadModule") << subdet_folder << " exists: " << badmodule_folder;
412  } else {
413  edm::LogError("SubDetFolderNotFound") << subdet_folder << " does not exist for detid " << det_id;
414  return flag;
415  }
416  if (!dqm_store->dirExists(badmodule_folder)) {
417  LogDebug("BadModuleFolderNotFound") << badmodule_folder << " does not exist for detid " << det_id;
418  return flag;
419  }
420  std::ostringstream badmodule_path;
421  badmodule_path << badmodule_folder << "/" << det_id;
422  LogDebug("SearchBadModule") << badmodule_folder << " exists: " << badmodule_path.str();
423 
424  auto const* bad_module_me = dqm_store->get(badmodule_path.str());
425  if (bad_module_me && bad_module_me->kind() == MonitorElement::Kind::INT) {
426  LogDebug("SearchBadModule") << "Monitor Element found";
427  flag = bad_module_me->getIntValue();
428  std::string message;
430  comment << message.c_str();
431  }
432  return flag;
433 }
434 //
435 // -- create branches for root file with tracker map values by detId and fill it
436 //
437 void SiStripTrackerMapCreator::createInfoFile(std::vector<std::string> const& map_names,
438  TTree* tkinfo_tree,
439  DQMStore& dqm_store) {
440  std::map<std::string, float> tkhmap_value;
441  int qtalarm_flag = 0;
442  uint32_t det_id = 0;
443 
444  if (!tkinfo_tree) {
445  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
446  } else {
447  tkinfo_tree->Branch("DetId", &det_id, "DetId/i");
448  for (auto const& mapname : map_names) {
449  if (mapname == "QTestAlarm") {
450  qtalarm_flag = 0;
451  tkinfo_tree->Branch(mapname.c_str(), &qtalarm_flag, std::string(mapname + "/I").c_str());
452  } else {
453  tkhmap_value[mapname] = -1.0;
454  tkinfo_tree->Branch(mapname.c_str(), &tkhmap_value[mapname], std::string(mapname + "/F").c_str());
455  }
456  }
457 
458  std::string dirname = "";
459 
460  std::string mdir = "MechanicalView";
461  dqm_store.cd();
462  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
463  edm::LogError("SiStripTrackerMapCreator::createInfoFile")
464  << "I cannot find the SiStrip top level directory in the DQM file";
465  } else {
466  const std::string& mechanicalview_dir = dqm_store.pwd();
467  dirname = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of('/'));
468  edm::LogInfo("SiStripTrackerMapCreator::createInfoFile") << "SiStrip top level directory is " << dirname;
469  }
470  dqm_store.cd();
471 
472  std::vector<TkHistoMap> tkHMaps;
473 
474  uint32_t nHists = map_names.size();
475 
476  for (uint32_t ih = 0; ih < nHists; ++ih) {
477  tkHMaps.emplace_back(tkDetMap_);
478  if (map_names.at(ih) != "QTestAlarm") {
479  std::string tkhmap_name = "TkHMap_" + map_names.at(ih);
480  tkHMaps.at(ih).loadTkHistoMap(dirname, tkhmap_name, true);
481  }
482  }
483 
484  edm::ESHandle<GeometricDet> geomDetHandle;
485  eSetup_.get<IdealGeometryRecord>().get(geomDetHandle);
486  const auto detidList = TrackerGeometryUtils::getSiStripDetIds(*geomDetHandle);
487  for (auto const id : detidList) {
488  det_id = id;
489  for (uint32_t ih = 0; ih < nHists; ++ih) {
490  if (map_names.at(ih) == "QTestAlarm") {
491  qtalarm_flag = getDetectorFlag(id);
492  } else {
493  tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(id);
494  }
495  }
496  if (!tkinfo_tree) {
497  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
498  } else {
499  tkinfo_tree->Fill();
500  }
501  }
502  }
503 }
504 
505 // DQMStore-explicit usages
506 
507 void SiStripTrackerMapCreator::printBadModuleList(std::map<unsigned int, std::string> const& badmodmap,
508  const edm::EventSetup& eSetup) {
509  // Retrieve tracker topology from geometry
510  edm::ESHandle<TrackerTopology> tTopoHandle;
511  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
512  const TrackerTopology* const tTopo = tTopoHandle.product();
513 
514  bool tibDone = false, tidSide1Done = false, tidSide2Done = false, tobDone = false, tecSide1Done = false,
515  tecSide2Done = false;
516  constexpr unsigned int tibFirst = 369120277 - 1, tidSide1First = 402664197 - 1, tidSide2First = 402672389 - 1,
517  tobFirst = 436228134 - 1, tecSide1First = 470044965 - 1, tecSide2First = 470307109 - 1;
518 
519  int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
520 
521  for (auto const& badmod : badmodmap) {
522  SiStripDetId ssdetid(badmod.first);
523  if (ssdetid.subDetector() == SiStripDetId::TIB)
524  ntib++;
525  if (ssdetid.subDetector() == SiStripDetId::TID) {
526  if (tTopo->tidSide(ssdetid) == 1)
527  ntids1++;
528  if (tTopo->tidSide(ssdetid) == 2)
529  ntids2++;
530  }
531  if (ssdetid.subDetector() == SiStripDetId::TOB)
532  ntob++;
533  if (ssdetid.subDetector() == SiStripDetId::TEC) {
534  if (tTopo->tecSide(ssdetid) == 1)
535  ntecs1++;
536  if (tTopo->tecSide(ssdetid) == 2)
537  ntecs2++;
538  }
539  }
540 
541  edm::LogVerbatim("BadModuleList") << "Run: " << sRunNumber << ", Number of bad modules in total:";
542  edm::LogVerbatim("BadModuleList") << "--------------------------------------------------------------";
543  edm::LogVerbatim("BadModuleList") << "TIB: " << ntib;
544  edm::LogVerbatim("BadModuleList") << "TID/MINUS: " << ntids1;
545  edm::LogVerbatim("BadModuleList") << "TID/PLUS: " << ntids2;
546  edm::LogVerbatim("BadModuleList") << "TOB: " << ntob;
547  edm::LogVerbatim("BadModuleList") << "TEC/MINUS: " << ntecs1;
548  edm::LogVerbatim("BadModuleList") << "TEC/PLUS: " << ntecs2;
549  edm::LogVerbatim("BadModuleList") << "-------------------------------";
550  edm::LogVerbatim("BadModuleList");
551  edm::LogVerbatim("BadModuleList") << "List of bad modules per partition:";
552  edm::LogVerbatim("BadModuleList") << "----------------------------------";
553 
554  for (auto const& badmod : badmodmap) {
555  if (!tibDone && badmod.first >= tibFirst) {
556  tibDone = true;
557  edm::LogVerbatim("BadModuleList");
558  edm::LogVerbatim("BadModuleList") << "SubDetector TIB";
559  edm::LogVerbatim("BadModuleList");
560  }
561  if (!tidSide1Done && badmod.first >= tidSide1First) {
562  tidSide1Done = true;
563  edm::LogVerbatim("BadModuleList");
564  edm::LogVerbatim("BadModuleList") << "SubDetector TID/MINUS";
565  edm::LogVerbatim("BadModuleList");
566  }
567  if (!tidSide2Done && badmod.first >= tidSide2First) {
568  tidSide2Done = true;
569  edm::LogVerbatim("BadModuleList");
570  edm::LogVerbatim("BadModuleList") << "SubDetector TID/PLUS";
571  edm::LogVerbatim("BadModuleList");
572  }
573  if (!tobDone && badmod.first >= tobFirst) {
574  tobDone = true;
575  edm::LogVerbatim("BadModuleList");
576  edm::LogVerbatim("BadModuleList") << "SubDetector TOB";
577  edm::LogVerbatim("BadModuleList");
578  }
579  if (!tecSide1Done && badmod.first >= tecSide1First) {
580  tecSide1Done = true;
581  edm::LogVerbatim("BadModuleList");
582  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/MINUS";
583  edm::LogVerbatim("BadModuleList");
584  }
585  if (!tecSide2Done && badmod.first >= tecSide2First) {
586  tecSide2Done = true;
587  edm::LogVerbatim("BadModuleList");
588  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/PLUS";
589  edm::LogVerbatim("BadModuleList");
590  }
591  edm::LogVerbatim("BadModuleList") << badmod.second;
592  }
593 }
594 
595 void SiStripTrackerMapCreator::printTopModules(std::vector<std::pair<float, uint32_t>>& topNmodVec,
596  const edm::EventSetup& eSetup) {
598  edm::ESHandle<TrackerTopology> tTopoHandle;
599  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
600  const TrackerTopology* const tTopo = tTopoHandle.product();
601 
602  if (topNmodVec.empty())
603  return;
604 
605  std::sort(topNmodVec.rbegin(), topNmodVec.rend());
606  if (topNmodVec.size() > numTopModules_)
607  topNmodVec.resize(numTopModules_);
608 
609  edm::LogVerbatim("TopModules") << topModLabel_;
610  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
611 
612  for (auto const& aPair : topNmodVec) {
613  uint32_t det_id = aPair.second;
614  std::ostringstream comment;
616  SiStripDetId ssdetid(aPair.second);
617  if (ssdetid.subDetector() == SiStripDetId::TIB)
618  subdetector = "TIB ";
619  if (ssdetid.subDetector() == SiStripDetId::TID) {
620  if (tTopo->tidSide(ssdetid) == 1)
621  subdetector = "TID/MINUS ";
622  if (tTopo->tidSide(ssdetid) == 2)
623  subdetector = "TID/PLUS ";
624  }
625  if (ssdetid.subDetector() == SiStripDetId::TOB)
626  subdetector = "TOB ";
627  if (ssdetid.subDetector() == SiStripDetId::TEC) {
628  if (tTopo->tecSide(ssdetid) == 1)
629  subdetector = "TEC/MINUS ";
630  if (tTopo->tecSide(ssdetid) == 2)
631  subdetector = "TEC/PLUS ";
632  }
633  uint16_t flag = getDetectorFlagAndComment(nullptr, det_id, tTopo, comment);
634  if (flag == 0)
635  edm::LogVerbatim("TopModules") << subdetector << comment.str() << " value: " << aPair.first;
636  }
637  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
638 }
639 
640 //
641 // -- Get Tracker Map Fill Range
642 //
644  tkMapMin_ = 0.0;
645  if (tkMapMax_ == 0.0) {
646  if (map_type.find("FractionOfBadChannels") != std::string::npos)
647  tkMapMax_ = 1.0;
648  else if (map_type.find("NumberOfCluster") != std::string::npos)
649  tkMapMax_ = 0.01;
650  else if (map_type.find("NumberOfDigi") != std::string::npos)
651  tkMapMax_ = 0.6;
652  else if (map_type.find("NumberOfOffTrackCluster") != std::string::npos)
653  tkMapMax_ = 100.0;
654  else if (map_type.find("NumberOfOnTrackCluster") != std::string::npos)
655  tkMapMax_ = 50.0;
656  else if (map_type.find("StoNCorrOnTrack") != std::string::npos)
657  tkMapMax_ = 200.0;
658  } else {
659  tkMapMax_ = tkMapMax_ / nDet_ * 1.0;
661  }
662  trackerMap_->setRange(tkMapMin_, tkMapMax_);
663 }
664 
666  tkMapMin_ = 0.0;
667  if (tkMapMax_ != 0.0) {
668  tkMapMax_ = tkMapMax_ / (nDet_ * 1.0);
670  }
671 }
SiStripTrackerMapCreator::nDet_
int nDet_
Definition: SiStripTrackerMapCreator.h:77
SiStripTrackerMapCreator::tkMapMax_
float tkMapMax_
Definition: SiStripTrackerMapCreator.h:71
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiStripTrackerMapCreator::printBadModuleList
void printBadModuleList(std::map< unsigned int, std::string > const &badmodmap, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:507
SiStripTrackerMapCreator::stripTopLevelDir_
std::string stripTopLevelDir_
Definition: SiStripTrackerMapCreator.h:69
dqm::implementation::IGetter::getContents
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
MessageLogger.h
SiStripFolderOrganizer.h
MonitorElementData::Kind::INT
SiStripDetCabling::getDetCabling
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
Definition: SiStripDetCabling.h:33
SiStripTrackerMapCreator.h
SiStripTrackerMapCreator::detCabling_
edm::ESHandle< SiStripDetCabling > detCabling_
Definition: SiStripTrackerMapCreator.h:80
TrackerTopology
Definition: TrackerTopology.h:16
SiStripQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiStripQuality.cc:599
TkLayerMap::XYbin::ix
int16_t ix
Definition: TkDetMap.h:15
SiStripTrackerMapCreator::create
void create(edm::ParameterSet const &tkmapPset, DQMStore &dqm_store, std::string const &htype, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:33
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripTrackerMapCreator::tkMapMin_
float tkMapMin_
Definition: SiStripTrackerMapCreator.h:72
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
SiStripTrackerMapCreator::getDetectorFlagAndComment
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
Definition: SiStripTrackerMapCreator.cc:369
TkDetMap::getXY
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
DQMStore.h
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
dqm::implementation::IGetter::getSubdirs
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:678
SiStripTrackerMapCreator::cachedDetId_
DetId cachedDetId_
Definition: SiStripTrackerMapCreator.h:81
SiStripDetId.h
SiStripTrackerMapCreator::ResidualsRMS_
bool ResidualsRMS_
Definition: SiStripTrackerMapCreator.h:75
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetCabling::fedCabling
const SiStripFedCabling * fedCabling() const
Definition: SiStripDetCabling.h:86
TkLayerMap::XYbin::iy
int16_t iy
Definition: TkDetMap.h:15
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
parallelization.uint
uint
Definition: parallelization.py:124
TrackerGeometryUtils::getSiStripDetIds
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiStripUtility.h
TkDetMap::getLayerNum
static int getLayerNum(const std::string &in)
Definition: TkDetMap.cc:311
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripTrackerMapCreator::paintTkMapFromAlarm
void paintTkMapFromAlarm(uint32_t det_id, const TrackerTopology *tTopo, DQMStore &dqm_store, bool isBad, std::map< unsigned int, std::string > &badmodmap)
Definition: SiStripTrackerMapCreator.cc:235
SiStripUtility::getDetectorStatusColor
static void getDetectorStatusColor(int status, int &rval, int &gval, int &bval)
Definition: SiStripUtility.cc:122
TrackerTopology.h
TrackerTopologyRcd.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
SiStripTrackerMapCreator::SiStripTrackerMapCreator
SiStripTrackerMapCreator(edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:23
dqm::legacy::DQMStore
Definition: DQMStore.h:727
SiStripConfigParser.h
SiStripQualityRcd
Definition: SiStripDependentRecords.h:55
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiStripUtility::getBadModuleStatus
static void getBadModuleStatus(uint16_t flag, std::string &message)
Definition: SiStripUtility.cc:343
edm::ESHandle
Definition: DTSurvey.h:22
SiStripDetCablingRcd
Definition: SiStripDependentRecords.h:19
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
TkHistoMap.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripTrackerMapCreator::printTopModules
void printTopModules(std::vector< std::pair< float, uint32_t >> &topNmodVec, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:595
dqm::implementation::DQMStore::pwd
std::string pwd() override
Definition: DQMStore.h:567
SiStripTrackerMapCreator::sRunNumber
std::string sRunNumber
Definition: SiStripTrackerMapCreator.h:67
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripTrackerMapCreator::eSetup_
edm::EventSetup const & eSetup_
Definition: SiStripTrackerMapCreator.h:79
SiStripTrackerMapCreator::createForOffline
void createForOffline(edm::ParameterSet const &tkmapPset, DQMStore &dqm_store, std::string &htype, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:69
SiStripFolderOrganizer::getSubDetFolder
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
Definition: SiStripFolderOrganizer.cc:406
SiStripTrackerMapCreator::cachedXYbin_
TkLayerMap::XYbin cachedXYbin_
Definition: SiStripTrackerMapCreator.h:84
SiStripTrackerMapCreator::setTkMapFromHistogram
void setTkMapFromHistogram(DQMStore &dqm_store, std::string const &htype, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:266
SiStripUtility::goToDir
static bool goToDir(DQMStore &dqm_store, std::string const &name)
Definition: SiStripUtility.cc:252
TkDetMap::getDetsForLayer
std::vector< DetId > getDetsForLayer(int layer) const
Definition: TkDetMap.h:196
SiStripTrackerMapCreator::meanToMaxFactor_
float meanToMaxFactor_
Definition: SiStripTrackerMapCreator.h:73
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
SiStripTrackerMapCreator::getDetectorFlag
uint16_t getDetectorFlag(uint32_t const det_id)
Definition: SiStripTrackerMapCreator.h:60
SiStripFolderOrganizer::setSiStripFolderName
void setSiStripFolderName(std::string name)
Definition: SiStripFolderOrganizer.cc:41
SiStripTrackerMapCreator::setTkMapFromAlarm
void setTkMapFromAlarm(DQMStore &dqm_store, edm::EventSetup const &eSetup)
Definition: SiStripTrackerMapCreator.cc:193
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
utils.h
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
SiStripTrackerMapCreator::tkDetMap_
TkDetMap const * tkDetMap_
Definition: SiStripTrackerMapCreator.h:78
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
SiStripTrackerMapCreator::numTopModules_
uint32_t numTopModules_
Definition: SiStripTrackerMapCreator.h:86
SiStripTrackerMapCreator::cachedLayer_
int16_t cachedLayer_
Definition: SiStripTrackerMapCreator.h:82
MonitorElementData::Kind::TPROFILE2D
SiStripTrackerMapCreator::paintTkMapFromHistogram
void paintTkMapFromHistogram(MonitorElement const *me, std::string const &map_type, std::vector< std::pair< float, uint32_t >> *topNmodVec)
Definition: SiStripTrackerMapCreator.cc:325
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
SiStripDetId::subDetector
SubDetector subDetector() const
Definition: SiStripDetId.h:105
SiStripTrackerMapCreator::createInfoFile
void createInfoFile(std::vector< std::string > const &map_names, TTree *tkinfo_tree, DQMStore &dqm_store)
Definition: SiStripTrackerMapCreator.cc:437
SiStripFolderOrganizer
Definition: SiStripFolderOrganizer.h:27
SiStripQuality.h
SiStripTrackerMapCreator::trackerMap_
std::unique_ptr< TrackerMap > trackerMap_
Definition: SiStripTrackerMapCreator.h:66
SiStripQualityRcd.h
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
TkDetMap.h
RefreshWebPage.dname
dname
Definition: RefreshWebPage.py:56
sd
double sd
Definition: CascadeWrapper.h:113
SiStripTrackerMapCreator::useSSQuality_
bool useSSQuality_
Definition: SiStripTrackerMapCreator.h:74
SiStripTrackerMapCreator::setTkMapRange
void setTkMapRange(std::string const &map_type)
Definition: SiStripTrackerMapCreator.cc:643
SiStripTrackerMapCreator::topModules_
bool topModules_
Definition: SiStripTrackerMapCreator.h:85
SiStripDetCablingRcd.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SiStripTrackerMapCreator::ssqLabel_
std::string ssqLabel_
Definition: SiStripTrackerMapCreator.h:76
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
TkLayerMap::XYbin
Definition: TkDetMap.h:12
SiStripTrackerMapCreator::topModLabel_
std::string topModLabel_
Definition: SiStripTrackerMapCreator.h:87
SiStripTrackerMapCreator::detFlag_
std::map< uint32_t, uint16_t > detFlag_
Definition: SiStripTrackerMapCreator.h:83
sistrip::runNumber_
static const char runNumber_[]
Definition: ConstantsForDqm.h:33
SiStripDetCabling::getConnections
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
Definition: SiStripDetCabling.cc:161
dqm::implementation::IGetter::dirExists
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:708
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
SiStripTrackerMapCreator::setTkMapRangeOffline
void setTkMapRangeOffline()
Definition: SiStripTrackerMapCreator.cc:665
dqm::implementation::DQMStore::cd
void cd() override
Definition: DQMStore.h:564
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184
subdetector
TString subdetector
Definition: trackSplitPlot.h:54