CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripTrackerMapCreator Class Reference

#include <SiStripTrackerMapCreator.h>

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, std::vector< uint32_t > const &detidList)
 
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_ {nullptr}
 
bool useSSQuality_
 

Detailed Description

Definition at line 24 of file SiStripTrackerMapCreator.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file SiStripTrackerMapCreator.cc.

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

24  : eSetup_{eSetup}
25 {
27  edm::ESHandle<TkDetMap> tkDetMapHandle;
28  eSetup_.get<TrackerTopologyRcd>().get(tkDetMapHandle);
29  tkDetMap_ = tkDetMapHandle.product();
30 }
edm::ESHandle< SiStripDetCabling > detCabling_
T get() const
Definition: EventSetup.h:71
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 36 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_.

40 {
41  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
42 
43  if(!fedcabling) return;
44 
46  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
47  const TrackerTopology* const tTopo = tTopoHandle.product();
48 
49  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
50  std::string tmap_title = " Tracker Map from " + map_type;
51  trackerMap_->setTitle(tmap_title);
52 
53  nDet_ = 0;
54  tkMapMax_ = 0.0;
55  tkMapMin_ = 0.0;
56  meanToMaxFactor_ = 2.5;
57  useSSQuality_ = false;
58  ssqLabel_ = "";
59  stripTopLevelDir_="SiStrip";
60 
61  if (map_type == "QTestAlarm") {
62  setTkMapFromAlarm(dqm_store, eSetup);
63  } else {
64  trackerMap_->fill_all_blank();
65  setTkMapFromHistogram(dqm_store, map_type, eSetup);
66  setTkMapRange(map_type);
67  }
68  trackerMap_->printonline();
69  trackerMap_.reset();
70 }
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 73 of file SiStripTrackerMapCreator.cc.

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

