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 (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::string &dir_path, std::vector< std::string > &me_names)
 
static int getMEList (std::string name, std::vector< std::string > &values)
 
static std::vector< std::string > getQTestNameList (MonitorElement *me)
 
static int getStatus (MonitorElement *me)
 
static void getStatusColor (double status, int &rval, int &gval, int &bval)
 
static void getStatusColor (int status, int &icol, std::string &tag)
 
static void getStatusColor (int 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

◆ DQMStore

Definition at line 22 of file SiPixelUtility.h.

◆ MonitorElement

Definition at line 21 of file SiPixelUtility.h.

Member Function Documentation

◆ checkME()

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

Definition at line 33 of file SiPixelUtility.cc.

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 }

References Skims_PA_cff::name, submitPVValidationJobs::split(), and contentValuesCheck::values.

◆ computeErrorCode()

int SiPixelUtility::computeErrorCode ( int  status)
static

Definition at line 150 of file SiPixelUtility.cc.

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 }

References dqm::qstatus::ERROR, dqm::qstatus::INSUF_STAT, mps_update::status, and dqm::qstatus::WARNING.

◆ computeHistoBin()

int SiPixelUtility::computeHistoBin ( std::string &  module_path)
static

Definition at line 167 of file SiPixelUtility.cc.

167  {
168  int module_bin = 0;
169 
170  int module = 0;
171  int shell = 0;
172  int layer = 0;
173  int ladder = 0;
174  int halfcylinder = 0;
175  int disk = 0;
176  int blade = 0;
177  int panel = 0;
178 
179  int nbinShell = 192;
180  int nbinLayer = 0;
181  int nbinLadder = 4;
182 
183  int nbinHalfcylinder = 168;
184  int nbinDisk = 84;
185  int nbinBlade = 7;
186  int nbinPanel = 0;
187 
188  vector<string> subDirVector;
189  SiPixelUtility::split(module_path, subDirVector, "/");
190 
191  for (vector<string>::const_iterator it = subDirVector.begin(); it != subDirVector.end(); it++) {
192  if ((*it).find("Collector") != string::npos ||
193  //(*it).find("Collated") != string::npos ||
194  (*it).find("FU") != string::npos || (*it).find("Pixel") != string::npos ||
195  (*it).find("Barrel") != string::npos || (*it).find("Endcap") != string::npos)
196  continue;
197 
198  if ((*it).find("Module") != string::npos) {
199  module = atoi((*it).substr((*it).find("_") + 1).c_str());
200  }
201 
202  if ((*it).find("Shell") != string::npos) {
203  if ((*it).find("mI") != string::npos)
204  shell = 1;
205  if ((*it).find("mO") != string::npos)
206  shell = 2;
207  if ((*it).find("pI") != string::npos)
208  shell = 3;
209  if ((*it).find("pO") != string::npos)
210  shell = 4;
211  }
212  if ((*it).find("Layer") != string::npos) {
213  layer = atoi((*it).substr((*it).find("_") + 1).c_str());
214  if (layer == 1) {
215  nbinLayer = 0;
216  }
217  if (layer == 2) {
218  nbinLayer = 40;
219  }
220  if (layer == 3) {
221  nbinLayer = 40 + 64;
222  }
223  }
224  if ((*it).find("Ladder") != string::npos) {
225  ladder = atoi((*it).substr((*it).find("_") + 1, 2).c_str());
226  }
227  if ((*it).find("HalfCylinder") != string::npos) {
228  if ((*it).find("mI") != string::npos)
229  halfcylinder = 1;
230  if ((*it).find("mO") != string::npos)
231  halfcylinder = 2;
232  if ((*it).find("pI") != string::npos)
233  halfcylinder = 3;
234  if ((*it).find("pO") != string::npos)
235  halfcylinder = 4;
236  }
237  if ((*it).find("Disk") != string::npos) {
238  disk = atoi((*it).substr((*it).find("_") + 1).c_str());
239  }
240  if ((*it).find("Blade") != string::npos) {
241  blade = atoi((*it).substr((*it).find("_") + 1, 2).c_str());
242  }
243  if ((*it).find("Panel") != string::npos) {
244  panel = atoi((*it).substr((*it).find("_") + 1).c_str());
245  if (panel == 1)
246  nbinPanel = 0;
247  if (panel == 2)
248  nbinPanel = 4;
249  }
250  }
251  if (module_path.find("Barrel") != string::npos) {
252  module_bin = module + (ladder - 1) * nbinLadder + nbinLayer + (shell - 1) * nbinShell;
253  }
254  if (module_path.find("Endcap") != string::npos) {
255  module_bin = module + (panel - 1) * nbinPanel + (blade - 1) * nbinBlade + (disk - 1) * nbinDisk +
256  (halfcylinder - 1) * nbinHalfcylinder;
257  }
258 
259  return module_bin;
260 
261  // cout << "leaving SiPixelInformationExtractor::computeHistoBin" << endl;
262 }

