CMS 3D CMS Logo

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

#include <TrackingUtility.h>

Public Types

typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 

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 19 of file TrackingUtility.h.

Member Typedef Documentation

Definition at line 21 of file TrackingUtility.h.

Definition at line 22 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 contentValuesCheck::values.

31  {
32  if (name.find(name) == std::string::npos)
33  return false;
34  std::string prefix_str = name.substr(0, (name.find(":")));
35  prefix_str += "/";
36  std::string temp_str = name.substr(name.find(":") + 1);
37  std::vector<std::string> values;
38  split(temp_str, values, ",");
39  for (std::vector<std::string>::iterator it = values.begin(); 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 228 of file TrackingUtility.cc.

References testProducerWithPsetDescEmpty_cfi::x1.

228  {
229  if (flag == 0)
230  message += " No Error";
231  else {
232  // message += " Error from :: ";
233  if (((flag >> 0) & 0x1) > 0)
234  message += " Fed BadChannel : ";
235  if (((flag >> 1) & 0x1) > 0)
236  message += " # of Digi : ";
237  if (((flag >> 2) & 0x1) > 0)
238  message += " # of Clusters :";
239  if (((flag >> 3) & 0x1) > 0)
240  message += " Excluded FED Channel ";
241  if (((flag >> 4) & 0x1) > 0)
242  message += " DCSError ";
243  }
244 }
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(); it != values.end(); it++)
15  (*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 120 of file TrackingUtility.cc.

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

120  {
121  int status = 0;
122  if (me->getQReports().empty()) {
123  status = 0;
124  } else if (me->hasError()) {
125  status = dqm::qstatus::ERROR;
126  } else if (me->hasWarning()) {
127  status = dqm::qstatus::WARNING;
128  } else if (me->hasOtherReport()) {
129  status = dqm::qstatus::OTHER;
130  } else {
131  status = dqm::qstatus::STATUS_OK;
132  }
133  return status;
134 }
static const int OTHER
static const int WARNING
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
bool hasError() const
true if at least of one of the quality tests returned an error
static const int STATUS_OK
static const int ERROR
int TrackingUtility::getMEStatus ( MonitorElement me,
int &  bad_channels 
)
static

Definition at line 157 of file TrackingUtility.cc.

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

157  {
158  int status = 0;
159  if (me->getQReports().empty()) {
160  status = 0;
161  bad_channels = -1;
162  } else {
163  std::vector<QReport*> qreports = me->getQReports();
164  bad_channels = qreports[0]->getBadChannels().size();
165  if (me->hasError()) {
166  status = dqm::qstatus::ERROR;
167  } else if (me->hasWarning()) {
168  status = dqm::qstatus::WARNING;
169  } else if (me->hasOtherReport()) {
170  status = dqm::qstatus::OTHER;
171  } else {
172  status = dqm::qstatus::STATUS_OK;
173  }
174  }
175  return status;
176 }
static const int OTHER
static const int WARNING
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
bool hasError() const
true if at least of one of the quality tests returned an error
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;
75  gval = 255;
76  bval = 0;
77  } else if (status == dqm::qstatus::WARNING) {
78  rval = 255;
79  gval = 255;
80  bval = 0;
81  } else if (status == dqm::qstatus::ERROR) {
82  rval = 255;
83  gval = 0;
84  bval = 0;
85  } else if (status == dqm::qstatus::OTHER) {
86  rval = 255;
87  gval = 150;
88  bval = 0;
89  } else {
90  rval = 0;
91  gval = 0;
92  bval = 255;
93  }
94 }
static const int OTHER
static const int WARNING
unsigned long long int rval
Definition: vlib.h:21
static const int STATUS_OK
static const int ERROR
void TrackingUtility::getMEStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

Definition at line 98 of file TrackingUtility.cc.

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

