CMS 3D CMS Logo

List of all members | Static Public Member Functions
SiStripUtility Class Reference

#include <SiStripUtility.h>

Static Public Member Functions

static bool checkME (std::string const &element, std::string const &name, std::string &full_path)
 
static void getBadModuleStatus (uint16_t flag, std::string &message)
 
static void getDetectorStatusColor (int status, int &rval, int &gval, int &bval)
 
static int getMEList (std::string const &name, std::vector< std::string > &values)
 
static int getMEList (std::string const &name, std::string &dir_path, std::vector< std::string > &me_names)
 
static int getMEStatus (MonitorElement const *me)
 
static int getMEStatus (MonitorElement const *me, int &bad_channels)
 
static void getMEStatusColor (int status, int &rval, int &gval, int &bval)
 
static void getMEStatusColor (int status, int &icol, std::string &tag)
 
static void getMEValue (MonitorElement const *me, std::string &val)
 
static void getModuleFolderList (DQMStore &dqm_store, std::vector< std::string > &m_ids)
 
static void getModuleFolderList (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::vector< std::string > &m_ids)
 
static void getSubDetectorTag (uint32_t det_id, std::string &subdet_tag, const TrackerTopology *tTopo)
 
static void getTopFolderPath (DQMStore &dqm_store, std::string const &top_dir, std::string &path)
 
static void getTopFolderPath (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string const &top_dir, std::string &path)
 
static bool goToDir (DQMStore &dqm_store, std::string const &name)
 
static bool goToDir (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string const &name)
 
static void setBadModuleFlag (std::string &hname, uint16_t &flg)
 
