AliPhysics  v5-07-18-02 (20ec537)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAODRecoDecayHF.h
Go to the documentation of this file.
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 /* $Id$ */
7 
13 
14 #include <TRef.h>
15 #include <TList.h>
16 #include "AliAODTrack.h"
17 #include "AliAODRecoDecay.h"
18 
19 class AliAODEvent;
20 class AliRDHFCuts;
21 class AliKFParticle;
22 
23 class AliAODRecoDecayHF : public AliAODRecoDecay {
24 
25  public:
26 
28  AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
29  Double_t *px,Double_t *py,Double_t *pz,
30  Double_t *d0,Double_t *d0err);
31  AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
32  Double_t *d0,Double_t *d0err);
33  AliAODRecoDecayHF(Double_t vtx1[3],Double_t vtx2[3],
34  Int_t nprongs,Short_t charge,
35  Double_t *px,Double_t *py,Double_t *pz,Double_t *d0);
36  virtual ~AliAODRecoDecayHF();
37 
38  AliAODRecoDecayHF(const AliAODRecoDecayHF& source);
40 
41 
43  void SetPrimaryVtxRef(TObject *vtx) { fEventPrimaryVtx = vtx; }
44  AliAODVertex* GetPrimaryVtxRef() const { return (AliAODVertex*)(fEventPrimaryVtx.GetObject()); }
45  void SetOwnPrimaryVtx(const AliAODVertex *vtx) { UnsetOwnPrimaryVtx(); fOwnPrimaryVtx = new AliAODVertex(*vtx);}
46  void CheckOwnPrimaryVtx() const
47  {if(!fOwnPrimaryVtx) printf("fOwnPrimaryVtx not set"); return;}
48  AliAODVertex* GetOwnPrimaryVtx() const {return fOwnPrimaryVtx;}
49  void GetOwnPrimaryVtx(Double_t vtx[3]) const
50  {CheckOwnPrimaryVtx();fOwnPrimaryVtx->GetPosition(vtx);}
52  AliAODVertex* GetPrimaryVtx() const { return (GetOwnPrimaryVtx() ? GetOwnPrimaryVtx() : GetPrimaryVtxRef()); }
53  AliAODVertex* RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod);
54  void RecalculateImpPars(AliAODVertex *vtxAODNew,AliAODEvent *aod);
55 
56  void SetIsFilled(Int_t filled){fIsFilled=filled;}
57  Int_t GetIsFilled() const {return fIsFilled;}
58  virtual void DeleteRecoD();
59 
61  Double_t DecayLength2() const
62  { return AliAODRecoDecay::DecayLength2(GetPrimaryVtx());}
63  Double_t DecayLength() const
64  { return AliAODRecoDecay::DecayLength(GetPrimaryVtx());}
65  Double_t DecayLengthError() const
66  { return AliAODRecoDecay::DecayLengthError(GetPrimaryVtx());}
67  Double_t NormalizedDecayLength() const
68  { return AliAODRecoDecay::NormalizedDecayLength(GetPrimaryVtx());}
69  Double_t NormalizedDecayLength2() const
70  { return AliAODRecoDecay::NormalizedDecayLength2(GetPrimaryVtx());}
71  Double_t DecayLengthXY() const
72  { return AliAODRecoDecay::DecayLengthXY(GetPrimaryVtx());}
73  Double_t DecayLengthXYError() const
74  { return AliAODRecoDecay::DecayLengthXYError(GetPrimaryVtx());}
75  Double_t NormalizedDecayLengthXY() const
76  { return AliAODRecoDecay::NormalizedDecayLengthXY(GetPrimaryVtx());}
77  Double_t Ct(UInt_t pdg) const
78  { return AliAODRecoDecay::Ct(pdg,GetPrimaryVtx());}
79  Double_t CosPointingAngle() const
80  { return AliAODRecoDecay::CosPointingAngle(GetPrimaryVtx());}
81  Double_t CosPointingAngleXY() const
82  { return AliAODRecoDecay::CosPointingAngleXY(GetPrimaryVtx());}
83  Double_t ImpParXY() const
84  { return AliAODRecoDecay::ImpParXY(GetPrimaryVtx());}
85  Double_t QtProngFlightLine(Int_t ip) const
86  { return AliAODRecoDecay::QtProngFlightLine(ip,GetPrimaryVtx());}
87  Double_t QlProngFlightLine(Int_t ip) const
88  { return AliAODRecoDecay::QlProngFlightLine(ip,GetPrimaryVtx());}
89 
91  Double_t Getd0errProng(Int_t ip) const {return fd0err[ip];}
92  void Setd0errProngs(Int_t nprongs,Double_t *d0);
93  Double_t Normalizedd0Prong(Int_t ip) const
94  {return Getd0Prong(ip)/Getd0errProng(ip);}
95  void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t& d0diff, Double_t& errd0diff) const;
96 
97 
98  void SetProngIDs(Int_t nIDs,UShort_t *id);
99  UShort_t GetProngID(Int_t ip) const
100  {if(fProngID) {return fProngID[ip];} else {return 9999;}}
101 
103  Bool_t DaughterHasPointOnITSLayer(Int_t dg,Int_t l) const;
104 
106  Bool_t IsLikeSign() const;
107 
109  void SetListOfCutsRef(TObject *obj) {fListOfCuts=obj;}
110  TList *GetListOfCuts() const {return (TList*)(fListOfCuts.GetObject());}
111  AliRDHFCuts *GetCuts(const char* name) const;
112 
114  AliKFParticle *ApplyVertexingKF(Int_t *iprongs,Int_t nprongs,Int_t *pdgs,
115  Bool_t topoCostraint,Double_t bzkG,
116  Double_t *mass) const;
117 
119  void Misalign(TString misal="null");
120 
122  void SetSelectionBit(Int_t i) {SETBIT(fSelectionMap,i); return;}
123  Bool_t HasSelectionBit(Int_t i) const {return TESTBIT(fSelectionMap,i);}
124  ULong_t GetSelectionMap() const {return fSelectionMap;}
125 
126  Int_t NumberOfFakeDaughters() const;
127 
128  Bool_t HasBadDaughters() const;
129 
130  protected:
131 
132  AliAODVertex *fOwnPrimaryVtx;
134  TRef fListOfCuts;
135  Double_t *fd0err; //[fNProngs] error on prongs rphi impact param [cm]
138  UShort_t *fProngID; //[fNProngs] track ID of daughters
139  ULong_t fSelectionMap;
140  Int_t fIsFilled; // 0 if standard refiltering; 1 if data members of candidates are empty, 2 if data members are refilled in analysis task
141 
143  ClassDef(AliAODRecoDecayHF,6) // base class for AOD reconstructed heavy-flavour decays
145 };
146 
147 inline void AliAODRecoDecayHF::SetProngIDs(Int_t nIDs,UShort_t *id)
148 {
149  if(nIDs!=GetNProngs()) {
150  printf("Wrong number of IDs, must be nProngs\n");
151  return;
152  }
153  if(fProngID) delete [] fProngID;
154  fProngID = new UShort_t[nIDs];
155  for(Int_t i=0;i<nIDs;i++)
156  fProngID[i] = id[i];
157  return;
158 }
159 
160 inline Bool_t AliAODRecoDecayHF::IsLikeSign() const
161 {
163 
164  Int_t ndg=GetNDaughters();
165  if(!ndg) {
166  printf("Daughters not available\n");
167  return kFALSE;
168  }
169  Int_t chargeDg0 = ((AliAODTrack*)GetDaughter(0))->Charge();
170 
171  for(Int_t i=1; i<ndg; i++) {
172  if(chargeDg0!=((AliAODTrack*)GetDaughter(i))->Charge()) return kFALSE;
173  }
174 
175  return kTRUE;
176 }
177 
178 inline AliRDHFCuts *AliAODRecoDecayHF::GetCuts(const char* name) const
179 {
181 
182  TList *list = GetListOfCuts();
183  if(!list) return 0;
184 
185 
186  return (AliRDHFCuts*)list->FindObject(name);
187 }
188 
189 inline Bool_t AliAODRecoDecayHF::DaughterHasPointOnITSLayer(Int_t dg,Int_t l) const
190 {
192 
193  if(l<0 || l>5) {
194  printf("ERROR: layer has to be in the range 0-5\n");
195  return kFALSE;
196  }
197  AliAODTrack *t = (AliAODTrack*)GetDaughter(dg);
198  if(!t) return kFALSE;
199 
200  return TESTBIT(t->GetITSClusterMap(),l);
201 }
202 
204 {
206 
207  Int_t nfakes=0;
208  for(Int_t i=0; i<GetNDaughters(); i++) {
209  AliAODTrack *track=(AliAODTrack*)GetDaughter(i);
210 
211  if(track->Charge()==0) { // this is a two prong decay
212  AliAODRecoDecay *rd=(AliAODRecoDecay*)GetDaughter(i);
213  for(Int_t j=0; j<rd->GetNDaughters(); j++) {
214  AliAODTrack *track2=(AliAODTrack*)GetDaughter(j);
215  if(track2->GetLabel()<0) nfakes++;
216  }
217  continue;
218  }
219 
220  if(track->GetLabel()<0) nfakes++;
221  }
222  return nfakes;
223 }
224 
225 inline void AliAODRecoDecayHF::Setd0errProngs(Int_t nprongs,Double_t *d0err)
226 {
227  if(nprongs!=GetNProngs()) {
228  printf("Wrong number of momenta, must be nProngs");
229  return;
230  }
231  if(!fd0err) {
232  fd0err = new Double32_t[nprongs];
233  }
234  for(Int_t i=0;i<nprongs;i++) {
235  fd0err[i] = d0err[i];
236  }
237 
238  return;
239 }
240 
241 inline Bool_t AliAODRecoDecayHF::HasBadDaughters() const {
242 
244 
245  for(Int_t iDau=0; iDau<GetNDaughters(); iDau++){
246  if (GetDaughter(iDau)==NULL) continue;
247  AliAODTrack* at=dynamic_cast<AliAODTrack*>(GetDaughter(iDau));
248  if (!at) continue;
249  if(at->Charge()==0) continue;
250  if(at->GetTPCNcls()==0) continue;
251  if(!(at->TestFilterMask(BIT(4)))) return kTRUE;
252  }
253  return kFALSE;
254 }
255 
256 
257 #endif
258 
Int_t charge
Double_t * fd0err
error on prongs rphi impact param [cm]
Double_t NormalizedDecayLengthXY() const
Int_t pdg
Double_t NormalizedDecayLength() const
AliAODRecoDecayHF & operator=(const AliAODRecoDecayHF &source)
void SetSelectionBit(Int_t i)
selection map
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
Bool_t HasSelectionBit(Int_t i) const
Double_t Ct(UInt_t pdg) const
TList * GetListOfCuts() const
AliAODVertex * fOwnPrimaryVtx
TPC+ITS tracks not passing the StandardCuts2010 with loose DCA.
Double_t mass
Double_t NormalizedDecayLength2() const
Double_t ImpParXY() const
Int_t fIsFilled
used to store outcome of selection in AliAnalysisVertexingHF
TList * list
Double_t CosPointingAngleXY() const
virtual void DeleteRecoD()
ULong_t GetSelectionMap() const
AliAODVertex * GetPrimaryVtxRef() const
void RecalculateImpPars(AliAODVertex *vtxAODNew, AliAODEvent *aod)
Bool_t HasBadDaughters() const
void GetOwnPrimaryVtx(Double_t vtx[3]) const
AliRDHFCuts * GetCuts(const char *name) const
Int_t GetIsFilled() const
void SetListOfCutsRef(TObject *obj)
list of cuts
AliAODVertex * GetOwnPrimaryVtx() const
void SetProngIDs(Int_t nIDs, UShort_t *id)
Double_t Getd0errProng(Int_t ip) const
prongs
UShort_t GetProngID(Int_t ip) const
UShort_t * fProngID
track ID of daughters
AliAODVertex * RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod)
Double_t DecayLength2() const
kinematics & topology
void SetPrimaryVtxRef(TObject *vtx)
primary vertex
void Misalign(TString misal="null")
misalign
Bool_t DaughterHasPointOnITSLayer(Int_t dg, Int_t l) const
ITS clustermap for daughters.
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Double_t DecayLengthXY() const
TRef fEventPrimaryVtx
primary vertex for this candidate
Double_t Normalizedd0Prong(Int_t ip) const
void Setd0errProngs(Int_t nprongs, Double_t *d0)
TRef fListOfCuts
ref to primary vertex of the event
Double_t DecayLengthError() const
Int_t NumberOfFakeDaughters() const
Double_t QlProngFlightLine(Int_t ip) const
void CheckOwnPrimaryVtx() const
AliAODVertex * GetPrimaryVtx() const
Double_t QtProngFlightLine(Int_t ip) const
AliKFParticle * ApplyVertexingKF(Int_t *iprongs, Int_t nprongs, Int_t *pdgs, Bool_t topoCostraint, Double_t bzkG, Double_t *mass) const
vertexing KF:
Double_t CosPointingAngle() const
Double_t DecayLengthXYError() const
Double_t DecayLength() const
Bool_t IsLikeSign() const
check if it is like-sign
void SetIsFilled(Int_t filled)