CMS 3D CMS Logo

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

#include <TrackingUtility.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 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::IBooker &ibooker, DQMStore::IGetter &igetter, std::vector< std::string > &m_ids)
 
static void getTopFolderPath (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string top_dir, std::string &path)
 
static bool goToDir (DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, 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 TrackingUtility.h.

Member Function Documentation

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

Definition at line 31 of file TrackingUtility.cc.

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

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

Definition at line 214 of file TrackingUtility.cc.

References globals_cff::x1.

214  {
215  if (flag == 0) message += " No Error";
216  else {
217  // message += " Error from :: ";
218  if (((flag >> 0) & 0x1) > 0) message += " Fed BadChannel : ";
219  if (((flag >> 1) & 0x1) > 0) message += " # of Digi : ";
220  if (((flag >> 2) & 0x1) > 0) message += " # of Clusters :";
221  if (((flag >> 3) & 0x1) > 0) message += " Excluded FED Channel ";
222  if (((flag >> 4) & 0x1) > 0) message += " DCSError ";
223  }
224 }
int TrackingUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
)
static

Definition at line 8 of file TrackingUtility.cc.

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 21 of file TrackingUtility.cc.

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 110 of file TrackingUtility.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.

110  {
111  int status = 0;
112  if (me->getQReports().empty()) {
113  status = 0;
114  } else if (me->hasError()) {
115  status = dqm::qstatus::ERROR;
116  } else if (me->hasWarning()) {
117  status = dqm::qstatus::WARNING;
118  } else if (me->hasOtherReport()) {
119  status = dqm::qstatus::OTHER;
120  } else {
121  status = dqm::qstatus::STATUS_OK;
122  }
123  return status;
124 }
static const int OTHER
static const int WARNING
bool hasError() const
true if at least of one of the quality tests returned an error
bool hasOtherReport() const
true if at least of one of the tests returned some other (non-ok) status
bool hasWarning() const
true if at least of one of the quality tests returned a warning
std::vector< QReport * > getQReports() const
get map of QReports
static const int STATUS_OK
static const int ERROR
int TrackingUtility::getMEStatus ( MonitorElement me,
int &  bad_channels 
)
static

Definition at line 146 of file TrackingUtility.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.

146  {
147  int status = 0;
148  if (me->getQReports().empty()) {
149  status = 0;
150  bad_channels = -1;
151  } else {
152  std::vector<QReport *> qreports = me->getQReports();
153  bad_channels =qreports[0]->getBadChannels().size();
154  if (me->hasError()) {
155  status = dqm::qstatus::ERROR;
156  } else if (me->hasWarning()) {
157  status = dqm::qstatus::WARNING;
158  } else if (me->hasOtherReport()) {
159  status = dqm::qstatus::OTHER;
160  } else {
161  status = dqm::qstatus::STATUS_OK;
162  }
163  }
164  return status;
165 }
static const int OTHER
static const int WARNING
bool hasError() const
true if at least of one of the quality tests returned an error
bool hasOtherReport() const
true if at least of one of the tests returned some other (non-ok) status
bool hasWarning() const
true if at least of one of the quality tests returned a warning
std::vector< QReport * > getQReports() const
get map of QReports
static const int STATUS_OK
static const int ERROR
void TrackingUtility::getMEStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 72 of file TrackingUtility.cc.

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

72  {
74  rval = 0; gval = 255; bval = 0;
75  } else if (status == dqm::qstatus::WARNING) {
76  rval = 255; gval = 255; bval = 0;
77  } else if (status == dqm::qstatus::ERROR) {
78  rval = 255; gval = 0; bval = 0;
79  } else if (status == dqm::qstatus::OTHER) {
80  rval = 255; gval = 150; bval = 0;
81  } else {
82  rval = 0; gval = 0; bval = 255;
83  }
84 }
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 TrackingUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 88 of file TrackingUtility.cc.

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

88  {
90  tag = "Ok";
91  icol = 3;
92  } else if (status == dqm::qstatus::WARNING) {
93  tag = "Warning";
94  icol = 5;
95  } else if (status == dqm::qstatus::ERROR) {
96  tag = "Error";
97  icol = 2;
98  } else if (status == dqm::qstatus::OTHER) {
99  tag = "Other";
100  icol = 1;
101  } else {
102  tag = " ";
103  icol = 1;
104  }
105 }
static const int OTHER
static const int WARNING
static const int STATUS_OK
static const int ERROR
void TrackingUtility::getMEValue ( MonitorElement me,
std::string &  val 
)
static

