CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SiStripTrackerMapCreator Class Reference

#include <SiStripTrackerMapCreator.h>

Public Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef
dqm::harvesting::MonitorElement 
MonitorElement
 

Public Member Functions

void create (edm::ParameterSet const &tkmapPset, DQMStore &dqm_store, std::string const &htype)
 
void createForOffline (edm::ParameterSet const &tkmapPset, DQMStore &dqm_store, std::string &htype, const SiStripQuality *)
 
void createInfoFile (std::vector< std::string > const &map_names, TTree *tkinfo_tree, DQMStore &dqm_store, const GeometricDet *geomDet)
 
bool readConfiguration ()
 
 SiStripTrackerMapCreator (const SiStripDetCabling *detCabling, const TkDetMap *tkDetMap, const TrackerTopology *tTopo)
 

Private Member Functions

uint16_t getDetectorFlag (uint32_t const det_id)
 
uint16_t getDetectorFlagAndComment (DQMStore *dqm_store, uint32_t det_id, std::ostringstream &comment)
 
void paintTkMapFromAlarm (uint32_t det_id, DQMStore &dqm_store, bool isBad, std::map< unsigned int, std::string > &badmodmap)
 
void paintTkMapFromHistogram (MonitorElement const *me, std::string const &map_type, std::vector< std::pair< float, uint32_t >> *topNmodVec)
 
void printBadModuleList (std::map< unsigned int, std::string > const &badmodmap)
 
void printTopModules (std::vector< std::pair< float, uint32_t >> &topNmodVec)
 
void setTkMapFromAlarm (DQMStore &dqm_store, const SiStripQuality *stripQuality)
 
void setTkMapFromHistogram (DQMStore &dqm_store, std::string const &htype)
 
void setTkMapRange (std::string const &map_type)
 
void setTkMapRangeOffline ()
 

Private Attributes

DetId cachedDetId_ {}
 
int16_t cachedLayer_ {}
 
TkLayerMap::XYbin cachedXYbin_
 
const SiStripDetCablingdetCabling_
 
std::map< uint32_t, uint16_t > detFlag_
 
float meanToMaxFactor_ {2.5}
 
int nDet_
 
uint32_t numTopModules_
 
bool ResidualsRMS_
 
std::string sRunNumber
 
std::string stripTopLevelDir_ {}
 
TkDetMap const * tkDetMap_
 
float tkMapMax_
 
float tkMapMin_
 
std::string tkMapName_
 
std::string topModLabel_
 
bool topModules_
 
std::unique_ptr< TrackerMaptrackerMap_ {nullptr}
 
const TrackerTopologytTopo_
 

Detailed Description

Definition at line 23 of file SiStripTrackerMapCreator.h.

Member Typedef Documentation

Definition at line 26 of file SiStripTrackerMapCreator.h.

Definition at line 25 of file SiStripTrackerMapCreator.h.

Constructor & Destructor Documentation

SiStripTrackerMapCreator::SiStripTrackerMapCreator ( const SiStripDetCabling detCabling,
const TkDetMap tkDetMap,
const TrackerTopology tTopo 
)

Definition at line 22 of file SiStripTrackerMapCreator.cc.

25  : detCabling_(detCabling), tkDetMap_(tkDetMap), tTopo_(tTopo) {}
const SiStripDetCabling * detCabling_
const TrackerTopology * tTopo_

Member Function Documentation

void SiStripTrackerMapCreator::create ( edm::ParameterSet const &  tkmapPset,
DQMStore dqm_store,
std::string const &  htype 
)

Definition at line 30 of file SiStripTrackerMapCreator.cc.

References detCabling_, SiStripDetCabling::fedCabling(), meanToMaxFactor_, nDet_, setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRange(), AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, trackerMap_, and tTopo_.

32  {
33  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
34 
35  if (!fedcabling)
36  return;
37 
38  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo_);
39  std::string tmap_title = " Tracker Map from " + map_type;
40  trackerMap_->setTitle(tmap_title);
41 
42  nDet_ = 0;
43  tkMapMax_ = 0.0;
44  tkMapMin_ = 0.0;
45  meanToMaxFactor_ = 2.5;
46  stripTopLevelDir_ = "SiStrip";
47 
48  if (map_type == "QTestAlarm") {
49  setTkMapFromAlarm(dqm_store, nullptr);
50  } else {
51  trackerMap_->fill_all_blank();
52  setTkMapFromHistogram(dqm_store, map_type);
53  setTkMapRange(map_type);
54  }
55  trackerMap_->printonline();
56  trackerMap_.reset();
57 }
std::unique_ptr< TrackerMap > trackerMap_
const SiStripDetCabling * detCabling_
const SiStripFedCabling * fedCabling() const
void setTkMapRange(std::string const &map_type)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void setTkMapFromHistogram(DQMStore &dqm_store, std::string const &htype)
const TrackerTopology * tTopo_
void setTkMapFromAlarm(DQMStore &dqm_store, const SiStripQuality *stripQuality)
void SiStripTrackerMapCreator::createForOffline ( edm::ParameterSet const &  tkmapPset,
DQMStore dqm_store,
std::string &  htype,
const SiStripQuality stripQuality 
)

