1 #ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 33 default:
return "should never be here";
46 default :
return "should never be here";
81 auto region =
static_cast<std::underlying_type_t<SiStripPI::TrackerRegion>
>(
index);
123 default :
return std::make_pair(999,
"should never be here");
131 float sum = std::accumulate(
std::begin(values),
135 {
return value + p.second; }
138 float m = sum / values.size();
144 {accum += (p.second -
m) * (p.second - m);}
147 float stdev =
sqrt(accum / (values.size()-1));
150 return std::make_pair(m-nsigma*stdev,m+nsigma*stdev);
152 return std::make_pair(m>0.? 0.95*m : 1.05*m, m>0? 1.05*m : 0.95*m);
163 for (
const auto &element : legend ){
164 TPaveText*
stat =
new TPaveText(
X,
Y-(i*
H),
X+W,
Y-(i+1)*H,
"NDC");
166 auto Histo =
histos[element];
167 sprintf(buffer,
"Entries : %i\n",(
int)Histo->GetEntries());
168 stat->AddText(buffer);
170 sprintf(buffer,
"Mean : %6.2f\n",Histo->GetMean());
171 stat->AddText(buffer);
173 sprintf(buffer,
"RMS : %6.2f\n",Histo->GetRMS());
174 stat->AddText(buffer);
176 stat->SetFillColor(0);
177 stat->SetLineColor(colormap[element]);
178 stat->SetTextColor(colormap[element]);
179 stat->SetTextSize(0.03);
180 stat->SetBorderSize(0);
181 stat->SetMargin(0.05);
182 stat->SetTextAlign(12);
191 float theMax(-9999.);
193 theMax = h1->GetMaximum() > h2->GetMaximum() ? h1->GetMaximum() : h2->GetMaximum();
194 theMin = h1->GetMinimum() < h2->GetMaximum() ? h1->GetMinimum() : h2->GetMinimum();
196 float add_min = theMin>0. ? -0.05 : 0.05;
197 float add_max = theMax>0. ? 0.05 : -0.05;
199 auto result = std::make_pair(theMin*(1+add_min),theMax*(1+add_max));
209 hist->SetStats(kFALSE);
210 hist->SetLineWidth(2);
211 hist->GetXaxis()->CenterTitle(
true);
212 hist->GetYaxis()->CenterTitle(
true);
213 hist->GetXaxis()->SetTitleFont(42);
214 hist->GetYaxis()->SetTitleFont(42);
215 hist->GetXaxis()->SetTitleSize(0.05);
216 hist->GetYaxis()->SetTitleSize(0.05);
217 hist->GetXaxis()->SetTitleOffset(0.9);
218 hist->GetYaxis()->SetTitleOffset(1.3);
219 hist->GetXaxis()->SetLabelFont(42);
220 hist->GetYaxis()->SetLabelFont(42);
221 hist->GetYaxis()->SetLabelSize(.05);
222 hist->GetXaxis()->SetLabelSize(.05);
230 for (
const auto &element : map){
231 int count = element.second.count;
232 double mean = count>0 ? (element.second.mean)/count : 0. ;
233 double rms = count>0 ? (element.second.rms)/count - mean*mean : 0.;
241 switch ((element.first)/1000)
257 int layer = (element.first)/10 - (element.first)/1000*100;
258 int stereo = (element.first) - (layer*10) -(element.first)/1000*1000;
260 std::cout<<
"key of the map:"<<element.first <<
" ( region: "<<
regionType(element.first).second <<
" ) " 261 << detector<<
" layer: "<<layer<<
" stereo:"<<stereo
262 <<
"| count:"<<count<<
" mean: "<<mean<<
" rms: "<<rms<<std::endl;
275 NBadComponent[
i][0][2]+= std::bitset<16>(BC.
BadApvs&0x3f).
count();
276 NBadComponent[
i][component][2]+= std::bitset<16>(BC.
BadApvs&0x3f).
count();
281 NBadComponent[
i][component][1]+= std::bitset<4>(BC.
BadFibers&0x7).
count();
285 NBadComponent[
i][0][0]++;
286 NBadComponent[
i][component][0]++;
297 TStyle *palettestyle =
new TStyle(
"palettestyle",
"Style for P-TDR");
300 const int NCont = 255;
306 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
307 double red[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
308 double green[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
309 double blue[NRGBs] = {1.00, 0.91, 0.80, 0.67, 1.00};
310 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
316 double stops[NRGBs] = {0.00, 0.01, 0.05, 0.09, 0.1};
317 double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
318 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
319 double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
320 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
326 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
327 double red[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
328 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
329 double blue[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
330 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
337 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
338 double red[NRGBs] = {1.00, 1.00, 1.00, 1.00, 1.00};
339 double green[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
340 double blue[NRGBs] = {1.00, 0.84, 0.61, 0.34, 0.00};
341 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
347 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
348 double red[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
349 double green[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
350 double blue[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
351 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
357 double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00};
358 double red[NRGBs] = {1.00, 1.00, 1.00, 0.50};
359 double green[NRGBs] = {1.00, 1.00, 0.00, 0.00};
360 double blue[NRGBs] = {0.20, 0.00, 0.00, 0.00};
361 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
367 double stops[NRGBs] = {0.00, 0.20, 0.80, 1.00};
368 double red[NRGBs] = {0.50, 1.00, 1.00, 1.00};
369 double green[NRGBs] = {0.00, 0.00, 1.00, 1.00};
370 double blue[NRGBs] = {0.00, 0.00, 0.00, 0.20};
371 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
377 double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
378 double red[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
379 double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
380 double blue[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
381 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
387 double stops[NRGBs] = {0.0001, 0.0010, 0.0100, 0.1000, 1.0000};
388 double red[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
389 double green[NRGBs] = {0.00, 0.00, 0.00, 0.00, 0.00};
390 double blue[NRGBs] = {1.00, 0.75, 0.50, 0.25, 0.00};
391 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
397 double stops[NRGBs] = {0.00, 0.34, 0.61, 0.84, 1.00};
398 double red[NRGBs] = {0.00, 0.00, 0.87, 1.00, 0.51};
399 double green[NRGBs] = {0.00, 0.81, 1.00, 0.20, 0.00};
400 double blue[NRGBs] = {0.51, 1.00, 0.12, 0.00, 0.00};
401 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
405 std::cout<<
"should nevere be here" << std::endl;
409 palettestyle->SetNumberContours(NCont);
void setPaletteStyle(SiStripPI::palette palette)
void printSummary(const std::map< unsigned int, SiStripDetSummary::Values > &map)
Container::value_type value_type
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 setBadComponents(int i, int component, SiStripQuality::BadComponent &BC, int NBadComponent[4][19][4])
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
void makeNicePlotStyle(TH1 *hist)
std::string getStringFromSubdet(StripSubdetector::SubDetector sub)
std::string estimatorType(SiStripPI::estimator e)
std::pair< int, const char * > regionType(int index)