77 {
78  // Determine the strip top level dirctory in the DQM file: it is the
79  // path where MechanicalView is minus one directory
80  std::string const mdir{"MechanicalView"};
81  dqm_store.cd();
82  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
83  edm::LogError("SiStripTopLevelDirNotFound") << "I cannot find the SiStrip top level directory in the DQM file";
84  }
85  else {
86  const std::string& mechanicalview_dir = dqm_store.pwd();
87  stripTopLevelDir_=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of("/"));
88  edm::LogInfo("SiStripTopLevelDirFound") << "SiStrip top level directory is " << stripTopLevelDir_;
89  }
90  dqm_store.cd();
91 
92  //
93  const SiStripFedCabling* fedcabling = detCabling_->fedCabling();
94 
95  if(!fedcabling) return;
96 
98  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
99  const TrackerTopology* const tTopo = tTopoHandle.product();
100 
101  trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
102 
103  meanToMaxFactor_ = tkmapPset.getUntrackedParameter<double>("meanToMaxFact",2.5);
104  useSSQuality_ = tkmapPset.getUntrackedParameter<bool>("useSSQuality",false);
105  ssqLabel_ = tkmapPset.getUntrackedParameter<std::string>("ssqLabel","");
106  bool tkMapPSU = tkmapPset.getUntrackedParameter<bool>("psuMap",false);
107  bool tkMapFED = tkmapPset.getUntrackedParameter<bool>("fedMap",false);
108  std::string namesuffix = tkmapPset.getUntrackedParameter<std::string>("mapSuffix","");
109 
110  // std::string tmap_title = " Tracker Map from " + map_type;
111  unsigned int runNumber_ =
112  tkmapPset.getUntrackedParameter<unsigned int>("RunNumber", 1);
113  std::stringstream ss;
114  ss << runNumber_;
115  sRunNumber = ss.str();
116  std::cout << sRunNumber << "\n\n\n\n\n\n";
117  std::string tmap_title;
118  if (runNumber_ > 0) {
119  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
120  } else {
121  tmap_title = " Tracker Map from " + map_type;
122  }
123  trackerMap_->setTitle(tmap_title);
124 
125  if(tkmapPset.exists("TopModules"))
126  topModules_ = tkmapPset.getUntrackedParameter<bool>("TopModules");
127  else
128  topModules_ = false;
129 
130  if(tkmapPset.exists("numberTopModules"))
132  tkmapPset.getUntrackedParameter<uint32_t>("numberTopModules");
133  else
134  numTopModules_ = 20;
135 
136  if (tkmapPset.exists("topModLabel"))
137  topModLabel_ = tkmapPset.getUntrackedParameter<int32_t>("topModLabel");
138  else
139  topModLabel_ = " top Modules " + map_type;
140 
141  if (map_type == "QTestAlarm") {
142  setTkMapFromAlarm(dqm_store, eSetup);
143  }
144  else {
145  setTkMapFromHistogram(dqm_store, map_type, eSetup);
146  }
147  // if not overwitten by manual configuration min=0 and max= mean value * meanToMaxFactor_
149 
150  // check manual setting
151 
152  if(tkmapPset.exists("mapMax")) tkMapMax_ = tkmapPset.getUntrackedParameter<double>("mapMax");
153  if(tkmapPset.exists("mapMin")) tkMapMin_ = tkmapPset.getUntrackedParameter<double>("mapMin");
154 
155  if (map_type == "ResidualsMean"){
156  ResidualsRMS_ = false;
157  setTkMapFromHistogram(dqm_store, map_type, eSetup);
158  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
159  trackerMap_->save(true, 0.0000000001,0.005, map_type+namesuffix+".svg");
160  trackerMap_->save(true, 0.0000000001,0.005, map_type+namesuffix+".png",4500,2400);
161  ResidualsRMS_ = true;
162  map_type = "ResidualsRMS";
163  if (runNumber_ > 0) {
164  tmap_title = " Run: " + sRunNumber + ", Tracker Map from " + map_type;
165  } else {
166  tmap_title = " Tracker Map from " + map_type;
167  }
168  trackerMap_->setTitle(tmap_title);
169  setTkMapFromHistogram(dqm_store, map_type, eSetup);
170  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to 0.0 - 1.0";
171  trackerMap_->save(true, 0.0, 1.0, map_type+namesuffix+".svg");
172  trackerMap_->save(true, 0.0, 1.0, map_type+namesuffix+".png",4500,2400);
173  } else {
174  edm::LogInfo("TkMapToBeSaved") << "Ready to save TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
175  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".svg");
176  trackerMap_->save(true, tkMapMin_,tkMapMax_, map_type+namesuffix+".png",4500,2400);
177  }
178 
179  if(tkMapPSU) {
180 
181  edm::LogInfo("PSUMapToBeSaved") << "Ready to save PSU TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
182  trackerMap_->save_as_psutrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_psu.png");
183 
184  }
185 
186  if(tkMapFED) {
187 
188  edm::LogInfo("FEDMapToBeSaved") << "Ready to save FED TkMap " << map_type << namesuffix << " with range set to " << tkMapMin_ << " - " << tkMapMax_;
189  trackerMap_->save_as_fedtrackermap(true, tkMapMin_,tkMapMax_, map_type+namesuffix+"_fed.png");
190 
191  }
192  trackerMap_.reset();
193 }
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)
std::string const & pwd() const
Definition: DQMStore.cc:539
const SiStripFedCabling * fedCabling() const
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
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,
std::vector< uint32_t > const &  detidList 
)

Definition at line 450 of file SiStripTrackerMapCreator.cc.

References DQMStore::cd(), compare_using_db::dirname, getDetectorFlag(), SiStripUtility::goToDir(), triggerObjects_cff::id, DQMStore::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, and tkDetMap_.