Definition at line 59 of file SiStripTrackerMapCreator.cc.

References dqm::implementation::DQMStore::cd(), gather_cfg::cout, detCabling_, SiStripDetCabling::fedCabling(), SiStripUtility::goToDir(), meanToMaxFactor_, numTopModules_, dqm::implementation::DQMStore::pwd(), ResidualsRMS_, sistrip::runNumber_, setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRangeOffline(), sRunNumber, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, topModLabel_, topModules_, trackerMap_, and tTopo_.

62  {
63  // Determine the strip top level dirctory in the DQM file: it is the
64  // path where MechanicalView is minus one directory
65  std::string const mdir{"MechanicalView"};
66  dqm_store.cd();
67  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
68  edm::LogError("SiStripTopLevelDirNotFound") << "I cannot find the SiStrip top level directory in the DQM file";
69  } else {
70  const std::string& mechanicalview_dir = dqm_store.pwd();
71  stripTopLevelDir_ = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of('/'));
72  edm::LogInfo("SiStripTopLevelDirFound") << "SiStrip top level directory is " << stripTopLevelDir_;
73  }
74  dqm_store.cd();
75 
76  //
77  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
78 
79  if (!fedcabling)
80  return;
81 
82  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo_);
83 
84  meanToMaxFactor_ = tkmapPset.getUntrackedParameter<double>("meanToMaxFact", 2.5);
85  bool tkMapPSU = tkmapPset.getUntrackedParameter<bool>("psuMap", false);
86  bool tkMapFED = tkmapPset.getUntrackedParameter<bool>("fedMap", false);
87  std::string namesuffix = tkmapPset.getUntrackedParameter<std::string>("mapSuffix", "");
88 
89  // std::string tmap_title = " Tracker Map from " + map_type;
90  unsigned int runNumber_ = tkmapPset.getUntrackedParameter<unsigned int>("RunNumber", 1);
91  std::stringstream ss;
92  ss << runNumber_;
93  sRunNumber = ss.str();
94  std::cout << sRunNumber << "\n\n\n\n\n\n";
95  std::string tmap_title;
96  if (runNumber_ > 0) {
97  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
98  } else {
99  tmap_title = " Tracker Map from " + map_type;
100  }
101  trackerMap_->setTitle(tmap_title);
102 
103  if (tkmapPset.exists("TopModules"))
104  topModules_ = tkmapPset.getUntrackedParameter<bool>("TopModules");
105  else
106  topModules_ = false;
107 
108  if (tkmapPset.exists("numberTopModules"))
109  numTopModules_ = tkmapPset.getUntrackedParameter<uint32_t>("numberTopModules");
110  else
111  numTopModules_ = 20;
112 
113  if (tkmapPset.exists("topModLabel"))
114  topModLabel_ = tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
115  else
116  topModLabel_ = " top Modules " + map_type;
117 
118  if (map_type == "QTestAlarm") {
119  setTkMapFromAlarm(dqm_store, stripQuality);
120  } else {
121  setTkMapFromHistogram(dqm_store, map_type);
122  }
123  // if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
125 
126  // check manual setting
127 
128  if (tkmapPset.exists("mapMax"))
129  tkMapMax_ = tkmapPset.getUntrackedParameter<double>("mapMax");
130  if (tkmapPset.exists("mapMin"))
131  tkMapMin_ = tkmapPset.getUntrackedParameter<double>("mapMin");
132 
133  if (map_type == "ResidualsMean") {
134  ResidualsRMS_ = false;
135  setTkMapFromHistogram(dqm_store, map_type);
136  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to "
137  << tkMapMin_ << " - " << tkMapMax_;
138  trackerMap_->save(true, 0.0000000001, 0.005, map_type + namesuffix + ".svg");
139  trackerMap_->save(true, 0.0000000001, 0.005, map_type + namesuffix + ".png", 4500, 2400);
140  ResidualsRMS_ = true;
141  map_type = "ResidualsRMS";
142  if (runNumber_ > 0) {
143  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
144  } else {
145  tmap_title = " Tracker Map from " + map_type;
146  }
147  trackerMap_->setTitle(tmap_title);
148  setTkMapFromHistogram(dqm_store, map_type);
149  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix
150  << " with range set to 0.0 - 1.0";
151  trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".svg");
152  trackerMap_->save(true, 0.0, 1.0, map_type + namesuffix + ".png", 4500, 2400);
153  // reset the map name to ResidualsMean to restore the
154  // correct behaviour for the summary file creation
155  map_type = "ResidualsMean";
156  } else {
157  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to "
158  << tkMapMin_ << " - " << tkMapMax_;
159  trackerMap_->save(true, tkMapMin_, tkMapMax_, map_type + namesuffix + ".svg");
160  trackerMap_->save(true, tkMapMin_, tkMapMax_, map_type + namesuffix + ".png", 4500, 2400);
161  }
162 
163  if (tkMapPSU) {
164  edm::LogInfo("PSUMapToBeSaved") << "Ready to save PSU TkMap " << map_type << namesuffix << " with range set to "
165  << tkMapMin_ << " - " << tkMapMax_;
166  trackerMap_->save_as_psutrackermap(true, tkMapMin_, tkMapMax_, map_type + namesuffix + "_psu.png");
167  }
168 
169  if (tkMapFED) {
170  edm::LogInfo("FEDMapToBeSaved") << "Ready to save FED TkMap " << map_type << namesuffix << " with range set to "
171  << tkMapMin_ << " - " << tkMapMax_;
172  trackerMap_->save_as_fedtrackermap(true, tkMapMin_, tkMapMax_, map_type + namesuffix + "_fed.png");
173  }
174  trackerMap_.reset();
175 }
static const char runNumber_[]
std::unique_ptr< TrackerMap > trackerMap_
std::string pwd() override
Definition: DQMStore.h:567
Log< level::Error, false > LogError
const SiStripDetCabling * detCabling_
const SiStripFedCabling * fedCabling() const
Log< level::Info, false > LogInfo
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void setTkMapFromHistogram(DQMStore &dqm_store, std::string const &htype)
tuple cout
Definition: gather_cfg.py:144
const TrackerTopology * tTopo_
void setTkMapFromAlarm(DQMStore &dqm_store, const SiStripQuality *stripQuality)
void SiStripTrackerMapCreator::createInfoFile ( std::vector< std::string > const &  map_names,
TTree *  tkinfo_tree,
DQMStore dqm_store,
const GeometricDet geomDet 
)