Definition at line 169 of file TrackingUtility.cc.

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

169  {
170  val = "";
171  if ( me && ( me->kind()==MonitorElement::DQM_KIND_REAL || me->kind()==MonitorElement::DQM_KIND_INT ) ) {
172  val = me->valueString();
173  val = val.substr(val.find("=")+1);
174  }
175 }
std::string valueString() const
Kind kind() const
Get the type of the monitor element.
void TrackingUtility::getModuleFolderList ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::vector< std::string > &  m_ids 
)
static

Definition at line 128 of file TrackingUtility.cc.

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

128  {
129  std::string currDir = ibooker.pwd();
130  if (currDir.find("module_") != std::string::npos) {
131  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
132  mfolders.push_back(currDir);
133  } else {
134  std::vector<std::string> subdirs = igetter.getSubdirs();
135  for (std::vector<std::string>::const_iterator it = subdirs.begin();
136  it != subdirs.end(); it++) {
137  ibooker.cd(*it);
138  getModuleFolderList(ibooker,igetter, mfolders);
139  ibooker.goUp();
140  }
141  }
142 }
static void getModuleFolderList(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::vector< std::string > &m_ids)
const std::string & pwd()
Definition: DQMStore.cc:282
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:320
void TrackingUtility::getTopFolderPath ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  top_dir,
std::string &  path 
)
static

Definition at line 228 of file TrackingUtility.cc.

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

Referenced by TrackingQualityChecker::bookGlobalStatus(), TrackingQualityChecker::bookLSStatus(), TrackingCertificationInfo::bookTrackingCertificationMEs(), TrackingCertificationInfo::bookTrackingCertificationMEsAtLumi(), TrackingCertificationInfo::fillTrackingCertificationMEs(), and TrackingCertificationInfo::fillTrackingCertificationMEsAtLumi().

228  {
229  path = "";
230  ibooker.cd();
231  if (igetter.dirExists(top_dir)) {
232  ibooker.cd(top_dir);
233  path = ibooker.pwd();
234  } else {
235  if (TrackingUtility::goToDir(ibooker,igetter, top_dir)) {
236  std::string tdir = "TrackParameters";
237  if (TrackingUtility::goToDir(ibooker,igetter, tdir)) {
238  path = ibooker.pwd();
239  path = path.substr(0, path.find(tdir)-1);
240  }
241  }
242  }
243 }
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
bool dirExists(const std::string &path)
Definition: DQMStore.cc:332
const std::string & pwd()
Definition: DQMStore.cc:282
bool TrackingUtility::goToDir ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  name 
)
static

Definition at line 179 of file TrackingUtility.cc.

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

Referenced by TrackingQualityChecker::fillTrackingStatus(), TrackingQualityChecker::fillTrackingStatusAtLumi(), and getTopFolderPath().

179  {
180  std::string currDir = ibooker.pwd();
181  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
182  if (dirName.find(name) == 0) {
183  return true;
184  }
185  std::vector<std::string> subDirVec = igetter.getSubdirs();
186  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
187  ic != subDirVec.end(); ic++) {
188  std::string fname = (*ic);
189  if (
190  (fname.find("Reference") != std::string::npos) ||
191  (fname.find("AlCaReco") != std::string::npos) ||
192  (fname.find("HLT") != std::string::npos)
193  ) continue;
194  igetter.cd(fname);
195  if (!goToDir(ibooker,igetter, name)) ibooker.goUp();
196  else return true;
197  }
198  return false;
199 }
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
const std::string & pwd()
Definition: DQMStore.cc:282
string fname
main script
std::vector< std::string > getSubdirs()
Definition: DQMStore.cc:320
void TrackingUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 203 of file TrackingUtility.cc.

203  {
204 
205  if (hname.find("FractionOfBadChannels") != std::string::npos) flg |= (1<<0);
206  else if (hname.find("NumberOfDigi") != std::string::npos) flg |= (1<<1);
207  else if (hname.find("NumberOfCluster") != std::string::npos) flg |= (1<<2);
208  else if (hname.find("ExcludedFedChannel") != std::string::npos) flg |= (1<<3);
209  else if (hname.find("DCSError") != std::string::npos) flg |= (1<<4);
210 }
void TrackingUtility::split ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
)
static

Definition at line 51 of file TrackingUtility.cc.

Referenced by checkME(), and getMEList().

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