CMS 3D CMS Logo

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

#include <SiStripUtility.h>

Public Types

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

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 21 of file SiStripUtility.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 23 of file SiStripUtility.h.

◆ MonitorElement

Definition at line 24 of file SiStripUtility.h.

Member Function Documentation

◆ checkME()

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

Definition at line 34 of file SiStripUtility.cc.

References Skims_PA_cff::name, split(), relativeConstraints::value, and contentValuesCheck::values.

34  {
35  if (name.find(name) == std::string::npos)
36  return false;
37  auto prefix_str = name.substr(0, (name.find(':')));
38  prefix_str += "/";
39  auto const temp_str = name.substr(name.find(':') + 1);
40  std::vector<std::string> values;
41  split(temp_str, values, ",");
42  for (auto const& value : values) {
43  if (value.find(me_name) != std::string::npos) {
44  full_path = prefix_str + value;
45  return true;
46  }
47  }
48  return false;
49 }
Definition: value.py:1
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")

◆ getBadModuleStatus()

void SiStripUtility::getBadModuleStatus ( uint16_t  flag,
std::string &  message 
)
static

Definition at line 343 of file SiStripUtility.cc.

References RemoveAddSevLevel::flag, and testProducerWithPsetDescEmpty_cfi::x1.

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

343  {
344  if (flag == 0)
345  message += " No Error";
346  else {
347  if (((flag >> 0) & 0x1) > 0)
348  message += " Fed BadChannel : ";
349  if (((flag >> 1) & 0x1) > 0)
350  message += " # of Digi : ";
351  if (((flag >> 2) & 0x1) > 0)
352  message += " # of Clusters :";
353  if (((flag >> 3) & 0x1) > 0)
354  message += " Excluded FED Channel ";
355  if (((flag >> 4) & 0x1) > 0)
356  message += " DCSError ";
357  }
358 }

◆ getDetectorStatusColor()

void SiStripUtility::getDetectorStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 122 of file SiStripUtility.cc.

References mps_update::status, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm().

122  {
123  // No Error
124  if (status == 0) {
125  rval = 0;
126  gval = 255;
127  bval = 0;
128  return;
129  }
130  // Error detected in FED Channel
131  if (((status >> 0) & 0x1) > 0) {
132  rval = 150;
133  gval = 0;
134  bval = 0;
135  return;
136  }
137  // Excluded FED Channel
138  if (((status >> 3) & 0x1) > 0) {
139  rval = 100;
140  gval = 100;
141  bval = 255;
142  return;
143  }
144  // DCS Error
145  if (((status >> 4) & 0x1) > 0) {
146  rval = 200;
147  gval = 20;
148  bval = 255;
149  return;
150  }
151  // Digi and Cluster Problem
152  if (((status >> 1) & 0x1) > 0) {
153  rval = 255;
154  bval = 0;
155  if (((status >> 2) & 0x1) > 0)
156  gval = 0;
157  else
158  gval = 100;
159  } else {
160  rval = 251;
161  gval = 0;
162  bval = 100;
163  }
164 }

◆ getMEList() [1/2]

int SiStripUtility::getMEList ( std::string const &  name,
std::vector< std::string > &  values 
)
static

Definition at line 10 of file SiStripUtility.cc.

References Skims_PA_cff::name, split(), and contentValuesCheck::values.

10  {
11  values.clear();
12  auto prefix_str = name.substr(0, (name.find(':')));
13  prefix_str += "/";
14  auto const temp_str = name.substr(name.find(':') + 1);
15  split(temp_str, values, ",");
16  for (auto& value : values) {
17  value.insert(0, prefix_str);
18  }
19  return values.size();
20 }
Definition: value.py:1
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")

◆ getMEList() [2/2]

int SiStripUtility::getMEList ( std::string const &  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static

Definition at line 24 of file SiStripUtility.cc.

References Skims_PA_cff::name, split(), and contentValuesCheck::values.

24  {
25  values.clear();
26  dir_path = name.substr(0, (name.find(':')));
27  dir_path += "/";
28  auto const temp_str = name.substr(name.find(':') + 1);
29  split(temp_str, values, ",");
30  return values.size();
31 }
static void split(std::string const &str, std::vector< std::string > &tokens, std::string const &delimiters=" ")

◆ getMEStatus() [1/2]

int SiStripUtility::getMEStatus ( MonitorElement const *  me)
static

Definition at line 169 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, hlt_dqm_clientPB-live_cfg::me, 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()) {
175  } else if (me->hasWarning()) {
177  } else if (me->hasOtherReport()) {
179  } else {
181  }
182  return status;
183 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR

◆ getMEStatus() [2/2]

int SiStripUtility::getMEStatus ( MonitorElement const *  me,
int &  bad_channels 
)
static

Definition at line 217 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, hlt_dqm_clientPB-live_cfg::me, dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

217  {
218  int status = 0;
219  if (me->getQReports().empty()) {
220  bad_channels = -1;
221  } else {
222  std::vector<QReport*> qreports = me->getQReports();
223  bad_channels = qreports[0]->getBadChannels().size();
224  if (me->hasError()) {
226  } else if (me->hasWarning()) {
228  } else if (me->hasOtherReport()) {
230  } else {
232  }
233  }
234  return status;
235 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR

◆ getMEStatusColor() [1/2]

void SiStripUtility::getMEStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 75 of file SiStripUtility.cc.

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

Referenced by SiStripHistoPlotter::makePlot().

75  {
77  rval = 0;
78  gval = 255;
79  bval = 0;
80  } else if (status == dqm::qstatus::WARNING) {
81  rval = 255;
82  gval = 255;
83  bval = 0;
84  } else if (status == dqm::qstatus::ERROR) {
85  rval = 255;
86  gval = 0;
87  bval = 0;
88  } else if (status == dqm::qstatus::OTHER) {
89  rval = 255;
90  gval = 150;
91  bval = 0;
92  } else {
93  rval = 0;
94  gval = 0;
95  bval = 255;
96  }
97 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR

◆ getMEStatusColor() [2/2]

void SiStripUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 101 of file SiStripUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, makeGlobalPositionRcd_cfg::tag, and dqm::qstatus::WARNING.

101  {
103  tag = "Ok";
104  icol = 3;
105  } else if (status == dqm::qstatus::WARNING) {
106  tag = "Warning";
107  icol = 5;
108  } else if (status == dqm::qstatus::ERROR) {
109  tag = "Error";
110  icol = 2;
111  } else if (status == dqm::qstatus::OTHER) {
112  tag = "Other";
113  icol = 1;
114  } else {
115  tag = " ";
116  icol = 1;
117  }
118 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR

◆ getMEValue()

void SiStripUtility::getMEValue ( MonitorElement const *  me,
std::string &  val 
)
static

◆ getModuleFolderList() [1/2]

void SiStripUtility::getModuleFolderList ( DQMStore dqm_store,
std::vector< std::string > &  m_ids 
)
static

Definition at line 187 of file SiStripUtility.cc.

References dqm::implementation::DQMStore::cd(), dqm::implementation::IGetter::getSubdirs(), dqm::implementation::DQMStore::goUp(), dqm::implementation::DQMStore::pwd(), mkLumiAveragedPlots::subdir, and compareTotals::subdirs.

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

187  {
188  if (auto currDir = dqm_store.pwd(); currDir.find("module_") != std::string::npos) {
189  mfolders.push_back(currDir);
190  } else {
191  auto const subdirs = dqm_store.getSubdirs();
192  for (auto const& subdir : subdirs) {
193  dqm_store.cd(subdir);
194  getModuleFolderList(dqm_store, mfolders);
195  dqm_store.goUp();
196  }
197  }
198 }
static void getModuleFolderList(DQMStore &dqm_store, std::vector< std::string > &m_ids)
std::string pwd() override
Definition: DQMStore.h:654
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

◆ getModuleFolderList() [2/2]

void SiStripUtility::getModuleFolderList ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::vector< std::string > &  m_ids 
)
static

Definition at line 200 of file SiStripUtility.cc.

References dqm::implementation::NavigatorBase::cd(), getModuleFolderList(), dqm::implementation::IGetter::getSubdirs(), dqm::implementation::NavigatorBase::goUp(), dqm::implementation::NavigatorBase::pwd(), mkLumiAveragedPlots::subdir, and compareTotals::subdirs.