static void split (std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")
 

Detailed Description

Definition at line 22 of file SiStripUtility.h.

Member Function Documentation

bool SiStripUtility::checkME ( std::string const &  element,
std::string const &  name,
std::string &  full_path 
)
static

Definition at line 43 of file SiStripUtility.cc.

References split(), relativeConstraints::value, and MuonErrorMatrixValues_cff::values.

46 {
47  if (name.find(name) == std::string::npos) return false;
48  auto prefix_str = name.substr(0, (name.find(":")));
49  prefix_str += "/";
50  auto const temp_str = name.substr(name.find(":") + 1);
51  std::vector<std::string> values;
52  split(temp_str, values, ",");
53  for (auto const& value : values) {
54  if (value.find(me_name) != std::string::npos) {
55  full_path = prefix_str + value;
56  return true;
57  }
58  }
59  return false;
60 }
Definition: value.py:1
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")
void SiStripUtility::getBadModuleStatus ( uint16_t  flag,
std::string &  message 
)
static

Definition at line 363 of file SiStripUtility.cc.

References globals_cff::x1.

Referenced by SiStripTrackerMapCreator::getDetectorFlagAndComment(), and SiStripActionExecutor::printFaultyModuleList().

363  {
364  if (flag == 0) message += " No Error";
365  else {
366  if (((flag >> 0) & 0x1) > 0) message += " Fed BadChannel : ";
367  if (((flag >> 1) & 0x1) > 0) message += " # of Digi : ";
368  if (((flag >> 2) & 0x1) > 0) message += " # of Clusters :";
369  if (((flag >> 3) & 0x1) > 0) message += " Excluded FED Channel ";
370  if (((flag >> 4) & 0x1) > 0) message += " DCSError ";
371  }
372 }
void SiStripUtility::getDetectorStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 125 of file SiStripUtility.cc.

References globals_cff::x1.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm().

125  {
126  // No Error
127  if (status == 0) {
128  rval = 0; gval = 255;bval = 0;
129  return;
130  }
131  // Error detected in FED Channel
132  if (((status >> 0) & 0x1) > 0) {
133  rval = 150;
134  gval = 0;
135  bval = 0;
136  return;
137  }
138  // Excluded FED Channel
139  if (((status >> 3) & 0x1) > 0) {
140  rval = 100;
141  gval = 100;
142  bval = 255;
143  return;
144  }
145  // DCS Error
146  if (((status >> 4) & 0x1) > 0) {
147  rval = 200;
148  gval = 20;
149  bval = 255;
150  return;
151  }
152  // Digi and Cluster Problem
153  if (((status >> 1) & 0x1) > 0) {
154  rval = 255; bval = 0;
155  if (((status >> 2) & 0x1) > 0) gval = 0;
156  else gval = 100;
157  } else {
158  rval = 251;
159  gval = 0;
160  bval = 100;
161  }
162 }
unsigned long long int rval
Definition: vlib.h:22
int SiStripUtility::getMEList ( std::string const &  name,
std::vector< std::string > &  values 
)
static

Definition at line 12 of file SiStripUtility.cc.

References split().

14 {
15  values.clear();
16  auto prefix_str = name.substr(0, (name.find(":")));
17  prefix_str += "/";
18  auto const temp_str = name.substr(name.find(":") + 1);
19  split(temp_str, values, ",");
20  for (auto& value : values) {
21  value.insert(0, prefix_str);
22  }
23  return values.size();
24 }
Definition: value.py:1
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")
int SiStripUtility::getMEList ( std::string const &  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static

Definition at line 29 of file SiStripUtility.cc.

References split().

32 {
33  values.clear();
34  dir_path = name.substr(0,(name.find(":")));
35  dir_path += "/";
36  auto const temp_str = name.substr(name.find(":") + 1);
37  split(temp_str, values, ",");
38  return values.size();
39 }
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")
int SiStripUtility::getMEStatus ( MonitorElement const *  me)
static

Definition at line 168 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, MonitorElement::getQReports(), MonitorElement::hasError(), MonitorElement::hasOtherReport(), MonitorElement::hasWarning(), dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by SiStripQualityChecker::fillSubDetStatus(), and SiStripHistoPlotter::makePlot().

169 {
170  int status = 0;
171  if (me->getQReports().empty()) {
172  return status;
173  } else if (me->hasError()) {
174  status = dqm::qstatus::ERROR;
175  } else if (me->hasWarning()) {
176  status = dqm::qstatus::WARNING;
177  } else if (me->hasOtherReport()) {
178  status = dqm::qstatus::OTHER;
179  } else {
180  status = dqm::qstatus::STATUS_OK;
181  }
182  return status;
183 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR
int SiStripUtility::getMEStatus ( MonitorElement const *  me,
int &  bad_channels 
)
static

Definition at line 225 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, MonitorElement::getQReports(), MonitorElement::hasError(), MonitorElement::hasOtherReport(), MonitorElement::hasWarning(), dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

226 {
227  int status = 0;
228  if (me->getQReports().empty()) {
229  bad_channels = -1;
230  } else {
231  std::vector<QReport *> qreports = me->getQReports();
232  bad_channels =qreports[0]->getBadChannels().size();
233  if (me->hasError()) {
234  status = dqm::qstatus::ERROR;
235  } else if (me->hasWarning()) {
236  status = dqm::qstatus::WARNING;
237  } else if (me->hasOtherReport()) {
238  status = dqm::qstatus::OTHER;
239  } else {
240  status = dqm::qstatus::STATUS_OK;
241  }
242  }
243  return status;
244 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR
void SiStripUtility::getMEStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 86 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by SiStripHistoPlotter::makePlot().

86  {
88  rval = 0;
89  gval = 255;
90  bval = 0;
91  } else if (status == dqm::qstatus::WARNING) {
92  rval = 255; gval = 255; bval = 0;
93  } else if (status == dqm::qstatus::ERROR) {
94  rval = 255; gval = 0; bval = 0;
95  } else if (status == dqm::qstatus::OTHER) {
96  rval = 255; gval = 150; bval = 0;
97  } else {
98  rval = 0; gval = 0; bval = 255;
99  }
100 }
static const int OTHER
static const int WARNING
unsigned long long int rval
Definition: vlib.h:22
static const int STATUS_OK
static const int ERROR
void SiStripUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 104 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

104  {
106  tag = "Ok";
107  icol = 3;
108  } else if (status == dqm::qstatus::WARNING) {
109  tag = "Warning";
110  icol = 5;
111  } else if (status == dqm::qstatus::ERROR) {
112  tag = "Error";
113  icol = 2;
114  } else if (status == dqm::qstatus::OTHER) {
115  tag = "Other";
116  icol = 1;
117  } else {
118  tag = " ";
119  icol = 1;
120  }
121 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR
void SiStripUtility::getMEValue ( MonitorElement const *  me,
std::string &  val 
)
static
void SiStripUtility::getModuleFolderList ( DQMStore dqm_store,
std::vector< std::string > &  m_ids 
)
static

Definition at line 188 of file SiStripUtility.cc.

References DQMStore::cd(), DQMStore::getSubdirs(), DQMStore::goUp(), and DQMStore::pwd().

Referenced by getModuleFolderList(), and SiStripActionExecutor::printFaultyModuleList().

190 {
191  if (auto currDir = dqm_store.pwd();
192  currDir.find("module_") != std::string::npos) {
193  mfolders.push_back(currDir);
194  } else {
195  auto const subdirs = dqm_store.getSubdirs();
196  for (auto const& subdir : subdirs) {
197  dqm_store.cd(subdir);
198  getModuleFolderList(dqm_store, mfolders);
199  dqm_store.goUp();
200  }
201  }
202 }
static void getModuleFolderList(DQMStore &dqm_store, std::vector< std::string > &m_ids)
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
void goUp()
equivalent to "cd .."
Definition: DQMStore.cc:582
void SiStripUtility::getModuleFolderList ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::vector< std::string > &  m_ids 
)
static

Definition at line 205 of file SiStripUtility.cc.

References DQMStore::IBooker::cd(), getModuleFolderList(), DQMStore::IGetter::getSubdirs(), DQMStore::IBooker::goUp(), and DQMStore::IBooker::pwd().

208 {
209  if (auto currDir = ibooker.pwd();
210  currDir.find("module_") != std::string::npos) {
211  mfolders.push_back(currDir);
212  } else {
213  auto const subdirs = igetter.getSubdirs();
214  for (auto const& subdir : subdirs) {
215  ibooker.cd(subdir);
216  getModuleFolderList(ibooker, igetter, mfolders);
217  ibooker.goUp();
218  }
219  }
220 }
static void getModuleFolderList(DQMStore &dqm_store, std::vector< std::string > &m_ids)
std::string const & pwd()
Definition: DQMStore.cc:278
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:325
void SiStripUtility::getSubDetectorTag ( uint32_t  det_id,
std::string &  subdet_tag,
const TrackerTopology tTopo 
)
static

Definition at line 316 of file SiStripUtility.cc.

References DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecSide(), StripSubdetector::TIB, StripSubdetector::TID, TrackerTopology::tidSide(), and StripSubdetector::TOB.

Referenced by SiStripDcsInfo::readCabling(), SiStripDaqInfo::readFedIds(), and SiStripDcsInfo::readStatus().

319 {
320  StripSubdetector const subdet(det_id);
321  subdet_tag = "";
322  switch (subdet.subdetId()) {
323  case StripSubdetector::TIB: {
324  subdet_tag = "TIB";
325  return;
326  }
327  case StripSubdetector::TID: {
328  if (tTopo->tidSide(det_id) == 2) {
329  subdet_tag = "TIDF";
330  } else if (tTopo->tidSide(det_id) == 1) {
331  subdet_tag = "TIDB";
332  }
333  return;
334  }
335  case StripSubdetector::TOB: {
336  subdet_tag = "TOB";
337  return;
338  }
339  case StripSubdetector::TEC: {
340  if (tTopo->tecSide(det_id) == 2) {
341  subdet_tag = "TECF";
342  } else if (tTopo->tecSide(det_id) == 1) {
343  subdet_tag = "TECB";
344  }
345  }
346  }
347 }
unsigned int tidSide(const DetId &id) const
const std::string subdet_tag("SubDet")
unsigned int tecSide(const DetId &id) const
void SiStripUtility::getTopFolderPath ( DQMStore dqm_store,
std::string const &  top_dir,
std::string &  path 
)
static

Definition at line 377 of file SiStripUtility.cc.

References DQMStore::cd(), DQMStore::dirExists(), goToDir(), DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripCertificationInfo::bookSiStripCertificationMEs(), SiStripQualityChecker::bookStatus(), SiStripDcsInfo::bookStatus(), SiStripDaqInfo::bookStatus(), and SiStripCertificationInfo::fillSiStripCertificationMEsAtLumi().

380 {
381  path = "";
382  dqm_store.cd();
383  if (dqm_store.dirExists(top_dir)) {
384  dqm_store.cd(top_dir);
385  path = dqm_store.pwd();
386  } else {
387  if (SiStripUtility::goToDir(dqm_store, top_dir)) {
388  std::string mdir = "MechanicalView";
389  if (SiStripUtility::goToDir(dqm_store, mdir)) {
390  path = dqm_store.pwd();
391  path = path.substr(0, path.find(mdir) - 1);
392  }
393  }
394  }
395 }
bool dirExists(std::string const &path) const
true if directory exists
Definition: DQMStore.cc:635
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)
void SiStripUtility::getTopFolderPath ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string const &  top_dir,
std::string &  path 
)
static

