CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions
SiStripUtility Class Reference

#include <SiStripUtility.h>

Static Public Member Functions

static bool checkME (std::string element, std::string 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 name, std::vector< std::string > &values)
 
static int getMEList (std::string name, std::string &dir_path, std::vector< std::string > &me_names)
 
static int getMEStatus (MonitorElement *me)
 
static int getMEStatus (MonitorElement *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 *me, std::string &val)
 
static void getModuleFolderList (DQMStore *dqm_store, 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 top_dir, std::string &path)
 
static bool goToDir (DQMStore *dqm_store, std::string name)
 
static void setBadModuleFlag (std::string &hname, uint16_t &flg)
 
static void split (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
 

Detailed Description

Definition at line 20 of file SiStripUtility.h.

Member Function Documentation

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

Definition at line 34 of file SiStripUtility.cc.

References split(), AlCaHLTBitMon_QueryRunRegistry::string, and makeHLTPrescaleTable::values.

34  {
35  if (name.find(name) == std::string::npos) return false;
36  std::string prefix_str = name.substr(0,(name.find(":")));
37  prefix_str += "/";
38  std::string temp_str = name.substr(name.find(":")+1);
39  std::vector<std::string> values;
40  split(temp_str, values, ",");
41  for (std::vector<std::string>::iterator it = values.begin();
42  it != values.end(); it++) {
43  if ((*it).find(me_name) != std::string::npos) {
44  full_path = prefix_str + (*it);
45  return true;
46  }
47  }
48  return false;
49 }
static void split(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
void SiStripUtility::getBadModuleStatus ( uint16_t  flag,
std::string &  message 
)
static

Definition at line 290 of file SiStripUtility.cc.

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

290  {
291  if (flag == 0) message += " No Error";
292  else {
293  // message += " Error from :: ";
294  if (((flag >> 0) & 0x1) > 0) message += " Fed BadChannel : ";
295  if (((flag >> 1) & 0x1) > 0) message += " # of Digi : ";
296  if (((flag >> 2) & 0x1) > 0) message += " # of Clusters :";
297  if (((flag >> 3) & 0x1) > 0) message += " Excluded FED Channel ";
298  if (((flag >> 4) & 0x1) > 0) message += " DCSError ";
299  }
300 }
void SiStripUtility::getDetectorStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 112 of file SiStripUtility.cc.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm().

112  {
113  // No Error
114  if (status == 0) {
115  rval = 0; gval = 255;bval = 0;
116  return;
117  }
118  // Error detected in FED Channel
119  if (((status >> 0) & 0x1) > 0) {
120  rval = 150; gval = 0; bval = 0;
121  return;
122  }
123  // Excluded FED Channel
124  if (((status >> 3) & 0x1) > 0) {
125  rval = 100; gval = 100; bval = 255;
126  return;
127  }
128  // DCS Error
129  if (((status >> 4) & 0x1) > 0) {
130  rval = 200; gval = 20; bval = 255;
131  return;
132  }
133  // Digi and Cluster Problem
134  if (((status >> 1) & 0x1) > 0) {
135  rval = 255; bval = 0;
136  if (((status >> 2) & 0x1) > 0) gval = 0;
137  else gval = 100;
138  } else {
139  rval = 251; gval = 0; bval = 100;
140  }
141 }
unsigned long long int rval
Definition: vlib.h:22
tuple status
Definition: ntuplemaker.py:245
int SiStripUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
)
static

Definition at line 11 of file SiStripUtility.cc.

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

11  {
12  values.clear();
13  std::string prefix_str = name.substr(0,(name.find(":")));
14  prefix_str += "/";
15  std::string temp_str = name.substr(name.find(":")+1);
16  split(temp_str, values, ",");
17  for (std::vector<std::string>::iterator it = values.begin();
18  it != values.end(); it++) (*it).insert(0,prefix_str);
19  return values.size();
20 }
static void split(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
int SiStripUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static

Definition at line 24 of file SiStripUtility.cc.

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 146 of file SiStripUtility.cc.

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

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

146  {
147  int status = 0;
148  if (me->getQReports().size() == 0) {
149  status = 0;
150  } else if (me->hasError()) {
151  status = dqm::qstatus::ERROR;
152  } else if (me->hasWarning()) {
153  status = dqm::qstatus::WARNING;
154  } else if (me->hasOtherReport()) {
155  status = dqm::qstatus::OTHER;
156  } else {
157  status = dqm::qstatus::STATUS_OK;
158  }
159  return status;
160 }
static const int OTHER
bool hasError(void) const
true if at least of one of the quality tests returned an error
static const int WARNING
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning
std::vector< QReport * > getQReports(void) const
get map of QReports
bool hasOtherReport(void) const
true if at least of one of the tests returned some other (non-ok) status
static const int STATUS_OK
tuple status
Definition: ntuplemaker.py:245
static const int ERROR
int SiStripUtility::getMEStatus ( MonitorElement me,
int &  bad_channels 
)
static

Definition at line 182 of file SiStripUtility.cc.

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

182  {
183  int status = 0;
184  if (me->getQReports().size() == 0) {
185  status = 0;
186  bad_channels = -1;
187  } else {
188  std::vector<QReport *> qreports = me->getQReports();
189  bad_channels =qreports[0]->getBadChannels().size();
190  if (me->hasError()) {
191  status = dqm::qstatus::ERROR;
192  } else if (me->hasWarning()) {
193  status = dqm::qstatus::WARNING;
194  } else if (me->hasOtherReport()) {
195  status = dqm::qstatus::OTHER;
196  } else {
197  status = dqm::qstatus::STATUS_OK;
198  }
199  }
200  return status;
201 }
static const int OTHER
bool hasError(void) const
true if at least of one of the quality tests returned an error
static const int WARNING
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning
std::vector< QReport * > getQReports(void) const
get map of QReports
bool hasOtherReport(void) const
true if at least of one of the tests returned some other (non-ok) status
static const int STATUS_OK
tuple status
Definition: ntuplemaker.py:245
static const int ERROR
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, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

Referenced by SiStripHistoPlotter::makePlot().

75  {
77  rval = 0; gval = 255; bval = 0;
78  } else if (status == dqm::qstatus::WARNING) {
79  rval = 255; gval = 255; bval = 0;
80  } else if (status == dqm::qstatus::ERROR) {
81  rval = 255; gval = 0; bval = 0;
82  } else if (status == dqm::qstatus::OTHER) {
83  rval = 255; gval = 150; bval = 0;
84  } else {
85  rval = 0; gval = 0; bval = 255;
86  }
87 }
static const int OTHER
static const int WARNING
unsigned long long int rval
Definition: vlib.h:22
static const int STATUS_OK
tuple status
Definition: ntuplemaker.py:245
static const int ERROR
void SiStripUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 91 of file SiStripUtility.cc.

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

91  {
93  tag = "Ok";
94  icol = 3;
95  } else if (status == dqm::qstatus::WARNING) {
96  tag = "Warning";
97  icol = 5;
98  } else if (status == dqm::qstatus::ERROR) {
99  tag = "Error";
100  icol = 2;
101  } else if (status == dqm::qstatus::OTHER) {
102  tag = "Other";
103  icol = 1;
104  } else {
105  tag = " ";
106  icol = 1;
107  }
108 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
tuple status
Definition: ntuplemaker.py:245
static const int ERROR
void SiStripUtility::getMEValue ( MonitorElement me,
std::string &  val 
)
static

Definition at line 205 of file SiStripUtility.cc.

References MonitorElement::DQM_KIND_INT, MonitorElement::DQM_KIND_REAL, MonitorElement::kind(), and MonitorElement::valueString().

Referenced by SiStripQualityChecker::getModuleStatus(), TrackingActionExecutor::printReportSummary(), SiStripActionExecutor::printReportSummary(), and SiStripQualityChecker::printStatusReport().

205  {
206  val = "";
207  if ( me && ( me->kind()==MonitorElement::DQM_KIND_REAL || me->kind()==MonitorElement::DQM_KIND_INT ) ) {
208  val = me->valueString();
209  val = val.substr(val.find("=")+1);
210  }
211 }
Kind kind(void) const
Get the type of the monitor element.
std::string valueString(void) const
void SiStripUtility::getModuleFolderList ( DQMStore dqm_store,
std::vector< std::string > &  m_ids 
)
static

Definition at line 164 of file SiStripUtility.cc.

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

Referenced by SiStripActionExecutor::printFaultyModuleList().

164  {
165  std::string currDir = dqm_store->pwd();
166  if (currDir.find("module_") != std::string::npos) {
167  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
168  mfolders.push_back(currDir);
169  } else {
170  std::vector<std::string> subdirs = dqm_store->getSubdirs();
171  for (std::vector<std::string>::const_iterator it = subdirs.begin();
172  it != subdirs.end(); it++) {
173  dqm_store->cd(*it);
174  getModuleFolderList(dqm_store, mfolders);
175  dqm_store->goUp();
176  }
177  }
178 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1659
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:644
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:678
static void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &m_ids)
const std::string & pwd(void) const
Definition: DQMStore.cc:639
void SiStripUtility::getSubDetectorTag ( uint32_t  det_id,
std::string &  subdet_tag,
const TrackerTopology tTopo 
)
static

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

239  {
240  StripSubdetector subdet(det_id);
241  subdet_tag = "";
242  switch (subdet.subdetId())
243  {
245  {
246  subdet_tag = "TIB";
247  break;
248  }
250  {
251 
252  if (tTopo->tidSide(det_id) == 2) {
253  subdet_tag = "TIDF";
254  } else if (tTopo->tidSide(det_id) == 1) {
255  subdet_tag = "TIDB";
256  }
257  break;
258  }
260  {
261  subdet_tag = "TOB";
262  break;
263  }
265  {
266 
267  if (tTopo->tecSide(det_id) == 2) {
268  subdet_tag = "TECF";
269  } else if (tTopo->tecSide(det_id) == 1) {
270  subdet_tag = "TECB";
271  }
272  break;
273  }
274  }
275 }
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  top_dir,
std::string &  path 
)
static