202  {
203  if (auto currDir = ibooker.pwd(); currDir.find("module_") != std::string::npos) {
204  mfolders.push_back(currDir);
205  } else {
206  auto const subdirs = igetter.getSubdirs();
207  for (auto const& subdir : subdirs) {
208  ibooker.cd(subdir);
209  getModuleFolderList(ibooker, igetter, mfolders);
210  ibooker.goUp();
211  }
212  }
213 }
static void getModuleFolderList(DQMStore &dqm_store, std::vector< std::string > &m_ids)
virtual std::string pwd()
Definition: DQMStore.cc:20
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

◆ getSubDetectorTag()

void SiStripUtility::getSubDetectorTag ( uint32_t  det_id,
std::string &  subdet_tag,
const TrackerTopology tTopo 
)
static

Definition at line 296 of file SiStripUtility.cc.

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

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

296  {
297  StripSubdetector const subdet(det_id);
298  subdet_tag = "";
299  switch (subdet.subdetId()) {
300  case StripSubdetector::TIB: {
301  subdet_tag = "TIB";
302  return;
303  }
304  case StripSubdetector::TID: {
305  if (tTopo->tidSide(det_id) == 2) {
306  subdet_tag = "TIDF";
307  } else if (tTopo->tidSide(det_id) == 1) {
308  subdet_tag = "TIDB";
309  }
310  return;
311  }
312  case StripSubdetector::TOB: {
313  subdet_tag = "TOB";
314  return;
315  }
316  case StripSubdetector::TEC: {
317  if (tTopo->tecSide(det_id) == 2) {
318  subdet_tag = "TECF";
319  } else if (tTopo->tecSide(det_id) == 1) {
320  subdet_tag = "TECB";
321  }
322  }
323  }
324 }
static constexpr auto TEC
unsigned int tidSide(const DetId &id) const
unsigned int tecSide(const DetId &id) const
const std::string subdet_tag("SubDet")
static constexpr auto TOB
static constexpr auto TIB
static constexpr auto TID

◆ getTopFolderPath() [1/2]

void SiStripUtility::getTopFolderPath ( DQMStore dqm_store,
std::string const &  top_dir,
std::string &  path 
)
static

Definition at line 362 of file SiStripUtility.cc.

References dqm::implementation::DQMStore::cd(), dqm::implementation::IGetter::dirExists(), goToDir(), castor_dqm_sourceclient_file_cfg::path, dqm::implementation::DQMStore::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

362  {
363  path = "";
364  dqm_store.cd();
365  if (dqm_store.dirExists(top_dir)) {
366  dqm_store.cd(top_dir);
367  path = dqm_store.pwd();
368  } else {
369  if (SiStripUtility::goToDir(dqm_store, top_dir)) {
370  std::string mdir = "MechanicalView";
371  if (SiStripUtility::goToDir(dqm_store, mdir)) {
372  path = dqm_store.pwd();
373  path = path.substr(0, path.find(mdir) - 1);
374  }
375  }
376  }
377 }
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:769
std::string pwd() override
Definition: DQMStore.h:654
static bool goToDir(DQMStore &dqm_store, std::string const &name)

◆ getTopFolderPath() [2/2]

void SiStripUtility::getTopFolderPath ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string const &  top_dir,
std::string &  path 
)
static

Definition at line 379 of file SiStripUtility.cc.

References dqm::implementation::NavigatorBase::cd(), dqm::implementation::IGetter::dirExists(), goToDir(), castor_dqm_sourceclient_file_cfg::path, dqm::implementation::NavigatorBase::pwd(), and AlCaHLTBitMon_QueryRunRegistry::string.

382  {
383  path = "";
384  ibooker.cd();
385  if (igetter.dirExists(top_dir)) {
386  ibooker.cd(top_dir);
387  path = ibooker.pwd();
388  } else {
389  if (SiStripUtility::goToDir(ibooker, igetter, top_dir)) {
390  std::string tdir = "MechanicalView";
391  if (SiStripUtility::goToDir(ibooker, igetter, tdir)) {
392  path = ibooker.pwd();
393  path = path.substr(0, path.find(tdir) - 1);
394  }
395  }
396  }
397 }
virtual std::string pwd()
Definition: DQMStore.cc:20
virtual bool dirExists(std::string const &path) const
Definition: DQMStore.cc:769
static bool goToDir(DQMStore &dqm_store, std::string const &name)

◆ goToDir() [1/2]

bool SiStripUtility::goToDir ( DQMStore dqm_store,
std::string const &  name 
)
static

