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