References PVValHelper::ladder, phase1PixelTopology::layer, and split().

◆ createStatusLegendMessages()

void SiPixelUtility::createStatusLegendMessages ( std::map< std::string, std::pair< int, double >> &  messages)
static

Definition at line 309 of file SiPixelUtility.cc.

309  {
310  for (int iStatus = 1; iStatus < 5; iStatus++) {
311  pair<int, double> color_size;
312  int color = 1;
313  double size = 0.03;
314  string code;
315  string type;
316  color_size.second = size;
317  switch (iStatus) {
318  case 1:
319  code = "1";
320  type = "INSUF_STAT";
321  color = kBlue;
322  break;
323  case 2:
324  code = "2";
325  type = "WARNING(S)";
326  color = kYellow;
327  break;
328  case 3:
329  code = "3";
330  type = "ERROR(S) ";
331  color = kRed;
332  break;
333  case 4:
334  code = "4";
335  type = "ERRORS ";
336  color = kMagenta;
337  break;
338  } // end of switch
339  string messageString = code + ": " + type;
340  color_size.first = color;
341  messages[messageString] = color_size;
342  }
343 }

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

◆ fillPaveText()

void SiPixelUtility::fillPaveText ( TPaveText *  pave,
const std::map< std::string, std::pair< int, double >> &  messages 
)
static

Definition at line 264 of file SiPixelUtility.cc.

264  {
265  TText *sourceCodeOnCanvas;
266  for (map<string, pair<int, double>>::const_iterator it = messages.begin(); it != messages.end(); it++) {
267  string message = it->first;
268  int color = (it->second).first;
269  double size = (it->second).second;
270  sourceCodeOnCanvas = pave->AddText(message.c_str());
271  sourceCodeOnCanvas->SetTextColor(color);
272  sourceCodeOnCanvas->SetTextSize(size);
273  sourceCodeOnCanvas->SetTextFont(112);
274  }
275 }

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

◆ getMEList() [1/2]

static int SiPixelUtility::getMEList ( std::string  name,
std::string &  dir_path,
std::vector< std::string > &  me_names 
)
static

◆ getMEList() [2/2]

static int SiPixelUtility::getMEList ( std::string  name,
std::vector< std::string > &  values 
)
static

◆ getQTestNameList()

vector< string > SiPixelUtility::getQTestNameList ( MonitorElement me)
static

Definition at line 145 of file SiPixelUtility.cc.

145  {
146  vector<string> qtestNameList;
147  return qtestNameList;
148 }

◆ getStatus()

int SiPixelUtility::getStatus ( MonitorElement me)
static

Definition at line 129 of file SiPixelUtility.cc.

129  {
130  int status = 0;
131  if (me->getQReports().empty()) {
132  status = 0;
133  } else if (me->hasError()) {
135  } else if (me->hasWarning()) {
137  } else if (me->hasOtherReport()) {
139  } else {
141  }
142  return status;
143 }

