CMS 3D CMS Logo

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

#include <SiPixelUtility.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Static Public Member Functions

static bool checkME (std::string element, std::string name, std::string &full_path)
 
static int computeErrorCode (DQMStore *bei, std::string &module_path)
 
static int computeErrorCode (int status)
 
static int computeHistoBin (std::string &module_path)
 
static void createStatusLegendMessages (std::map< std::string, std::pair< int, double >> &messages)
 
static void fillPaveText (TPaveText *pave, const std::map< std::string, std::pair< int, double >> &messages)
 
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 std::vector< std::string > getQTestNameList (MonitorElement *me)
 
static int getStatus (MonitorElement *me)
 
static void getStatusColor (int status, int &rval, int &gval, int &bval)
 
static void getStatusColor (int status, int &icol, std::string &tag)
 
static void getStatusColor (double status, int &rval, int &gval, int &bval)
 
static void setDrawingOption (TH1 *hist, float xlow=-1., float xhigh=-1.)
 
static std::map< std::string, std::string > sourceCodeMap ()
 
static void split (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
 

Detailed Description

Definition at line 19 of file SiPixelUtility.h.

Member Typedef Documentation

Definition at line 22 of file SiPixelUtility.h.

Definition at line 21 of file SiPixelUtility.h.

Member Function Documentation

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

Definition at line 33 of file SiPixelUtility.cc.

References cms::dd::split(), and contentValuesCheck::values.

33  {
34  if (name.find(name) == string::npos)
35  return false;
36  string prefix_str = name.substr(0, (name.find(":")));
37  prefix_str += "/";
38  string temp_str = name.substr(name.find(":") + 1);
39  vector<string> values;
40  split(temp_str, values, ",");
41  for (vector<string>::iterator it = values.begin(); it != values.end(); it++) {
42  if ((*it).find(me_name) != 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=" ")
static int SiPixelUtility::computeErrorCode ( DQMStore bei,
std::string &  module_path 
)
static

Referenced by computeErrorCode().

int SiPixelUtility::computeErrorCode ( int  status)
static

Definition at line 150 of file SiPixelUtility.cc.

References computeErrorCode(), dqm::qstatus::ERROR, dqm::dqmstoreimpl::DQMStore::getStatus(), dqm::qstatus::INSUF_STAT, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

150  {
151  int code = 0;
152  switch (status) {
154  code = 1;
155  break;
157  code = 2;
158  break;
159  case dqm::qstatus::ERROR:
160  code = 3;
161  break;
162  } // end switch
163 
164  return code;
165 }
static const int WARNING
static const int INSUF_STAT
static const int ERROR
int SiPixelUtility::computeHistoBin ( std::string &  module_path)
static

Definition at line 189 of file SiPixelUtility.cc.

References PVValHelper::ladder, and split().

189  {
190  int module_bin = 0;
191 
192  int module = 0;
193  int shell = 0;
194  int layer = 0;
195  int ladder = 0;
196  int halfcylinder = 0;
197  int disk = 0;
198  int blade = 0;
199  int panel = 0;
200 
201  int nbinShell = 192;
202  int nbinLayer = 0;
203  int nbinLadder = 4;
204 
205  int nbinHalfcylinder = 168;
206  int nbinDisk = 84;
207  int nbinBlade = 7;
208  int nbinPanel = 0;
209 
210  vector<string> subDirVector;
211  SiPixelUtility::split(module_path, subDirVector, "/");
212 
213  for (vector<string>::const_iterator it = subDirVector.begin(); it != subDirVector.end(); it++) {
214  if ((*it).find("Collector") != string::npos ||
215  //(*it).find("Collated") != string::npos ||
216  (*it).find("FU") != string::npos || (*it).find("Pixel") != string::npos ||
217  (*it).find("Barrel") != string::npos || (*it).find("Endcap") != string::npos)
218  continue;
219 
220  if ((*it).find("Module") != string::npos) {
221  module = atoi((*it).substr((*it).find("_") + 1).c_str());
222  }
223 
224  if ((*it).find("Shell") != string::npos) {
225  if ((*it).find("mI") != string::npos)
226  shell = 1;
227  if ((*it).find("mO") != string::npos)
228  shell = 2;
229  if ((*it).find("pI") != string::npos)
230  shell = 3;
231  if ((*it).find("pO") != string::npos)
232  shell = 4;
233  }
234  if ((*it).find("Layer") != string::npos) {
235  layer = atoi((*it).substr((*it).find("_") + 1).c_str());
236  if (layer == 1) {
237  nbinLayer = 0;
238  }
239  if (layer == 2) {
240  nbinLayer = 40;
241  }
242  if (layer == 3) {
243  nbinLayer = 40 + 64;
244  }
245  }
246  if ((*it).find("Ladder") != string::npos) {
247  ladder = atoi((*it).substr((*it).find("_") + 1, 2).c_str());
248  }
249  if ((*it).find("HalfCylinder") != string::npos) {
250  if ((*it).find("mI") != string::npos)
251  halfcylinder = 1;
252  if ((*it).find("mO") != string::npos)
253  halfcylinder = 2;
254  if ((*it).find("pI") != string::npos)
255  halfcylinder = 3;
256  if ((*it).find("pO") != string::npos)
257  halfcylinder = 4;
258  }
259  if ((*it).find("Disk") != string::npos) {
260  disk = atoi((*it).substr((*it).find("_") + 1).c_str());
261  }
262  if ((*it).find("Blade") != string::npos) {
263  blade = atoi((*it).substr((*it).find("_") + 1, 2).c_str());
264  }
265  if ((*it).find("Panel") != string::npos) {
266  panel = atoi((*it).substr((*it).find("_") + 1).c_str());
267  if (panel == 1)
268  nbinPanel = 0;
269  if (panel == 2)
270  nbinPanel = 4;
271  }
272  }
273  if (module_path.find("Barrel") != string::npos) {
274  module_bin = module + (ladder - 1) * nbinLadder + nbinLayer + (shell - 1) * nbinShell;
275  }
276  if (module_path.find("Endcap") != string::npos) {
277  module_bin = module + (panel - 1) * nbinPanel + (blade - 1) * nbinBlade + (disk - 1) * nbinDisk +
278  (halfcylinder - 1) * nbinHalfcylinder;
279  }
280 
281  return module_bin;
282 
283  // cout << "leaving SiPixelInformationExtractor::computeHistoBin" << endl;
284 }
static void split(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Definition: shell.py:1
Definition: vlib.h:198
void SiPixelUtility::createStatusLegendMessages ( std::map< std::string, std::pair< int, double >> &  messages)
static

Definition at line 331 of file SiPixelUtility.cc.

References contentValuesCheck::messages, and findQualityFiles::size.

331  {
332  for (int iStatus = 1; iStatus < 5; iStatus++) {
333  pair<int, double> color_size;
334  int color = 1;
335  double size = 0.03;
336  string code;
337  string type;
338  color_size.second = size;
339  switch (iStatus) {
340  case 1:
341  code = "1";
342  type = "INSUF_STAT";
343  color = kBlue;
344  break;
345  case 2:
346  code = "2";
347  type = "WARNING(S)";
348  color = kYellow;
349  break;
350  case 3:
351  code = "3";
352  type = "ERROR(S) ";
353  color = kRed;
354  break;
355  case 4:
356  code = "4";
357  type = "ERRORS ";
358  color = kMagenta;
359  break;
360  } // end of switch
361  string messageString = code + ": " + type;
362  color_size.first = color;
363  messages[messageString] = color_size;
364  }
365 }
size
Write out results.
type
Definition: HCALResponse.h:21
void SiPixelUtility::fillPaveText ( TPaveText *  pave,
const std::map< std::string, std::pair< int, double >> &  messages 
)
static

Definition at line 286 of file SiPixelUtility.cc.

References dqmdumpme::first, genParticles_cff::map, contentValuesCheck::messages, edm::second(), and findQualityFiles::size.

286  {
287  TText *sourceCodeOnCanvas;
288  for (map<string, pair<int, double>>::const_iterator it = messages.begin(); it != messages.end(); it++) {
289  string message = it->first;
290  int color = (it->second).first;
291  double size = (it->second).second;
292  sourceCodeOnCanvas = pave->AddText(message.c_str());
293  sourceCodeOnCanvas->SetTextColor(color);
294  sourceCodeOnCanvas->SetTextSize(size);
295  sourceCodeOnCanvas->SetTextFont(112);
296  }
297 }
size
Write out results.
U second(std::pair< T, U > const &p)
static int SiPixelUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
)
static
static int SiPixelUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static
vector< string > SiPixelUtility::getQTestNameList ( MonitorElement me)
static

Definition at line 145 of file SiPixelUtility.cc.

145  {
146  vector<string> qtestNameList;
147  return qtestNameList;
148 }
int SiPixelUtility::getStatus ( MonitorElement me)
static

Definition at line 129 of file SiPixelUtility.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.

129  {
130  int status = 0;
131  if (me->getQReports().empty()) {
132  status = 0;
133  } else if (me->hasError()) {
134  status = dqm::qstatus::ERROR;
135  } else if (me->hasWarning()) {
136  status = dqm::qstatus::WARNING;
137  } else if (me->hasOtherReport()) {
138  status = dqm::qstatus::OTHER;
139  } else {
140  status = dqm::qstatus::STATUS_OK;
141  }
142  return status;
143 }
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 SiPixelUtility::getStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 74 of file SiPixelUtility.cc.

References dqm::qstatus::ERROR, dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, GlobalPosition_Frontier_DevDB_cff::tag, and dqm::qstatus::WARNING.

74  {
76  rval = 0;
77  gval = 255;
78  bval = 0;
79  } else if (status == dqm::qstatus::WARNING) {
80  rval = 255;
81  gval = 255;
82  bval = 0;
83  } else if (status == dqm::qstatus::ERROR) {
84  rval = 255;
85  gval = 0;
86  bval = 0;
87  } else if (status == dqm::qstatus::OTHER) {
88  rval = 255;
89  gval = 150;
90  bval = 0;
91  } else {
92  rval = 0;
93  gval = 0;
94  bval = 255;
95  }
96 }
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
static void SiPixelUtility::getStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static
void SiPixelUtility::getStatusColor ( double  status,
int &  rval,
int &  gval,
int &  bval 
)
static
void SiPixelUtility::setDrawingOption ( TH1 *  hist,
float  xlow = -1.,
float  xhigh = -1. 
)
static

Definition at line 371 of file SiPixelUtility.cc.

371  {
372  if (!hist)
373  return;
374 
375  TAxis *xa = hist->GetXaxis();
376  TAxis *ya = hist->GetYaxis();
377 
378  xa->SetTitleOffset(0.7);
379  xa->SetTitleSize(0.06);
380  xa->SetLabelSize(0.04);
381  // xa->SetLabelColor(0);
382 
383  ya->SetTitleOffset(0.7);
384  ya->SetTitleSize(0.06);
385 
386  if (xlow != -1 && xhigh != -1.0) {
387  xa->SetRangeUser(xlow, xhigh);
388  }
389 }
map< string, string > SiPixelUtility::sourceCodeMap ( )
static

Definition at line 299 of file SiPixelUtility.cc.

299  {
300  map<string, string> sourceCode;
301  for (int iSource = 0; iSource < 5; iSource++) {
302  string type;
303  string code;
304  switch (iSource) {
305  case 0:
306  type = "RAW";
307  code = "1 ";
308  break;
309  case 1:
310  type = "DIG";
311  code = "10 ";
312  break;
313  case 2:
314  type = "CLU";
315  code = "100 ";
316  break;
317  case 3:
318  type = "TRK";
319  code = "1000 ";
320  break;
321  case 4:
322  type = "REC";
323  code = "10000";
324  break;
325  } // end of switch
326  sourceCode[type] = code;
327  }
328  return sourceCode;
329 }
type
Definition: HCALResponse.h:21
void SiPixelUtility::split ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
)
static

Definition at line 53 of file SiPixelUtility.cc.

Referenced by computeHistoBin().

53  {
54  // Skip delimiters at beginning.
55  string::size_type lastPos = str.find_first_not_of(delimiters, 0);
56 
57  // Find first "non-delimiter".
58  string::size_type pos = str.find_first_of(delimiters, lastPos);
59 
60  while (string::npos != pos || string::npos != lastPos) {
61  // Found a token, add it to the 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
#define str(s)