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
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 *dqm_store, std::vector< std::string > &m_ids)
 
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 19 of file TrackingUtility.h.

Member Function Documentation

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

Definition at line 34 of file TrackingUtility.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 TrackingUtility::getBadModuleStatus ( uint16_t  flag,
std::string &  message 
)
static

Definition at line 217 of file TrackingUtility.cc.

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

Definition at line 11 of file TrackingUtility.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 TrackingUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static

Definition at line 24 of file TrackingUtility.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 TrackingUtility::getMEStatus ( MonitorElement me)
static

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

113  {
114  int status = 0;
115  if (me->getQReports().size() == 0) {
116  status = 0;
117  } else if (me->hasError()) {
118  status = dqm::qstatus::ERROR;
119  } else if (me->hasWarning()) {
120  status = dqm::qstatus::WARNING;
121  } else if (me->hasOtherReport()) {
122  status = dqm::qstatus::OTHER;
123  } else {
124  status = dqm::qstatus::STATUS_OK;
125  }
126  return status;
127 }
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 TrackingUtility::getMEStatus ( MonitorElement me,
int &  bad_channels 
)
static

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

149  {
150  int status = 0;
151  if (me->getQReports().size() == 0) {
152  status = 0;
153  bad_channels = -1;
154  } else {
155  std::vector<QReport *> qreports = me->getQReports();
156  bad_channels =qreports[0]->getBadChannels().size();
157  if (me->hasError()) {
158  status = dqm::qstatus::ERROR;
159  } else if (me->hasWarning()) {
160  status = dqm::qstatus::WARNING;
161  } else if (me->hasOtherReport()) {
162  status = dqm::qstatus::OTHER;
163  } else {
164  status = dqm::qstatus::STATUS_OK;
165  }
166  }
167  return status;
168 }
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 TrackingUtility::getMEStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 75 of file TrackingUtility.cc.

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

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 TrackingUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 91 of file TrackingUtility.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 TrackingUtility::getMEValue ( MonitorElement me,
std::string &  val 
)
static

Definition at line 172 of file TrackingUtility.cc.

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

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

Definition at line 131 of file TrackingUtility.cc.

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

131  {
132  std::string currDir = dqm_store->pwd();
133  if (currDir.find("module_") != std::string::npos) {
134  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
135  mfolders.push_back(currDir);
136  } else {
137  std::vector<std::string> subdirs = dqm_store->getSubdirs();
138  for (std::vector<std::string>::const_iterator it = subdirs.begin();
139  it != subdirs.end(); it++) {
140  dqm_store->cd(*it);
141  getModuleFolderList(dqm_store, mfolders);
142  dqm_store->goUp();
143  }
144  }
145 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1644
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
static void getModuleFolderList(DQMStore *dqm_store, std::vector< std::string > &m_ids)
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:666
const std::string & pwd(void) const
Definition: DQMStore.cc:627
void TrackingUtility::getTopFolderPath ( DQMStore dqm_store,
std::string  top_dir,
std::string &  path 
)
static

Definition at line 231 of file TrackingUtility.cc.

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

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

231  {
232  path = "";
233  dqm_store->cd();
234  if (dqm_store->dirExists(top_dir)) {
235  dqm_store->cd(top_dir);
236  path = dqm_store->pwd();
237  } else {
238  if (TrackingUtility::goToDir(dqm_store, top_dir)) {
239  std::string tdir = "TrackParameters";
240  if (TrackingUtility::goToDir(dqm_store, tdir)) {
241  path = dqm_store->pwd();
242  path = path.substr(0, path.find(tdir)-1);
243  }
244  }
245  }
246 }
static bool goToDir(DQMStore *dqm_store, std::string name)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
tuple path
else: Piece not in the list, fine.
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:720
const std::string & pwd(void) const
Definition: DQMStore.cc:627
bool TrackingUtility::goToDir ( DQMStore dqm_store,
std::string  name 
)
static

Definition at line 182 of file TrackingUtility.cc.

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

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

182  {
183  std::string currDir = dqm_store->pwd();
184  std::string dirName = currDir.substr(currDir.find_last_of("/")+1);
185  if (dirName.find(name) == 0) {
186  return true;
187  }
188  std::vector<std::string> subDirVec = dqm_store->getSubdirs();
189  for (std::vector<std::string>::const_iterator ic = subDirVec.begin();
190  ic != subDirVec.end(); ic++) {
191  std::string fname = (*ic);
192  if (
193  (fname.find("Reference") != std::string::npos) ||
194  (fname.find("AlCaReco") != std::string::npos) ||
195  (fname.find("HLT") != std::string::npos)
196  ) continue;
197  dqm_store->cd(fname);
198  if (!goToDir(dqm_store, name)) dqm_store->goUp();
199  else return true;
200  }
201  return false;
202 }
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1644
static bool goToDir(DQMStore *dqm_store, std::string name)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:632
string fname
main script
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:666
const std::string & pwd(void) const
Definition: DQMStore.cc:627
void TrackingUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 206 of file TrackingUtility.cc.

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

Definition at line 54 of file TrackingUtility.cc.

Referenced by checkME(), and getMEList().

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