9{
11 {
12 return 0;
13 }
14
15 TH2F tmp_dead_pixels(*
static_cast<TH2F*
>(
input->Clone(
"tmp_dead_pixels")));
16 tmp_dead_pixels.Reset();
17
19 deadpixels_output.SetName(Form("deadpixels_%s",deadpixels_output.GetName()));
20 deadpixels_output.SetTitle(Form("dead pixels, %s",deadpixels_output.GetTitle()));
21 deadpixels_output.Reset();
22
23 auto maxHitValue=
input->GetMaximum();
24
25
26 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
27 {
28 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
29 {
30 if(
input->GetBinContent(row_ID, col_ID)==0 )
31 {
33
34 int sum_neighbours=0;
35 int inactive_pixels_around=0;
36
38 for(auto legpix : legit_pixels)
39 {
40 sum_neighbours+=
input->GetBinContent(legpix.first, legpix.second);
41 if(
input->GetBinContent(legpix.first, legpix.second)<1) ++inactive_pixels_around;
42 }
43
44 if(inactive_pixels_around<4 && std::round(sum_neighbours/nNeighbours)>=
m_range*maxHitValue)
45 {
46 deadpixels_output.Fill(row_ID, col_ID);
47 tmp_dead_pixels.SetBinContent(row_ID,col_ID, 1);
48 }
49 }
50 }
51 }
52
53
54 bool newDEAD=true;
55 while(newDEAD)
56 {
57 newDEAD=false;
58 for(
int col_ID=1; col_ID<=
input->GetNbinsY(); col_ID++)
59 {
60 for(
int row_ID=1; row_ID<=
input->GetNbinsX(); row_ID++)
61 {
62 if(tmp_dead_pixels.GetBinContent(row_ID,col_ID)==0 &&
input->GetBinContent(row_ID, col_ID)==0)
63 {
65
66 int sum_neighbours=0;
67 int inactive_pixels_around=0;
68 int dead_pixels_around=0;
69
71 for(auto legpix : legit_pixels)
72 {
73 sum_neighbours+=
input->GetBinContent(legpix.first, legpix.second);
74 if(
input->GetBinContent(legpix.first, legpix.second)<1) ++inactive_pixels_around;
75
76 if(tmp_dead_pixels.GetBinContent(legpix.first, legpix.second)>0) dead_pixels_around++;
77 }
78
79
80 if(dead_pixels_around>0 && inactive_pixels_around>3 && std::round(sum_neighbours/nNeighbours)>=
m_range*maxHitValue)
81 {
82 deadpixels_output.Fill(row_ID, col_ID);
83 tmp_dead_pixels.SetBinContent(row_ID,col_ID, 1);
84 newDEAD=true;
85 }
86 }
87 }
88 }
89 }
90
91 return 0;
92}
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)