FEDRA emulsion software from the OPERA Collaboration
EdbPeakProb Class Reference

#include <EdbPeakProb.h>

Inheritance diagram for EdbPeakProb:
Collaboration diagram for EdbPeakProb:

Public Member Functions

 EdbPeakProb ()
 
Float_t Prob ()
 
Float_t Probability2D (TH2F *hd, float &xpeak, float &ypeak)
 
virtual ~EdbPeakProb ()
 

Public Attributes

TH1F * eHbin
 
TH2F * eHD
 
TH2F * eHpeak
 
Int_t ePeakNmax
 
Int_t ePeakNmin
 
Float_t ePeakRMS
 
Float_t ePeakRMSmax
 
Float_t ePeakRMSmin
 
Float_t ePeakX
 
Float_t ePeakY
 
Float_t eProb
 
Int_t eVerbosity
 

Constructor & Destructor Documentation

◆ EdbPeakProb()

EdbPeakProb::EdbPeakProb ( )

◆ ~EdbPeakProb()

EdbPeakProb::~EdbPeakProb ( )
virtual
40 {
41  SafeDelete(eHbin);
42  SafeDelete(eHpeak);
43 }
TH2F * eHpeak
Definition: EdbPeakProb.h:22
TH1F * eHbin
Definition: EdbPeakProb.h:21

Member Function Documentation

◆ Prob()

Float_t EdbPeakProb::Prob ( )
47 {
48  float prob = Probability2D( eHD, ePeakX, ePeakY);
49  return prob;
50 }
Float_t Probability2D(TH2F *hd, float &xpeak, float &ypeak)
Definition: EdbPeakProb.cxx:53
TH2F * eHD
Definition: EdbPeakProb.h:19
Float_t ePeakY
Definition: EdbPeakProb.h:16
Float_t ePeakX
Definition: EdbPeakProb.h:16

◆ Probability2D()

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

Member Data Documentation

◆ eHbin

TH1F* EdbPeakProb::eHbin

◆ eHD

TH2F* EdbPeakProb::eHD

◆ eHpeak

TH2F* EdbPeakProb::eHpeak

◆ ePeakNmax

Int_t EdbPeakProb::ePeakNmax

◆ ePeakNmin

Int_t EdbPeakProb::ePeakNmin

◆ ePeakRMS

Float_t EdbPeakProb::ePeakRMS

◆ ePeakRMSmax

Float_t EdbPeakProb::ePeakRMSmax

◆ ePeakRMSmin

Float_t EdbPeakProb::ePeakRMSmin

◆ ePeakX

Float_t EdbPeakProb::ePeakX

◆ ePeakY

Float_t EdbPeakProb::ePeakY

◆ eProb

Float_t EdbPeakProb::eProb

◆ eVerbosity

Int_t EdbPeakProb::eVerbosity

The documentation for this class was generated from the following files: