]>
Commit | Line | Data |
---|---|---|
06351446 | 1 | // |
2 | // Class AliRsnPairParticle | |
3 | // | |
4 | // Implementation of a pair of tracks, for several purposes | |
5 | // - computing the total 4-momentum & inv. mass for output histos filling | |
6 | // - evaluating cut checks on the pair of particles | |
e0baff8c | 7 | // - evaluating any kind of kinematic value over their sum |
06351446 | 8 | // |
e0baff8c | 9 | // authors: Martin Vala (martin.vala@cern.ch) |
10 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
06351446 | 11 | // |
12 | ||
5eb970a4 | 13 | #include <TParticle.h> |
14 | ||
06351446 | 15 | #include "AliLog.h" |
16 | ||
17 | #include "AliRsnPairParticle.h" | |
18 | ||
aec0ec32 | 19 | ClassImp(AliRsnPairParticle) |
06351446 | 20 | |
21 | //_____________________________________________________________________________ | |
e2bafbbc | 22 | AliRsnPairParticle::AliRsnPairParticle() |
06351446 | 23 | { |
24 | // | |
25 | // Constructor. | |
26 | // Initializes all variables to meaningless values. | |
27 | // | |
e2bafbbc | 28 | |
aec0ec32 | 29 | Int_t i, j; |
30 | ||
5eb970a4 | 31 | for (i = 0; i < 3; i++) { |
aec0ec32 | 32 | fPTot[i] = 0.0; |
33 | fPTotMC[i] = 0.0; | |
5eb970a4 | 34 | if (i < 2) { |
aec0ec32 | 35 | fMotherLabel[i] = -1; |
36 | fMotherPDG[i] = 0; | |
37 | fDaughter[i] = 0x0; | |
06351446 | 38 | } |
5eb970a4 | 39 | for (j = 0; j < 2; j++) { |
aec0ec32 | 40 | fPTrack[j][i] = 0.0; |
41 | fPTrackMC[j][i] = 0.0; | |
42 | } | |
43 | } | |
06351446 | 44 | } |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliRsnPairParticle::AliRsnPairParticle(const AliRsnPairParticle &obj) : | |
aec0ec32 | 48 | TObject(obj) |
06351446 | 49 | { |
50 | // | |
51 | // Copy constructor. | |
52 | // Initializes all variables to copy values. | |
53 | // Does not duplicate pointers. | |
54 | // | |
e2bafbbc | 55 | |
aec0ec32 | 56 | Int_t i, j; |
5eb970a4 | 57 | for (i = 0; i < 3; i++) { |
aec0ec32 | 58 | fPTot[i] = obj.fPTot[i]; |
59 | fPTotMC[i] = obj.fPTotMC[i]; | |
5eb970a4 | 60 | if (i < 2) { |
aec0ec32 | 61 | fMotherLabel[i] = obj.fMotherLabel[i]; |
62 | fMotherPDG[i] = obj.fMotherPDG[i]; | |
63 | fDaughter[i] = obj.fDaughter[i]; | |
64 | } | |
5eb970a4 | 65 | for (j = 0; j < 2; j++) { |
aec0ec32 | 66 | fPTrack[j][i] = obj.fPTrack[j][i]; |
67 | fPTrackMC[j][i] = obj.fPTrackMC[j][i]; | |
06351446 | 68 | } |
aec0ec32 | 69 | } |
06351446 | 70 | } |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliRsnPairParticle& AliRsnPairParticle::operator=(const AliRsnPairParticle &obj) | |
74 | { | |
75 | // | |
76 | // Assignment operator. | |
77 | // Initializes all variables to copy values. | |
78 | // Does not duplicate pointers. | |
79 | // | |
80 | ||
aec0ec32 | 81 | Int_t i, j; |
5eb970a4 | 82 | for (i = 0; i < 3; i++) { |
aec0ec32 | 83 | fPTot[i] = obj.fPTot[i]; |
84 | fPTotMC[i] = obj.fPTotMC[i]; | |
5eb970a4 | 85 | if (i < 2) { |
aec0ec32 | 86 | fMotherLabel[i] = obj.fMotherLabel[i]; |
87 | fMotherPDG[i] = obj.fMotherPDG[i]; | |
88 | fDaughter[i] = obj.fDaughter[i]; | |
89 | } | |
5eb970a4 | 90 | for (j = 0; j < 2; j++) { |
aec0ec32 | 91 | fPTrack[j][i] = obj.fPTrack[j][i]; |
92 | fPTrackMC[j][i] = obj.fPTrackMC[j][i]; | |
06351446 | 93 | } |
aec0ec32 | 94 | } |
06351446 | 95 | |
aec0ec32 | 96 | return (*this); |
06351446 | 97 | } |
98 | ||
99 | //_____________________________________________________________________________ | |
100 | AliRsnPairParticle::~AliRsnPairParticle() | |
101 | { | |
102 | // | |
103 | // Desctructor. | |
104 | // Does nothing. | |
105 | // | |
106 | } | |
107 | ||
108 | //_____________________________________________________________________________ | |
e2bafbbc | 109 | Double_t AliRsnPairParticle::GetInvMass(Double_t mass0, Double_t mass1) |
06351446 | 110 | { |
111 | // | |
e2bafbbc | 112 | // Compute invariant mass using reconstructed values. |
113 | // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), | |
5eb970a4 | 114 | // mass in argument #2 is assigned to second track in the pair (fDaughter[1]). |
115 | // If the third argument is not zero, a rotation of that angle is applied to XY momentum of track #2 | |
116 | // before computing invariant mass. | |
e2bafbbc | 117 | // Then, the invariant mass of the pair is computed by using their total momentum |
e0baff8c | 118 | // and the sum of their energies computed after assigned masses. |
06351446 | 119 | // |
06351446 | 120 | |
5eb970a4 | 121 | if (!fDaughter[0] || !fDaughter[1]) { |
aec0ec32 | 122 | AliError("One of the two tracks is NULL in this pair!"); |
123 | return -1000.0; | |
124 | } | |
06351446 | 125 | |
aec0ec32 | 126 | // compute track energies using the shortcut method defined in AliRsnDaughter |
127 | Double_t etot = 0.0; | |
128 | etot += fDaughter[0]->E(mass0); | |
129 | etot += fDaughter[1]->E(mass1); | |
06351446 | 130 | |
aec0ec32 | 131 | // compute & return invariant mass |
132 | return TMath::Sqrt(etot * etot - GetP2()); | |
06351446 | 133 | } |
134 | ||
135 | //_____________________________________________________________________________ | |
e2bafbbc | 136 | Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1) |
06351446 | 137 | { |
138 | // | |
e2bafbbc | 139 | // Compute invariant mass using MC values. |
140 | // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), | |
141 | // mass in argument #2 is assigned to second track in the pair (fDaughter[1]) | |
142 | // Then, the invariant mass of the pair is computed by using their total momentum | |
e0baff8c | 143 | // and the sum of their energies. |
06351446 | 144 | // |
145 | ||
5eb970a4 | 146 | if (!fDaughter[0] || !fDaughter[1]) { |
aec0ec32 | 147 | AliError("One of the two tracks is NULL in this pair!"); |
148 | return -1000.0; | |
149 | } | |
5eb970a4 | 150 | if (!fDaughter[0]->GetParticle() || !fDaughter[1]->GetParticle()) { |
aec0ec32 | 151 | AliError("One of the two tracks has a NULL MCInfo in this pair!"); |
152 | return -1000.0; | |
153 | } | |
154 | ||
155 | // compute track energies using the shortcut method defined in AliRsnDaughter | |
156 | Double_t etot = 0.0; | |
5eb970a4 | 157 | etot += fDaughter[0]->GetMCEnergy(mass0); |
158 | etot += fDaughter[1]->GetMCEnergy(mass1); | |
aec0ec32 | 159 | |
160 | // compute & return invariant mass | |
e0baff8c | 161 | return TMath::Sqrt(etot * etot - GetP2MC()); |
aec0ec32 | 162 | } |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | Double_t AliRsnPairParticle::GetEtot(Double_t mass0, Double_t mass1) const | |
166 | { | |
167 | // | |
168 | // Compute total pair energy from the sum of single track energies | |
169 | // with a necessary mass hypothesis (rec. values). | |
170 | // | |
e0baff8c | 171 | |
172 | Double_t etot = 0.0; | |
173 | etot += fDaughter[0]->E(mass0); | |
174 | etot += fDaughter[1]->E(mass1); | |
175 | ||
176 | return etot; | |
aec0ec32 | 177 | } |
06351446 | 178 | |
aec0ec32 | 179 | //_____________________________________________________________________________ |
180 | Double_t AliRsnPairParticle::GetEtotMC(Double_t mass0, Double_t mass1) const | |
181 | { | |
182 | // | |
183 | // Compute total pair energy from the sum of single track energies | |
184 | // with a necessary mass hypothesis (MC values). | |
185 | // | |
e0baff8c | 186 | Double_t etot = 0.0; |
5eb970a4 | 187 | etot += fDaughter[0]->GetMCEnergy(mass0); |
188 | etot += fDaughter[1]->GetMCEnergy(mass1); | |
e0baff8c | 189 | |
190 | return etot; | |
06351446 | 191 | } |
192 | ||
193 | //_____________________________________________________________________________ | |
e2bafbbc | 194 | Double_t AliRsnPairParticle::GetAngle() const |
06351446 | 195 | { |
196 | // | |
e2bafbbc | 197 | // Returns the relative angle between the vector momenta of the tracks |
198 | // Return value is in DEGREES. | |
06351446 | 199 | // |
200 | ||
aec0ec32 | 201 | Double_t dotProd = 0.0; |
202 | dotProd += fDaughter[0]->Px() * fDaughter[1]->Px(); | |
5acd0c9b | 203 | dotProd += fDaughter[0]->Py() * fDaughter[1]->Py(); |
aec0ec32 | 204 | dotProd += fDaughter[0]->Pz() * fDaughter[1]->Pz(); |
205 | ||
206 | Double_t cosAngle = dotProd / (fDaughter[0]->P() * fDaughter[1]->P()); | |
207 | ||
78b94cbd | 208 | return TMath::ACos(cosAngle) * TMath::RadToDeg(); |
06351446 | 209 | } |
210 | ||
211 | //_____________________________________________________________________________ | |
212 | Bool_t AliRsnPairParticle::IsTruePair(Int_t refPDG) | |
213 | { | |
214 | // | |
e2bafbbc | 215 | // Checks if the two tracks in the pair come from the same resonance. |
06351446 | 216 | // This can be known if MC info is present, looking at the GEANT label of mother |
217 | // (which should be the same). | |
218 | // If the argument is 0, the answer is kTRUE whenever the labels of mothers of the | |
219 | // two tracks is the same. When the argument is not zero, the answer is kTRUE only | |
220 | // if the mother is the same and its PDG code is equal to the argument. | |
e2bafbbc | 221 | // |
06351446 | 222 | |
aec0ec32 | 223 | // if MC info is not available, the pairs is not true by default |
5eb970a4 | 224 | if (!fDaughter[0]->GetParticle() || !fDaughter[1]->GetParticle()) { |
aec0ec32 | 225 | AliInfo("Cannot know if the pairs is true or not because MC Info is not present"); |
226 | return kFALSE; | |
227 | } | |
228 | ||
229 | // check that labels are the same | |
5eb970a4 | 230 | if (fDaughter[0]->GetParticle()->GetFirstMother() != fDaughter[1]->GetParticle()->GetFirstMother()) { |
aec0ec32 | 231 | return kFALSE; |
232 | } | |
233 | ||
234 | // if we reach this point, the two tracks have the same mother | |
235 | // let's check now the PDG code of this common mother | |
5eb970a4 | 236 | Int_t motherPDG = TMath::Abs(fDaughter[0]->GetMotherPDG()); |
aec0ec32 | 237 | if (refPDG == 0) return kTRUE; |
238 | else return (motherPDG == refPDG); | |
06351446 | 239 | } |
240 | ||
5eb970a4 | 241 | //_____________________________________________________________________________ |
242 | Int_t AliRsnPairParticle::CommonMother() | |
243 | { | |
244 | // | |
245 | // Checks if the two tracks in the pair have the same mother. | |
246 | // This can be known if MC info is present. | |
247 | // If the mother label is the same, rhe PDG code of the mother is returned, | |
248 | // otherwise the method returns 0. | |
249 | // | |
250 | ||
251 | // if MC info is not available, the pairs is not true by default | |
252 | if (!fDaughter[0]->GetParticle() || !fDaughter[1]->GetParticle()) { | |
253 | AliInfo("Cannot know if the pairs is true or not because MC Info is not present"); | |
254 | return 0; | |
255 | } | |
256 | ||
257 | // check that labels are the same | |
258 | if (fDaughter[0]->GetParticle()->GetFirstMother() != fDaughter[1]->GetParticle()->GetFirstMother()) { | |
259 | return 0; | |
260 | } | |
261 | ||
262 | // if we reach this point, the two tracks have the same mother | |
263 | // let's check now the PDG code of this common mother | |
264 | return TMath::Abs(fDaughter[0]->GetMotherPDG()); | |
265 | } | |
266 | ||
06351446 | 267 | //_____________________________________________________________________________ |
268 | void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2) | |
269 | { | |
270 | // | |
06351446 | 271 | // Accepts two AliRsnDaughter's which are the two tracks in the pair, |
272 | // fills all data-members which contain their momenta & info, | |
273 | // and computes the total momentum for REC data and MC if available | |
274 | // | |
275 | ||
aec0ec32 | 276 | Int_t i; |
06351446 | 277 | |
aec0ec32 | 278 | fDaughter[0] = daughter1; |
279 | fDaughter[1] = daughter2; | |
06351446 | 280 | |
e0baff8c | 281 | // copy MC info (if available) |
5eb970a4 | 282 | if (fDaughter[0]->GetParticle() && fDaughter[1]->GetParticle()) { |
283 | for (i = 0; i < 2; i++) { | |
284 | fPTrackMC[i][0] = fDaughter[i]->GetParticle()->Px(); | |
285 | fPTrackMC[i][1] = fDaughter[i]->GetParticle()->Py(); | |
286 | fPTrackMC[i][2] = fDaughter[i]->GetParticle()->Pz(); | |
287 | fMotherPDG[i] = fDaughter[i]->GetMotherPDG(); | |
e0baff8c | 288 | } |
289 | for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i]; | |
290 | } | |
291 | ||
292 | // copy reconstructed info (always available) | |
5eb970a4 | 293 | for (i = 0; i < 2; i++) { |
e0baff8c | 294 | fPTrack[i][0] = fDaughter[i]->Px(); |
295 | fPTrack[i][1] = fDaughter[i]->Py(); | |
296 | fPTrack[i][2] = fDaughter[i]->Pz(); | |
297 | } | |
298 | for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; | |
299 | } | |
300 | ||
301 | //_____________________________________________________________________________ | |
302 | void AliRsnPairParticle::ResetPair() | |
303 | { | |
304 | // | |
305 | // Computes the total momentum for REC data and MC if available | |
306 | // | |
307 | ||
308 | Int_t i; | |
309 | ||
aec0ec32 | 310 | // copy MC info (if available) |
5eb970a4 | 311 | if (fDaughter[0]->GetParticle() && fDaughter[1]->GetParticle()) { |
312 | for (i = 0; i < 2; i++) { | |
313 | fPTrackMC[i][0] = fDaughter[i]->GetParticle()->Px(); | |
314 | fPTrackMC[i][1] = fDaughter[i]->GetParticle()->Py(); | |
315 | fPTrackMC[i][2] = fDaughter[i]->GetParticle()->Pz(); | |
316 | fMotherPDG[i] = fDaughter[i]->GetMotherPDG(); | |
06351446 | 317 | } |
aec0ec32 | 318 | for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i]; |
319 | } | |
320 | ||
321 | // copy reconstructed info (always available) | |
5eb970a4 | 322 | for (i = 0; i < 2; i++) { |
aec0ec32 | 323 | fPTrack[i][0] = fDaughter[i]->Px(); |
324 | fPTrack[i][1] = fDaughter[i]->Py(); | |
325 | fPTrack[i][2] = fDaughter[i]->Pz(); | |
326 | } | |
327 | for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; | |
06351446 | 328 | } |
329 | ||
5eb970a4 | 330 | //_____________________________________________________________________________ |
331 | void AliRsnPairParticle::RotateTrack(Int_t idx, Double_t angle, Bool_t isDegrees) | |
332 | { | |
333 | // | |
334 | // Computes the total momentum for REC data and MC if available | |
335 | // | |
336 | ||
337 | if (idx < 0 || idx > 1) return; | |
338 | ||
339 | Int_t i; | |
340 | ||
341 | // copy MC info (if available) | |
342 | if (fDaughter[0]->GetParticle() && fDaughter[1]->GetParticle()) { | |
343 | for (i = 0; i < 2; i++) { | |
344 | if (i == idx) { | |
345 | fDaughter[i]->RotateP(angle, fPTrackMC[i][0], fPTrackMC[i][1], isDegrees); | |
346 | } else { | |
347 | fPTrackMC[i][0] = fDaughter[i]->GetParticle()->Px(); | |
348 | fPTrackMC[i][1] = fDaughter[i]->GetParticle()->Py(); | |
349 | } | |
350 | fPTrackMC[i][2] = fDaughter[i]->GetParticle()->Pz(); | |
351 | } | |
352 | for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i]; | |
353 | } | |
354 | ||
355 | for (i = 0; i < 2; i++) { | |
356 | if (i == idx) { | |
357 | fDaughter[i]->RotateP(angle, fPTrack[i][0], fPTrack[i][1], isDegrees); | |
358 | } else { | |
359 | fPTrack[i][0] = fDaughter[i]->GetParticle()->Px(); | |
360 | fPTrack[i][1] = fDaughter[i]->GetParticle()->Py(); | |
361 | } | |
362 | fPTrack[i][2] = fDaughter[i]->GetParticle()->Pz(); | |
363 | } | |
364 | for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; | |
365 | ||
366 | } | |
367 | ||
06351446 | 368 | //_____________________________________________________________________________ |
aec0ec32 | 369 | void AliRsnPairParticle::PrintInfo(const Option_t *option) |
06351446 | 370 | { |
371 | // | |
aec0ec32 | 372 | // Print some info of the pair. |
e2bafbbc | 373 | // The options are passed to the AliRsnDaughter::Print() method |
06351446 | 374 | // |
5eb970a4 | 375 | option = "ALL"; |
aec0ec32 | 376 | AliInfo("======== BEGIN PAIR INFO ==========="); |
377 | AliInfo("Track #1"); | |
378 | fDaughter[0]->Print(option); | |
379 | AliInfo("Track #2"); | |
380 | fDaughter[1]->Print(option); | |
381 | AliInfo("========= END PAIR INFO ==========="); | |
06351446 | 382 | } |