Definition at line 409 of file SiStripTrackerMapCreator.cc.

References dqm::implementation::DQMStore::cd(), HILowLumiHLTOfflineSource_cfi::dirname, getDetectorFlag(), TrackerGeometryUtils::getSiStripDetIds(), SiStripUtility::goToDir(), gpuClustering::id, dqm::implementation::DQMStore::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, and tkDetMap_.

412  {
413  std::map<std::string, float> tkhmap_value;
414  int qtalarm_flag = 0;
415  uint32_t det_id = 0;
416 
417  if (!tkinfo_tree) {
418  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
419  } else {
420  tkinfo_tree->Branch("DetId", &det_id, "DetId/i");
421  for (auto const& mapname : map_names) {
422  if (mapname == "QTestAlarm") {
423  qtalarm_flag = 0;
424  tkinfo_tree->Branch(mapname.c_str(), &qtalarm_flag, std::string(mapname + "/I").c_str());
425  } else {
426  tkhmap_value[mapname] = -1.0;
427  tkinfo_tree->Branch(mapname.c_str(), &tkhmap_value[mapname], std::string(mapname + "/F").c_str());
428  }
429  }
430 
431  std::string dirname = "";
432 
433  std::string mdir = "MechanicalView";
434  dqm_store.cd();
435  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
436  edm::LogError("SiStripTrackerMapCreator::createInfoFile")
437  << "I cannot find the SiStrip top level directory in the DQM file";
438  } else {
439  const std::string& mechanicalview_dir = dqm_store.pwd();
440  dirname = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of('/'));
441  edm::LogInfo("SiStripTrackerMapCreator::createInfoFile") << "SiStrip top level directory is " << dirname;
442  }
443  dqm_store.cd();
444 
445  std::vector<TkHistoMap> tkHMaps;
446 
447  uint32_t nHists = map_names.size();
448 
449  for (uint32_t ih = 0; ih < nHists; ++ih) {
450  tkHMaps.emplace_back(tkDetMap_);
451  if (map_names.at(ih) != "QTestAlarm") {
452  std::string tkhmap_name = "TkHMap_" + map_names.at(ih);
453  tkHMaps.at(ih).loadTkHistoMap(dirname, tkhmap_name, true);
454  }
455  }
456 
457  const auto detidList = TrackerGeometryUtils::getSiStripDetIds(*geomDet);
458  for (auto const id : detidList) {
459  det_id = id;
460  for (uint32_t ih = 0; ih < nHists; ++ih) {
461  if (map_names.at(ih) == "QTestAlarm") {
462  qtalarm_flag = getDetectorFlag(id);
463  } else {
464  tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(id);
465  }
466  }
467  if (!tkinfo_tree) {
468  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
469  } else {
470  tkinfo_tree->Fill();
471  }
472  }
473  }
474 }
uint16_t getDetectorFlag(uint32_t const det_id)
uint16_t *__restrict__ id
std::string pwd() override
Definition: DQMStore.h:567
Log< level::Error, false > LogError
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
Log< level::Info, false > LogInfo
static bool goToDir(DQMStore &dqm_store, std::string const &name)
uint16_t SiStripTrackerMapCreator::getDetectorFlag ( uint32_t const  det_id)
inlineprivate

Definition at line 55 of file SiStripTrackerMapCreator.h.

References detFlag_.

