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)
 
static void getTopFolderPath (DQMStore *dqm_store, std::string type, 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 21 of file SiStripUtility.h.

Member Function Documentation

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

Definition at line 36 of file SiStripUtility.cc.

References split(), and makeHLTPrescaleTable::values.

36  {
37  if (name.find(name) == std::string::npos) return false;
38  std::string prefix_str = name.substr(0,(name.find(":")));
39  prefix_str += "/";
40  std::string temp_str = name.substr(name.find(":")+1);
41  std::vector<std::string> values;
42  split(temp_str, values, ",");
43  for (std::vector<std::string>::iterator it = values.begin();
44  it != values.end(); it++) {
45  if ((*it).find(me_name) != std::string::npos) {
46  full_path = prefix_str + (*it);
47  return true;
48  }
49  }
50  return false;
51 }
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(), SiStripActionExecutor::printFaultyModuleList(), and SiStripInformationExtractor::readQTestSummary().

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 }
long int flag
Definition: mlp_lapack.h:47
void SiStripUtility::getDetectorStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 114 of file SiStripUtility.cc.

Referenced by SiStripTrackerMapCreator::paintTkMapFromAlarm().

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

Definition at line 13 of file SiStripUtility.cc.

References split().

13  {
14  values.clear();
15  std::string prefix_str = name.substr(0,(name.find(":")));
16  prefix_str += "/";
17  std::string temp_str = name.substr(name.find(":")+1);
18  split(temp_str, values, ",");
19  for (std::vector<std::string>::iterator it = values.begin();
20  it != values.end(); it++) (*it).insert(0,prefix_str);
21  return values.size();
22 }
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 26 of file SiStripUtility.cc.

References split().

26  {
27  values.clear();
28  dir_path = name.substr(0,(name.find(":")));
29  dir_path += "/";
30  std::string temp_str = name.substr(name.find(":")+1);
31  split(temp_str, values, ",");
32  return values.size();
33 }
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 148 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().

148  {
149  int status = 0;
150  if (me->getQReports().size() == 0) {
151  status = 0;
152  } else if (me->hasError()) {
153  status = dqm::qstatus::ERROR;
154  } else if (me->hasWarning()) {
155  status = dqm::qstatus::WARNING;
156  } else if (me->hasOtherReport()) {
157  status = dqm::qstatus::OTHER;
158  } else {
159  status = dqm::qstatus::STATUS_OK;
160  }
161  return status;
162 }
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 184 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.

184  {
185  int status = 0;
186  if (me->getQReports().size() == 0) {
187  status = 0;
188  bad_channels = -1;
189  } else {
190  std::vector<QReport *> qreports = me->getQReports();
191  bad_channels =qreports[0]->getBadChannels().size();
192  if (me->hasError()) {
193  status = dqm::qstatus::ERROR;
194  } else if (me->hasWarning()) {
195  status = dqm::qstatus::WARNING;
196  } else if (me->hasOtherReport()) {
197  status = dqm::qstatus::OTHER;
198  } else {
199  status = dqm::qstatus::STATUS_OK;
200  }
201  }
202  return status;
203 }
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 77 of file SiStripUtility.cc.

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

Referenced by SiStripHistoPlotter::makePlot().

77  {
79  rval = 0; gval = 255; bval = 0;
80  } else if (status == dqm::qstatus::WARNING) {
81  rval = 255; gval = 255; bval = 0;
82  } else if (status == dqm::qstatus::ERROR) {
83  rval = 255; gval = 0; bval = 0;
84  } else if (status == dqm::qstatus::OTHER) {
85  rval = 255; gval = 150; bval = 0;
86  } else {
87  rval = 0; gval = 0; bval = 255;
88  }
89 }
static const int OTHER
static const int WARNING
unsigned long long int rval
Definition: vlib.h:23
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 93 of file SiStripUtility.cc.

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

