CMS 3D CMS Logo

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, edm::EventSetup const &eSetup)
 
void createForOffline (edm::ParameterSet const &tkmapPset, DQMStore &dqm_store, std::string &htype, edm::EventSetup const &eSetup)
 
void createInfoFile (std::vector< std::string > const &map_names, TTree *tkinfo_tree, DQMStore &dqm_store)
 
bool readConfiguration ()
 
 SiStripTrackerMapCreator (edm::EventSetup const &eSetup)
 

Private Member Functions

uint16_t getDetectorFlag (uint32_t const det_id)
 
uint16_t getDetectorFlagAndComment (DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
 
void paintTkMapFromAlarm (uint32_t det_id, const TrackerTopology *tTopo, 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, edm::EventSetup const &eSetup)
 
void printTopModules (std::vector< std::pair< float, uint32_t >> &topNmodVec, edm::EventSetup const &eSetup)
 
void setTkMapFromAlarm (DQMStore &dqm_store, edm::EventSetup const &eSetup)
 
void setTkMapFromHistogram (DQMStore &dqm_store, std::string const &htype, edm::EventSetup const &eSetup)
 
void setTkMapRange (std::string const &map_type)
 
void setTkMapRangeOffline ()
 

Private Attributes

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

Detailed Description

Definition at line 24 of file SiStripTrackerMapCreator.h.

Member Typedef Documentation

Definition at line 27 of file SiStripTrackerMapCreator.h.

Definition at line 26 of file SiStripTrackerMapCreator.h.

Constructor & Destructor Documentation

SiStripTrackerMapCreator::SiStripTrackerMapCreator ( edm::EventSetup const &  eSetup)

Definition at line 23 of file SiStripTrackerMapCreator.cc.

References detCabling_, eSetup_, edm::EventSetup::get(), edm::ESHandle< T >::product(), and tkDetMap_.

23  : eSetup_{eSetup} {
25  edm::ESHandle<TkDetMap> tkDetMapHandle;
26  eSetup_.get<TrackerTopologyRcd>().get(tkDetMapHandle);
27  tkDetMap_ = tkDetMapHandle.product();
28 }
edm::ESHandle< SiStripDetCabling > detCabling_
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
edm::EventSetup const & eSetup_

Member Function Documentation

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

Definition at line 33 of file SiStripTrackerMapCreator.cc.

References detCabling_, SiStripDetCabling::fedCabling(), edm::EventSetup::get(), meanToMaxFactor_, nDet_, edm::ESHandle< T >::product(), setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRange(), ssqLabel_, AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, trackerMap_, and useSSQuality_.

36  {
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 }
std::unique_ptr< TrackerMap > trackerMap_
void setTkMapFromAlarm(DQMStore &dqm_store, edm::EventSetup const &eSetup)
void setTkMapFromHistogram(DQMStore &dqm_store, std::string const &htype, edm::EventSetup const &eSetup)
const SiStripFedCabling * fedCabling() const
edm::ESHandle< SiStripDetCabling > detCabling_
void setTkMapRange(std::string const &map_type)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
T const * product() const
Definition: ESHandle.h:86
void SiStripTrackerMapCreator::createForOffline ( edm::ParameterSet const &  tkmapPset,
DQMStore dqm_store,
std::string &  htype,
edm::EventSetup const &  eSetup 
)

Definition at line 69 of file SiStripTrackerMapCreator.cc.

References dqm::dqmstoreimpl::DQMStore::cd(), gather_cfg::cout, detCabling_, SiStripDetCabling::fedCabling(), edm::EventSetup::get(), SiStripUtility::goToDir(), meanToMaxFactor_, numTopModules_, edm::ESHandle< T >::product(), dqm::dqmstoreimpl::DQMStore::pwd(), ResidualsRMS_, sistrip::runNumber_, setTkMapFromAlarm(), setTkMapFromHistogram(), setTkMapRangeOffline(), sRunNumber, contentValuesCheck::ss, ssqLabel_, AlCaHLTBitMon_QueryRunRegistry::string, stripTopLevelDir_, tkMapMax_, tkMapMin_, topModLabel_, topModules_, trackerMap_, and useSSQuality_.

72  {
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 }
static const char runNumber_[]
std::unique_ptr< TrackerMap > trackerMap_
void setTkMapFromAlarm(DQMStore &dqm_store, edm::EventSetup const &eSetup)
void setTkMapFromHistogram(DQMStore &dqm_store, std::string const &htype, edm::EventSetup const &eSetup)
const SiStripFedCabling * fedCabling() const
edm::ESHandle< SiStripDetCabling > detCabling_
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
static bool goToDir(DQMStore &dqm_store, std::string const &name)
T const * product() const
Definition: ESHandle.h:86
void SiStripTrackerMapCreator::createInfoFile ( std::vector< std::string > const &  map_names,
TTree *  tkinfo_tree,
DQMStore dqm_store 
)

Definition at line 437 of file SiStripTrackerMapCreator.cc.

References dqm::dqmstoreimpl::DQMStore::cd(), BTVHLTOfflineSource_cfi::dirname, eSetup_, edm::EventSetup::get(), getDetectorFlag(), TrackerGeometryUtils::getSiStripDetIds(), SiStripUtility::goToDir(), triggerObjects_cff::id, dqm::dqmstoreimpl::DQMStore::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, and tkDetMap_.

439  {
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 }
uint16_t getDetectorFlag(uint32_t const det_id)
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:4
static bool goToDir(DQMStore &dqm_store, std::string const &name)
T get() const
Definition: EventSetup.h:73
edm::EventSetup const & eSetup_
uint16_t SiStripTrackerMapCreator::getDetectorFlag ( uint32_t const  det_id)
inlineprivate

Definition at line 60 of file SiStripTrackerMapCreator.h.

Referenced by createInfoFile().

60  {
61  return detFlag_.find(det_id) != detFlag_.end() ? detFlag_[det_id] : 0;
62  }
std::map< uint32_t, uint16_t > detFlag_
uint16_t SiStripTrackerMapCreator::getDetectorFlagAndComment ( DQMStore dqm_store,
uint32_t  det_id,
TrackerTopology const *  tTopo,
std::ostringstream &  comment 
)
private

Definition at line 369 of file SiStripTrackerMapCreator.cc.

References dqm::dqmstoreimpl::DQMStore::cd(), SiStripCommissioningClient_cfg::conn, constexpr, detCabling_, dqm::dqmstoreimpl::DQMStore::dirExists(), RemoveAddSevLevel::flag, dqm::dqmstoreimpl::DQMStore::get(), SiStripUtility::getBadModuleStatus(), SiStripDetCabling::getConnections(), SiStripFolderOrganizer::getSubDetFolder(), MonitorElementData::INT, LogDebug, SiStripFolderOrganizer::setSiStripFolderName(), AlCaHLTBitMon_QueryRunRegistry::string, and stripTopLevelDir_.

Referenced by paintTkMapFromAlarm(), and printTopModules().

372  {
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;
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;
429  SiStripUtility::getBadModuleStatus(flag, message);
430  comment << message.c_str();
431  }
432  return flag;
433 }
#define LogDebug(id)
void setSiStripFolderName(std::string name)
void getSubDetFolder(const uint32_t &detid, const TrackerTopology *tTopo, std::string &folder_name)
static void getBadModuleStatus(uint16_t flag, std::string &message)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
edm::ESHandle< SiStripDetCabling > detCabling_
#define constexpr
#define comment(par)
Definition: vmac.h:163
void SiStripTrackerMapCreator::paintTkMapFromAlarm ( uint32_t  det_id,
const TrackerTopology tTopo,
DQMStore dqm_store,
bool  isBad,
std::map< unsigned int, std::string > &  badmodmap 
)
private