98  {
100  tag = "Ok";
101  icol = 3;
102  } else if (status == dqm::qstatus::WARNING) {
103  tag = "Warning";
104  icol = 5;
105  } else if (status == dqm::qstatus::ERROR) {
106  tag = "Error";
107  icol = 2;
108  } else if (status == dqm::qstatus::OTHER) {
109  tag = "Other";
110  icol = 1;
111  } else {
112  tag = " ";
113  icol = 1;
114  }
115 }
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 180 of file TrackingUtility.cc.

References MonitorElementData::INT, dqm::impl::MonitorElement::kind(), MonitorElementData::REAL, and dqm::impl::MonitorElement::valueString().

180  {
181  val = "";
182  if (me && (me->kind() == MonitorElement::Kind::REAL || me->kind() == MonitorElement::Kind::INT)) {
183  val = me->valueString();
184  val = val.substr(val.find("=") + 1);
185  }
186 }
Kind kind() const
Get the type of the monitor element.
std::string valueString() const
void TrackingUtility::getModuleFolderList ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::vector< std::string > &  m_ids 
)
static

Definition at line 138 of file TrackingUtility.cc.

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

140  {
141  std::string currDir = ibooker.pwd();
142  if (currDir.find("module_") != std::string::npos) {
143  // std::string mId = currDir.substr(currDir.find("module_")+7, 9);
144  mfolders.push_back(currDir);
145  } else {
146  std::vector<std::string> subdirs = igetter.getSubdirs();
147  for (std::vector<std::string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
148  ibooker.cd(*it);
149  getModuleFolderList(ibooker, igetter, mfolders);
150  ibooker.goUp();
151  }
152  }
153 }
static void getModuleFolderList(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::vector< std::string > &m_ids)
void TrackingUtility::getTopFolderPath ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  top_dir,
std::string &  path 
)
static

Definition at line 248 of file TrackingUtility.cc.

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

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

251  {
252  path = "";
253  ibooker.cd();
254  if (igetter.dirExists(top_dir)) {
255  ibooker.cd(top_dir);
256  path = ibooker.pwd();
257  } else {
258  if (TrackingUtility::goToDir(ibooker, igetter, top_dir)) {
259  std::string tdir = "TrackParameters";
260  if (TrackingUtility::goToDir(ibooker, igetter, tdir)) {
261  path = ibooker.pwd();
262  path = path.substr(0, path.find(tdir) - 1);
263  }
264  }
265  }
266 }
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
bool TrackingUtility::goToDir ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string  name 
)
static

Definition at line 190 of file TrackingUtility.cc.

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

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

190  {
191  std::string currDir = ibooker.pwd();
192  std::string dirName = currDir.substr(currDir.find_last_of("/") + 1);
193  if (dirName.find(name) == 0) {
194  return true;
195  }
196  std::vector<std::string> subDirVec = igetter.getSubdirs();
197  for (std::vector<std::string>::const_iterator ic = subDirVec.begin(); ic != subDirVec.end(); ic++) {
198  std::string fname = (*ic);
199  if ((fname.find("Reference") != std::string::npos) || (fname.find("AlCaReco") != std::string::npos) ||
200  (fname.find("HLT") != std::string::npos))
201  continue;
202  igetter.cd(fname);
203  if (!goToDir(ibooker, igetter, name))
204  ibooker.goUp();
205  else
206  return true;
207  }
208  return false;
209 }
static bool goToDir(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, std::string name)
string fname
main script
void TrackingUtility::setBadModuleFlag ( std::string &  hname,
uint16_t &  flg 
)
static

Definition at line 213 of file TrackingUtility.cc.

213  {
214  if (hname.find("FractionOfBadChannels") != std::string::npos)
215  flg |= (1 << 0);
216  else if (hname.find("NumberOfDigi") != std::string::npos)
217  flg |= (1 << 1);
218  else if (hname.find("NumberOfCluster") != std::string::npos)
219  flg |= (1 << 2);
220  else if (hname.find("ExcludedFedChannel") != std::string::npos)
221  flg |= (1 << 3);
222  else if (hname.find("DCSError") != std::string::npos)
223  flg |= (1 << 4);
224 }
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)