estimate the probability that the highest bin of the histogram do not belong to the background
Method: estimate the deviation of the tail of the coincidence distribution from exponential shape
55{
58
59 float prob=0;
60
61 float maxbin = hd->GetMaximum();
62 eHbin =
new TH1F(
"hbin",
"hbin", (
int)maxbin+1, 0, maxbin+1);
63 int nx = hd->GetNbinsX();
64 int ny = hd->GetNbinsY();
65 for(int ix=1; ix<=nx; ix++)
66 for(int iy=1; iy<=ny; iy++)
67 eHbin->Fill( hd->GetBinContent(ix,iy) );
68
69 float tailbin =
eHbin->GetMean()+
eHbin->GetRMS();
70 eHbin->Fit(
"expo",
"QR0",
"",tailbin,maxbin);
71 float a =
eHbin->GetFunction(
"expo")->GetParameter(0);
72 float b =
eHbin->GetFunction(
"expo")->GetParameter(1);
73
74 float lowlim = (int)((-
a)/b+0.99999);
75 if(lowlim<1) lowlim=1;
76
77 float real =
eHbin->GetBinContent((
int)maxbin+1);
78 if( lowlim>maxbin ) prob=0;
79 else prob = 1.-
eHbin->GetFunction(
"expo")->Integral(maxbin,2*(maxbin+1)+10) / real;
80
81
82
83 eHpeak = (TH2F*)hd->Clone(
"hdpeak");
85
86 float bin;
87 for(int ix=1; ix<=nx; ix++)
88 for(int iy=1; iy<=ny; iy++) {
89 bin = hd->GetBinContent(hd->GetBin(ix, iy));
90 if(bin<lowlim) continue;
91 eHpeak->Fill( hd->GetXaxis()->GetBinCenter( ix ),
92 hd->GetYaxis()->GetBinCenter( iy ),
93 bin );
94 }
95 Log(3,
"AlignmentProbability",
"peak: ( %f %f ) rms: ( %f %f )",
97
100 c->Divide(2,2);
101 c->cd(1); hd->Draw("colz");
102 c->GetPad(2)->SetLogy();
103 c->cd(2);
eHbin->Draw();
eHbin->GetFunction(
"expo")->Draw(
"same");
104
105 c->cd(3);
107 } else {
110 }
111
112 Log(2,
"Probability2D",
"%f BGlim=%6.1f, maxbin=%6.1f",prob,lowlim,maxbin);
113 return prob;
114}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
void a()
Definition: check_aligned.C:59
Int_t eVerbosity
0-no any message, 1-print, 2-plot; default=2
Definition: EdbPeakProb.h:24