CMS 3D CMS Logo

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

#include <SiPixelUtility.h>

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 20 of file SiPixelUtility.h.

Member Function Documentation

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

Definition at line 34 of file SiPixelUtility.cc.

References split, and MuonErrorMatrixValues_cff::values.

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

Referenced by computeErrorCode().

int SiPixelUtility::computeErrorCode ( int  status)
static

Definition at line 151 of file SiPixelUtility.cc.

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

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

Definition at line 190 of file SiPixelUtility.cc.

References PVValHelper::ladder, and split().

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

Definition at line 332 of file SiPixelUtility.cc.

References create_public_lumi_plots::color, and findQualityFiles::size.

332  {
333  for (int iStatus = 1; iStatus < 5; iStatus++) {
334  pair<int, double> color_size;
335  int color = 1;
336  double size = 0.03;
337  string code;
338  string type;
339  color_size.second = size;
340  switch (iStatus) {
341  case 1:
342  code = "1";
343  type = "INSUF_STAT";
344  color = kBlue;
345  break;
346  case 2:
347  code = "2";
348  type = "WARNING(S)";
349  color = kYellow;
350  break;
351  case 3:
352  code = "3";
353  type = "ERROR(S) ";
354  color = kRed;
355  break;
356  case 4:
357  code = "4";
358  type = "ERRORS ";
359  color = kMagenta;
360  break;
361  } // end of switch
362  string messageString = code + ": " + type;
363  color_size.first = color;
364  messages[messageString] = color_size;
365  }
366 }
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 287 of file SiPixelUtility.cc.

References create_public_lumi_plots::color, plotBeamSpotDB::first, genParticles_cff::map, edm::second(), and findQualityFiles::size.

287  {
288  TText *sourceCodeOnCanvas;
289  for (map<string, pair<int, double>>::const_iterator it = messages.begin(); it != messages.end(); it++) {
290  string message = it->first;
291  int color = (it->second).first;
292  double size = (it->second).second;
293  sourceCodeOnCanvas = pave->AddText(message.c_str());
294  sourceCodeOnCanvas->SetTextColor(color);
295  sourceCodeOnCanvas->SetTextSize(size);
296  sourceCodeOnCanvas->SetTextFont(112);
297  }
298 }
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 146 of file SiPixelUtility.cc.

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

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

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

Definition at line 75 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.

75  {
77  rval = 0;
78  gval = 255;
79  bval = 0;
80  } else if (status == dqm::qstatus::WARNING) {
81  rval = 255;
82  gval = 255;
83  bval = 0;
84  } else if (status == dqm::qstatus::ERROR) {
85  rval = 255;
86  gval = 0;
87  bval = 0;
88  } else if (status == dqm::qstatus::OTHER) {
89  rval = 255;
90  gval = 150;
91  bval = 0;
92  } else {
93  rval = 0;
94  gval = 0;
95  bval = 255;
96  }
97 }
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
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 372 of file SiPixelUtility.cc.

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

Definition at line 300 of file SiPixelUtility.cc.

300  {
301  map<string, string> sourceCode;
302  for (int iSource = 0; iSource < 5; iSource++) {
303  string type;
304  string code;
305  switch (iSource) {
306  case 0:
307  type = "RAW";
308  code = "1 ";
309  break;
310  case 1:
311  type = "DIG";
312  code = "10 ";
313  break;
314  case 2:
315  type = "CLU";
316  code = "100 ";
317  break;
318  case 3:
319  type = "TRK";
320  code = "1000 ";
321  break;
322  case 4:
323  type = "REC";
324  code = "10000";
325  break;
326  } // end of switch
327  sourceCode[type] = code;
328  }
329  return sourceCode;
330 }
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 54 of file SiPixelUtility.cc.

Referenced by computeHistoBin().

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