455 {
456  std::map<std::string, float> tkhmap_value;
457  int qtalarm_flag = 0;
458  uint32_t det_id = 0;
459 
460  if(!tkinfo_tree) {
461  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
462  }
463  else {
464  tkinfo_tree->Branch("DetId", &det_id, "DetId/i");
465  for (auto const& mapname : map_names) {
466  if(mapname == "QTestAlarm") {
467  qtalarm_flag = 0;
468  tkinfo_tree->Branch(mapname.c_str(),&qtalarm_flag,std::string(mapname+"/I").c_str());
469  } else {
470  tkhmap_value[mapname] = -1.0;
471  tkinfo_tree->Branch(mapname.c_str(),&tkhmap_value[mapname],std::string(mapname+"/F").c_str());
472  }
473  }
474 
475  std::string dirname = "";
476 
477  std::string mdir = "MechanicalView";
478  dqm_store.cd();
479  if (!SiStripUtility::goToDir(dqm_store, mdir)) {
480  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "I cannot find the SiStrip top level directory in the DQM file";
481  }
482  else {
483  const std::string& mechanicalview_dir = dqm_store.pwd();
484  dirname=mechanicalview_dir.substr(0,mechanicalview_dir.find_last_of("/"));
485  edm::LogInfo("SiStripTrackerMapCreator::createInfoFile") << "SiStrip top level directory is " << dirname;
486  }
487  dqm_store.cd();
488 
489  std::vector<TkHistoMap> tkHMaps;
490 
491  uint32_t nHists = map_names.size();
492 
493  for (uint32_t ih = 0; ih < nHists; ++ih) {
494  tkHMaps.emplace_back(tkDetMap_);
495  if(map_names.at(ih) != "QTestAlarm") {
496  std::string tkhmap_name = "TkHMap_" + map_names.at(ih);
497  tkHMaps.at(ih).loadTkHistoMap(dirname, tkhmap_name, true);
498  }
499  }
500 
501  for (auto const id : detidList) {
502  det_id = id;
503  for (uint32_t ih = 0; ih < nHists; ++ih) {
504  if (map_names.at(ih) == "QTestAlarm") {
505  qtalarm_flag = getDetectorFlag(id);
506  } else {
507  tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(id);
508  }
509  }
510  if (!tkinfo_tree) {
511  edm::LogError("SiStripTrackerMapCreator::createInfoFile") << "Tree not found!";
512  }
513  else {
514  tkinfo_tree->Fill();
515  }
516  }
517  }
518 }
uint16_t getDetectorFlag(uint32_t const det_id)
std::string const & pwd() const
Definition: DQMStore.cc:539
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
static bool goToDir(DQMStore &dqm_store, std::string const &name)
uint16_t SiStripTrackerMapCreator::getDetectorFlag ( uint32_t const  det_id)
inlineprivate

Definition at line 64 of file SiStripTrackerMapCreator.h.

Referenced by createInfoFile().

65  {
66  return detFlag_.find(det_id) != detFlag_.end() ? detFlag_[det_id] : 0;
67  }
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 377 of file SiStripTrackerMapCreator.cc.

References DQMStore::cd(), constexpr, detCabling_, DQMStore::dirExists(), MonitorElement::DQM_KIND_INT, RemoveAddSevLevel::flag, DQMStore::get(), SiStripUtility::getBadModuleStatus(), SiStripDetCabling::getConnections(), SiStripFolderOrganizer::getSubDetFolder(), LogDebug, SiStripFolderOrganizer::setSiStripFolderName(), AlCaHLTBitMon_QueryRunRegistry::string, and stripTopLevelDir_.

Referenced by paintTkMapFromAlarm(), and printTopModules().