93  {
95  tag = "Ok";
96  icol = 3;
97  } else if (status == dqm::qstatus::WARNING) {
98  tag = "Warning";
99  icol = 5;
100  } else if (status == dqm::qstatus::ERROR) {
101  tag = "Error";
102  icol = 2;
103  } else if (status == dqm::qstatus::OTHER) {
104  tag = "Other";
105  icol = 1;
106  } else {
107  tag = " ";
108  icol = 1;
109  }
110 }
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 207 of file SiStripUtility.cc.

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

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

207  {
208  val = "";
209  if (me && ( me->kind()==MonitorElement::DQM_KIND_REAL || me->kind()==MonitorElement::DQM_KIND_INT ) ) {
210  val = me->valueString();
211  val = val.substr(val.find("=")+1);
212  }
213 }
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 166 of file SiStripUtility.cc.

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

Referenced by SiStripActionExecutor::printFaultyModuleList(), SiStripInformationExtractor::readModuleAndHistoList(), and SiStripInformationExtractor::readQTestSummary().

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

Definition at line 239 of file SiStripUtility.cc.

References TIDDetId::side(), TECDetId::side(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, 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  TIDDetId tidId(det_id);
252  if (tidId.side() == 2) {
253  subdet_tag = "TIDF";
254  } else if (tidId.side() == 1) {
255  subdet_tag = "TIDB";
256  }
257  break;
258  }
260  {
261  subdet_tag = "TOB";
262  break;
263  }
265  {
266  TECDetId tecId(det_id);
267  if (tecId.side() == 2) {
268  subdet_tag = "TECF";
269  } else if (tecId.side() == 1) {
270  subdet_tag = "TECB";
271  }
272  break;
273  }
274  }
275 }
const std::string subdet_tag("SubDet")
void SiStripUtility::getTopFolderPath ( DQMStore dqm_store,
std::string  type,
std::string &  path 
)
static

Definition at line 304 of file SiStripUtility.cc.

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

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

304  {
305  if (type != "SiStrip" && type != "Tracking") return;
306  path = "";
307  dqm_store->cd();
308  if (type == "SiStrip") {
309  if (dqm_store->dirExists(type)) {
310  dqm_store->cd(type);
311  path = dqm_store->pwd();
312  } else {
313  if (SiStripUtility::goToDir(dqm_store, type)) {
314  std::string mdir = "MechanicalView";
315  if (SiStripUtility::goToDir(dqm_store, mdir)) {
316  path = dqm_store->pwd();
317  path = path.substr(0, path.find(mdir)-1);
318  }
319  }
320  }
321  } else if (type == "Tracking") {
322  std::string top_dir = "Tracking";
323  if (dqm_store->dirExists(top_dir)) {
324  dqm_store->cd(top_dir);
325  path = dqm_store->pwd();
326  } else {
327  if (SiStripUtility::goToDir(dqm_store, top_dir)) {
328  std::string tdir = "TrackParameters";
329  if (SiStripUtility::goToDir(dqm_store, tdir)) {
330  path = dqm_store->pwd();
331  path = path.substr(0, path.find(tdir)-1);
332  }
333  }
334  }
335  }
336 }
type
Definition: HCALResponse.h:22
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
list path
Definition: scaleCards.py:51
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:493
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:401
bool SiStripUtility::goToDir ( DQMStore dqm_store,
std::string  name 
)
static

Definition at line 217 of file SiStripUtility.cc.

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

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

217  {
218  std::string currDir = dqm_store->pwd();
219  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
220  if (dirName.find(name) == 0) {
221  return true;
222  }
223  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
224  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
225  ic != subDirVec.end(); ic++) {
226  std::string fname = (*ic);
227  if ((fname.find("Reference") != std::string::npos) ||
228  (fname.find("AlCaReco") != std::string::npos) ||
229  (fname.find("HLT") != std::string::npos) ) 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:1419
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
string fname
main script
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:440
static bool goToDir(DQMStore *dqm_store, std::string name)
const std::string & pwd(void) const
Definition: DQMStore.cc:401
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 56 of file SiStripUtility.cc.

References pos.

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

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