Referenced by createInfoFile().

55  {
56  return detFlag_.find(det_id) != detFlag_.end() ? detFlag_[det_id] : 0;
57  }
std::map< uint32_t, uint16_t > detFlag_
uint16_t SiStripTrackerMapCreator::getDetectorFlagAndComment ( DQMStore dqm_store,
uint32_t  det_id,
std::ostringstream &  comment 
)
private

Definition at line 342 of file SiStripTrackerMapCreator.cc.

References dqm::implementation::DQMStore::cd(), getInfo::conn, detCabling_, dqm::implementation::IGetter::dirExists(), folder_organizer, dqm::implementation::IGetter::get(), SiStripUtility::getBadModuleStatus(), SiStripDetCabling::getConnections(), SiStripFolderOrganizer::getSubDetFolder(), MonitorElementData::INT, LogDebug, SiStripFolderOrganizer::setSiStripFolderName(), AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, and tTopo_.

Referenced by paintTkMapFromAlarm(), and printTopModules().

344  {
345  comment << "Module " << det_id;
346  uint16_t flag = 0;
347 
348  // get FED channels corresponding to the det_id
349 
350  comment << " FEDCHs ";
351  constexpr std::size_t indent_width{7ull};
352  std::vector<const FedChannelConnection*> conns = detCabling_->getConnections(det_id);
353  for (auto const conn : conns) {
354  if (conn) {
355  comment << std::setw(3) << conn->fedId() << "/" << std::setw(2) << conn->fedCh() << " ";
356  } else {
357  comment << std::string(indent_width, ' ');
358  }
359  }
360  if (conns.empty()) {
361  comment << std::string(indent_width * 3, ' ');
362  } else if (conns.size() == 1) {
363  comment << std::string(indent_width * 2, ' ');
364  } else if (conns.size() == 2) {
365  comment << std::string(indent_width, ' ');
366  }
367 
368  if (!dqm_store)
369  return flag;
370 
372  std::string subdet_folder, badmodule_folder;
373 
374  dqm_store->cd();
375 
376  folder_organizer.setSiStripFolderName(stripTopLevelDir_);
377  folder_organizer.getSubDetFolder(det_id, tTopo_, subdet_folder);
378 
379  LogDebug("SearchBadModule") << det_id << " " << subdet_folder << " " << stripTopLevelDir_;
380 
381  if (dqm_store->dirExists(subdet_folder)) {
382  badmodule_folder = subdet_folder + "/BadModuleList";
383  LogDebug("SearchBadModule") << subdet_folder << " exists: " << badmodule_folder;
384  } else {
385  edm::LogError("SubDetFolderNotFound") << subdet_folder << " does not exist for detid " << det_id;
386  return flag;
387  }
388  if (!dqm_store->dirExists(badmodule_folder)) {
389  LogDebug("BadModuleFolderNotFound") << badmodule_folder << " does not exist for detid " << det_id;
390  return flag;
391  }
392  std::ostringstream badmodule_path;
393  badmodule_path << badmodule_folder << "/" << det_id;
394  LogDebug("SearchBadModule") << badmodule_folder << " exists: " << badmodule_path.str();
395 
396  auto const* bad_module_me = dqm_store->get(badmodule_path.str());
397  if (bad_module_me && bad_module_me->kind() == MonitorElement::Kind::INT) {
398  LogDebug("SearchBadModule") << "Monitor Element found";
399  flag = bad_module_me->getIntValue();
400  std::string message;
401  SiStripUtility::getBadModuleStatus(flag, message);
402  comment << message.c_str();
403  }
404  return flag;
405 }
void setSiStripFolderName(std::string name)
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
Log< level::Error, false > LogError
static void getBadModuleStatus(uint16_t flag, std::string &message)
const SiStripDetCabling * detCabling_
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
SiStripFolderOrganizer folder_organizer
tuple conn
Definition: getInfo.py:9
const TrackerTopology * tTopo_
#define LogDebug(id)
void SiStripTrackerMapCreator::paintTkMapFromAlarm ( uint32_t  det_id,
DQMStore dqm_store,
bool  isBad,
std::map< unsigned int, std::string > &  badmodmap 
)
private

Definition at line 211 of file SiStripTrackerMapCreator.cc.

References detFlag_, getDetectorFlagAndComment(), SiStripUtility::getDetectorStatusColor(), phase1PixelTopology::layer, TrackerTopology::layer(), AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), trackerMap_, tTopo_, and parallelization::uint().

Referenced by setTkMapFromAlarm().