382 {
383  comment << "Module " << det_id;
384  uint16_t flag = 0;
385 
386  // get FED channels corresponding to the det_id
387 
388  comment << " FEDCHs ";
389  constexpr std::size_t indent_width{7ull};
390  std::vector<const FedChannelConnection*> conns =
391  detCabling_->getConnections(det_id);
392  for (auto const conn : conns) {
393  if (conn) {
394  comment << std::setw(3) << conn->fedId() << "/" << std::setw(2)
395  << conn->fedCh() << " ";
396  }
397  else {
398  comment << std::string(indent_width, ' ');
399  }
400  }
401  if (conns.empty()) {
402  comment << std::string(indent_width * 3, ' ');
403  } else if (conns.size() == 1) {
404  comment << std::string(indent_width * 2, ' ');
405  } else if (conns.size() == 2) {
406  comment << std::string(indent_width, ' ');
407  }
408 
409  if(!dqm_store) return flag;
410 
411  SiStripFolderOrganizer folder_organizer;
412  std::string subdet_folder, badmodule_folder;
413 
414  dqm_store->cd();
415 
416  folder_organizer.setSiStripFolderName(stripTopLevelDir_);
417  folder_organizer.getSubDetFolder(det_id, tTopo, subdet_folder);
418 
419  LogDebug("SearchBadModule") << det_id << " " << subdet_folder << " " << stripTopLevelDir_;
420 
421  if (dqm_store->dirExists(subdet_folder)){
422  badmodule_folder = subdet_folder + "/BadModuleList";
423  LogDebug("SearchBadModule") << subdet_folder << " exists: " << badmodule_folder;
424  } else {
425  edm::LogError("SubDetFolderNotFound") << subdet_folder << " does not exist for detid " << det_id;
426  return flag;
427  }
428  if (!dqm_store->dirExists(badmodule_folder)) {
429  LogDebug("BadModuleFolderNotFound") << badmodule_folder << " does not exist for detid " << det_id;
430  return flag;
431  }
432  std::ostringstream badmodule_path;
433  badmodule_path << badmodule_folder << "/" << det_id;
434  LogDebug("SearchBadModule") << badmodule_folder << " exists: " << badmodule_path;
435 
436  auto const* bad_module_me = dqm_store->get(badmodule_path.str());
437  if (bad_module_me && bad_module_me->kind() == MonitorElement::DQM_KIND_INT) {
438  LogDebug("SearchBadModule") << "Monitor Element found";
439  flag = bad_module_me->getIntValue();
440  std::string message;
441  SiStripUtility::getBadModuleStatus(flag, message);
442  comment << message.c_str();
443  }
444  return flag;
445 }
#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
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:635
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
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 242 of file SiStripTrackerMapCreator.cc.

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

Referenced by setTkMapFromAlarm().

248 {
249  std::ostringstream comment;
250  uint16_t flag = 0;
251  flag = getDetectorFlagAndComment(&dqm_store, det_id, tTopo, comment);
252 
253  int rval, gval, bval;
254  SiStripUtility::getDetectorStatusColor(flag, rval, gval, bval);
255  if (isBad) {
256  rval = 255;
257  gval = 255;
258  bval = 0;
259  comment << " PCLBadModule ";
260  }
261  trackerMap_->setText(det_id, comment.str());
262  trackerMap_->fillc(det_id, rval, gval, bval);
263 
264  if (flag != 0 || isBad) {
265  uint lay = tTopo->layer(SiStripDetId(det_id));
266  std::string layer =" Layer "+ std::to_string(lay);
267  badmodmap[det_id] = comment.str() + layer;
268  }
269 
270  detFlag_[det_id] = flag;
271 }
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:17
unsigned long long int rval
Definition: vlib.h:22
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
def uint(string)
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 333 of file SiStripTrackerMapCreator.cc.

References funct::abs(), cachedDetId_, cachedLayer_, cachedXYbin_, MonitorElement::DQM_KIND_TPROFILE2D, MonitorElement::getBinContent(), TkDetMap::getDetsForLayer(), TkDetMap::getLayerNum(), MonitorElement::getName(), MonitorElement::getTProfile2D(), TkDetMap::getXY(), TkLayerMap::XYbin::ix, TkLayerMap::XYbin::iy, MonitorElement::kind(), dataset::name, nDet_, ResidualsRMS_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, tkDetMap_, tkMapMax_, and trackerMap_.

Referenced by setTkMapFromHistogram().

