Correct formula for the error on significance
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliVertexingHFUtils.h
CommitLineData
a6c5a2e9 1#ifndef ALIVERTEXINGHFUTILS_H
2#define ALIVERTEXINGHFUTILS_H
3
4
d947ea9c 5/* $Id$ */
a6c5a2e9 6
7///////////////////////////////////////////////////////////////////
8// //
9// Class with functions useful for different D2H analyses //
10// - event plane resolution //
11// - <pt> calculation with side band subtraction //
25504150 12// - tracklet multiplicity calculation //
a6c5a2e9 13// Origin: F.Prino, Torino, prino@to.infn.it //
14// //
15///////////////////////////////////////////////////////////////////
16
17#include "TObject.h"
b176db3b 18
19class AliAODMCParticle;
20class AliAODMCHeader;
5d1396f9 21class AliAODEvent;
b176db3b 22class TProfile;
23class TClonesArray;
24class TH1F;
25class TH2F;
26class TF1;
a6c5a2e9 27
28class AliVertexingHFUtils : public TObject{
29 public:
30 AliVertexingHFUtils();
31 AliVertexingHFUtils(Int_t k);
32 virtual ~AliVertexingHFUtils() {};
33
5d1396f9 34 // Significance calculator
35 static void ComputeSignificance(Double_t signal, Double_t errsignal, Double_t background, Double_t errbackground, Double_t &significance,Double_t &errsignificance);
36
a6c5a2e9 37 // Functions for Event plane resolution
38 void SetK(Int_t k){fK=k;}
39 void SetSubEvResol(Double_t res){fSubRes=res;}
40 void SetSubEventHisto(const TH1F* hSub){
41 fSubRes=GetSubEvResol(hSub);
42 }
43 Int_t GetK() const {return fK;}
44 Double_t GetSubEvResol() const {return fSubRes;}
45 Double_t Pol(Double_t x) const {return Pol(x,fK);}
46 Double_t FindChi() const {return FindChi(fSubRes,fK);}
47 Double_t GetFullEvResol() const {return GetFullEvResol(fSubRes,fK);}
48 static Double_t FindChi(Double_t res, Int_t k=1);
49 static Double_t Pol(Double_t x, Int_t k);
50 static Double_t ResolK1(Double_t x);
51 static Double_t GetSubEvResol(const TH1F* hSubEvCorr){
52 if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean());
53 else return 1.;
54 }
55 static Double_t GetSubEvResolLowLim(const TH1F* hSubEvCorr){
56 if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean()-hSubEvCorr->GetMeanError());
57 else return 1.;
58 }
59 static Double_t GetSubEvResolHighLim(const TH1F* hSubEvCorr){
60 if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean()+hSubEvCorr->GetMeanError());
61 else return 1.;
62 }
63 static Double_t GetFullEvResol(Double_t resSub, Int_t k=1);
64 static Double_t GetFullEvResol(const TH1F* hSubEvCorr, Int_t k=1);
65 static Double_t GetFullEvResolLowLim(const TH1F* hSubEvCorr, Int_t k=1);
66 static Double_t GetFullEvResolHighLim(const TH1F* hSubEvCorr, Int_t k=1);
67
68 // Functions for tracklet multiplcity calculation
69 void SetEtaRangeForTracklets(Double_t mineta, Double_t maxeta){
70 fMinEtaForTracklets=mineta;
71 fMaxEtaForTracklets=maxeta;
72 }
73 static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent* ev, Double_t mineta, Double_t maxeta);
74 Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent* ev) const {
75 return GetNumberOfTrackletsInEtaRange(ev,fMinEtaForTracklets,fMaxEtaForTracklets);
76 }
25504150 77 static Int_t GetGeneratedMultiplicityInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
78 static Int_t GetGeneratedPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
79 static Int_t GetGeneratedPhysicalPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
a6c5a2e9 80
86d84fa4 81 // Functions for computing average pt
82 static void AveragePt(Float_t& averagePt, Float_t& errorPt, Float_t ptmin, Float_t ptmax, TH2F* hMassD, Float_t massFromFit, Float_t sigmaFromFit, TF1* funcB2, Float_t sigmaRangeForSig=2.5, Float_t sigmaRangeForBkg=4.5, Int_t rebin=4);
83
b176db3b 84 // Functions for computing true impact parameter of D meson
15917f37 85 static Double_t GetTrueImpactParameterDzero(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
b176db3b 86 static Double_t GetTrueImpactParameterDplus(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
87
686e4710 88 static Double_t GetCorrectedNtracklets(TProfile* estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult);
86d84fa4 89
a6c5a2e9 90 private:
91
92 Int_t fK; // ratio of measured harmonic to event plane harmonic
93 Double_t fSubRes; // sub-event resolution = sqrt(<cos[n(phiA-phiB)] >)
94 Double_t fMinEtaForTracklets; // min eta for counting tracklets
95 Double_t fMaxEtaForTracklets; // min eta for counting tracklets
96
97 ClassDef(AliVertexingHFUtils,0)
98};
99#endif