1 #ifndef CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 2 #define CONDCORE_SISTRIPPLUGINS_SISTRIPPAYLOADINSPECTORHELPER_H 31 default:
return "should never be here";
44 default :
return "should never be here";
79 auto region =
static_cast<std::underlying_type_t<SiStripPI::TrackerRegion>
>(
index);
121 default :
return "should never be here";
129 float sum = std::accumulate(
std::begin(values),
133 {
return value + p.second; }
136 float m = sum / values.size();
142 {accum += (p.second -
m) * (p.second - m);}
145 float stdev =
sqrt(accum / (values.size()-1));
147 return std::make_pair(m-2*stdev,m+2*stdev);
158 for (
const auto &element : legend ){
159 TPaveText*
stat =
new TPaveText(
X,
Y-(i*
H),
X+W,
Y-(i+1)*H,
"NDC");
161 auto Histo =
histos[element];
162 sprintf(buffer,
"Entries : %i\n",(
int)Histo->GetEntries());
163 stat->AddText(buffer);
165 sprintf(buffer,
"Mean : %6.2f\n",Histo->GetMean());
166 stat->AddText(buffer);
168 sprintf(buffer,
"RMS : %6.2f\n",Histo->GetRMS());
169 stat->AddText(buffer);
171 stat->SetFillColor(0);
172 stat->SetLineColor(colormap[element]);
173 stat->SetTextColor(colormap[element]);
174 stat->SetTextSize(0.03);
175 stat->SetBorderSize(0);
176 stat->SetMargin(0.05);
177 stat->SetTextAlign(12);
186 float theMax(-9999.);
188 theMax = h1->GetMaximum() > h2->GetMaximum() ? h1->GetMaximum() : h2->GetMaximum();
189 theMin = h1->GetMinimum() < h2->GetMaximum() ? h1->GetMinimum() : h2->GetMinimum();
191 float add_min = theMin>0. ? -0.05 : 0.05;
192 float add_max = theMax>0. ? 0.05 : -0.05;
194 auto result = std::make_pair(theMin*(1+add_min),theMax*(1+add_max));
204 hist->SetStats(kFALSE);
205 hist->SetLineWidth(2);
206 hist->GetXaxis()->CenterTitle(
true);
207 hist->GetYaxis()->CenterTitle(
true);
208 hist->GetXaxis()->SetTitleFont(42);
209 hist->GetYaxis()->SetTitleFont(42);
210 hist->GetXaxis()->SetTitleSize(0.05);
211 hist->GetYaxis()->SetTitleSize(0.05);
212 hist->GetXaxis()->SetTitleOffset(0.9);
213 hist->GetYaxis()->SetTitleOffset(1.3);
214 hist->GetXaxis()->SetLabelFont(42);
215 hist->GetYaxis()->SetLabelFont(42);
216 hist->GetYaxis()->SetLabelSize(.05);
217 hist->GetXaxis()->SetLabelSize(.05);
225 for (
const auto &element : map){
226 int count = element.second.count;
227 double mean = count>0 ? (element.second.mean)/count : 0. ;
228 double rms = count>0 ? (element.second.rms)/count - mean*mean : 0.;
236 switch ((element.first)/1000)
252 int layer = (element.first)/10 - (element.first)/1000*100;
253 int stereo = (element.first) - (layer*10) -(element.first)/1000*1000;
255 std::cout<<
"key of the map:"<<element.first <<
" ( region: "<<
regionType(element.first) <<
" ) " 256 << detector<<
" layer: "<<layer<<
" stereo:"<<stereo
257 <<
"| count:"<<count<<
" mean: "<<mean<<
" rms: "<<rms<<std::endl;
270 NBadComponent[
i][0][2]+= std::bitset<16>(BC.
BadApvs&0x3f).
count();
271 NBadComponent[
i][component][2]+= std::bitset<16>(BC.
BadApvs&0x3f).
count();
276 NBadComponent[
i][component][1]+= std::bitset<4>(BC.
BadFibers&0x7).
count();
280 NBadComponent[
i][0][0]++;
281 NBadComponent[
i][component][0]++;
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)
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)