2 // Class AliRsnDaughter
4 // Interface to candidate daughters of a resonance (tracks).
5 // Points to the source of information, which is generally an AliVParticle-derived object
6 // and contains few internal data-members to store "on fly" some important information
7 // for the computations required during resonance analysis.
8 // It contains a useful TLorentzVector data-member which, provided that a meaningful mass was assigned,
9 // eases a lot the computation of invariant masses from summing up several of these objects.
11 // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
12 // M. Vala (martin.vala@cern.ch)
15 #include <TParticle.h>
16 #include "AliAODVertex.h"
17 #include "AliRsnDaughter.h"
19 ClassImp(AliRsnDaughter)
21 //_____________________________________________________________________________
22 AliRsnDaughter::AliRsnDaughter() :
26 fPrec(0.0, 0.0, 0.0, 0.0),
27 fPsim(0.0, 0.0, 0.0, 0.0),
32 // Default constructor.
36 //_____________________________________________________________________________
37 AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) :
41 fMotherPDG(copy.fMotherPDG),
49 // Pointers are NOT duplicated, since they don't come from a 'new'
50 // statement, but from just referencing something in the data source.
54 //_____________________________________________________________________________
55 AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter ©)
58 // Assignment operator.
59 // Pointers are NOT duplicated, since they don't come from a 'new'
60 // statement, but from just referencing something in the data source.
65 fMotherPDG = copy.fMotherPDG;
74 //_____________________________________________________________________________
75 void AliRsnDaughter::Reset()
78 // Reset this track to meaningless values and to a 'bad' status.
79 // After this has been done, this object should not be used
80 // for analysis unless initialized properly.
89 fPrec.SetXYZM(0.0, 0.0, 0.0, 0.0);
90 fPsim.SetXYZM(0.0, 0.0, 0.0, 0.0);
93 //_____________________________________________________________________________
94 Int_t AliRsnDaughter::GetPDG(Bool_t abs)
97 // Return the PDG code of the particle from MC ref (if any).
98 // If argument is kTRUE, returns its absolute value.
104 AliMCParticle *esd = GetRefMCESD();
105 if (esd) pdg = esd->Particle()->GetPdgCode();
108 AliAODMCParticle *aod = GetRefMCAOD();
109 if (aod) pdg = aod->GetPdgCode();
111 // abs value if required
112 if (abs) pdg = TMath::Abs(pdg);
116 //_____________________________________________________________________________
117 Int_t AliRsnDaughter::GetID()
120 // Return reference index, using the "GetID" method
121 // of the possible source object.
122 // In case of V0s, since this method is unsuccessful, return the label.
126 AliESDtrack *esd = GetRefESDtrack();
127 if (esd) return esd->GetID();
130 AliAODTrack *aod = GetRefAODtrack();
131 if (aod) return aod->GetID();
137 //_____________________________________________________________________________
138 Bool_t AliRsnDaughter::HasFlag(ULong_t flag)
141 // Checks that the 'status' flag of the source object has one or
142 // a combination of status flags specified in argument.
143 // Works only with track-like objects, irrespectively if they
144 // are ESD or AOD tracks, since it refers to their AliVTrack base class.
147 AliVTrack *track = dynamic_cast<AliVTrack*>(fRef);
148 if (!track) return kFALSE;
150 ULong_t status = (ULong_t)track->GetStatus();
152 return ((status & flag) != 0);
155 //_____________________________________________________________________________
156 Bool_t AliRsnDaughter::SetMass(Double_t mass)
159 // Assign a mass hypothesis to the track.
160 // This causes the 4-momentum data members to be initialized
161 // using the momenta of referenced tracks/v0s and this mass.
162 // This step is fundamental for the following of the analysis.
163 // Of course, this operation is successful only if the mass is
164 // a meaningful positive number, and the pointers are properly initialized.
167 if (mass < 0.) return kFALSE;
169 if (fRef) fPrec.SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass);
170 if (fRefMC) fPsim.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass);
175 //_____________________________________________________________________________
176 Bool_t AliRsnDaughter::IsKinkDaughter()
179 // Checks if this track is a kink daughter.
180 // this information is important for some cuts, in some cases
181 // and it is retrieved differently from ESDs and AODs, so
182 // this is done here in order to have a unique outcome.
185 AliESDtrack *etrack = GetRefESDtrack();
186 AliAODTrack *atrack = GetRefAODtrack();
190 return (etrack->GetKinkIndex(0) > 0);
194 AliAODVertex *vertex = atrack->GetProdVertex();
195 if (vertex) if (vertex->GetType() == AliAODVertex::kKink) return kTRUE;