1 #ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 44 auto region =
static_cast<std::underlying_type_t<SiStripPI::TrackerRegion>
>(
index);
86 default :
return "should never be here";
94 float sum = std::accumulate(
std::begin(values),
98 {
return value + p.second; }
101 float m = sum / values.size();
107 {accum += (p.second -
m) * (p.second - m);}
110 float stdev =
sqrt(accum / (values.size()-1));
112 return std::make_pair(m-2*stdev,m+2*stdev);
123 for (
const auto &element : legend ){
124 TPaveText*
stat =
new TPaveText(
X,
Y-(i*
H),
X+W,
Y-(i+1)*H,
"NDC");
126 auto Histo =
histos[element];
127 sprintf(buffer,
"Entries : %i\n",(
int)Histo->GetEntries());
128 stat->AddText(buffer);
130 sprintf(buffer,
"Mean : %6.2f\n",Histo->GetMean());
131 stat->AddText(buffer);
133 sprintf(buffer,
"RMS : %6.2f\n",Histo->GetRMS());
134 stat->AddText(buffer);
136 stat->SetFillColor(0);
137 stat->SetLineColor(colormap[element]);
138 stat->SetTextColor(colormap[element]);
139 stat->SetTextSize(0.03);
140 stat->SetBorderSize(0);
141 stat->SetMargin(0.05);
142 stat->SetTextAlign(12);
151 float theMax(-9999.);
153 theMax = h1->GetMaximum() > h2->GetMaximum() ? h1->GetMaximum() : h2->GetMaximum();
154 theMin = h1->GetMinimum() < h2->GetMaximum() ? h1->GetMinimum() : h2->GetMinimum();
156 float add_min = theMin>0. ? -0.05 : 0.05;
157 float add_max = theMax>0. ? 0.05 : -0.05;
159 auto result = std::make_pair(theMin*(1+add_min),theMax*(1+add_max));
169 hist->SetStats(kFALSE);
170 hist->SetLineWidth(2);
171 hist->GetXaxis()->CenterTitle(
true);
172 hist->GetYaxis()->CenterTitle(
true);
173 hist->GetXaxis()->SetTitleFont(42);
174 hist->GetYaxis()->SetTitleFont(42);
175 hist->GetXaxis()->SetTitleSize(0.05);
176 hist->GetYaxis()->SetTitleSize(0.05);
177 hist->GetXaxis()->SetTitleOffset(0.9);
178 hist->GetYaxis()->SetTitleOffset(1.3);
179 hist->GetXaxis()->SetLabelFont(42);
180 hist->GetYaxis()->SetLabelFont(42);
181 hist->GetYaxis()->SetLabelSize(.05);
182 hist->GetXaxis()->SetLabelSize(.05);
190 for (
const auto &element : map){
191 int count = element.second.count;
192 double mean = count>0 ? (element.second.mean)/count : 0. ;
193 double rms = count>0 ? (element.second.rms)/count - mean*mean : 0.;
201 switch ((element.first)/1000)
217 int layer = (element.first)/10 - (element.first)/1000*100;
218 int stereo = (element.first) - (layer*10) -(element.first)/1000*1000;
220 std::cout<<
"key of the map:"<<element.first <<
" ( region: "<<
regionType(element.first) <<
" ) " 221 << detector<<
" layer: "<<layer<<
" stereo:"<<stereo
222 <<
"| count:"<<count<<
" mean: "<<mean<<
" rms: "<<rms<<std::endl;
const char * regionType(int index)
std::pair< float, float > getTheRange(std::map< uint32_t, float > values)
void printSummary(const std::map< unsigned int, SiStripDetSummary::Values > &map)
Container::value_type value_type
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)
std::pair< float, float > getExtrema(TH1 *h1, TH1 *h2)
void makeNicePlotStyle(TH1 *hist)