214  {
215  std::ostringstream comment;
216  uint16_t flag = 0;
217  flag = getDetectorFlagAndComment(&dqm_store, det_id, comment);
218 
219  int rval, gval, bval;
220  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
221  if (isBad) {
222  rval = 255;
223  gval = 255;
224  bval = 0;
225  comment << " PCLBadModule ";
226  }
227  trackerMap_->setText(det_id, comment.str());
228  trackerMap_->fillc(det_id, rval, gval, bval);
229 
230  if (flag != 0 || isBad) {
231  uint lay = tTopo_->layer(SiStripDetId(det_id));
232  std::string layer = " Layer " + std::to_string(lay);
233  badmodmap[det_id] = comment.str() + layer;
234  }
235 
236  detFlag_[det_id] = flag;
237 }
std::unique_ptr< TrackerMap > trackerMap_
static void getDetectorStatusColor(int status, int &rval, int &gval, int &bval)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
constexpr std::array< uint8_t, layerIndexSize > layer
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
unsigned int layer(const DetId &id) const
std::map< uint32_t, uint16_t > detFlag_
const TrackerTopology * tTopo_
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, std::ostringstream &comment)
void SiStripTrackerMapCreator::paintTkMapFromHistogram ( MonitorElement const *  me,
std::string const &  map_type,
std::vector< std::pair< float, uint32_t >> *  topNmodVec 
)
private

Definition at line 298 of file SiStripTrackerMapCreator.cc.

References funct::abs(), cachedDetId_, cachedLayer_, cachedXYbin_, dqm::impl::MonitorElement::getBinContent(), TkDetMap::getDetsForLayer(), TkDetMap::getLayerNum(), dqm::impl::MonitorElement::getName(), dqm::legacy::MonitorElement::getTProfile2D(), TkDetMap::getXY(), TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, dqm::impl::MonitorElement::kind(), mergeVDriftHistosByStation::name, nDet_, ResidualsRMS_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, tkDetMap_, tkMapMax_, cmsswSequenceInfo::tp, MonitorElementData::TPROFILE2D, and trackerMap_.

Referenced by setTkMapFromHistogram().

300  {
301  const std::string& name = me->getName();
302  std::string lname = name.substr(name.find("TkHMap_") + 7);
303  lname = lname.substr(lname.find("_T") + 1);
304  for (DetId det_id : tkDetMap_->getDetsForLayer(TkDetMap::getLayerNum(lname))) {
305  if (det_id.rawId() <= 0)
306  continue;
307  nDet_++;
309  float fval = 0.0;
310  if (name.find("Residuals") != std::string::npos) {
311  if (ResidualsRMS_ == true) {
312  if (me->kind() == MonitorElement::Kind::TPROFILE2D) {
313  TProfile2D* tp = me->getTProfile2D();
314  float fval_prov =
315  tp->GetBinError(xyval.ix, xyval.iy) * sqrt(tp->GetBinEntries(tp->GetBin(xyval.ix, xyval.iy)));
316  fval = fval_prov;
317  }
318  } else {
319  float fval_prov = me->getBinContent(xyval.ix, xyval.iy);
320  fval = std::abs(fval_prov);
321  }
322  } else
323  fval = me->getBinContent(xyval.ix, xyval.iy);
324  if (htype == "QTestAlarm") {
325  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
326  } else {
327  if (fval == 0.0)
328  trackerMap_->fillc(det_id, 255, 255, 255);
329  else {
330  trackerMap_->fill_current_val(det_id, fval);
331  if (topNmodVec) {
332  topNmodVec->emplace_back(fval, det_id);
333  }
334  }
335  tkMapMax_ += fval;
336  }
337  }
338 }
std::unique_ptr< TrackerMap > trackerMap_
Log< level::Error, false > LogError
std::vector< DetId > getDetsForLayer(int layer) const
Definition: TkDetMap.h:196
static int getLayerNum(const std::string &in)
Definition: TkDetMap.cc:311
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:548
void SiStripTrackerMapCreator::printBadModuleList ( std::map< unsigned int, std::string > const &  badmodmap)
private

Definition at line 478 of file SiStripTrackerMapCreator.cc.

References sRunNumber, SiStripDetId::subDetector(), SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), SiStripDetId::TOB, and tTopo_.

Referenced by setTkMapFromAlarm().

