2 void getAvgEff(Char_t* signalFile=
"signalShapes.root", Bool_t onlyQuadB=
true, Int_t diskNr=3)
9 sprintf(buffer,
"radioDiskEffLoose_%d",diskNr-1);
10 TH2D* h=(TH2D*)f.Get(buffer);
11 sprintf(buffer,
"allCountsLooseDisk_%d",diskNr);
12 TH2D* hEff=(TH2D*)f.Get(buffer);
13 sprintf(buffer,
"radioDiskNonEffLoose_%d",diskNr-1);
14 TH2D* hNonEff=(TH2D*)f.Get(buffer);
16 Double_t max=h->GetXaxis()->GetXmax();
17 Double_t min=h->GetXaxis()->GetXmin();
21 TH2D OverallEff(
"overallEff",
"overallEff",h->GetNbinsX(),min,max,h->GetNbinsY(),min,max);
22 OverallEff.GetXaxis()->SetTitle(
"x [cm]");
23 OverallEff.GetYaxis()->SetTitle(
"y [cm]");
31 Double_t overallErr=0;
32 for(Int_t i=1;i<h->GetNbinsX()+1;i++)
34 for(Int_t j=1;j<h->GetNbinsY()+1;j++)
39 if(i<(h->GetNbinsX()-1)/2|| j>(h->GetNbinsY()-1)/2)
49 Int_t numEff=hEff->GetBinContent(i,j);
50 Int_t numNonEff=hNonEff->GetBinContent(i,j);
51 Int_t numCounts=numEff+numNonEff;
52 Double_t efficiency=0;
56 efficiency=(Double_t)numEff/(Double_t)numCounts;
64 OverallEff.SetBinContent(i,j,efficiency);
73 relErr=sqrt((1/(Double_t)(numEff+numNonEff)+1/(Double_t)numEff));
74 err=relErr*efficiency;
79 err=1/sqrt(numNonEff);
81 eff+=efficiency/(err*err);
82 overallErr+=(1/(err*err));
89 Double_t avgEff=sumEff/(Double_t)(sumEff+sumNonEff);
91 Double_t errOnEffNum=sqrt(avgEff*(1-avgEff)*(sumEff+sumNonEff));
92 Double_t altErr= ((Double_t)1/(Double_t)(sumEff+sumNonEff))*sqrt(sumEff*(Double_t)(1-sumEff/(sumEff+sumNonEff)));
93 sprintf(buffer,
"Average Efficiency is %f +- %f",avgEff,altErr);
94 TLatex t1(-30,0,buffer);
95 OverallEff.Draw(
"colz");
97 c.SaveAs(
"overallEff.png");
98 c.SaveAs(
"overallEff.C");
101 cout <<
"Hits found: " << sumEff <<
" Hits not found: " << sumNonEff<<
" efficiency: " <<avgEff<<
" +- " << altErr<<endl;