Definition at line 235 of file SiStripTrackerMapCreator.cc.

References comment, detFlag_, RemoveAddSevLevel::flag, getDetectorFlagAndComment(), SiStripUtility::getDetectorStatusColor(), TrackerTopology::layer(), AlCaHLTBitMon_QueryRunRegistry::string, trackerMap_, and parallelization::uint.

Referenced by setTkMapFromAlarm().

239  {
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 }
std::unique_ptr< TrackerMap > trackerMap_
static void getDetectorStatusColor(int status, int &rval, int &gval, int &bval)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
unsigned long long int rval
Definition: vlib.h:21
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
unsigned int layer(const DetId &id) const
std::map< uint32_t, uint16_t > detFlag_
#define comment(par)
Definition: vmac.h:163
void SiStripTrackerMapCreator::paintTkMapFromHistogram ( MonitorElement const *  me,
std::string const &  map_type,
std::vector< std::pair< float, uint32_t >> *  topNmodVec 
)
private

Definition at line 325 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(), Skims_PA_cff::name, nDet_, ResidualsRMS_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, tkDetMap_, tkMapMax_, MonitorElementData::TPROFILE2D, and trackerMap_.

Referenced by setTkMapFromHistogram().

327  {
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 }
std::unique_ptr< TrackerMap > trackerMap_
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,
edm::EventSetup const &  eSetup 
)
private

Definition at line 507 of file SiStripTrackerMapCreator.cc.

References constexpr, edm::EventSetup::get(), edm::ESHandle< T >::product(), sRunNumber, SiStripDetId::subDetector(), SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), and SiStripDetId::TOB.

Referenced by setTkMapFromAlarm().

508  {
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 }
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
T const * product() const
Definition: ESHandle.h:86
#define constexpr
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,
edm::EventSetup const &  eSetup 
)
private

Definition at line 595 of file SiStripTrackerMapCreator.cc.

References comment, RemoveAddSevLevel::flag, edm::EventSetup::get(), getDetectorFlagAndComment(), numTopModules_, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::subDetector(), subdetector, SiStripDetId::TEC, TrackerTopology::tecSide(), SiStripDetId::TIB, SiStripDetId::TID, TrackerTopology::tidSide(), SiStripDetId::TOB, and topModLabel_.