478  {
479  // Retrieve tracker topology from geometry
480  bool tibDone = false, tidSide1Done = false, tidSide2Done = false, tobDone = false, tecSide1Done = false,
481  tecSide2Done = false;
482  constexpr unsigned int tibFirst = 369120277 - 1, tidSide1First = 402664197 - 1, tidSide2First = 402672389 - 1,
483  tobFirst = 436228134 - 1, tecSide1First = 470044965 - 1, tecSide2First = 470307109 - 1;
484 
485  int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
486 
487  for (auto const& badmod : badmodmap) {
488  SiStripDetId ssdetid(badmod.first);
489  if (ssdetid.subDetector() == SiStripDetId::TIB)
490  ntib++;
491  if (ssdetid.subDetector() == SiStripDetId::TID) {
492  if (tTopo_->tidSide(ssdetid) == 1)
493  ntids1++;
494  if (tTopo_->tidSide(ssdetid) == 2)
495  ntids2++;
496  }
497  if (ssdetid.subDetector() == SiStripDetId::TOB)
498  ntob++;
499  if (ssdetid.subDetector() == SiStripDetId::TEC) {
500  if (tTopo_->tecSide(ssdetid) == 1)
501  ntecs1++;
502  if (tTopo_->tecSide(ssdetid) == 2)
503  ntecs2++;
504  }
505  }
506 
507  edm::LogVerbatim("BadModuleList") << "Run: " << sRunNumber << ", Number of bad modules in total:";
508  edm::LogVerbatim("BadModuleList") << "--------------------------------------------------------------";
509  edm::LogVerbatim("BadModuleList") << "TIB: " << ntib;
510  edm::LogVerbatim("BadModuleList") << "TID/MINUS: " << ntids1;
511  edm::LogVerbatim("BadModuleList") << "TID/PLUS: " << ntids2;
512  edm::LogVerbatim("BadModuleList") << "TOB: " << ntob;
513  edm::LogVerbatim("BadModuleList") << "TEC/MINUS: " << ntecs1;
514  edm::LogVerbatim("BadModuleList") << "TEC/PLUS: " << ntecs2;
515  edm::LogVerbatim("BadModuleList") << "-------------------------------";
516  edm::LogVerbatim("BadModuleList");
517  edm::LogVerbatim("BadModuleList") << "List of bad modules per partition:";
518  edm::LogVerbatim("BadModuleList") << "----------------------------------";
519 
520  for (auto const& badmod : badmodmap) {
521  if (!tibDone && badmod.first >= tibFirst) {
522  tibDone = true;
523  edm::LogVerbatim("BadModuleList");
524  edm::LogVerbatim("BadModuleList") << "SubDetector TIB";
525  edm::LogVerbatim("BadModuleList");
526  }
527  if (!tidSide1Done && badmod.first >= tidSide1First) {
528  tidSide1Done = true;
529  edm::LogVerbatim("BadModuleList");
530  edm::LogVerbatim("BadModuleList") << "SubDetector TID/MINUS";
531  edm::LogVerbatim("BadModuleList");
532  }
533  if (!tidSide2Done && badmod.first >= tidSide2First) {
534  tidSide2Done = true;
535  edm::LogVerbatim("BadModuleList");
536  edm::LogVerbatim("BadModuleList") << "SubDetector TID/PLUS";
537  edm::LogVerbatim("BadModuleList");
538  }
539  if (!tobDone && badmod.first >= tobFirst) {
540  tobDone = true;
541  edm::LogVerbatim("BadModuleList");
542  edm::LogVerbatim("BadModuleList") << "SubDetector TOB";
543  edm::LogVerbatim("BadModuleList");
544  }
545  if (!tecSide1Done && badmod.first >= tecSide1First) {
546  tecSide1Done = true;
547  edm::LogVerbatim("BadModuleList");
548  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/MINUS";
549  edm::LogVerbatim("BadModuleList");
550  }
551  if (!tecSide2Done && badmod.first >= tecSide2First) {
552  tecSide2Done = true;
553  edm::LogVerbatim("BadModuleList");
554  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/PLUS";
555  edm::LogVerbatim("BadModuleList");
556  }
557  edm::LogVerbatim("BadModuleList") << badmod.second;
558  }
559 }
Log< level::Info, true > LogVerbatim
static constexpr auto TID
Definition: SiStripDetId.h:38
unsigned int tidSide(const DetId &id) const
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
static constexpr auto TIB
Definition: SiStripDetId.h:37
const TrackerTopology * tTopo_
static constexpr auto TEC
Definition: SiStripDetId.h:40
unsigned int tecSide(const DetId &id) const
void SiStripTrackerMapCreator::printTopModules ( std::vector< std::pair< float, uint32_t >> &  topNmodVec)
private

Definition at line 561 of file SiStripTrackerMapCreator.cc.

References getDetectorFlagAndComment(), numTopModules_, AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::subDetector(), subdetector, SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), SiStripDetId::TOB, topModLabel_, and tTopo_.

Referenced by setTkMapFromHistogram().