Definition at line 304 of file SiStripUtility.cc.

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

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

304  {
305 
306  path = "";
307  dqm_store->cd();
308  if (dqm_store->dirExists(top_dir)) {
309  dqm_store->cd(top_dir);
310  path = dqm_store->pwd();
311  } else {
312  if (SiStripUtility::goToDir(dqm_store, top_dir)) {
313  std::string mdir = "MechanicalView";
314  if (SiStripUtility::goToDir(dqm_store, mdir)) {
315  path = dqm_store->pwd();
316  path = path.substr(0, path.find(mdir)-1);
317  }
318  }
319  }
320 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:644
tuple path
else: Piece not in the list, fine.
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:732
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:639
bool SiStripUtility::goToDir ( DQMStore dqm_store,
std::string  name 
)
static

Definition at line 215 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(), SiStripActionExecutor::createSummaryOffline(), SiStripQualityChecker::fillDetectorStatus(), SiStripQualityChecker::fillDetectorStatusAtLumi(), SiStripQualityChecker::fillFaultyModuleStatus(), SiStripCertificationInfo::fillSiStripCertificationMEs(), SiStripDaqInfo::findExcludedModule(), getTopFolderPath(), SiStripActionExecutor::printFaultyModuleList(), and SiStripTrackerMapCreator::setTkMapFromHistogram().

215  {
216  std::string currDir = dqm_store->pwd();
217  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
218  if (dirName.find(name) == 0) {
219  return true;
220  }
221  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
222  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
223  ic != subDirVec.end(); ic++) {
224  std::string fname = (*ic);
225  if (
226  (fname.find("Reference") != std::string::npos) ||
227  (fname.find("AlCaReco") != std::string::npos) ||
228  (fname.find("HLT") != std::string::npos)
229  ) continue;
230  dqm_store->cd(fname);
231  if (!goToDir(dqm_store, name)) dqm_store->goUp();
232  else return true;
233  }
234  return false;
235 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1659
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:644
string fname
main script
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:678
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:639
void SiStripUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 279 of file SiStripUtility.cc.

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

279  {
280 
281  if (hname.find("FractionOfBadChannels") != std::string::npos) flg |= (1<<0);
282  else if (hname.find("NumberOfDigi") != std::string::npos) flg |= (1<<1);
283  else if (hname.find("NumberOfCluster") != std::string::npos) flg |= (1<<2);
284  else if (hname.find("ExcludedFedChannel") != std::string::npos) flg |= (1<<3);
285  else if (hname.find("DCSError") != std::string::npos) flg |= (1<<4);
286 }
void SiStripUtility::split ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
)
static

Definition at line 54 of file SiStripUtility.cc.

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