Definition at line 398 of file SiStripUtility.cc.

References DQMStore::IBooker::cd(), DQMStore::IGetter::dirExists(), goToDir(), DQMStore::IBooker::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

402 {
403  path = "";
404  ibooker.cd();
405  if (igetter.dirExists(top_dir)) {
406  ibooker.cd(top_dir);
407  path = ibooker.pwd();
408  } else {
409  if (SiStripUtility::goToDir(ibooker, igetter, top_dir)) {
410  std::string tdir = "MechanicalView";
411  if (SiStripUtility::goToDir(ibooker, igetter, tdir)) {
412  path = ibooker.pwd();
413  path = path.substr(0, path.find(tdir) - 1);
414  }
415  }
416  }
417 }
std::string const & pwd()
Definition: DQMStore.cc:278
bool dirExists(std::string const &path)
Definition: DQMStore.cc:343
static bool goToDir(DQMStore &dqm_store, std::string const &name)
bool SiStripUtility::goToDir ( DQMStore dqm_store,
std::string const &  name 
)
static

Definition at line 262 of file SiStripUtility.cc.

References DQMStore::cd(), TrackerOfflineValidation_Dqm_cff::dirName, alignmentValidation::fname, DQMStore::getSubdirs(), DQMStore::goUp(), DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by SiStripDcsInfo::addBadModules(), SiStripTrackerMapCreator::createForOffline(), SiStripTrackerMapCreator::createInfoFile(), SiStripActionExecutor::createSummaryOffline(), SiStripQualityChecker::fillDetectorStatus(), SiStripQualityChecker::fillDetectorStatusAtLumi(), SiStripQualityChecker::fillFaultyModuleStatus(), SiStripCertificationInfo::fillSiStripCertificationMEs(), SiStripDaqInfo::findExcludedModule(), getTopFolderPath(), goToDir(), SiStripActionExecutor::printFaultyModuleList(), and SiStripTrackerMapCreator::setTkMapFromHistogram().