561  {
562  if (topNmodVec.empty())
563  return;
564 
565  std::sort(topNmodVec.rbegin(), topNmodVec.rend());
566  if (topNmodVec.size() > numTopModules_)
567  topNmodVec.resize(numTopModules_);
568 
569  edm::LogVerbatim("TopModules") << topModLabel_;
570  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
571 
572  for (auto const& aPair : topNmodVec) {
573  uint32_t det_id = aPair.second;
574  std::ostringstream comment;
576  SiStripDetId ssdetid(aPair.second);
577  if (ssdetid.subDetector() == SiStripDetId::TIB)
578  subdetector = "TIB ";
579  if (ssdetid.subDetector() == SiStripDetId::TID) {
580  if (tTopo_->tidSide(ssdetid) == 1)
581  subdetector = "TID/MINUS ";
582  if (tTopo_->tidSide(ssdetid) == 2)
583  subdetector = "TID/PLUS ";
584  }
585  if (ssdetid.subDetector() == SiStripDetId::TOB)
586  subdetector = "TOB ";
587  if (ssdetid.subDetector() == SiStripDetId::TEC) {
588  if (tTopo_->tecSide(ssdetid) == 1)
589  subdetector = "TEC/MINUS ";
590  if (tTopo_->tecSide(ssdetid) == 2)
591  subdetector = "TEC/PLUS ";
592  }
593  uint16_t flag = getDetectorFlagAndComment(nullptr, det_id, comment);
594  if (flag == 0)
595  edm::LogVerbatim("TopModules") << subdetector << comment.str() << " value: " << aPair.first;
596  }
597  edm::LogVerbatim("TopModules") << "------------------------------------------------------";
598 }
Log< level::Info, true > LogVerbatim
static constexpr auto TID
Definition: SiStripDetId.h:38
TString subdetector
unsigned int tidSide(const DetId &id) const
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
static constexpr auto TIB
Definition: SiStripDetId.h:37
const TrackerTopology * tTopo_
static constexpr auto TEC
Definition: SiStripDetId.h:40
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, std::ostringstream &comment)
unsigned int tecSide(const DetId &id) const
bool SiStripTrackerMapCreator::readConfiguration ( )
void SiStripTrackerMapCreator::setTkMapFromAlarm ( DQMStore dqm_store,
const SiStripQuality stripQuality 
)
private

Definition at line 180 of file SiStripTrackerMapCreator.cc.

References detCabling_, SiStripDetCabling::getDetCabling(), SiStripQuality::IsModuleBad(), callgraph::module, nDet_, paintTkMapFromAlarm(), printBadModuleList(), tkMapMax_, tkMapMin_, and trackerMap_.

Referenced by create(), and createForOffline().

180  {
181  nDet_ = 0;
182  tkMapMax_ = 0.0;
183  tkMapMin_ = 0.0;
184 
185  trackerMap_->fillc_all_blank();
186 
187  std::map<unsigned int, std::string> badmodmap;
188 
189  // used to avoid multiple checks on the same detid since the loop is done on the FED channels
190  uint32_t detId_save = 0;
191  // example of loop using SiStripDetCabling
192  for (auto const& module : detCabling_->getDetCabling()) {
193  uint32_t detId = module.first;
194  if (detId == 0 || detId == 0xFFFFFFFF)
195  continue;
196  if (detId_save != detId) {
197  detId_save = detId;
198  bool isBad = stripQuality && stripQuality->IsModuleBad(detId);
199  paintTkMapFromAlarm(detId, dqm_store, isBad, badmodmap);
200  } else {
201  edm::LogWarning("TwiceTheSameDetId")
202  << "The detid " << detId << " was found already in the loop on SiStripDetCabling";
203  }
204  }
205  printBadModuleList(badmodmap);
206 }
void paintTkMapFromAlarm(uint32_t det_id, DQMStore &dqm_store, bool isBad, std::map< unsigned int, std::string > &badmodmap)
std::unique_ptr< TrackerMap > trackerMap_
void printBadModuleList(std::map< unsigned int, std::string > const &badmodmap)
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
const SiStripDetCabling * detCabling_
bool IsModuleBad(const uint32_t &detid) const
Log< level::Warning, false > LogWarning
tuple module
Definition: callgraph.py:69
void SiStripTrackerMapCreator::setTkMapFromHistogram ( DQMStore dqm_store,
std::string const &  htype 
)
private

Definition at line 241 of file SiStripTrackerMapCreator.cc.

References dqm::implementation::DQMStore::cd(), dqm::implementation::IGetter::dirExists(), RefreshWebPage::dname, dqm::implementation::IGetter::getContents(), dqm::implementation::IGetter::getSubdirs(), SiStripUtility::goToDir(), phase1PixelTopology::layer, mergeVDriftHistosByStation::name, nDet_, paintTkMapFromHistogram(), printTopModules(), dqm::implementation::DQMStore::pwd(), sd, AlCaHLTBitMon_QueryRunRegistry::string, tkMapMax_, tkMapMin_, and topModules_.

Referenced by create(), and createForOffline().