337 {
338  const std::string& name = me->getName();
339  std::string lname = name.substr(name.find("TkHMap_") + 7);
340  lname = lname.substr(lname.find("_T")+1);
341  for ( DetId det_id : tkDetMap_->getDetsForLayer(TkDetMap::getLayerNum(lname)) ) {
342  if (det_id.rawId() <= 0) continue;
343  nDet_++;
344  const TkLayerMap::XYbin& xyval =
346  float fval = 0.0;
347  if (name.find("Residuals") != std::string::npos) {
348  if(ResidualsRMS_==true){
349  if (me->kind() == MonitorElement::DQM_KIND_TPROFILE2D) {
350  TProfile2D* tp = me->getTProfile2D() ;
351  float fval_prov = tp->GetBinError(xyval.ix, xyval.iy) * sqrt(tp->GetBinEntries(tp->GetBin(xyval.ix, xyval.iy)));
352  fval = fval_prov;
353  }
354  } else {
355  float fval_prov = me->getBinContent(xyval.ix, xyval.iy);
356  fval = std::abs(fval_prov);
357  }
358  } else fval = me->getBinContent(xyval.ix, xyval.iy);
359  if (htype == "QTestAlarm") {
360  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
361  } else {
362  if (fval == 0.0) trackerMap_->fillc(det_id,255, 255, 255);
363  else {
364  trackerMap_->fill_current_val(det_id, fval);
365  if (topNmodVec) {
366  topNmodVec->emplace_back(fval, det_id);
367  }
368  }
369  tkMapMax_ += fval;
370  }
371  }
372 }
std::unique_ptr< TrackerMap > trackerMap_
std::vector< DetId > getDetsForLayer(int layer) const
Definition: TkDetMap.h:144
static int getLayerNum(const std::string &in)
Definition: TkDetMap.cc:310
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:18
const TkLayerMap::XYbin & getXY(DetId detid, DetId &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:549
void SiStripTrackerMapCreator::printBadModuleList ( std::map< unsigned int, std::string > const &  badmodmap,
edm::EventSetup const &  eSetup 
)
private

Definition at line 523 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().

526 {
527  // Retrieve tracker topology from geometry
528  edm::ESHandle<TrackerTopology> tTopoHandle;
529  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
530  const TrackerTopology* const tTopo = tTopoHandle.product();
531 
532  bool tibDone = false, tidSide1Done = false, tidSide2Done = false,
533  tobDone = false, tecSide1Done = false, tecSide2Done = false;
534  constexpr unsigned int tibFirst = 369120277 - 1,
535  tidSide1First = 402664197 - 1,
536  tidSide2First = 402672389 - 1,
537  tobFirst = 436228134 - 1,
538  tecSide1First = 470044965 - 1,
539  tecSide2First = 470307109 - 1;
540 
541  int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
542 
543  for (auto const& badmod : badmodmap) {
544  SiStripDetId ssdetid(badmod.first);
545  if (ssdetid.subDetector() == SiStripDetId::TIB) ntib++;
546  if (ssdetid.subDetector() == SiStripDetId::TID) {
547 
548  if (tTopo->tidSide(ssdetid) == 1) ntids1++;
549  if (tTopo->tidSide(ssdetid) == 2) ntids2++;
550  }
551  if (ssdetid.subDetector() == SiStripDetId::TOB) ntob++;
552  if (ssdetid.subDetector() == SiStripDetId::TEC) {
553 
554  if (tTopo->tecSide(ssdetid) == 1) ntecs1++;
555  if (tTopo->tecSide(ssdetid) == 2) ntecs2++;
556  }
557  }
558 
559  edm::LogVerbatim("BadModuleList")
560  << "Run: " << sRunNumber << ", Number of bad modules in total:";
561  edm::LogVerbatim("BadModuleList")
562  << "--------------------------------------------------------------";
563  edm::LogVerbatim("BadModuleList") << "TIB: " << ntib;
564  edm::LogVerbatim("BadModuleList") << "TID/MINUS: " << ntids1;
565  edm::LogVerbatim("BadModuleList") << "TID/PLUS: " << ntids2;
566  edm::LogVerbatim("BadModuleList") << "TOB: " << ntob;
567  edm::LogVerbatim("BadModuleList") << "TEC/MINUS: " << ntecs1;
568  edm::LogVerbatim("BadModuleList") << "TEC/PLUS: " << ntecs2;
569  edm::LogVerbatim("BadModuleList") << "-------------------------------";
570  edm::LogVerbatim("BadModuleList");
571  edm::LogVerbatim("BadModuleList") << "List of bad modules per partition:";
572  edm::LogVerbatim("BadModuleList") << "----------------------------------";
573 
574  for (auto const& badmod : badmodmap) {
575  if (!tibDone && badmod.first >= tibFirst) {
576  tibDone = true;
577  edm::LogVerbatim("BadModuleList");
578  edm::LogVerbatim("BadModuleList") << "SubDetector TIB";
579  edm::LogVerbatim("BadModuleList");
580  }
581  if (!tidSide1Done && badmod.first >= tidSide1First) {
582  tidSide1Done = true;
583  edm::LogVerbatim("BadModuleList");
584  edm::LogVerbatim("BadModuleList") << "SubDetector TID/MINUS";
585  edm::LogVerbatim("BadModuleList");
586  }
587  if (!tidSide2Done && badmod.first >= tidSide2First) {
588  tidSide2Done = true;
589  edm::LogVerbatim("BadModuleList");
590  edm::LogVerbatim("BadModuleList") << "SubDetector TID/PLUS";
591  edm::LogVerbatim("BadModuleList");
592  }
593  if (!tobDone && badmod.first >= tobFirst) {
594  tobDone = true;
595  edm::LogVerbatim("BadModuleList");
596  edm::LogVerbatim("BadModuleList") << "SubDetector TOB";
597  edm::LogVerbatim("BadModuleList");
598  }
599  if (!tecSide1Done && badmod.first >= tecSide1First) {
600  tecSide1Done = true;
601  edm::LogVerbatim("BadModuleList");
602  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/MINUS";
603  edm::LogVerbatim("BadModuleList");
604  }
605  if (!tecSide2Done && badmod.first >= tecSide2First) {
606  tecSide2Done = true;
607  edm::LogVerbatim("BadModuleList");
608  edm::LogVerbatim("BadModuleList") << "SubDetector TEC/PLUS";
609  edm::LogVerbatim("BadModuleList");
610  }
611  edm::LogVerbatim("BadModuleList") << badmod.second;
612  }
613 }
unsigned int tidSide(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
T const * product() const
Definition: ESHandle.h:86
#define constexpr
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 616 of file SiStripTrackerMapCreator.cc.

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

Referenced by setTkMapFromHistogram().

619 {
621  edm::ESHandle<TrackerTopology> tTopoHandle;
622  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
623  const TrackerTopology* const tTopo = tTopoHandle.product();
624 
625  if (topNmodVec.empty()) return;
626 
627  std::sort(topNmodVec.rbegin(), topNmodVec.rend());
628  if (topNmodVec.size() > numTopModules_) topNmodVec.resize(numTopModules_);
629 
630  edm::LogVerbatim("TopModules") << topModLabel_;
631  edm::LogVerbatim("TopModules")
632  << "------------------------------------------------------";
633 
634  for (auto const& aPair : topNmodVec) {
635  uint32_t det_id = aPair.second;
636  std::ostringstream comment;
638  SiStripDetId ssdetid(aPair.second);
639  if (ssdetid.subDetector() == SiStripDetId::TIB) subdetector = "TIB ";
640  if (ssdetid.subDetector() == SiStripDetId::TID) {
641  if (tTopo->tidSide(ssdetid) == 1) subdetector = "TID/MINUS ";
642  if (tTopo->tidSide(ssdetid) == 2) subdetector = "TID/PLUS ";
643  }
644  if (ssdetid.subDetector() == SiStripDetId::TOB) subdetector = "TOB ";
645  if (ssdetid.subDetector() == SiStripDetId::TEC) {
646  if (tTopo->tecSide(ssdetid) == 1) subdetector = "TEC/MINUS ";
647  if (tTopo->tecSide(ssdetid) == 2) subdetector = "TEC/PLUS ";
648  }
649  uint16_t flag = getDetectorFlagAndComment(nullptr, det_id, tTopo, comment);
650  if (flag == 0)
651  edm::LogVerbatim("TopModules")
652  << subdetector << comment.str() << " value: " << aPair.first;
653  }
654  edm::LogVerbatim("TopModules")
655  << "------------------------------------------------------";
656 }
TString subdetector
unsigned int tidSide(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
uint16_t getDetectorFlagAndComment(DQMStore *dqm_store, uint32_t det_id, TrackerTopology const *tTopo, std::ostringstream &comment)
T const * product() const
Definition: ESHandle.h:86
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 199 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().

201 {
202  //Retrieve tracker topology from geometry
203  edm::ESHandle<TrackerTopology> tTopoHandle;
204  eSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
205  const TrackerTopology* const tTopo = tTopoHandle.product();
206 
207  nDet_ = 0;
208  tkMapMax_ = 0.0;
209  tkMapMin_ = 0.0;
210 
212 
214 
215  trackerMap_->fillc_all_blank();
216 
217  std::map<unsigned int, std::string> badmodmap;
218 
219  // used to avoid multiple checks on the same detid since the loop is done on the FED channels
220  uint32_t detId_save = 0;
221  // example of loop using SiStripDetCabling
222  for (auto const& module : detCabling_->getDetCabling()) {
223  uint32_t detId = module.first;
224  if (detId == 0 || detId == 0xFFFFFFFF) continue;
225  if (detId_save != detId) {
226  detId_save = detId;
227  bool isBad = useSSQuality_ && ssq->IsModuleBad(detId);
228  paintTkMapFromAlarm(detId, tTopo, dqm_store, isBad, badmodmap);
229  } else {
230  edm::LogWarning("TwiceTheSameDetId")
231  << "The detid " << detId
232  << " was found already in the loop on SiStripDetCabling";
233  }
234  }
235  printBadModuleList(badmodmap, eSetup);
236 }
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:71
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208
edm::EventSetup const & eSetup_
void SiStripTrackerMapCreator::setTkMapFromHistogram ( DQMStore dqm_store,
std::string const &  htype,
edm::EventSetup const &  eSetup 
)
private

Definition at line 276 of file SiStripTrackerMapCreator.cc.

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

Referenced by create(), and createForOffline().

279 {
280  dqm_store.cd();
281 
282  std::string const mdir{"MechanicalView"};
283  if (!SiStripUtility::goToDir(dqm_store, mdir)) return;
284  std::string mechanicalview_dir = dqm_store.pwd();
285 
286  std::vector<std::string> subdet_folder;
287  subdet_folder.push_back("TIB");
288  subdet_folder.push_back("TOB");
289  subdet_folder.push_back("TEC/MINUS");
290  subdet_folder.push_back("TEC/PLUS");
291  subdet_folder.push_back("TID/MINUS");
292  subdet_folder.push_back("TID/PLUS");
293 
294  nDet_ = 0;
295  tkMapMax_ = 0.0;
296  tkMapMin_ = 0.0;
297 
298  auto topNmodVec =
299  topModules_ ? new std::vector<std::pair<float, uint32_t>>{} : nullptr;
300  for (auto const& sd : subdet_folder) {
301  std::string dname = mechanicalview_dir + "/" + sd;
302  if (!dqm_store.dirExists(dname)) continue;
303  dqm_store.cd(dname);
304  std::vector<std::string> layerVec = dqm_store.getSubdirs();
305  for (auto const& layer : layerVec) {
306  if (layer.find("BadModuleList") != std::string::npos) continue;
307  std::vector<MonitorElement*> meVec = dqm_store.getContents(layer);
308  MonitorElement* tkhmap_me{nullptr};
310  for (auto tkh : meVec) {
311  name = tkh->getName();
312  if (name.find("TkHMap") == std::string::npos) continue;
313  if (htype == "QTestAlarm" ){
314  edm::LogError("ItShouldNotBeHere") << "QTestAlarm map: you should not be here!";
315  tkhmap_me = tkh;
316  break;
317  } else if (name.find(htype) != std::string::npos) {
318  tkhmap_me = tkh;
319  break;
320  }
321  }
322  if (tkhmap_me != nullptr) {
323  paintTkMapFromHistogram(tkhmap_me, htype, topNmodVec);
324  }
325  }
326  dqm_store.cd(mechanicalview_dir);
327  }
328  dqm_store.cd();
329  if (topNmodVec) printTopModules(*topNmodVec, eSetup);
330 }
std::vector< MonitorElement * > getContents(std::string const &path) const
Definition: DQMStore.cc:1640
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)
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:635
std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:1564
std::string const & pwd() const
Definition: DQMStore.cc:539
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:546
double sd
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void SiStripTrackerMapCreator::setTkMapRange ( std::string const &  map_type)
private

Definition at line 662 of file SiStripTrackerMapCreator.cc.

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

Referenced by create().

663 {
664  tkMapMin_ = 0.0;
665  if (tkMapMax_ == 0.0) {
666  if (map_type.find("FractionOfBadChannels") != std::string::npos)
667  tkMapMax_ = 1.0;
668  else if (map_type.find("NumberOfCluster") != std::string::npos)
669  tkMapMax_ = 0.01;
670  else if (map_type.find("NumberOfDigi") != std::string::npos)
671  tkMapMax_ = 0.6;
672  else if (map_type.find("NumberOfOffTrackCluster") != std::string::npos)
673  tkMapMax_ = 100.0;
674  else if (map_type.find("NumberOfOnTrackCluster") != std::string::npos)
675  tkMapMax_ = 50.0;
676  else if (map_type.find("StoNCorrOnTrack") != std::string::npos)
677  tkMapMax_ = 200.0;
678  } else {
679  tkMapMax_ = tkMapMax_ / nDet_ * 1.0;
681  }
682  trackerMap_->setRange(tkMapMin_, tkMapMax_);
683 }
std::unique_ptr< TrackerMap > trackerMap_
void SiStripTrackerMapCreator::setTkMapRangeOffline ( )
private

Member Data Documentation

DetId SiStripTrackerMapCreator::cachedDetId_ {}
private

Definition at line 88 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

int16_t SiStripTrackerMapCreator::cachedLayer_ {}
private

Definition at line 89 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromHistogram().

TkLayerMap::XYbin SiStripTrackerMapCreator::cachedXYbin_
private

Definition at line 91 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 90 of file SiStripTrackerMapCreator.h.

Referenced by paintTkMapFromAlarm().

edm::EventSetup const& SiStripTrackerMapCreator::eSetup_
private

Definition at line 86 of file SiStripTrackerMapCreator.h.

Referenced by setTkMapFromAlarm(), and SiStripTrackerMapCreator().

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

Definition at line 93 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::ResidualsRMS_
private

Definition at line 82 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and paintTkMapFromHistogram().

std::string SiStripTrackerMapCreator::sRunNumber
private

Definition at line 74 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printBadModuleList().

std::string SiStripTrackerMapCreator::ssqLabel_
private

Definition at line 83 of file SiStripTrackerMapCreator.h.

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

std::string SiStripTrackerMapCreator::stripTopLevelDir_ {}
private

Definition at line 76 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 75 of file SiStripTrackerMapCreator.h.

std::string SiStripTrackerMapCreator::topModLabel_
private

Definition at line 94 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and printTopModules().

bool SiStripTrackerMapCreator::topModules_
private

Definition at line 92 of file SiStripTrackerMapCreator.h.

Referenced by createForOffline(), and setTkMapFromHistogram().

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

Definition at line 81 of file SiStripTrackerMapCreator.h.

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