AliPhysics  master (3d17d9d)
Go to the documentation of this file.
5 /* $Id$ */
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"
26 #include <vector>
28 #include "Fit/Fitter.h"
29 #include "Fit/Chi2FCN.h"
30 #include "Math/WrappedMultiTF1.h"
31 #include "Fit/BinData.h"
32 #include "HFitInterface.h"
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;
46 using std::vector;
49  public:
52  virtual ~AliVertexingHFUtils() {};
55  static void ComputeSignificance(Double_t signal, Double_t errsignal, Double_t background, Double_t errbackground, Double_t &significance,Double_t &errsignificance);
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  static Bool_t IsTrackInjected(Int_t label,AliAODMCHeader *header,TClonesArray *arrayMC);
89  static Bool_t IsTrackInjected(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC);
90  static void GetTrackPrimaryGenerator(AliAODTrack *track,AliAODMCHeader *header,TClonesArray *arrayMC,TString &nameGen);
91  static void GetTrackPrimaryGenerator(Int_t label,AliAODMCHeader *header,TClonesArray *arrayMC,TString &nameGen);
92  static Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC);
93  static Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODEvent* aod, AliAODMCHeader *header,TClonesArray *arrayMC);
94  static Bool_t HasCascadeCandidateAnyDaughInjected(AliAODRecoCascadeHF *cand, AliAODMCHeader *header,TClonesArray *arrayMC);
95  static Int_t PreSelectITSUpgrade(TClonesArray* arrayMC, AliAODMCHeader *header, TObjArray aodTracks, Int_t nDaug, Int_t pdgabs, const Int_t *pdgDg);
99  fMinEtaForTracklets=mineta;
100  fMaxEtaForTracklets=maxeta;
101  }
105  }
106  static Int_t GetGeneratedMultiplicityInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
107  static Int_t GetGeneratedPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
108  static Int_t GetGeneratedPhysicalPrimariesInEtaRange(TClonesArray* arrayMC, Double_t mineta, Double_t maxeta);
111  static void GetSpherocity(AliAODEvent* aod,
112  Double_t &spherocity, Double_t &phiRef,
113  Double_t etaMin=-0.8, Double_t etaMax=0.8,
114  Double_t ptMin=0.15, Double_t ptMax=10.,
115  Int_t filtbit1=256, Int_t filtbit2=512,
116  Int_t minMult=3, Double_t phiStepSizeDeg=0.1,
117  Int_t nTrksToSkip=0, Int_t* idToSkip=0x0);
119  static void GetGeneratedSpherocity(TClonesArray *arrayMC,
120  Double_t &spherocity, Double_t &phiRef,
121  Double_t etaMin=-0.8, Double_t etaMax=0.8,
122  Double_t ptMin=0.15, Double_t ptMax=10.,
123  Int_t minMult=3, Double_t phiStepSizeDeg=0.1);
125  static Double_t GetSphericity(AliAODEvent* aod,
126  Double_t etaMin=-0.8, Double_t etaMax=0.8,
127  Double_t ptMin=0.15, Double_t ptMax=10.,
128  Int_t filtbit1=256, Int_t filtbit2=512,
129  Int_t minMult=3);
136  static void AveragePt(Float_t& averagePt, Float_t& errorPt, Float_t ptmin, Float_t ptmax, TH2F* hMassD, Float_t massFromFit, Float_t sigmaFromFit,
137  TF1* funcB2, Float_t sigmaRangeForSig=2.5, Float_t sigmaRangeForBkg=4.5, Float_t minMass=0., Float_t maxMass=3., Int_t rebin=1);
140  static Bool_t CheckT0TriggerFired(AliAODEvent* aodEv);
143  static TH1D* RebinHisto(TH1* hOrig, Int_t reb, Int_t firstUse=-1);
144  static TH1* AdaptTemplateRangeAndBinning(const TH1 *hRef,TH1 *hData, Double_t minFit, Double_t maxFit);
147  static Double_t GetTrueImpactParameterDzero(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
148  static Double_t GetTrueImpactParameterDplus(AliAODMCHeader *mcHeader, TClonesArray* arrayMC, AliAODMCParticle *partDp);
150  static Double_t GetCorrectedNtracklets(TProfile* estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult);
153  static Int_t CheckOrigin(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE);
154  static Int_t CheckOrigin(AliMCEvent* mcEvent, AliMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE);
155  static Bool_t IsTrackFromCharm(AliAODTrack* tr, TClonesArray* arrayMC);
156  static Bool_t IsTrackFromBeauty(AliAODTrack* tr, TClonesArray* arrayMC);
157  static Bool_t IsTrackFromHadronDecay(Int_t pdgMoth, AliAODTrack* tr, TClonesArray* arrayMC);
158  static Double_t GetBeautyMotherPt(TClonesArray* arrayMC, AliAODMCParticle *mcPart);
159  static Double_t GetBeautyMotherPtAndPDG(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t &pdgGranma);
160  static Int_t CheckD0Decay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
161  static Int_t CheckD0Decay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
162  static Int_t CheckDplusDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
163  static Int_t CheckDplusDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
164  static Int_t CheckDplusKKpiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
165  static Int_t CheckDplusKKpiDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
166  static Int_t CheckDplusK0spiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
167  static Int_t CheckDsDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
168  static Int_t CheckDsDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
169  static Int_t CheckDsK0sKDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
170  static Int_t CheckDstarDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
171  static Int_t CheckDstarDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
172  static Int_t CheckLcpKpiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
173  static Int_t CheckLcpKpiDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
174  static Int_t CheckLcV0bachelorDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
175  static Int_t CheckLcV0bachelorDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
176  static Int_t CheckXicXipipiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
177  static Int_t CheckBplusDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
178  static Int_t CheckBplusDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
179  static Int_t CheckB0toDminuspiDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
180  static Int_t CheckB0toDminuspiDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
181  static Int_t CheckBsDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab, Bool_t ITS2UpgradeProd=kFALSE);
182  static Int_t CheckBsDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab, Bool_t ITS2UpgradeProd=kFALSE);
183  static Int_t CheckLbDecay(AliMCEvent* mcEvent, Int_t label, Int_t* arrayDauLab);
184  static Int_t CheckLbDecay(TClonesArray* arrayMC, AliAODMCParticle *mcPart, Int_t* arrayDauLab);
190  GlobalInOutOfPlaneChi2(ROOT::Math::IMultiGenFunction & fInPlane, ROOT::Math::IMultiGenFunction & fOutOfPlane, Int_t npars, vector<UInt_t> commonpars) :
191  fChi2_InPlane(&fInPlane),
192  fChi2_OutOfPlane(&fOutOfPlane),
193  fNpars(npars),
194  fCommonPars() {
195  fCommonPars.clear();
196  fCommonPars = commonpars;
197  }
199  Double_t operator() (const Double_t *par) const {
200  const UInt_t npars = fNpars;
201  Double_t pInPlane[npars];
202  for(UInt_t iPar=0; iPar<npars; iPar++)
203  pInPlane[iPar]=par[iPar];
205  UInt_t iParOutOfPlane = fNpars;
206  Double_t pOutOfPlane[npars];
207  vector<UInt_t> veccopy = fCommonPars;
208  vector<UInt_t>::iterator iter;
209  for(UInt_t iPar=0; iPar<npars; iPar++) {
210  iter = find(veccopy.begin(),veccopy.end(),iPar);
211  if(iter!=veccopy.end()) { //is common
212  pOutOfPlane[iPar] = par[iPar];
213  }
214  else {
215  pOutOfPlane[iPar] = par[iParOutOfPlane];
216  iParOutOfPlane++;
217  }
218  }
220  return (*fChi2_InPlane)(pInPlane) + (*fChi2_OutOfPlane)(pOutOfPlane);
221  }
223  const ROOT::Math::IMultiGenFunction *fChi2_InPlane;
224  const ROOT::Math::IMultiGenFunction *fChi2_OutOfPlane;
226  vector<UInt_t> fCommonPars;
227  };
229  static ROOT::Fit::FitResult DoInPlaneOutOfPlaneSimultaneusFit(AliHFInvMassFitter *&massfitterInPlane, AliHFInvMassFitter *&massfitterOutOfPlane,
230  TH1F* hMassInPlane, TH1F* hMassOutOfPlane, Double_t MinMass, Double_t MaxMass,
231  Double_t massD, vector<UInt_t> commonpars);
235  static Double_t CombineNsigmaTPCTOF(Double_t nsigmaTPC, Double_t nsigmaTOF);
237  private:
245  ClassDef(AliVertexingHFUtils,0);
247 };
248 #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 Double_t CombineNsigmaTPCTOF(Double_t nsigmaTPC, Double_t nsigmaTOF)
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.
static Bool_t IsTrackFromBeauty(AliAODTrack *tr, TClonesArray *arrayMC)
Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev) const
static Double_t GetBeautyMotherPtAndPDG(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Int_t &pdgGranma)
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 Bool_t IsTrackFromCharm(AliAODTrack *tr, TClonesArray *arrayMC)
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Functions to check the decay tree.
static 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 Int_t CheckLbDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
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)
static Int_t CheckBsDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab, Bool_t ITS2UpgradeProd=kFALSE)
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
static Int_t PreSelectITSUpgrade(TClonesArray *arrayMC, AliAODMCHeader *header, TObjArray aodTracks, Int_t nDaug, Int_t pdgabs, const Int_t *pdgDg)
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.
static Bool_t IsTrackFromHadronDecay(Int_t pdgMoth, AliAODTrack *tr, TClonesArray *arrayMC)
Definition: External.C:212
static Double_t GetSubEvResolLowLim(const TH1F *hSubEvCorr)
const Double_t ptmin
static Bool_t HasCascadeCandidateAnyDaughInjected(AliAODRecoCascadeHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
static 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 Int_t CheckB0toDminuspiDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
static Double_t ComputeMaxd0MeasMinusExp(AliAODRecoDecayHF *cand, Double_t bfield)
Helper functions for D-meson analyses.
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
static Bool_t IsTrackInjected(Int_t label, 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 //.