241  {
242  dqm_store.cd();
243 
244  std::string const mdir{"MechanicalView"};
245  if (!SiStripUtility::goToDir(dqm_store, mdir))
246  return;
247  std::string mechanicalview_dir = dqm_store.pwd();
248 
249  std::vector<std::string> subdet_folder;
250  subdet_folder.push_back("TIB");
251  subdet_folder.push_back("TOB");
252  subdet_folder.push_back("TEC/MINUS");
253  subdet_folder.push_back("TEC/PLUS");
254  subdet_folder.push_back("TID/MINUS");
255  subdet_folder.push_back("TID/PLUS");
256 
257  nDet_ = 0;
258  tkMapMax_ = 0.0;
259  tkMapMin_ = 0.0;
260 
261  auto topNmodVec = topModules_ ? new std::vector<std::pair<float, uint32_t>>{} : nullptr;
262  for (auto const& sd : subdet_folder) {
263  std::string dname = mechanicalview_dir + "/" + sd;
264  if (!dqm_store.dirExists(dname))
265  continue;
266  dqm_store.cd(dname);
267  std::vector<std::string> layerVec = dqm_store.getSubdirs();
268  for (auto const& layer : layerVec) {
269  if (layer.find("BadModuleList") != std::string::npos)
270  continue;
271  std::vector<MonitorElement*> meVec = dqm_store.getContents(layer);
272  MonitorElement* tkhmap_me{nullptr};
274  for (auto tkh : meVec) {
275  name = tkh->getName();
276  if (name.find("TkHMap") == std::string::npos)
277  continue;
278  if (htype == "QTestAlarm") {
279  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
280  tkhmap_me = tkh;
281  break;
282  } else if (name.find(htype) != std::string::npos) {
283  tkhmap_me = tkh;
284  break;
285  }
286  }
287  if (tkhmap_me != nullptr) {
288  paintTkMapFromHistogram(tkhmap_me, htype, topNmodVec);
289  }
290  }
291  dqm_store.cd(mechanicalview_dir);
292  }
293  dqm_store.cd();
294  if (topNmodVec)
295  printTopModules(*topNmodVec);
296 }
void printTopModules(std::vector< std::pair< float, uint32_t >> &topNmodVec)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:700
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:593
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:730
std::string pwd() override
Definition: DQMStore.h:567
void paintTkMapFromHistogram(MonitorElement const *me, std::string const &map_type, std::vector< std::pair< float, uint32_t >> *topNmodVec)
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
double sd
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void SiStripTrackerMapCreator::setTkMapRange ( std::string const &  map_type)
private

Definition at line 603 of file SiStripTrackerMapCreator.cc.

References meanToMaxFactor_, nDet_, tkMapMax_, tkMapMin_, and trackerMap_.

Referenced by create().

603  {
604  tkMapMin_ = 0.0;
605  if (tkMapMax_ == 0.0) {
606  if (map_type.find("FractionOfBadChannels") != std::string::npos)
607  tkMapMax_ = 1.0;
608  else if (map_type.find("NumberOfCluster") != std::string::npos)
609  tkMapMax_ = 0.01;
610  else if (map_type.find("NumberOfDigi") != std::string::npos)
611  tkMapMax_ = 0.6;
612  else if (map_type.find("NumberOfOffTrackCluster") != std::string::npos)
613  tkMapMax_ = 100.0;
614  else if (map_type.find("NumberOfOnTrackCluster") != std::string::npos)
615  tkMapMax_ = 50.0;
616  else if (map_type.find("StoNCorrOnTrack") != std::string::npos)
617  tkMapMax_ = 200.0;
618  } else {
619  tkMapMax_ = tkMapMax_ / nDet_ * 1.0;
621  }
622  trackerMap_->setRange(tkMapMin_, tkMapMax_);
623 }
std::unique_ptr< TrackerMap > trackerMap_
void SiStripTrackerMapCreator::setTkMapRangeOffline ( )
private

Member Data Documentation

DetId SiStripTrackerMapCreator::cachedDetId_ {}
private

Definition at line 74 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

int16_t SiStripTrackerMapCreator::cachedLayer_ {}
private

Definition at line 75 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

TkLayerMap::XYbin SiStripTrackerMapCreator::cachedXYbin_
private

Definition at line 77 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

const SiStripDetCabling* SiStripTrackerMapCreator::detCabling_
private
std::map<uint32_t, uint16_t> SiStripTrackerMapCreator::detFlag_
private

Definition at line 76 of file SiStripTrackerMapCreator.h.

Referenced by getDetectorFlag(), and paintTkMapFromAlarm().

float SiStripTrackerMapCreator::meanToMaxFactor_ {2.5}
private
int SiStripTrackerMapCreator::nDet_
private
uint32_t SiStripTrackerMapCreator::numTopModules_
private

Definition at line 79 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::ResidualsRMS_
private

Definition at line 69 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and paintTkMapFromHistogram().

std::string SiStripTrackerMapCreator::sRunNumber
private

Definition at line 62 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printBadModuleList().

std::string SiStripTrackerMapCreator::stripTopLevelDir_ {}
private

Definition at line 64 of file SiStripTrackerMapCreator.h.

Referenced by create(), createForOffline(), and getDetectorFlagAndComment().

TkDetMap const* SiStripTrackerMapCreator::tkDetMap_
private

Definition at line 72 of file SiStripTrackerMapCreator.h.

Referenced by createInfoFile(), and paintTkMapFromHistogram().

float SiStripTrackerMapCreator::tkMapMax_
private
float SiStripTrackerMapCreator::tkMapMin_
private
std::string SiStripTrackerMapCreator::tkMapName_
private

Definition at line 63 of file SiStripTrackerMapCreator.h.

std::string SiStripTrackerMapCreator::topModLabel_
private

Definition at line 80 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::topModules_
private

Definition at line 78 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and setTkMapFromHistogram().

std::unique_ptr<TrackerMap> SiStripTrackerMapCreator::trackerMap_ {nullptr}
private
const TrackerTopology* SiStripTrackerMapCreator::tTopo_
private