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::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 33 of file TrackingUtility.cc.

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

33  {
34  if (name.find(name) == std::string::npos) return false;
35  std::string prefix_str = name.substr(0,(name.find(":")));
36  prefix_str += "/";
37  std::string temp_str = name.substr(name.find(":")+1);
38  std::vector<std::string> values;
39  split(temp_str, values, ",");
40  for (std::vector<std::string>::iterator it = values.begin();
41  it != values.end(); it++) {
42  if ((*it).find(me_name) != std::string::npos) {
43  full_path = prefix_str + (*it);
44  return true;
45  }
46  }
47  return false;
48 }
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 216 of file TrackingUtility.cc.

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

Definition at line 10 of file TrackingUtility.cc.

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

References split(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

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

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

74  {
76  rval = 0; gval = 255; bval = 0;
77  } else if (status == dqm::qstatus::WARNING) {
78  rval = 255; gval = 255; bval = 0;
79  } else if (status == dqm::qstatus::ERROR) {
80  rval = 255; gval = 0; bval = 0;
81  } else if (status == dqm::qstatus::OTHER) {
82  rval = 255; gval = 150; bval = 0;
83  } else {
84  rval = 0; gval = 0; bval = 255;
85  }
86 }
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 90 of file TrackingUtility.cc.

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

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

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

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

Definition at line 130 of file TrackingUtility.cc.

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

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

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

230  {
231  path = "";
232  ibooker.cd();
233  if (igetter.dirExists(top_dir)) {
234  ibooker.cd(top_dir);
235  path = ibooker.pwd();
236  } else {
237  if (TrackingUtility::goToDir(ibooker,igetter, top_dir)) {
238  std::string tdir = "TrackParameters";
239  if (TrackingUtility::goToDir(ibooker,igetter, tdir)) {
240  path = ibooker.pwd();
241  path = path.substr(0, path.find(tdir)-1);
242  }
243  }
244  }
245 }
void cd(void)
Definition: DQMStore.cc:266
const std::string & pwd(void)
Definition: DQMStore.cc:282
tuple path
else: Piece not in the list, fine.
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
bool dirExists(const std::string &path)
Definition: DQMStore.cc:318
bool TrackingUtility::goToDir ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  name 
)
static

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

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

Definition at line 205 of file TrackingUtility.cc.

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

Definition at line 53 of file TrackingUtility.cc.

Referenced by checkME(), and getMEList().

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