CMS 3D CMS Logo

SiStripPayloadInspectorHelper.h
Go to the documentation of this file.
1 #ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H
3 
4 #include <vector>
5 #include <numeric>
6 #include <string>
7 #include "TH1.h"
8 #include "TPaveText.h"
9 #include "TStyle.h"
18 
21 
22 namespace SiStripPI {
23 
24  enum estimator {
25  min,
26  max,
29  };
30 
31  /*--------------------------------------------------------------------*/
33  /*--------------------------------------------------------------------*/
34  {
35  switch(e){
36  case SiStripPI::min : return "minimum";
37  case SiStripPI::max : return "maximum";
38  case SiStripPI::mean : return "mean";
39  case SiStripPI::rms : return "RMS";
40  default: return "should never be here";
41  }
42  }
43 
44  /*--------------------------------------------------------------------*/
46  /*-------------------------------------------------------------------*/
47  {
48  switch(sub){
49  case StripSubdetector::TIB : return "TIB";
50  case StripSubdetector::TOB : return "TOB";
51  case StripSubdetector::TID : return "TID";
52  case StripSubdetector::TEC : return "TEC";
53  default : return "should never be here";
54  }
55  }
56 
57  enum TrackerRegion {
58  TIB1r = 1010, TIB1s = 1011,
59  TIB2r = 1020, TIB2s = 1021,
60  TIB3r = 1030,
61  TIB4r = 1040,
62  TOB1r = 2010, TOB1s = 2011,
63  TOB2r = 2020, TOB2s = 2021,
64  TOB3r = 2030,
65  TOB4r = 2040,
66  TOB5r = 2050,
67  TOB6r = 2060,
68  TEC1r = 3010, TEC1s = 3011,
69  TEC2r = 3020, TEC2s = 3021,
70  TEC3r = 3030, TEC3s = 3031,
71  TEC4r = 3040, TEC4s = 3041,
72  TEC5r = 3050, TEC5s = 3051,
73  TEC6r = 3060, TEC6s = 3061,
74  TEC7r = 3070, TEC7s = 3071,
75  TEC8r = 3080, TEC8s = 3081,
76  TEC9r = 3090, TEC9s = 3091,
77  TID1r = 4010, TID1s = 4011,
78  TID2r = 4020, TID2s = 4021,
79  TID3r = 4030, TID3s = 4031,
81  };
82 
83  /*--------------------------------------------------------------------*/
84  std::pair<int,const char *> regionType(int index)
85  /*--------------------------------------------------------------------*/
86  {
87 
88  auto region = static_cast<std::underlying_type_t<SiStripPI::TrackerRegion> >(index);
89 
90  switch(region){
91  case SiStripPI::TIB1r: return std::make_pair(1 ,"TIB L1 r-#varphi");
92  case SiStripPI::TIB1s: return std::make_pair(2 ,"TIB L1 stereo");
93  case SiStripPI::TIB2r: return std::make_pair(3 ,"TIB L2 r-#varphi");
94  case SiStripPI::TIB2s: return std::make_pair(4 ,"TIB L2 stereo");
95  case SiStripPI::TIB3r: return std::make_pair(5 ,"TIB L3");
96  case SiStripPI::TIB4r: return std::make_pair(6 ,"TIB L4");
97  case SiStripPI::TOB1r: return std::make_pair(7 ,"TOB L1 r-#varphi");
98  case SiStripPI::TOB1s: return std::make_pair(8 ,"TOB L1 stereo");
99  case SiStripPI::TOB2r: return std::make_pair(9 ,"TOB L2 r-#varphi");
100  case SiStripPI::TOB2s: return std::make_pair(10,"TOB L2 stereo");
101  case SiStripPI::TOB3r: return std::make_pair(11,"TOB L3 r-#varphi");
102  case SiStripPI::TOB4r: return std::make_pair(12,"TOB L4");
103  case SiStripPI::TOB5r: return std::make_pair(13,"TOB L5");
104  case SiStripPI::TOB6r: return std::make_pair(14,"TOB L6");
105  case SiStripPI::TEC1r: return std::make_pair(15,"TEC D1 r-#varphi");
106  case SiStripPI::TEC1s: return std::make_pair(16,"TEC D1 stereo");
107  case SiStripPI::TEC2r: return std::make_pair(17,"TEC D2 r-#varphi");
108  case SiStripPI::TEC2s: return std::make_pair(18,"TEC D2 stereo");
109  case SiStripPI::TEC3r: return std::make_pair(19,"TEC D3 r-#varphi");
110  case SiStripPI::TEC3s: return std::make_pair(20,"TEC D3 stereo");
111  case SiStripPI::TEC4r: return std::make_pair(21,"TEC D4 r-#varphi");
112  case SiStripPI::TEC4s: return std::make_pair(22,"TEC D4 stereo");
113  case SiStripPI::TEC5r: return std::make_pair(23,"TEC D5 r-#varphi");
114  case SiStripPI::TEC5s: return std::make_pair(24,"TEC D5 stereo");
115  case SiStripPI::TEC6r: return std::make_pair(25,"TEC D6 r-#varphi");
116  case SiStripPI::TEC6s: return std::make_pair(26,"TEC D6 stereo");
117  case SiStripPI::TEC7r: return std::make_pair(27,"TEC D7 r-#varphi");
118  case SiStripPI::TEC7s: return std::make_pair(28,"TEC D7 stereo");
119  case SiStripPI::TEC8r: return std::make_pair(29,"TEC D8 r-#varphi");
120  case SiStripPI::TEC8s: return std::make_pair(30,"TEC D8 stereo");
121  case SiStripPI::TEC9r: return std::make_pair(31,"TEC D9 r-#varphi");
122  case SiStripPI::TEC9s: return std::make_pair(32,"TEC D9 stereo");
123  case SiStripPI::TID1r: return std::make_pair(33,"TID D1 r-#varphi");
124  case SiStripPI::TID1s: return std::make_pair(34,"TID D1 stereo");
125  case SiStripPI::TID2r: return std::make_pair(35,"TID D2 r-#varphi");
126  case SiStripPI::TID2s: return std::make_pair(36,"TID D2 stereo");
127  case SiStripPI::TID3r: return std::make_pair(37,"TID D3 r-#varphi");
128  case SiStripPI::TID3s: return std::make_pair(38,"TID D3 stereo");
129  case SiStripPI::END_OF_REGIONS : std::make_pair(-1,"undefined");
130  default : return std::make_pair(999,"should never be here");
131  }
132  }
133 
134  /*--------------------------------------------------------------------*/
135  std::pair<float,float> getTheRange(std::map<uint32_t,float> values,const float nsigma)
136  /*--------------------------------------------------------------------*/
137  {
138  float sum = std::accumulate(std::begin(values),
139  std::end(values),
140  0.0,
141  [] (float value, const std::map<uint32_t,float>::value_type& p)
142  { return value + p.second; }
143  );
144 
145  float m = sum / values.size();
146 
147  float accum = 0.0;
148  std::for_each (std::begin(values),
149  std::end(values),
151  {accum += (p.second - m) * (p.second - m);}
152  );
153 
154  float stdev = sqrt(accum / (values.size()-1));
155 
156  if(stdev!=0.){
157  return std::make_pair(m-nsigma*stdev,m+nsigma*stdev);
158  } else {
159  return std::make_pair(m>0.? 0.95*m : 1.05*m, m>0? 1.05*m : 0.95*m);
160  }
161  }
162 
163  /*--------------------------------------------------------------------*/
164  void drawStatBox(std::map<std::string,std::shared_ptr<TH1F>> histos, std::map<std::string,int> colormap, std::vector<std::string> legend, double X=0.15, double Y=0.93, double W=0.15, double H=0.10)
165  /*--------------------------------------------------------------------*/
166  {
167  char buffer[255];
168 
169  int i=0;
170  for ( const auto &element : legend ){
171  TPaveText* stat = new TPaveText(X,Y-(i*H), X+W, Y-(i+1)*H, "NDC");
172  i++;
173  auto Histo = histos[element];
174  sprintf(buffer,"Entries : %i\n",(int)Histo->GetEntries());
175  stat->AddText(buffer);
176 
177  sprintf(buffer,"Mean : %6.2f\n",Histo->GetMean());
178  stat->AddText(buffer);
179 
180  sprintf(buffer,"RMS : %6.2f\n",Histo->GetRMS());
181  stat->AddText(buffer);
182 
183  stat->SetFillColor(0);
184  stat->SetLineColor(colormap[element]);
185  stat->SetTextColor(colormap[element]);
186  stat->SetTextSize(0.03);
187  stat->SetBorderSize(0);
188  stat->SetMargin(0.05);
189  stat->SetTextAlign(12);
190  stat->Draw();
191  }
192  }
193 
194  /*--------------------------------------------------------------------*/
195  std::pair<float,float> getExtrema(TH1 *h1,TH1 *h2)
196  /*--------------------------------------------------------------------*/
197  {
198  float theMax(-9999.);
199  float theMin(9999.);
200  theMax = h1->GetMaximum() > h2->GetMaximum() ? h1->GetMaximum() : h2->GetMaximum();
201  theMin = h1->GetMinimum() < h2->GetMaximum() ? h1->GetMinimum() : h2->GetMinimum();
202 
203  float add_min = theMin>0. ? -0.05 : 0.05;
204  float add_max = theMax>0. ? 0.05 : -0.05;
205 
206  auto result = std::make_pair(theMin*(1+add_min),theMax*(1+add_max));
207  return result;
208 
209  }
210 
211 
212  /*--------------------------------------------------------------------*/
214  /*--------------------------------------------------------------------*/
215  {
216  hist->SetStats(kFALSE);
217  hist->SetLineWidth(2);
218  hist->GetXaxis()->CenterTitle(true);
219  hist->GetYaxis()->CenterTitle(true);
220  hist->GetXaxis()->SetTitleFont(42);
221  hist->GetYaxis()->SetTitleFont(42);
222  hist->GetXaxis()->SetTitleSize(0.05);
223  hist->GetYaxis()->SetTitleSize(0.05);
224  hist->GetXaxis()->SetTitleOffset(0.9);
225  hist->GetYaxis()->SetTitleOffset(1.3);
226  hist->GetXaxis()->SetLabelFont(42);
227  hist->GetYaxis()->SetLabelFont(42);
228  hist->GetYaxis()->SetLabelSize(.05);
229  hist->GetXaxis()->SetLabelSize(.05);
230  }
231 
232 
233  /*--------------------------------------------------------------------*/
234  void printSummary(const std::map<unsigned int, SiStripDetSummary::Values>& map)
235  /*--------------------------------------------------------------------*/
236  {
237  for (const auto &element : map){
238  int count = element.second.count;
239  double mean = count>0 ? (element.second.mean)/count : 0. ;
240  double rms = count>0 ? (element.second.rms)/count - mean*mean : 0.;
241  if(rms <= 0)
242  rms = 0;
243  else
244  rms = sqrt(rms);
245 
247 
248  switch ((element.first)/1000)
249  {
250  case 1:
251  detector = "TIB ";
252  break;
253  case 2:
254  detector = "TOB ";
255  break;
256  case 3:
257  detector = "TEC ";
258  break;
259  case 4:
260  detector = "TID ";
261  break;
262  }
263 
264  int layer = (element.first)/10 - (element.first)/1000*100;
265  int stereo = (element.first) - (layer*10) -(element.first)/1000*1000;
266 
267  std::cout<<"key of the map:"<<element.first <<" ( region: "<<regionType(element.first).second <<" ) "
268  << detector<<" layer: "<<layer<<" stereo:"<<stereo
269  <<"| count:"<<count<<" mean: "<<mean<<" rms: "<<rms<<std::endl;
270 
271  }
272  }
273 
274  // code is mutuated from CalibTracker/SiStripQuality/plugins/SiStripQualityStatistics
275 
276  /*--------------------------------------------------------------------*/
277  void setBadComponents(int i, int component,const SiStripQuality::BadComponent& BC,int NBadComponent[4][19][4])
278  /*--------------------------------------------------------------------*/
279  {
280 
281  if (BC.BadApvs){
282  NBadComponent[i][0][2]+= std::bitset<16>(BC.BadApvs&0x3f).count();
283  NBadComponent[i][component][2]+= std::bitset<16>(BC.BadApvs&0x3f).count();
284  }
285 
286  if (BC.BadFibers){
287  NBadComponent[i][0][1]+= std::bitset<4>(BC.BadFibers&0x7).count();
288  NBadComponent[i][component][1]+= std::bitset<4>(BC.BadFibers&0x7).count();
289  }
290 
291  if (BC.BadModule){
292  NBadComponent[i][0][0]++;
293  NBadComponent[i][component][0]++;
294  }
295  }
296 
297 
298  // generic code to fill a SiStripDetSummary with Noise payload info
299  /*--------------------------------------------------------------------*/
300  void fillNoiseDetSummary(SiStripDetSummary &summaryNoise,std::shared_ptr<SiStripNoises> payload,SiStripPI::estimator est)
301  /*--------------------------------------------------------------------*/
302  {
303  SiStripNoises::RegistryIterator rit=payload->getRegistryVectorBegin(), erit=payload->getRegistryVectorEnd();
304  uint16_t Nstrips;
305  std::vector<float> vstripnoise;
306  double mean,rms,min, max;
307  for(;rit!=erit;++rit){
308  Nstrips = (rit->iend-rit->ibegin)*8/9; //number of strips = number of chars * char size / strip noise size
309  vstripnoise.resize(Nstrips);
310  payload->allNoises(vstripnoise,make_pair(payload->getDataVectorBegin()+rit->ibegin,payload->getDataVectorBegin()+rit->iend));
311 
312  mean=0; rms=0; min=10000; max=0;
313 
314  DetId detId(rit->detid);
315 
316  for(size_t i=0;i<Nstrips;++i){
317  mean+=vstripnoise[i];
318  rms+=vstripnoise[i]*vstripnoise[i];
319  if(vstripnoise[i]<min) min=vstripnoise[i];
320  if(vstripnoise[i]>max) max=vstripnoise[i];
321  }
322 
323  mean/=Nstrips;
324  if((rms/Nstrips-mean*mean)>0.){
325  rms = sqrt(rms/Nstrips-mean*mean);
326  } else {
327  rms=0.;
328  }
329 
330  switch(est){
331  case SiStripPI::min:
332  summaryNoise.add(detId,min);
333  break;
334  case SiStripPI::max:
335  summaryNoise.add(detId,max);
336  break;
337  case SiStripPI::mean:
338  summaryNoise.add(detId,mean);
339  break;
340  case SiStripPI::rms:
341  summaryNoise.add(detId,rms);
342  break;
343  default:
344  edm::LogWarning("LogicError") << "Unknown estimator: " << est;
345  break;
346  }
347  }
348  }
349 
350  /*--------------------------------------------------------------------*/
351  void fillTotalComponents(int NTkComponents[4], int NComponents[4][19][4],const TrackerTopology m_trackerTopo)
352  /*--------------------------------------------------------------------*/
353  {
354  edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
356  const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >& DetInfos = reader->getAllData();
357  for (const auto& det : DetInfos){
358 
359  int nAPVs = reader->getNumberOfApvsAndStripLength(det.first).first;
360  // one fiber connects to 2 APVs
361  int nFibers = nAPVs/2;
362  int nStrips = (128*reader->getNumberOfApvsAndStripLength(det.first).first);
363  NTkComponents[0]++;
364  NTkComponents[1]+=nFibers;
365  NTkComponents[2]+=nAPVs;
366  NTkComponents[3]+=nStrips;
367 
368  DetId detectorId=DetId(det.first);
369  int subDet = detectorId.subdetId();
370 
371  int subDetIndex = -1;
372  int component = -1;
373  if ( subDet == StripSubdetector::TIB ){
374  subDetIndex=0;
375  component=m_trackerTopo.tibLayer(det.first);
376  } else if ( subDet == StripSubdetector::TID ){
377  subDetIndex=1;
378  component=m_trackerTopo.tidSide(det.first)==2?m_trackerTopo.tidWheel(det.first):m_trackerTopo.tidWheel(det.first)+3;
379  } else if ( subDet == StripSubdetector::TOB ){
380  subDetIndex=2;
381  component=m_trackerTopo.tobLayer(det.first);
382  } else if ( subDet == StripSubdetector::TEC ){
383  subDetIndex=3;
384  component=m_trackerTopo.tecSide(det.first)==2?m_trackerTopo.tecWheel(det.first):m_trackerTopo.tecWheel(det.first)+9;
385  }
386 
387  NComponents[subDetIndex][0][0]++;
388  NComponents[subDetIndex][0][1]+=nFibers;
389  NComponents[subDetIndex][0][2]+=nAPVs;
390  NComponents[subDetIndex][0][3]+=nStrips;
391 
392  NComponents[subDetIndex][component][0]++;
393  NComponents[subDetIndex][component][1]+=nFibers;
394  NComponents[subDetIndex][component][2]+=nAPVs;
395  NComponents[subDetIndex][component][3]+=nStrips;
396  }
397  delete reader;
398  }
399 
400  // generic code to fill the vectors of bad components
401  /*--------------------------------------------------------------------*/
402  void fillBCArrays (const SiStripQuality* siStripQuality_,int NTkBadComponent[4], int NBadComponent[4][19][4],const TrackerTopology m_trackerTopo)
403  /*--------------------------------------------------------------------*/
404  {
405 
406  std::vector<SiStripQuality::BadComponent> BC = siStripQuality_->getBadComponentList();
407 
408  for (size_t i=0;i<BC.size();++i){
409 
410  //&&&&&&&&&&&&&
411  //Full Tk
412  //&&&&&&&&&&&&&
413 
414  if (BC.at(i).BadModule)
415  NTkBadComponent[0]++;
416  if (BC.at(i).BadFibers)
417  NTkBadComponent[1]+= ( (BC.at(i).BadFibers>>2)&0x1 )+ ( (BC.at(i).BadFibers>>1)&0x1 ) + ( (BC.at(i).BadFibers)&0x1 );
418  if (BC.at(i).BadApvs)
419  NTkBadComponent[2]+= ( (BC.at(i).BadApvs>>5)&0x1 )+ ( (BC.at(i).BadApvs>>4)&0x1 ) + ( (BC.at(i).BadApvs>>3)&0x1 ) +
420  ( (BC.at(i).BadApvs>>2)&0x1 )+ ( (BC.at(i).BadApvs>>1)&0x1 ) + ( (BC.at(i).BadApvs)&0x1 );
421 
422  //&&&&&&&&&&&&&&&&&
423  //Single SubSyste
424  //&&&&&&&&&&&&&&&&&
425  int component;
426  DetId detectorId=DetId(BC.at(i).detid);
427  int subDet = detectorId.subdetId();
428  if ( subDet == StripSubdetector::TIB ){
429  //&&&&&&&&&&&&&&&&&
430  //TIB
431  //&&&&&&&&&&&&&&&&&
432 
433  component=m_trackerTopo.tibLayer(BC.at(i).detid);
434  SiStripPI::setBadComponents(0, component, BC.at(i),NBadComponent);
435 
436  } else if ( subDet == StripSubdetector::TID ) {
437  //&&&&&&&&&&&&&&&&&
438  //TID
439  //&&&&&&&&&&&&&&&&&
440 
441  component=m_trackerTopo.tidSide(BC.at(i).detid)==2?m_trackerTopo.tidWheel(BC.at(i).detid):m_trackerTopo.tidWheel(BC.at(i).detid)+3;
442  SiStripPI::setBadComponents(1, component, BC.at(i),NBadComponent);
443 
444  } else if ( subDet == StripSubdetector::TOB ) {
445  //&&&&&&&&&&&&&&&&&
446  //TOB
447  //&&&&&&&&&&&&&&&&&
448 
449  component=m_trackerTopo.tobLayer(BC.at(i).detid);
450  SiStripPI::setBadComponents(2, component, BC.at(i),NBadComponent);
451 
452  } else if ( subDet == StripSubdetector::TEC ) {
453  //&&&&&&&&&&&&&&&&&
454  //TEC
455  //&&&&&&&&&&&&&&&&&
456 
457  component=m_trackerTopo.tecSide(BC.at(i).detid)==2?m_trackerTopo.tecWheel(BC.at(i).detid):m_trackerTopo.tecWheel(BC.at(i).detid)+9;
458  SiStripPI::setBadComponents(3, component, BC.at(i),NBadComponent);
459  }
460  }
461 
462  //&&&&&&&&&&&&&&&&&&
463  // Single Strip Info
464  //&&&&&&&&&&&&&&&&&&
465 
466  edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
468 
469  float percentage=0;
470 
471  SiStripQuality::RegistryIterator rbegin = siStripQuality_->getRegistryVectorBegin();
472  SiStripQuality::RegistryIterator rend = siStripQuality_->getRegistryVectorEnd();
473 
474  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
475  uint32_t detid=rp->detid;
476 
477  int subdet=-999; int component=-999;
478  DetId detectorId=DetId(detid);
479  int subDet = detectorId.subdetId();
480  if ( subDet == StripSubdetector::TIB ){
481  subdet=0;
482  component=m_trackerTopo.tibLayer(detid);
483  } else if ( subDet == StripSubdetector::TID ) {
484  subdet=1;
485  component=m_trackerTopo.tidSide(detid)==2?m_trackerTopo.tidWheel(detid):m_trackerTopo.tidWheel(detid)+3;
486  } else if ( subDet == StripSubdetector::TOB ) {
487  subdet=2;
488  component=m_trackerTopo.tobLayer(detid);
489  } else if ( subDet == StripSubdetector::TEC ) {
490  subdet=3;
491  component=m_trackerTopo.tecSide(detid)==2?m_trackerTopo.tecWheel(detid):m_trackerTopo.tecWheel(detid)+9;
492  }
493 
494  SiStripQuality::Range sqrange = SiStripQuality::Range( siStripQuality_->getDataVectorBegin()+rp->ibegin , siStripQuality_->getDataVectorBegin()+rp->iend );
495 
496  percentage=0;
497  for(int it=0;it<sqrange.second-sqrange.first;it++){
498  unsigned int range=siStripQuality_->decode( *(sqrange.first+it) ).range;
499  NTkBadComponent[3]+=range;
500  NBadComponent[subdet][0][3]+=range;
501  NBadComponent[subdet][component][3]+=range;
502  percentage+=range;
503  }
504  if(percentage!=0)
505  percentage/=128.*reader->getNumberOfApvsAndStripLength(detid).first;
506  if(percentage>1)
507  edm::LogError("SiStripBadStrip_PayloadInspector") << "PROBLEM detid " << detid << " value " << percentage<< std::endl;
508  }
509 
510  delete reader;
511 
512  }
513 
514  /*--------------------------------------------------------------------*/
515  void printBCDebug(int NTkBadComponent[4], int NBadComponent[4][19][4])
516  /*--------------------------------------------------------------------*/
517  {
518  //&&&&&&&&&&&&&&&&&&
519  // printout
520  //&&&&&&&&&&&&&&&&&&
521 
522  std::stringstream ss;
523  ss.str("");
524  ss << "\n-----------------\nGlobal Info\n-----------------";
525  ss << "\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
526  ss << "\nTracker:\t\t"<<NTkBadComponent[0]<<"\t"<<NTkBadComponent[1]<<"\t"<<NTkBadComponent[2]<<"\t"<<NTkBadComponent[3];
527  ss<< "\n";
528  ss << "\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<"\t"<<NBadComponent[0][0][1]<<"\t"<<NBadComponent[0][0][2]<<"\t"<<NBadComponent[0][0][3];
529  ss << "\nTID:\t\t\t"<<NBadComponent[1][0][0]<<"\t"<<NBadComponent[1][0][1]<<"\t"<<NBadComponent[1][0][2]<<"\t"<<NBadComponent[1][0][3];
530  ss << "\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<"\t"<<NBadComponent[2][0][1]<<"\t"<<NBadComponent[2][0][2]<<"\t"<<NBadComponent[2][0][3];
531  ss << "\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<"\t"<<NBadComponent[3][0][1]<<"\t"<<NBadComponent[3][0][2]<<"\t"<<NBadComponent[3][0][3];
532  ss << "\n";
533 
534  for (int i=1;i<5;++i)
535  ss << "\nTIB Layer " << i << " :\t\t"<<NBadComponent[0][i][0]<<"\t"<<NBadComponent[0][i][1]<<"\t"<<NBadComponent[0][i][2]<<"\t"<<NBadComponent[0][i][3];
536  ss << "\n";
537  for (int i=1;i<4;++i)
538  ss << "\nTID+ Disk " << i << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
539  for (int i=4;i<7;++i)
540  ss << "\nTID- Disk " << i-3 << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
541  ss << "\n";
542  for (int i=1;i<7;++i)
543  ss << "\nTOB Layer " << i << " :\t\t"<<NBadComponent[2][i][0]<<"\t"<<NBadComponent[2][i][1]<<"\t"<<NBadComponent[2][i][2]<<"\t"<<NBadComponent[2][i][3];
544  ss << "\n";
545  for (int i=1;i<10;++i)
546  ss << "\nTEC+ Disk " << i << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
547  for (int i=10;i<19;++i)
548  ss << "\nTEC- Disk " << i-9 << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
549  ss<< "\n";
550 
551  //edm::LogInfo("SiStripBadStrip_PayloadInspector") << ss.str() << std::endl;
552  std::cout<< ss.str() << std::endl;
553 
554  }
555 
556 
558 
559  /*--------------------------------------------------------------------*/
561  /*--------------------------------------------------------------------*/
562  {
563 
564  TStyle *palettestyle = new TStyle("palettestyle","Style for P-TDR");
565 
566  const int NRGBs = 5;
567  const int NCont = 255;
568 
569  switch(palette){
570 
571  case HALFGRAY:
572  {
573  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
574  double red[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
575  double green[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
576  double blue[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
577  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
578  }
579  break;
580 
581  case GRAY:
582  {
583  double stops[NRGBs] = {0.00, 0.01, 0.05, 0.09, 0.1};
584  double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
585  double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
586  double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
587  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
588  }
589  break;
590 
591  case BLUES:
592  {
593  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
594  double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
595  double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
596  double blue[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
597  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
598 
599  }
600  break;
601 
602  case REDS:
603  {
604  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
605  double red[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
606  double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
607  double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
608  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
609  }
610  break;
611 
612  case ANTIGRAY:
613  {
614  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
615  double red[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
616  double green[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
617  double blue[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
618  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
619  }
620  break;
621 
622  case FIRE:
623  {
624  double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00};
625  double red[NRGBs] = {1.00, 1.00, 1.00, 0.50};
626  double green[NRGBs] = {1.00, 1.00, 0.00, 0.00};
627  double blue[NRGBs] = {0.20, 0.00, 0.00, 0.00};
628  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
629  }
630  break;
631 
632  case ANTIFIRE:
633  {
634  double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00};
635  double red[NRGBs] = {0.50, 1.00, 1.00, 1.00};
636  double green[NRGBs] = {0.00, 0.00, 1.00, 1.00};
637  double blue[NRGBs] = {0.00, 0.00, 0.00, 0.20};
638  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
639  }
640  break;
641 
642  case LOGREDBLUE:
643  {
644  double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
645  double red[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
646  double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
647  double blue[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
648  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
649  }
650  break;
651 
652  case LOGBLUERED:
653  {
654  double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
655  double red[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
656  double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
657  double blue[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
658  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
659  }
660  break;
661 
662  case BLUERED:
663  {
664  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
665  double red[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
666  double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
667  double blue[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
668  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
669  }
670  break;
671 
672  case DEFAULT:
673  {
674  double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
675  double red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
676  double green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
677  double blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
678  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
679  }
680  break;
681  default:
682  std::cout<<"should nevere be here" << std::endl;
683  break;
684  }
685 
686  palettestyle->SetNumberContours(NCont);
687  }
688 
689 };
690 #endif
unsigned short range
const std::vector< BadComponent > & getBadComponentList() const
unsigned int tibLayer(const DetId &id) const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
#define X(str)
Definition: MuonsGrabber.cc:48
unsigned int tidWheel(const DetId &id) const
Registry::const_iterator RegistryIterator
void setPaletteStyle(SiStripPI::palette palette)
void fillBCArrays(const SiStripQuality *siStripQuality_, int NTkBadComponent[4], int NBadComponent[4][19][4], const TrackerTopology m_trackerTopo)
void printSummary(const std::map< unsigned int, SiStripDetSummary::Values > &map)
void fillNoiseDetSummary(SiStripDetSummary &summaryNoise, std::shared_ptr< SiStripNoises > payload, SiStripPI::estimator est)
const std::map< uint32_t, DetInfo > & getAllData() const
RegistryIterator getRegistryVectorEnd() const
unsigned int tidSide(const DetId &id) const
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
void drawStatBox(std::map< std::string, std::shared_ptr< TH1F >> histos, std::map< std::string, int > colormap, std::vector< std::string > legend, double X=0.15, double Y=0.93, double W=0.15, double H=0.10)
void printBCDebug(int NTkBadComponent[4], int NBadComponent[4][19][4])
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
Registry::const_iterator RegistryIterator
Definition: SiStripNoises.h:52
void add(DetId detid, float value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
void makeNicePlotStyle(TH1 *hist)
#define end
Definition: vmac.h:39
std::string getStringFromSubdet(StripSubdetector::SubDetector sub)
Definition: value.py:1
std::string estimatorType(SiStripPI::estimator e)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
std::pair< int, const char * > regionType(int index)
ContainerIterator getDataVectorBegin() const
def green(string)
Definition: DetId.h:18
void setBadComponents(int i, int component, const SiStripQuality::BadComponent &BC, int NBadComponent[4][19][4])
RegistryIterator getRegistryVectorBegin() const
void fillTotalComponents(int NTkComponents[4], int NComponents[4][19][4], const TrackerTopology m_trackerTopo)
#define begin
Definition: vmac.h:32
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:197
def stdev(xlist)
Definition: plotscripts.py:67
unsigned int tecWheel(const DetId &id) const
data decode(const unsigned int &value) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const