]>
Commit | Line | Data |
---|---|---|
06351446 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // | |
17 | // Class AliRsnPairParticle | |
18 | // | |
19 | // Implementation of a pair of tracks, for several purposes | |
20 | // - computing the total 4-momentum & inv. mass for output histos filling | |
21 | // - evaluating cut checks on the pair of particles | |
22 | // | |
23 | // author: Martin Vala (martin.vala@cern.ch) | |
24 | // revised by: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
25 | // | |
26 | ||
27 | #include "AliLog.h" | |
28 | ||
29 | #include "AliRsnPairParticle.h" | |
30 | ||
31 | ClassImp (AliRsnPairParticle) | |
32 | ||
33 | //_____________________________________________________________________________ | |
e2bafbbc | 34 | AliRsnPairParticle::AliRsnPairParticle() |
06351446 | 35 | { |
36 | // | |
37 | // Constructor. | |
38 | // Initializes all variables to meaningless values. | |
39 | // | |
e2bafbbc | 40 | |
06351446 | 41 | Int_t i, j; |
e2bafbbc | 42 | |
06351446 | 43 | for (i = 0; i < 3; i++) { |
44 | fPTot[i] = 0.0; | |
45 | fPTotMC[i] = 0.0; | |
46 | if (i < 2) { | |
47 | fMotherLabel[i] = -1; | |
48 | fMotherPDG[i] = 0; | |
49 | fDaughter[i] = 0x0; | |
50 | } | |
51 | for (j = 0; j < 2; j++) { | |
52 | fPTrack[j][i] = 0.0; | |
53 | fPTrackMC[j][i] = 0.0; | |
54 | } | |
55 | } | |
56 | } | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliRsnPairParticle::AliRsnPairParticle(const AliRsnPairParticle &obj) : | |
e2bafbbc | 60 | TObject(obj) |
06351446 | 61 | { |
62 | // | |
63 | // Copy constructor. | |
64 | // Initializes all variables to copy values. | |
65 | // Does not duplicate pointers. | |
66 | // | |
e2bafbbc | 67 | |
06351446 | 68 | Int_t i, j; |
69 | for (i = 0; i < 3; i++) { | |
70 | fPTot[i] = obj.fPTot[i]; | |
71 | fPTotMC[i] = obj.fPTotMC[i]; | |
72 | if (i < 2) { | |
73 | fMotherLabel[i] = obj.fMotherLabel[i]; | |
74 | fMotherPDG[i] = obj.fMotherPDG[i]; | |
75 | fDaughter[i] = obj.fDaughter[i]; | |
76 | } | |
77 | for (j = 0; j < 2; j++) { | |
78 | fPTrack[j][i] = obj.fPTrack[j][i]; | |
79 | fPTrackMC[j][i] = obj.fPTrackMC[j][i]; | |
80 | } | |
81 | } | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | AliRsnPairParticle& AliRsnPairParticle::operator=(const AliRsnPairParticle &obj) | |
86 | { | |
87 | // | |
88 | // Assignment operator. | |
89 | // Initializes all variables to copy values. | |
90 | // Does not duplicate pointers. | |
91 | // | |
92 | ||
06351446 | 93 | Int_t i, j; |
94 | for (i = 0; i < 3; i++) { | |
95 | fPTot[i] = obj.fPTot[i]; | |
96 | fPTotMC[i] = obj.fPTotMC[i]; | |
97 | if (i < 2) { | |
98 | fMotherLabel[i] = obj.fMotherLabel[i]; | |
99 | fMotherPDG[i] = obj.fMotherPDG[i]; | |
100 | fDaughter[i] = obj.fDaughter[i]; | |
101 | } | |
102 | for (j = 0; j < 2; j++) { | |
103 | fPTrack[j][i] = obj.fPTrack[j][i]; | |
104 | fPTrackMC[j][i] = obj.fPTrackMC[j][i]; | |
105 | } | |
106 | } | |
107 | ||
108 | return (*this); | |
109 | } | |
110 | ||
111 | //_____________________________________________________________________________ | |
112 | AliRsnPairParticle::~AliRsnPairParticle() | |
113 | { | |
114 | // | |
115 | // Desctructor. | |
116 | // Does nothing. | |
117 | // | |
118 | } | |
119 | ||
120 | //_____________________________________________________________________________ | |
e2bafbbc | 121 | Double_t AliRsnPairParticle::GetInvMass(Double_t mass0, Double_t mass1) |
06351446 | 122 | { |
123 | // | |
e2bafbbc | 124 | // Compute invariant mass using reconstructed values. |
125 | // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), | |
126 | // mass in argument #2 is assigned to second track in the pair (fDaughter[1]) | |
127 | // Then, the invariant mass of the pair is computed by using their total momentum | |
128 | // and the sum of their energies as they result from assigned masses. | |
06351446 | 129 | // |
06351446 | 130 | |
e2bafbbc | 131 | if (!fDaughter[0] || !fDaughter[1]) { |
132 | AliError("One of the two tracks is NULL in this pair!"); | |
133 | return -1000.0; | |
134 | } | |
06351446 | 135 | |
e2bafbbc | 136 | // compute track energies using the shortcut method defined in AliRsnDaughter |
06351446 | 137 | Double_t etot = 0.0; |
e2bafbbc | 138 | etot += fDaughter[0]->E(mass0); |
139 | etot += fDaughter[1]->E(mass1); | |
06351446 | 140 | |
e2bafbbc | 141 | // compute & return invariant mass |
142 | return TMath::Sqrt (etot * etot - GetP2()); | |
06351446 | 143 | } |
144 | ||
145 | //_____________________________________________________________________________ | |
e2bafbbc | 146 | Double_t AliRsnPairParticle::GetInvMassMC(Double_t mass0, Double_t mass1) |
06351446 | 147 | { |
148 | // | |
e2bafbbc | 149 | // Compute invariant mass using MC values. |
150 | // Mass in argument #1 is assigned to first track in the pair (fDaughter[0]), | |
151 | // mass in argument #2 is assigned to second track in the pair (fDaughter[1]) | |
152 | // Then, the invariant mass of the pair is computed by using their total momentum | |
153 | // and the sum of their energies as they result from assigned masses. | |
06351446 | 154 | // |
155 | ||
e2bafbbc | 156 | if (!fDaughter[0] || !fDaughter[1]) { |
157 | AliError("One of the two tracks is NULL in this pair!"); | |
158 | return -1000.0; | |
06351446 | 159 | } |
e2bafbbc | 160 | if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) { |
161 | AliError("One of the two tracks has a NULL MCInfo in this pair!"); | |
162 | return -1000.0; | |
06351446 | 163 | } |
164 | ||
e2bafbbc | 165 | // compute track energies using the shortcut method defined in AliRsnDaughter |
166 | Double_t etot = 0.0; | |
167 | etot += fDaughter[0]->GetMCInfo()->E(mass0); | |
168 | etot += fDaughter[1]->GetMCInfo()->E(mass1); | |
169 | ||
170 | // compute & return invariant mass | |
171 | return TMath::Sqrt (etot * etot - GetP2()); | |
06351446 | 172 | } |
173 | ||
174 | //_____________________________________________________________________________ | |
e2bafbbc | 175 | Double_t AliRsnPairParticle::GetAngle() const |
06351446 | 176 | { |
177 | // | |
e2bafbbc | 178 | // Returns the relative angle between the vector momenta of the tracks |
179 | // Return value is in DEGREES. | |
06351446 | 180 | // |
181 | ||
e2bafbbc | 182 | Double_t dotProd = 0.0; |
183 | dotProd += fDaughter[0]->Px() * fDaughter[1]->Px(); | |
184 | dotProd += fDaughter[0]->Py() * fDaughter[1]->Pz(); | |
185 | dotProd += fDaughter[0]->Pz() * fDaughter[1]->Pz(); | |
186 | ||
187 | Double_t cosAngle = dotProd / (fDaughter[0]->P() * fDaughter[1]->P()); | |
188 | ||
189 | return TMath::ACos(cosAngle) * TMath::RadToDeg(); | |
06351446 | 190 | } |
191 | ||
192 | //_____________________________________________________________________________ | |
193 | Bool_t AliRsnPairParticle::IsTruePair(Int_t refPDG) | |
194 | { | |
195 | // | |
e2bafbbc | 196 | // Checks if the two tracks in the pair come from the same resonance. |
06351446 | 197 | // This can be known if MC info is present, looking at the GEANT label of mother |
198 | // (which should be the same). | |
199 | // If the argument is 0, the answer is kTRUE whenever the labels of mothers of the | |
200 | // two tracks is the same. When the argument is not zero, the answer is kTRUE only | |
201 | // if the mother is the same and its PDG code is equal to the argument. | |
e2bafbbc | 202 | // |
06351446 | 203 | |
204 | // if MC info is not available, the pairs is not true by default | |
205 | if (!fDaughter[0]->GetMCInfo() || !fDaughter[1]->GetMCInfo()) { | |
206 | return kFALSE; | |
207 | } | |
208 | ||
209 | // check that labels are the same | |
210 | if (fDaughter[0]->GetMCInfo()->Mother() != fDaughter[1]->GetMCInfo()->Mother()) { | |
211 | return kFALSE; | |
212 | } | |
213 | ||
214 | // if we reach this point, the two tracks have the same mother | |
215 | // let's check now the PDG code of this common mother | |
216 | Int_t motherPDG = TMath::Abs(fDaughter[0]->GetMCInfo()->MotherPDG()); | |
217 | if (refPDG == 0) return kTRUE; | |
218 | else return (motherPDG == refPDG); | |
219 | } | |
220 | ||
221 | //_____________________________________________________________________________ | |
222 | void AliRsnPairParticle::SetPair(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2) | |
223 | { | |
224 | // | |
06351446 | 225 | // Accepts two AliRsnDaughter's which are the two tracks in the pair, |
226 | // fills all data-members which contain their momenta & info, | |
227 | // and computes the total momentum for REC data and MC if available | |
228 | // | |
229 | ||
230 | Int_t i; | |
231 | ||
232 | fDaughter[0] = daughter1; | |
233 | fDaughter[1] = daughter2; | |
234 | ||
235 | // copy MC info (if available) | |
236 | if (fDaughter[0]->GetMCInfo() && fDaughter[1]->GetMCInfo()) { | |
237 | for (i = 0; i < 2; i++) { | |
238 | fPTrackMC[i][0] = fDaughter[i]->GetMCInfo()->Px(); | |
239 | fPTrackMC[i][1] = fDaughter[i]->GetMCInfo()->Py(); | |
240 | fPTrackMC[i][2] = fDaughter[i]->GetMCInfo()->Pz(); | |
241 | fMotherPDG[i] = fDaughter[i]->GetMCInfo()->MotherPDG(); | |
242 | } | |
243 | for (i = 0; i < 3; i++) fPTotMC[i] = fPTrackMC[0][i] + fPTrackMC[1][i]; | |
244 | } | |
245 | ||
246 | // copy reconstructed info (always available) | |
247 | for (i = 0; i < 2; i++) { | |
248 | fPTrack[i][0] = fDaughter[i]->Px(); | |
249 | fPTrack[i][1] = fDaughter[i]->Py(); | |
250 | fPTrack[i][2] = fDaughter[i]->Pz(); | |
251 | } | |
252 | for (i = 0; i < 3; i++) fPTot[i] = fPTrack[0][i] + fPTrack[1][i]; | |
253 | } | |
254 | ||
255 | //_____________________________________________________________________________ | |
256 | void AliRsnPairParticle::PrintInfo (const Option_t *option) | |
257 | { | |
258 | // | |
e2bafbbc | 259 | // Print some info of the pair. |
260 | // The options are passed to the AliRsnDaughter::Print() method | |
06351446 | 261 | // |
262 | ||
e2bafbbc | 263 | AliInfo("======== BEGIN PAIR INFO ==========="); |
264 | AliInfo("Track #1"); | |
265 | fDaughter[0]->Print(option); | |
266 | AliInfo("Track #2"); | |
267 | fDaughter[1]->Print(option); | |
268 | AliInfo ("========= END PAIR INFO ==========="); | |
06351446 | 269 | } |