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) 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();
42  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 142 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.

142  {
143  int code = 0;
144  switch(status){
146  code = 1;
147  break;
149  code = 2;
150  break;
151  case dqm::qstatus::ERROR:
152  code = 3;
153  break;
154  } // end switch
155 
156  return code;
157 
158 }
static const int WARNING
static const int INSUF_STAT
static const int ERROR
int SiPixelUtility::computeHistoBin ( std::string &  module_path)
static

Definition at line 186 of file SiPixelUtility.cc.

References PVValHelper::ladder, and split().

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

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

325  {
326  for(int iStatus=1; iStatus<5;iStatus++){
327  pair<int,double> color_size;
328  int color = 1;
329  double size = 0.03;
330  string code;
331  string type;
332  color_size.second = size;
333  switch(iStatus){
334  case 1: code = "1"; type = "INSUF_STAT"; color = kBlue;
335  break;
336  case 2: code = "2"; type = "WARNING(S)"; color = kYellow;
337  break;
338  case 3: code = "3"; type = "ERROR(S) "; color = kRed;
339  break;
340  case 4: code = "4"; type = "ERRORS "; color = kMagenta;
341  break;
342  } // end of switch
343  string messageString = code + ": " + type;
344  color_size.first = color;
345  messages[messageString] = color_size;
346  }
347 }
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 283 of file SiPixelUtility.cc.

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

284  {
285 
286  TText* sourceCodeOnCanvas;
287  for(map<string, pair<int,double> >::const_iterator it = messages.begin();
288  it != messages.end();
289  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  }
299 }
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 137 of file SiPixelUtility.cc.

137  {
138  vector<string> qtestNameList;
139  return qtestNameList;
140 }
int SiPixelUtility::getStatus ( MonitorElement me)
static

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

120  {
121  int status = 0;
122  if (me->getQReports().size() == 0) {
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
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
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; 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
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 353 of file SiPixelUtility.cc.

355  {
356  if (!hist) return;
357 
358  TAxis* xa = hist->GetXaxis();
359  TAxis* ya = hist->GetYaxis();
360 
361  xa->SetTitleOffset(0.7);
362  xa->SetTitleSize(0.06);
363  xa->SetLabelSize(0.04);
364  // xa->SetLabelColor(0);
365 
366  ya->SetTitleOffset(0.7);
367  ya->SetTitleSize(0.06);
368 
369 
370  if (xlow != -1 && xhigh != -1.0) {
371  xa->SetRangeUser(xlow, xhigh);
372  }
373 }
map< string, string > SiPixelUtility::sourceCodeMap ( )
static

Definition at line 301 of file SiPixelUtility.cc.

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