AliPhysics  608b256 (608b256)
AliVertexingHFUtils.h
Go to the documentation of this file.
1 #ifndef ALIVERTEXINGHFUTILS_H
2 #define ALIVERTEXINGHFUTILS_H
3 
4 
5 /* $Id$ */
6 
17 
18 #include "TObject.h"
19 #include "AliAODTrack.h"
20 #include "AliAODRecoDecay.h"
21 #include "AliAODRecoDecayHF.h"
22 #include "AliAODRecoCascadeHF.h"
23 #include "TVirtualPad.h"
24 #include "AliHFInvMassFitter.h"
25 
26 #include <vector>
27 
28 #include "Fit/Fitter.h"
29 #include "Fit/Chi2FCN.h"
30 #include "Math/WrappedMultiTF1.h"
31 #include "Fit/BinData.h"
32 #include "HFitInterface.h"
33 
34 class AliMCEvent;
35 class AliMCParticle;
36 class AliAODMCParticle;
37 class AliAODMCHeader;
38 class AliGenEventHeader;
39 class AliAODEvent;
40 class TProfile;
41 class TClonesArray;
42 class TH1F;
43 class TH2F;
44 class TF1;
45 
46 using std::vector;
47 
49  public:
52  virtual ~AliVertexingHFUtils() {};
53 
55  static void ComputeSignificance(Double_t signal, Double_t errsignal, Double_t background, Double_t errbackground, Double_t &significance,Double_t &errsignificance);
56 
58  void SetK(Int_t k){fK=k;}
59  void SetSubEvResol(Double_t res){fSubRes=res;}
60  void SetSubEventHisto(const TH1F* hSub){
61  fSubRes=GetSubEvResol(hSub);
62  }
63  Int_t GetK() const {return fK;}
64  Double_t GetSubEvResol() const {return fSubRes;}
65  Double_t Pol(Double_t x) const {return Pol(x,fK);}
66  Double_t FindChi() const {return FindChi(fSubRes,fK);}
68  static Double_t FindChi(Double_t res, Int_t k=1);
69  static Double_t Pol(Double_t x, Int_t k);
70  static Double_t ResolK1(Double_t x);
71  static Double_t GetSubEvResol(const TH1F* hSubEvCorr){
72  if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean());
73  else return 1.;
74  }
75  static Double_t GetSubEvResolLowLim(const TH1F* hSubEvCorr){
76  if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean()-hSubEvCorr->GetMeanError());
77  else return 1.;
78  }
79  static Double_t GetSubEvResolHighLim(const TH1F* hSubEvCorr){
80  if(hSubEvCorr) return TMath::Sqrt(hSubEvCorr->GetMean()+hSubEvCorr->GetMeanError());
81  else return 1.;
82  }
83  static Double_t GetFullEvResol(Double_t resSub, Int_t k=1);
84  static Double_t GetFullEvResol(const TH1F* hSubEvCorr, Int_t k=1);
85  static Double_t GetFullEvResolLowLim(const TH1F* hSubEvCorr, Int_t k=1);
86  static Double_t GetFullEvResolHighLim(const TH1F* hSubEvCorr, Int_t k=1);
87  static TString GetGenerator(Int_t label, AliAODMCHeader* header);
88  Bool_t IsTrackInjected(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC);
89  void GetTrackPrimaryGenerator(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC,TString &nameGen);
90  Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC);
91  Bool_t HasCascadeCandidateAnyDaughInjected(AliAODRecoCascadeHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC);
94  fMinEtaForTracklets=mineta;
95  fMaxEtaForTracklets=maxeta;
96  }
100  }
101  static Int_t GetGeneratedMultiplicityInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
102  static Int_t GetGeneratedPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
103  static Int_t GetGeneratedPhysicalPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
104 
106  static void GetSpherocity(AliAODEvent* aod,
107  Double_t &spherocity, Double_t &phiRef,
108  Double_t etaMin=-0.8, Double_t etaMax=0.8,
109  Double_t ptMin=0.15, Double_t ptMax=10.,
110  Int_t filtbit1=256, Int_t filtbit2=512,
111  Int_t minMult=3, Double_t phiStepSizeDeg=0.1,
112  Int_t nTrksToSkip=0, Int_t* idToSkip=0x0);
113 
114  static void GetGeneratedSpherocity(TClonesArray *arrayMC,
115  Double_t &spherocity, Double_t &phiRef,
116  Double_t etaMin=-0.8, Double_t etaMax=0.8,
117  Double_t ptMin=0.15, Double_t ptMax=10.,
118  Int_t minMult=3, Double_t phiStepSizeDeg=0.1);
119 
120  static Double_t GetSphericity(AliAODEvent* aod,
121  Double_t etaMin=-0.8, Double_t etaMax=0.8,
122  Double_t ptMin=0.15, Double_t ptMax=10.,
123  Int_t filtbit1=256, Int_t filtbit2=512,
124  Int_t minMult=3);
125 
129 
131  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, Float_t minMass=0., Float_t maxMass=3., Int_t rebin=1);
132 
134  static Bool_t CheckT0TriggerFired(AliAODEvent* aodEv);
135 
137  static TH1D* RebinHisto(TH1* hOrig, Int_t reb, Int_t firstUse=-1);
138  static TH1* AdaptTemplateRangeAndBinning(const TH1 *hRef,TH1 *hData, Double_t minFit, Double_t maxFit);
139 
141  static Double_t GetTrueImpactParameterDzero(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
142  static Double_t GetTrueImpactParameterDplus(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
143 
144  static Double_t GetCorrectedNtracklets(TProfile* estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult);
145 
147  static Int_t CheckOrigin(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE);
148  static Int_t CheckOrigin(AliMCEvent* mcEvent, AliMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE);
149  static Double_t GetBeautyMotherPt(TClonesArray* arrayMC, AliAODMCParticle *mcPart);
150  static Int_t CheckD0Decay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
151  static Int_t CheckD0Decay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
152  static Int_t CheckDplusDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
153  static Int_t CheckDplusDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
154  static Int_t CheckDplusKKpiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
155  static Int_t CheckDplusKKpiDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
156  static Int_t CheckDplusK0spiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
157  static Int_t CheckDsDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
158  static Int_t CheckDsDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
159  static Int_t CheckDsK0sKDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
160  static Int_t CheckDstarDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
161  static Int_t CheckDstarDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
162  static Int_t CheckLcpKpiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
163  static Int_t CheckLcpKpiDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
164  static Int_t CheckLcV0bachelorDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
165  static Int_t CheckLcV0bachelorDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
166  static Int_t CheckXicXipipiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
167  static Int_t CheckBplusDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
168  static Int_t CheckBplusDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
169 
170 
174  GlobalInOutOfPlaneChi2(ROOT::Math::IMultiGenFunction & fInPlane, ROOT::Math::IMultiGenFunction & fOutOfPlane, Int_t npars, vector<UInt_t> commonpars) :
175  fChi2_InPlane(&fInPlane),
176  fChi2_OutOfPlane(&fOutOfPlane),
177  fNpars(npars),
178  fCommonPars() {
179  fCommonPars.clear();
180  fCommonPars = commonpars;
181  }
182 
183  Double_t operator() (const Double_t *par) const {
184  const UInt_t npars = fNpars;
185  Double_t pInPlane[npars];
186  for(UInt_t iPar=0; iPar<npars; iPar++)
187  pInPlane[iPar]=par[iPar];
188 
189  UInt_t iParOutOfPlane = fNpars;
190  Double_t pOutOfPlane[npars];
191  vector<UInt_t> veccopy = fCommonPars;
192  vector<UInt_t>::iterator iter;
193  for(UInt_t iPar=0; iPar<npars; iPar++) {
194  iter = find(veccopy.begin(),veccopy.end(),iPar);
195  if(iter!=veccopy.end()) { //is common
196  pOutOfPlane[iPar] = par[iPar];
197  }
198  else {
199  pOutOfPlane[iPar] = par[iParOutOfPlane];
200  iParOutOfPlane++;
201  }
202  }
203 
204  return (*fChi2_InPlane)(pInPlane) + (*fChi2_OutOfPlane)(pOutOfPlane);
205  }
206 
207  const ROOT::Math::IMultiGenFunction *fChi2_InPlane;
208  const ROOT::Math::IMultiGenFunction *fChi2_OutOfPlane;
210  vector<UInt_t> fCommonPars;
211  };
212 
213  static ROOT::Fit::FitResult DoInPlaneOutOfPlaneSimultaneusFit(AliHFInvMassFitter *&massfitterInPlane, AliHFInvMassFitter *&massfitterOutOfPlane, TH1F* hMassInPlane, TH1F* hMassOutOfPlane, Double_t MinMass, Double_t MaxMass, Double_t massD, vector<UInt_t> commonpars);
214 
215  private:
216 
221 
223  ClassDef(AliVertexingHFUtils,0);
225 };
226 #endif
static void GetSpherocity(AliAODEvent *aod, Double_t &spherocity, Double_t &phiRef, Double_t etaMin=-0.8, Double_t etaMax=0.8, Double_t ptMin=0.15, Double_t ptMax=10., Int_t filtbit1=256, Int_t filtbit2=512, Int_t minMult=3, Double_t phiStepSizeDeg=0.1, Int_t nTrksToSkip=0, Int_t *idToSkip=0x0)
Functions for event shape variables.
static Int_t CheckD0Decay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
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, Float_t minMass=0., Float_t maxMass=3., Int_t rebin=1)
Functions for computing average pt.
static TH1D * RebinHisto(TH1 *hOrig, Int_t reb, Int_t firstUse=-1)
Rebinning of invariant mass histograms.
double Double_t
Definition: External.C:58
Definition: External.C:236
static Int_t CheckDplusDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
void SetSubEventHisto(const TH1F *hSub)
static Int_t CheckDsDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Int_t CheckLcpKpiDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static TString GetGenerator(Int_t label, AliAODMCHeader *header)
const ROOT::Math::IMultiGenFunction * fChi2_OutOfPlane
AliHFInvMassFitter class for the fit of invariant mass distribution of charm hadrons.
Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev) const
GlobalInOutOfPlaneChi2(ROOT::Math::IMultiGenFunction &fInPlane, ROOT::Math::IMultiGenFunction &fOutOfPlane, Int_t npars, vector< UInt_t > commonpars)
Double_t Pol(Double_t x) const
static Double_t GetFullEvResolLowLim(const TH1F *hSubEvCorr, Int_t k=1)
static Int_t CheckBplusDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
void SetK(Int_t k)
Functions for Event plane resolution.
Double_t ptMin
static TH1 * AdaptTemplateRangeAndBinning(const TH1 *hRef, TH1 *hData, Double_t minFit, Double_t maxFit)
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Functions to check the decay tree.
void GetTrackPrimaryGenerator(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC, TString &nameGen)
Double_t fMinEtaForTracklets
sub-event resolution = sqrt(<cos[n(phiA-phiB)] >)
Double_t fSubRes
ratio of measured harmonic to event plane harmonic
static Int_t CheckDplusK0spiDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Int_t CheckXicXipipiDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Int_t CheckLcV0bachelorDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
Double_t fMaxEtaForTracklets
min eta for counting tracklets
Double_t operator()(const Double_t *par) const
static Double_t GetVZEROCEqualizedMultiplicity(AliAODEvent *ev)
static Double_t GetFullEvResolHighLim(const TH1F *hSubEvCorr, Int_t k=1)
static void GetGeneratedSpherocity(TClonesArray *arrayMC, Double_t &spherocity, Double_t &phiRef, Double_t etaMin=-0.8, Double_t etaMax=0.8, Double_t ptMin=0.15, Double_t ptMax=10., Int_t minMult=3, Double_t phiStepSizeDeg=0.1)
Double_t massD
static Double_t ResolK1(Double_t x)
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
int Int_t
Definition: External.C:63
Double_t GetFullEvResol() const
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
const Double_t ptmax
static Int_t CheckDplusKKpiDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Bool_t CheckT0TriggerFired(AliAODEvent *aodEv)
Functions for processing trigger information.
Definition: External.C:212
static Double_t GetSubEvResolLowLim(const TH1F *hSubEvCorr)
const Double_t ptmin
Bool_t HasCascadeCandidateAnyDaughInjected(AliAODRecoCascadeHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
static Double_t GetSubEvResol(const TH1F *hSubEvCorr)
static Int_t CheckDstarDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Double_t GetBeautyMotherPt(TClonesArray *arrayMC, AliAODMCParticle *mcPart)
static void ComputeSignificance(Double_t signal, Double_t errsignal, Double_t background, Double_t errbackground, Double_t &significance, Double_t &errsignificance)
Significance calculator.
static Double_t GetCorrectedNtracklets(TProfile *estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult)
static ROOT::Fit::FitResult DoInPlaneOutOfPlaneSimultaneusFit(AliHFInvMassFitter *&massfitterInPlane, AliHFInvMassFitter *&massfitterOutOfPlane, TH1F *hMassInPlane, TH1F *hMassOutOfPlane, Double_t MinMass, Double_t MaxMass, Double_t massD, vector< UInt_t > commonpars)
void SetSubEvResol(Double_t res)
Double_t GetSubEvResol() const
Bool_t IsTrackInjected(AliAODTrack *track, AliAODMCHeader *header, TClonesArray *arrayMC)
Double_t minMass
Double_t FindChi() const
Int_t rebin
static Int_t GetGeneratedPhysicalPrimariesInEtaRange(TClonesArray *arrayMC, Double_t mineta, Double_t maxeta)
static Double_t GetVZEROAEqualizedMultiplicity(AliAODEvent *ev)
Utilities for V0 multiplicity checks.
static Double_t GetTrueImpactParameterDzero(AliAODMCHeader *mcHeader, TClonesArray *arrayMC, AliAODMCParticle *partDp)
Functions for computing true impact parameter of D meson.
Double_t maxMass
bool Bool_t
Definition: External.C:53
void SetEtaRangeForTracklets(Double_t mineta, Double_t maxeta)
Functions for tracklet multiplcity calculation.
static Int_t CheckDsK0sKDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
Double_t ptMax
static Double_t GetSubEvResolHighLim(const TH1F *hSubEvCorr)
static Double_t GetTrueImpactParameterDplus(AliAODMCHeader *mcHeader, TClonesArray *arrayMC, AliAODMCParticle *partDp)
const ROOT::Math::IMultiGenFunction * fChi2_InPlane
static Double_t GetSphericity(AliAODEvent *aod, Double_t etaMin=-0.8, Double_t etaMax=0.8, Double_t ptMin=0.15, Double_t ptMax=10., Int_t filtbit1=256, Int_t filtbit2=512, Int_t minMult=3)
Definition: External.C:196
static Int_t GetGeneratedMultiplicityInEtaRange(TClonesArray *arrayMC, Double_t mineta, Double_t maxeta)
static Int_t GetGeneratedPrimariesInEtaRange(TClonesArray *arrayMC, Double_t mineta, Double_t maxeta)
Class with functions useful for different D2H analyses //.