]>
Commit | Line | Data |
---|---|---|
e2bafbbc | 1 | // |
06351446 | 2 | // Class AliRsnDaughter |
3 | // | |
5eb970a4 | 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. | |
5f1c287d | 8 | // It contains a TLorentzVector data-member which, provided that a meaningful mass was assigned, |
2dab9030 | 9 | // eases a lot the computation of invariant masses from summing up several of these objects. |
06351446 | 10 | // |
e0baff8c | 11 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) |
12 | // M. Vala (martin.vala@cern.ch) | |
e2bafbbc | 13 | // |
7c2974c8 | 14 | |
a62a2d82 | 15 | #include <TParticle.h> |
5eb970a4 | 16 | #include "AliAODVertex.h" |
5f1c287d | 17 | |
a62a2d82 | 18 | #include "AliRsnDaughter.h" |
19 | ||
20 | ClassImp(AliRsnDaughter) | |
21 | ||
7c2974c8 | 22 | //_____________________________________________________________________________ |
2dab9030 | 23 | AliRsnDaughter::AliRsnDaughter() : |
2a1c7696 | 24 | fOK(kFALSE), |
25 | fLabel(-1), | |
26 | fMotherPDG(0), | |
5f1c287d | 27 | fRsnID(-1), |
2a1c7696 | 28 | fPrec(0.0, 0.0, 0.0, 0.0), |
29 | fPsim(0.0, 0.0, 0.0, 0.0), | |
30 | fRef(0x0), | |
31 | fRefMC(0x0) | |
2f769150 | 32 | { |
06351446 | 33 | // |
a62a2d82 | 34 | // Default constructor. |
5f1c287d | 35 | // Initializes all data members to the same values |
36 | // Which will be given by Reset() method. | |
06351446 | 37 | // |
7c2974c8 | 38 | } |
39 | ||
40 | //_____________________________________________________________________________ | |
41 | AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : | |
2a1c7696 | 42 | TObject(copy), |
43 | fOK(copy.fOK), | |
44 | fLabel(copy.fLabel), | |
45 | fMotherPDG(copy.fMotherPDG), | |
5f1c287d | 46 | fRsnID(copy.fRsnID), |
2a1c7696 | 47 | fPrec(copy.fPrec), |
48 | fPsim(copy.fPsim), | |
49 | fRef(copy.fRef), | |
50 | fRefMC(copy.fRefMC) | |
7c2974c8 | 51 | { |
06351446 | 52 | // |
7c2974c8 | 53 | // Copy constructor. |
2dab9030 | 54 | // Pointers are NOT duplicated, since they don't come from a 'new' |
55 | // statement, but from just referencing something in the data source. | |
06351446 | 56 | // |
7c2974c8 | 57 | } |
58 | ||
7c2974c8 | 59 | //_____________________________________________________________________________ |
60 | AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter ©) | |
61 | { | |
06351446 | 62 | // |
7c2974c8 | 63 | // Assignment operator. |
2dab9030 | 64 | // Pointers are NOT duplicated, since they don't come from a 'new' |
65 | // statement, but from just referencing something in the data source. | |
06351446 | 66 | // |
67 | ||
2a1c7696 | 68 | fOK = copy.fOK; |
69 | fLabel = copy.fLabel; | |
70 | fMotherPDG = copy.fMotherPDG; | |
5f1c287d | 71 | fRsnID = copy.fRsnID; |
2a1c7696 | 72 | fPrec = copy.fPrec; |
73 | fPsim = copy.fPsim; | |
74 | fRef = copy.fRef; | |
75 | fRefMC = copy.fRefMC; | |
aec0ec32 | 76 | |
2a1c7696 | 77 | return (*this); |
7c2974c8 | 78 | } |
79 | ||
5f1c287d | 80 | //_____________________________________________________________________________ |
81 | void AliRsnDaughter::SetRef(AliVParticle *p) | |
82 | { | |
83 | // | |
84 | // Set the pointer to reference VParticle | |
85 | // and copies its momentum in the 4-vector. | |
86 | // Mass is assigned by SetMass(). | |
87 | // | |
88 | ||
89 | fRef = p; | |
90 | if (p) fPrec.SetXYZT(p->Px(), p->Py(), p->Pz(), 0.0); | |
91 | else fPrec.SetXYZT(0.0, 0.0, 0.0, 0.0); | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | void AliRsnDaughter::SetRefMC(AliVParticle *p) | |
96 | { | |
97 | // | |
98 | // Set the pointer to reference MonteCarlo VParticle | |
99 | // and copies its momentum in the 4-vector. | |
100 | // Mass is assigned by SetMass(). | |
101 | // | |
102 | ||
103 | fRefMC = p; | |
104 | if (p) fPsim.SetXYZT(p->Px(), p->Py(), p->Pz(), 0.0); | |
105 | else fPrec.SetXYZT(0.0, 0.0, 0.0, 0.0); | |
106 | } | |
107 | ||
5eb970a4 | 108 | //_____________________________________________________________________________ |
109 | void AliRsnDaughter::Reset() | |
110 | { | |
111 | // | |
2dab9030 | 112 | // Reset this track to meaningless values and to a 'bad' status. |
113 | // After this has been done, this object should not be used | |
114 | // for analysis unless initialized properly. | |
5eb970a4 | 115 | // |
116 | ||
2a1c7696 | 117 | fOK = kFALSE; |
118 | fLabel = -1; | |
5f1c287d | 119 | fMotherPDG = 0; |
120 | fRsnID = -1; | |
2a1c7696 | 121 | |
5f1c287d | 122 | SetRef(NULL); |
123 | SetRefMC(NULL); | |
e2bafbbc | 124 | } |
125 | ||
5f1c287d | 126 | |
7c2974c8 | 127 | //_____________________________________________________________________________ |
a378358c | 128 | Int_t AliRsnDaughter::GetPDG(Bool_t abs) |
4c2fda1e | 129 | { |
06351446 | 130 | // |
a378358c | 131 | // Return the PDG code of the particle from MC ref (if any). |
132 | // If argument is kTRUE, returns its absolute value. | |
06351446 | 133 | // |
7c2974c8 | 134 | |
2a1c7696 | 135 | Int_t pdg = 0; |
136 | ||
137 | // ESD | |
138 | AliMCParticle *esd = GetRefMCESD(); | |
139 | if (esd) pdg = esd->Particle()->GetPdgCode(); | |
140 | ||
141 | // AOD | |
142 | AliAODMCParticle *aod = GetRefMCAOD(); | |
143 | if (aod) pdg = aod->GetPdgCode(); | |
ec927a7d | 144 | |
2a1c7696 | 145 | // abs value if required |
146 | if (abs) pdg = TMath::Abs(pdg); | |
147 | return pdg; | |
ec927a7d | 148 | } |
149 | ||
7c2974c8 | 150 | //_____________________________________________________________________________ |
a378358c | 151 | Int_t AliRsnDaughter::GetID() |
4fbb2459 | 152 | { |
06351446 | 153 | // |
2dab9030 | 154 | // Return reference index, using the "GetID" method |
155 | // of the possible source object. | |
5f1c287d | 156 | // When this method is unsuccessful (e.g.: V0s), return the label. |
06351446 | 157 | // |
4fbb2459 | 158 | |
2a1c7696 | 159 | // ESD tracks |
160 | AliESDtrack *esd = GetRefESDtrack(); | |
161 | if (esd) return esd->GetID(); | |
5eb970a4 | 162 | |
2a1c7696 | 163 | // AOD tracks |
164 | AliAODTrack *aod = GetRefAODtrack(); | |
165 | if (aod) return aod->GetID(); | |
2dab9030 | 166 | |
2a1c7696 | 167 | // whatever else |
168 | return GetLabel(); | |
e2bafbbc | 169 | } |
4fbb2459 | 170 | |
171 | //_____________________________________________________________________________ | |
a378358c | 172 | Bool_t AliRsnDaughter::HasFlag(ULong_t flag) |
4fbb2459 | 173 | { |
174 | // | |
2a1c7696 | 175 | // Checks that the 'status' flag of the source object has one or |
a378358c | 176 | // a combination of status flags specified in argument. |
5f1c287d | 177 | // Works only with objects inheriting from AliVTrack base class. |
4fbb2459 | 178 | // |
179 | ||
5f1c287d | 180 | AliVTrack *track = GetRefVtrack(); |
2a1c7696 | 181 | if (!track) return kFALSE; |
182 | ||
183 | ULong_t status = (ULong_t)track->GetStatus(); | |
184 | ||
185 | return ((status & flag) != 0); | |
2dab9030 | 186 | } |
187 | ||
188 | //_____________________________________________________________________________ | |
189 | Bool_t AliRsnDaughter::SetMass(Double_t mass) | |
190 | { | |
191 | // | |
d0282f3d | 192 | // Assign a mass hypothesis to the track. |
5f1c287d | 193 | // This causes the 4-momentum data members to be re-initialized |
a378358c | 194 | // using the momenta of referenced tracks/v0s and this mass. |
d0282f3d | 195 | // This step is fundamental for the following of the analysis. |
2dab9030 | 196 | // |
197 | ||
2a1c7696 | 198 | if (mass < 0.) return kFALSE; |
199 | ||
200 | if (fRef) fPrec.SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); | |
201 | if (fRefMC) fPsim.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); | |
202 | ||
203 | return kTRUE; | |
4fbb2459 | 204 | } |
32992791 | 205 | |
206 | //_____________________________________________________________________________ | |
207 | Bool_t AliRsnDaughter::IsKinkDaughter() | |
208 | { | |
209 | // | |
210 | // Checks if this track is a kink daughter. | |
211 | // this information is important for some cuts, in some cases | |
212 | // and it is retrieved differently from ESDs and AODs, so | |
213 | // this is done here in order to have a unique outcome. | |
214 | // | |
215 | ||
2a1c7696 | 216 | AliESDtrack *etrack = GetRefESDtrack(); |
217 | AliAODTrack *atrack = GetRefAODtrack(); | |
218 | ||
219 | if (etrack) { | |
220 | return (etrack->GetKinkIndex(0) > 0); | |
221 | } else if (atrack) { | |
222 | AliAODVertex *vertex = atrack->GetProdVertex(); | |
223 | if (vertex) if (vertex->GetType() == AliAODVertex::kKink) return kTRUE; | |
224 | } | |
225 | ||
226 | return kFALSE; | |
32992791 | 227 | } |