Added method to recalculate the primary vertex without the daughter tracks
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF.h
CommitLineData
3244eeed 1#ifndef ALIAODRECODECAYHF_H
2#define ALIAODRECODECAYHF_H
3/* Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6//***********************************************************
7// Class AliAODRecoDecayHF
8// base class for AOD reconstructed heavy-flavour decays
9// Author: A.Dainese, andrea.dainese@lnl.infn.it
10//***********************************************************
11
460cd990 12#include <TRef.h>
a9b75906 13#include <TList.h>
ac7797a7 14#include "AliAODTrack.h"
3244eeed 15#include "AliAODRecoDecay.h"
16
ead561f0 17class AliAODEvent;
a9b75906 18class AliRDHFCuts;
ec653946 19class AliKFParticle;
20
3244eeed 21class AliAODRecoDecayHF : public AliAODRecoDecay {
22
23 public:
24
25 AliAODRecoDecayHF();
26 AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
27 Double_t *px,Double_t *py,Double_t *pz,
28 Double_t *d0,Double_t *d0err);
29 AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
30 Double_t *d0,Double_t *d0err);
b39168f9 31 AliAODRecoDecayHF(Double_t vtx1[3],Double_t vtx2[3],
32 Int_t nprongs,Short_t charge,
33 Double_t *px,Double_t *py,Double_t *pz,Double_t *d0);
3244eeed 34 virtual ~AliAODRecoDecayHF();
35
36 AliAODRecoDecayHF(const AliAODRecoDecayHF& source);
37 AliAODRecoDecayHF& operator=(const AliAODRecoDecayHF& source);
38
39
40 // primary vertex
460cd990 41 void SetPrimaryVtxRef(TObject *vtx) { fEventPrimaryVtx = vtx; }
42 AliAODVertex* GetPrimaryVtxRef() const { return (AliAODVertex*)(fEventPrimaryVtx.GetObject()); }
43 void SetOwnPrimaryVtx(const AliAODVertex *vtx) { UnsetOwnPrimaryVtx(); fOwnPrimaryVtx = new AliAODVertex(*vtx);}
3244eeed 44 void CheckOwnPrimaryVtx() const
45 {if(!fOwnPrimaryVtx) printf("fOwnPrimaryVtx not set"); return;}
46 AliAODVertex* GetOwnPrimaryVtx() const {return fOwnPrimaryVtx;}
47 void GetOwnPrimaryVtx(Double_t vtx[3]) const
48 {CheckOwnPrimaryVtx();fOwnPrimaryVtx->GetPosition(vtx);}
0a65d33f 49 void UnsetOwnPrimaryVtx() {if(fOwnPrimaryVtx) {delete fOwnPrimaryVtx; fOwnPrimaryVtx=0;} return;}
460cd990 50 AliAODVertex* GetPrimaryVtx() const { return (GetOwnPrimaryVtx() ? GetOwnPrimaryVtx() : GetPrimaryVtxRef()); }
ead561f0 51 AliAODVertex* RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod);
52
3244eeed 53
54 // kinematics & topology
55 Double_t DecayLength() const
460cd990 56 { return AliAODRecoDecay::DecayLength(GetPrimaryVtx());}
3244eeed 57 Double_t DecayLengthError() const
460cd990 58 { return AliAODRecoDecay::DecayLengthError(GetPrimaryVtx());}
3244eeed 59 Double_t NormalizedDecayLength() const
460cd990 60 { return AliAODRecoDecay::NormalizedDecayLength(GetPrimaryVtx());}
3244eeed 61 Double_t DecayLengthXY() const
460cd990 62 { return AliAODRecoDecay::DecayLengthXY(GetPrimaryVtx());}
3244eeed 63 Double_t DecayLengthXYError() const
460cd990 64 { return AliAODRecoDecay::DecayLengthXYError(GetPrimaryVtx());}
3244eeed 65 Double_t NormalizedDecayLengthXY() const
460cd990 66 { return AliAODRecoDecay::NormalizedDecayLengthXY(GetPrimaryVtx());}
3244eeed 67 Double_t Ct(UInt_t pdg) const
460cd990 68 { return AliAODRecoDecay::Ct(pdg,GetPrimaryVtx());}
3244eeed 69 Double_t CosPointingAngle() const
460cd990 70 { return AliAODRecoDecay::CosPointingAngle(GetPrimaryVtx());}
3244eeed 71 Double_t CosPointingAngleXY() const
460cd990 72 { return AliAODRecoDecay::CosPointingAngleXY(GetPrimaryVtx());}
3244eeed 73 Double_t ImpParXY() const
460cd990 74 { return AliAODRecoDecay::ImpParXY(GetPrimaryVtx());}
3244eeed 75 Double_t QtProngFlightLine(Int_t ip) const
460cd990 76 { return AliAODRecoDecay::QtProngFlightLine(ip,GetPrimaryVtx());}
3244eeed 77 Double_t QlProngFlightLine(Int_t ip) const
460cd990 78 { return AliAODRecoDecay::QlProngFlightLine(ip,GetPrimaryVtx());}
3244eeed 79
80 // prongs
81 Double_t Getd0errProng(Int_t ip) const {return fd0err[ip];}
82 Double_t Normalizedd0Prong(Int_t ip) const
83 {return Getd0Prong(ip)/Getd0errProng(ip);}
84
6185d025 85 void SetProngIDs(Int_t nIDs,UShort_t *id);
86 UShort_t GetProngID(Int_t ip) const
dcb444c9 87 {if(fProngID) {return fProngID[ip];} else {return 9999;}}
6185d025 88
ac7797a7 89 // ITS clustermap for daughters
90 Bool_t DaughterHasPointOnITSLayer(Int_t dg,Int_t l) const;
91
27917274 92 // check if it is like-sign
93 Bool_t IsLikeSign() const;
3244eeed 94
a9b75906 95 // list of cuts
96 void SetListOfCutsRef(TObject *obj) {fListOfCuts=obj;}
97 TList *GetListOfCuts() const {return (TList*)(fListOfCuts.GetObject());}
98 AliRDHFCuts *GetCuts(const char* name) const;
ec653946 99
100 // vertexing KF:
101 AliKFParticle *ApplyVertexingKF(Int_t *iprongs,Int_t nprongs,Int_t *pdgs,
102 Bool_t topoCostraint,Double_t bzkG,
103 Double_t *mass) const;
104
3244eeed 105 protected:
106
107 AliAODVertex *fOwnPrimaryVtx; // primary vertex for this candidate
460cd990 108 TRef fEventPrimaryVtx; // ref to primary vertex of the event
a9b75906 109 TRef fListOfCuts; // ref to the list of analysis cuts
6185d025 110 Double_t *fd0err; //[fNProngs] error on prongs rphi impact param [cm]
111 UShort_t *fProngID; //[fNProngs] track ID of daughters
3244eeed 112
a9b75906 113 ClassDef(AliAODRecoDecayHF,4) // base class for AOD reconstructed heavy-flavour decays
3244eeed 114};
115
6185d025 116inline void AliAODRecoDecayHF::SetProngIDs(Int_t nIDs,UShort_t *id)
117{
118 if(nIDs!=GetNProngs()) {
119 printf("Wrong number of IDs, must be nProngs\n");
120 return;
121 }
122 if(fProngID) delete [] fProngID;
123 fProngID = new UShort_t[nIDs];
124 for(Int_t i=0;i<nIDs;i++)
125 fProngID[i] = id[i];
126 return;
127}
128
27917274 129inline Bool_t AliAODRecoDecayHF::IsLikeSign() const
130{
131 // check if it is like-sign
132
133 Int_t ndg=GetNDaughters();
134 if(!ndg) {
135 printf("Daughters not available\n");
136 return kFALSE;
137 }
138 Int_t chargeDg0 = ((AliAODTrack*)GetDaughter(0))->Charge();
139
140 for(Int_t i=1; i<ndg; i++) {
141 if(chargeDg0!=((AliAODTrack*)GetDaughter(i))->Charge()) return kFALSE;
142 }
143
144 return kTRUE;
145}
146
a9b75906 147inline AliRDHFCuts *AliAODRecoDecayHF::GetCuts(const char* name) const
148{
149 // returns the analysis cuts
150
151 TList *list = GetListOfCuts();
152 if(!list) return 0;
153
154
155 return (AliRDHFCuts*)list->FindObject(name);
156}
157
ac7797a7 158inline Bool_t AliAODRecoDecayHF::DaughterHasPointOnITSLayer(Int_t dg,Int_t l) const
159{
160 // ITS clustermap for daughters
161
162 if(l<0 || l>5) {
163 printf("ERROR: layer has to be in the range 0-5\n");
164 return kFALSE;
165 }
166 AliAODTrack *t = (AliAODTrack*)GetDaughter(dg);
167 if(!t) return kFALSE;
168
169 return TESTBIT(t->GetITSClusterMap(),l);
170}
171
3244eeed 172#endif
27917274 173