Referenced by setTkMapFromHistogram().

596  {
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 }
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
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
static constexpr auto TIB
Definition: SiStripDetId.h:37
T const * product() const
Definition: ESHandle.h:86
static constexpr auto TEC
Definition: SiStripDetId.h:40
unsigned int tecSide(const DetId &id) const
#define comment(par)
Definition: vmac.h:163
bool SiStripTrackerMapCreator::readConfiguration ( )
void SiStripTrackerMapCreator::setTkMapFromAlarm ( DQMStore dqm_store,
edm::EventSetup const &  eSetup 
)
private

Definition at line 193 of file SiStripTrackerMapCreator.cc.

References detCabling_, eSetup_, edm::EventSetup::get(), SiStripDetCabling::getDetCabling(), SiStripQuality::IsModuleBad(), nDet_, paintTkMapFromAlarm(), printBadModuleList(), edm::ESHandle< T >::product(), ssqLabel_, tkMapMax_, tkMapMin_, trackerMap_, and useSSQuality_.

Referenced by create(), and createForOffline().

193  {
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_) {
206  eSetup_.get<SiStripQualityRcd>().get(ssqLabel_, ssq);
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 }
std::unique_ptr< TrackerMap > trackerMap_
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
bool IsModuleBad(const uint32_t &detid) const
void printBadModuleList(std::map< unsigned int, std::string > const &badmodmap, edm::EventSetup const &eSetup)
edm::ESHandle< SiStripDetCabling > detCabling_
void paintTkMapFromAlarm(uint32_t det_id, const TrackerTopology *tTopo, DQMStore &dqm_store, bool isBad, std::map< unsigned int, std::string > &badmodmap)
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:198
edm::EventSetup const & eSetup_
void SiStripTrackerMapCreator::setTkMapFromHistogram ( DQMStore dqm_store,
std::string const &  htype,
edm::EventSetup const &  eSetup 
)
private

Definition at line 266 of file SiStripTrackerMapCreator.cc.

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

Referenced by create(), and createForOffline().

268  {
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 }
void paintTkMapFromHistogram(MonitorElement const *me, std::string const &map_type, std::vector< std::pair< float, uint32_t >> *topNmodVec)
void printTopModules(std::vector< std::pair< float, uint32_t >> &topNmodVec, edm::EventSetup const &eSetup)
double sd
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void SiStripTrackerMapCreator::setTkMapRange ( std::string const &  map_type)
private

Definition at line 643 of file SiStripTrackerMapCreator.cc.

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

Referenced by create().

643  {
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 }
std::unique_ptr< TrackerMap > trackerMap_
void SiStripTrackerMapCreator::setTkMapRangeOffline ( )
private

Member Data Documentation

DetId SiStripTrackerMapCreator::cachedDetId_ {}
private

Definition at line 81 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

int16_t SiStripTrackerMapCreator::cachedLayer_ {}
private

Definition at line 82 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

TkLayerMap::XYbin SiStripTrackerMapCreator::cachedXYbin_
private

Definition at line 84 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

edm::ESHandle<SiStripDetCabling> SiStripTrackerMapCreator::detCabling_
private
std::map<uint32_t, uint16_t> SiStripTrackerMapCreator::detFlag_
private

Definition at line 83 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromAlarm().

edm::EventSetup const& SiStripTrackerMapCreator::eSetup_
private
float SiStripTrackerMapCreator::meanToMaxFactor_ {2.5}
private
int SiStripTrackerMapCreator::nDet_
private
uint32_t SiStripTrackerMapCreator::numTopModules_
private

Definition at line 86 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::ResidualsRMS_
private

Definition at line 75 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and paintTkMapFromHistogram().

std::string SiStripTrackerMapCreator::sRunNumber
private

Definition at line 67 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printBadModuleList().

std::string SiStripTrackerMapCreator::ssqLabel_
private

Definition at line 76 of file SiStripTrackerMapCreator.h.

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

std::string SiStripTrackerMapCreator::stripTopLevelDir_ {}
private

Definition at line 69 of file SiStripTrackerMapCreator.h.

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

TkDetMap const* SiStripTrackerMapCreator::tkDetMap_
private
float SiStripTrackerMapCreator::tkMapMax_
private
float SiStripTrackerMapCreator::tkMapMin_
private
std::string SiStripTrackerMapCreator::tkMapName_
private

Definition at line 68 of file SiStripTrackerMapCreator.h.

std::string SiStripTrackerMapCreator::topModLabel_
private

Definition at line 87 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::topModules_
private

Definition at line 85 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and setTkMapFromHistogram().

std::unique_ptr<TrackerMap> SiStripTrackerMapCreator::trackerMap_ { 0 }
private
bool SiStripTrackerMapCreator::useSSQuality_
private

Definition at line 74 of file SiStripTrackerMapCreator.h.

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