17 template_output.Reset();
19 TH2F tmp_output1(template_output);
20 tmp_output1.SetNameTitle(Form(
"leffpixels_found_%s",template_output.GetName()), Form(
"low efficiency pixels, found, %s", template_output.GetTitle()));
22 TH2F tmp_output2(template_output);
23 tmp_output2.SetNameTitle(Form(
"noisypixels_eff_%s",template_output.GetName()), Form(
"noisy pixels, efficiency, %s", template_output.GetTitle()));
25 TH2F tmp_output3(template_output);
26 tmp_output3.SetNameTitle(Form(
"leffpixels_eff_%s",template_output.GetName()), Form(
"low efficiency pixels, efficiency, %s", template_output.GetTitle()));
28 noisypixels_found_output.SetNameTitle(Form(
"noisypixels_found_%s",template_output.GetName()), Form(
"noisy pixels, found, %s", template_output.GetTitle()));
30 output.push_back(tmp_output1);
31 output.push_back(tmp_output2);
32 output.push_back(tmp_output3);
39 if(
input->GetMaximum()<0.5)
return 0;
41 std::vector<TH2F> vec_found_leff{},vec_found_noisy{},vec_eff_leff{},vec_eff_noisy{};
45 TH2F tmp_eff_noisy, tmp_eff_leff;
46 TH2F tmp_found_leff, tmp_found_noisy;
64 tmp_eff_noisy.SetName(
"tmp_eff_noisy");
65 tmp_eff_noisy.Reset();
67 tmp_eff_leff.SetName(
"tmp_eff_leff");
70 tmp_found_noisy.SetName(
"tmp_found_noisy");
71 tmp_found_noisy.Reset();
73 tmp_found_leff.SetName(
"tmp_found_leff");
74 tmp_found_leff.Reset();
78 const double Threshold_LEFF=5.;
81 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
83 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
85 double ratio_leff=0, ratio_noisy=0;
86 double gauss_helper_12 = (col_ID-
p[1][row_ID])/
p[2][row_ID];
87 double gauss_helper_45 = (col_ID-
p[4][row_ID])/
p[5][row_ID];
88 double fit =
p[0][row_ID]*
exp(-0.5*gauss_helper_12*gauss_helper_12)
89 +
p[3][row_ID]*
exp(-0.5*gauss_helper_45*gauss_helper_45) +
p[6][row_ID];
93 double bin_content=
input->GetBinContent(row_ID,col_ID);
95 if(
fit>=bin_content) ratio_leff = std::abs(
fit-bin_content)/
sigma;
96 else ratio_noisy = std::abs(
fit-bin_content)/
sigma;
100 if( ratio_leff > Threshold_LEFF) tmp_found_leff.SetBinContent(row_ID,col_ID,1);
101 if( ratio_noisy > Threshold_NOISY) tmp_found_noisy.SetBinContent(row_ID,col_ID,1);
103 tmp_eff_leff.SetBinContent(row_ID,col_ID,100.*ratio_leff);
104 tmp_eff_noisy.SetBinContent(row_ID,col_ID,100.*ratio_noisy);
110 vec_found_leff.push_back(tmp_found_leff);
111 vec_found_noisy.push_back(tmp_found_noisy);
112 vec_eff_leff.push_back(tmp_eff_leff);
113 vec_eff_noisy.push_back(tmp_eff_noisy);
119 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
121 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
123 noisypixels_found_output.Fill(row_ID,col_ID, vec_found_noisy[
m].GetBinContent(row_ID,col_ID));
124 leffpixels_found_output.Fill(row_ID,col_ID, vec_found_leff[
m].GetBinContent(row_ID,col_ID));
128 noisypixels_eff_output.SetBinContent(row_ID,col_ID, vec_eff_noisy[
m].GetBinContent(row_ID,col_ID));
129 leffpixels_eff_output.SetBinContent(row_ID,col_ID, vec_eff_leff[
m].GetBinContent(row_ID,col_ID));
133 if(noisypixels_eff_output.GetBinContent(row_ID,col_ID)<vec_eff_noisy[
m].GetBinContent(row_ID,col_ID))
135 noisypixels_eff_output.SetBinContent(row_ID,col_ID, vec_eff_noisy[
m].GetBinContent(row_ID,col_ID));
137 if(leffpixels_eff_output.GetBinContent(row_ID,col_ID)>vec_eff_leff[
m].GetBinContent(row_ID,col_ID))
139 leffpixels_eff_output.SetBinContent(row_ID,col_ID, vec_eff_leff[
m].GetBinContent(row_ID,col_ID));
147 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
149 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
151 if(noisypixels_found_output.GetBinContent(row_ID,col_ID)==
m_methods.size()) noisypixels_found_output.SetBinContent(row_ID,col_ID,1);
152 else noisypixels_found_output.SetBinContent(row_ID,col_ID,0);
154 if(leffpixels_found_output.GetBinContent(row_ID,col_ID)==
m_methods.size()) leffpixels_found_output.SetBinContent(row_ID,col_ID,1);
155 else leffpixels_found_output.SetBinContent(row_ID,col_ID,0);
167 std::vector<std::pair<int,int>> legit_pixels={};
169 for(
int r=-1;
r<2;
r++)
171 for(
int c=-1;
c<2;
c++)
173 if( (row_ID+
r)>=1 && (col_ID+
c)>=1 && (col_ID+
c)<=
input->GetNbinsY() && (row_ID+
r)<=
input->GetNbinsX() && (
r!=0 ||
c!=0))
178 legit_pixels.push_back(std::pair<int,int>(row_ID+
r,col_ID+
c));
191 tmp_inact_pix_around.SetName(
"tmp_inact_pix_around");
192 tmp_inact_pix_around.Reset();
194 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
196 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
198 int inactive_pixels_around=0;
201 for(
auto legpix : legit_pixels)
203 if(
input->GetBinContent(legpix.first, legpix.second)<1) ++inactive_pixels_around;
206 tmp_inact_pix_around.SetBinContent(row_ID,col_ID, inactive_pixels_around+0.01);
210 return tmp_inact_pix_around;
216 if( row_ID!=
input->GetNbinsX() && row_ID!=1 && col_ID!=1 && col_ID!=
input->GetNbinsY())
return 8.;
217 else if( (row_ID==
input->GetNbinsX() || row_ID==1) && (col_ID==1 || col_ID==
input->GetNbinsY()))
return 3.;
225 tmp_found_leff.SetName(
"tmp_found_leff");
226 tmp_found_leff.Reset();
229 tmp_found_noisy.SetName(
"tmp_found_noisy");
230 tmp_found_noisy.Reset();
233 tmp_eff_leff.SetName(
"tmp_eff_leff");
234 tmp_eff_leff.Reset();
237 tmp_eff_noisy.SetName(
"tmp_eff_noisy");
238 tmp_eff_noisy.Reset();
240 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
242 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
244 if(
input->GetBinContent(row_ID, col_ID)!=0 && tmp_inact_pix_around.GetBinContent(row_ID, col_ID)<0.1)
250 for(
auto legpix : legit_pixels)
252 sum+=
input->GetBinContent(legpix.first,legpix.second);
261 av_noisy=
sum/(std::abs(npixels-4)*0.5);
266 av_noisy=
sum/(std::ceil(npixels*0.5));
271 av_noisy=
sum/(npixels);
276 double ratio_leff =
input->GetBinContent(row_ID,col_ID)/av_leff;
277 double ratio_noisy =
input->GetBinContent(row_ID,col_ID)/av_noisy;
278 tmp_eff_leff.SetBinContent(row_ID,col_ID,100.*ratio_leff);
279 tmp_eff_noisy.SetBinContent(row_ID,col_ID,100.*ratio_noisy);
281 if(ratio_leff <
m_threshLEff) tmp_found_leff.SetBinContent(row_ID,col_ID,1.);
282 if(ratio_noisy >
m_threshNoisy) tmp_found_noisy.SetBinContent(row_ID,col_ID,1.);
287 return {tmp_found_leff,tmp_found_noisy,tmp_eff_leff,tmp_eff_noisy};
293 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
295 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
297 if(
input->GetBinContent(row_ID,col_ID)==0)
continue;
299 int inactive_pixels_around=tmp_inact_pix_around.GetBinContent(row_ID, col_ID);
300 int leff_pixels_around=0;
302 for(
auto legpix : legit_pixels)
304 if(tmp_found_leff.GetBinContent(legpix.first,legpix.second)>0) leff_pixels_around++;
307 if(leff_pixels_around!=0 && inactive_pixels_around==0)
314 for(
auto legpix : legit_pixels)
316 if(tmp_found_leff.GetBinContent(legpix.first,legpix.second)==0)
318 re_av+=
input->GetBinContent(legpix.first,legpix.second);
326 for(
auto legpix : legit_pixels)
328 re_av+=
input->GetBinContent(legpix.first,legpix.second);
331 if(re_av/
input->GetBinContent(row_ID,col_ID)<1.5 && re_av/
input->GetBinContent(row_ID,col_ID)>0.5) re_av=1;
339 double ratio_leff =
input->GetBinContent(row_ID,col_ID)/re_av;
342 tmp_eff_leff.SetBinContent(row_ID,col_ID,1);
343 tmp_eff_noisy.SetBinContent(row_ID,col_ID,1);
346 if(row_ID!=
input->GetNbinsX() && row_ID!=1 && col_ID!=1 && col_ID!=
input->GetNbinsY())
350 tmp_found_noisy.SetBinContent(row_ID,col_ID,1);
351 if(re_av!=1) tmp_eff_noisy.SetBinContent(row_ID,col_ID,100.*ratio_noisy);
353 if( ((ratio_leff<
m_threshLEff && re_av!=1) || re_av==1) )
355 tmp_found_leff.SetBinContent(row_ID,col_ID,1);
356 if(re_av!=1) tmp_eff_leff.SetBinContent(row_ID,col_ID,100.*ratio_leff);
370 std::vector<std::vector<double>>
params(nParams, std::vector<double>(
input->GetNbinsX()+1, 0.));
372 for(
int row_ID=0; row_ID<=
input->GetNbinsX(); row_ID++)
375 std::unique_ptr<TH1F>
hist(
new TH1F((
"ROW"+srow_ID).c_str(), (
"ROW"+srow_ID).c_str(),
input->GetNbinsY(), 0.5,
input->GetNbinsX()+0.5));
377 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
379 hist->Fill(col_ID, 1.0*
input->GetBinContent(row_ID,col_ID));
383 std::shared_ptr<TF1> FIT_2(
new TF1(
"gaus",
"gaus(0)+gaus(3)+[6]",0,
input->GetNbinsY(),nParams));
386 FIT_2->SetParameters(25000,
hist->GetMean(),
hist->GetStdDev()/std::sqrt(2),
387 5000,
hist->GetMean(),
hist->GetStdDev()/std::sqrt(2),
399 hist->Fit(FIT_2.get(),
"Q");