Definition at line 252 of file SiStripUtility.cc.

References dqm::implementation::DQMStore::cd(), TrackerOfflineValidation_Dqm_cff::dirName, alignmentValidation::fname, dqm::implementation::IGetter::getSubdirs(), dqm::implementation::DQMStore::goUp(), Skims_PA_cff::name, dqm::implementation::DQMStore::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, and compareTotals::subdirs.

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().

252  {
253  std::string currDir = dqm_store.pwd();
254  std::string dirName = currDir.substr(currDir.find_last_of('/') + 1);
255  if (dirName.find(name) == 0) {
256  return true;
257  }
258  auto const subdirs = dqm_store.getSubdirs();
259  for (auto const& fname : subdirs) {
260  if ((fname.find("Reference") != std::string::npos) || (fname.find("AlCaReco") != std::string::npos) ||
261  (fname.find("HLT") != std::string::npos) || (fname.find("IsolatedBunches") != std::string::npos))
262  continue;
263  dqm_store.cd(fname);
264  if (!goToDir(dqm_store, name)) {
265  dqm_store.goUp();
266  } else {
267  return true;
268  }
269  }
270  return false;
271 }
std::string pwd() override
Definition: DQMStore.h:654
string fname
main script
static bool goToDir(DQMStore &dqm_store, std::string const &name)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

◆ goToDir() [2/2]

bool SiStripUtility::goToDir ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string const &  name 
)
static

Definition at line 273 of file SiStripUtility.cc.

References dqm::implementation::NavigatorBase::cd(), TrackerOfflineValidation_Dqm_cff::dirName, alignmentValidation::fname, dqm::implementation::IGetter::getSubdirs(), goToDir(), dqm::implementation::NavigatorBase::goUp(), Skims_PA_cff::name, dqm::implementation::NavigatorBase::pwd(), AlCaHLTBitMon_QueryRunRegistry::string, and compareTotals::subdirs.

273  {
274  std::string currDir = ibooker.pwd();
275  std::string dirName = currDir.substr(currDir.find_last_of('/') + 1);
276  if (dirName.find(name) == 0) {
277  return true;
278  }
279  auto const subdirs = igetter.getSubdirs();
280  for (auto const& fname : subdirs) {
281  if ((fname.find("Reference") != std::string::npos) || (fname.find("AlCaReco") != std::string::npos) ||
282  (fname.find("HLT") != std::string::npos) || (fname.find("IsolatedBunches") != std::string::npos))
283  continue;
284  igetter.cd(fname);
285  if (!goToDir(ibooker, igetter, name)) {
286  ibooker.goUp();
287  } else
288  return true;
289  }
290  return false;
291 }
virtual std::string pwd()
Definition: DQMStore.cc:20
string fname
main script
static bool goToDir(DQMStore &dqm_store, std::string const &name)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const
Definition: DQMStore.cc:739

◆ setBadModuleFlag()

void SiStripUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 328 of file SiStripUtility.cc.

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

328  {
329  if (hname.find("FractionOfBadChannels") != std::string::npos)
330  flg |= (1 << 0);
331  else if (hname.find("NumberOfDigi") != std::string::npos)
332  flg |= (1 << 1);
333  else if (hname.find("NumberOfCluster") != std::string::npos)
334  flg |= (1 << 2);
335  else if (hname.find("ExcludedFedChannel") != std::string::npos)
336  flg |= (1 << 3);
337  else if (hname.find("DCSError") != std::string::npos)
338  flg |= (1 << 4);
339 }

◆ split()

void SiStripUtility::split ( std::string const &  str,
std::vector< std::string > &  tokens,
std::string const &  delimiters = " " 
)
static

Definition at line 54 of file SiStripUtility.cc.

References str.

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

54  {
55  // Skip delimiters at beginning.
56  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
57 
58  // Find first "non-delimiter".
59  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
60 
61  while (std::string::npos != pos || std::string::npos != lastPos) {
62  // Found a token, add it to the std::vector.
63  tokens.push_back(str.substr(lastPos, pos - lastPos));
64 
65  // Skip delimiters. Note the "not_of"
66  lastPos = str.find_first_not_of(delimiters, pos);
67 
68  // Find next "non-delimiter"
69  pos = str.find_first_of(delimiters, lastPos);
70  }
71 }
uint16_t size_type
#define str(s)