263 {
264  std::string currDir = dqm_store.pwd();
265  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
266  if (dirName.find(name) == 0) {
267  return true;
268  }
269  auto const subdirs = dqm_store.getSubdirs();
270  for (auto const& fname : subdirs) {
271  if ((fname.find("Reference") != std::string::npos) ||
272  (fname.find("AlCaReco") != std::string::npos) ||
273  (fname.find("HLT") != std::string::npos) ||
274  (fname.find("IsolatedBunches") != std::string::npos))
275  continue;
276  dqm_store.cd(fname);
277  if (!goToDir(dqm_store, name)) {
278  dqm_store.goUp();
279  } else {
280  return true;
281  }
282  }
283  return false;
284 }
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
string fname
main script
static bool goToDir(DQMStore &dqm_store, std::string const &name)
void goUp()
equivalent to "cd .."
Definition: DQMStore.cc:582
bool SiStripUtility::goToDir ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string const &  name 
)
static

Definition at line 287 of file SiStripUtility.cc.

References DQMStore::IGetter::cd(), TrackerOfflineValidation_Dqm_cff::dirName, alignmentValidation::fname, DQMStore::IGetter::getSubdirs(), goToDir(), DQMStore::IBooker::goUp(), DQMStore::IBooker::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

290 {
291  std::string currDir = ibooker.pwd();
292  std::string dirName = currDir.substr(currDir.find_last_of("/") + 1);
293  if (dirName.find(name) == 0) {
294  return true;
295  }
296  auto const subdirs = igetter.getSubdirs();
297  for (auto const& fname : subdirs) {
298  if ((fname.find("Reference") != std::string::npos) ||
299  (fname.find("AlCaReco") != std::string::npos) ||
300  (fname.find("HLT") != std::string::npos) ||
301  (fname.find("IsolatedBunches") != std::string::npos))
302  continue;
303  igetter.cd(fname);
304  if (!goToDir(ibooker, igetter, name)) {
305  ibooker.goUp();
306  } else
307  return true;
308  }
309  return false;
310 }
std::string const & pwd()
Definition: DQMStore.cc:278
string fname
main script
static bool goToDir(DQMStore &dqm_store, std::string const &name)
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:325
void SiStripUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 351 of file SiStripUtility.cc.

Referenced by SiStripDcsInfo::addBadModules(), SiStripDaqInfo::findExcludedModule(), and SiStripQualityChecker::getModuleStatus().

351  {
352 
353  if (hname.find("FractionOfBadChannels") != std::string::npos) flg |= (1<<0);
354  else if (hname.find("NumberOfDigi") != std::string::npos) flg |= (1<<1);
355  else if (hname.find("NumberOfCluster") != std::string::npos) flg |= (1<<2);
356  else if (hname.find("ExcludedFedChannel") != std::string::npos) flg |= (1<<3);
357  else if (hname.find("DCSError") != std::string::npos)
358  flg |= (1 << 4);
359 }
void SiStripUtility::split ( std::string const &  str,
std::vector< std::string > &  tokens,
std::string const &  delimiters = " " 
)
static

Definition at line 65 of file SiStripUtility.cc.

Referenced by checkME(), getMEList(), and SiStripHistoPlotter::makeCondDBPlots().

65  {
66  // Skip delimiters at beginning.
67  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
68 
69  // Find first "non-delimiter".
70  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
71 
72  while (std::string::npos != pos || std::string::npos != lastPos) {
73  // Found a token, add it to the std::vector.
74  tokens.push_back(str.substr(lastPos, pos - lastPos));
75 
76  // Skip delimiters. Note the "not_of"
77  lastPos = str.find_first_not_of(delimiters, pos);
78 
79  // Find next "non-delimiter"
80  pos = str.find_first_of(delimiters, lastPos);
81  }
82 }
uint16_t size_type
#define str(s)