References dqm::qstatus::ERROR, hlt_dqm_clientPB-live_cfg::me, dqm::qstatus::OTHER, mps_update::status, dqm::qstatus::STATUS_OK, and dqm::qstatus::WARNING.

◆ getStatusColor() [1/3]

void SiPixelUtility::getStatusColor ( double  status,
int &  rval,
int &  gval,
int &  bval 
)
static

◆ getStatusColor() [2/3]

static void SiPixelUtility::getStatusColor ( int  status,
int &  icol,
std::string &  tag 
)
static

◆ getStatusColor() [3/3]

void SiPixelUtility::getStatusColor ( int  status,
int &  rval,
int &  gval,
int &  bval 
)
static

Definition at line 74 of file SiPixelUtility.cc.

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 }

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

◆ setDrawingOption()

void SiPixelUtility::setDrawingOption ( TH1 *  hist,
float  xlow = -1.,
float  xhigh = -1. 
)
static

Definition at line 349 of file SiPixelUtility.cc.

349  {
350  if (!hist)
351  return;
352 
353  TAxis *xa = hist->GetXaxis();
354  TAxis *ya = hist->GetYaxis();
355 
356  xa->SetTitleOffset(0.7);
357  xa->SetTitleSize(0.06);
358  xa->SetLabelSize(0.04);
359  // xa->SetLabelColor(0);
360 
361  ya->SetTitleOffset(0.7);
362  ya->SetTitleSize(0.06);
363 
364  if (xlow != -1 && xhigh != -1.0) {
365  xa->SetRangeUser(xlow, xhigh);
366  }
367 }

References gpuVertexFinder::hist.

◆ sourceCodeMap()

map< string, string > SiPixelUtility::sourceCodeMap ( )
static

Definition at line 277 of file SiPixelUtility.cc.

277  {
278  map<string, string> sourceCode;
279  for (int iSource = 0; iSource < 5; iSource++) {
280  string type;
281  string code;
282  switch (iSource) {
283  case 0:
284  type = "RAW";
285  code = "1 ";
286  break;
287  case 1:
288  type = "DIG";
289  code = "10 ";
290  break;
291  case 2:
292  type = "CLU";
293  code = "100 ";
294  break;
295  case 3:
296  type = "TRK";
297  code = "1000 ";
298  break;
299  case 4:
300  type = "REC";
301  code = "10000";
302  break;
303  } // end of switch
304  sourceCode[type] = code;
305  }
306  return sourceCode;
307 }

◆ split()

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.

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 }

References str.

Referenced by computeHistoBin().

dqm::qstatus::INSUF_STAT
static const int INSUF_STAT
Definition: MonitorElement.h:50
mps_update.status
status
Definition: mps_update.py:69
SiPixelContinuousPalette::g
constexpr int g[]
Definition: SiPixelContinuousPalette.h:23
pos
Definition: PixelAliasList.h:18
SiPixelContinuousPalette::b
constexpr int b[]
Definition: SiPixelContinuousPalette.h:29
dqm::qstatus::WARNING
static const int WARNING
Definition: MonitorElement.h:53
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
str
#define str(s)
Definition: TestProcessor.cc:52
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
SiPixelUtility::split
static void split(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
Definition: SiPixelUtility.cc:53
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
dqm::qstatus::OTHER
static const int OTHER
Definition: MonitorElement.h:47
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
SiPixelContinuousPalette::r
constexpr int r[]
Definition: SiPixelContinuousPalette.h:16
createfilelist.int
int
Definition: createfilelist.py:10
shell
Definition: shell.py:1
PVValHelper::ladder
Definition: PVValidationHelpers.h:73
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
contentValuesCheck.messages
messages
Definition: contentValuesCheck.py:44
dqm::qstatus::STATUS_OK
static const int STATUS_OK
Definition: MonitorElement.h:52
genParticles_cff.map
map
Definition: genParticles_cff.py:11
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
dqm::qstatus::ERROR
static const int ERROR
Definition: MonitorElement.h:54
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443