]>
Commit | Line | Data |
---|---|---|
2fbc0b17 | 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 | //////////////////////////////////////////////// | |
18 | // Class to handle pairs of tracks | |
19 | // Useful for resonance analysis | |
20 | // Derives from AliVParticle => | |
21 | // usable in Correction Framework | |
22 | //////////////////////////////////////////////// | |
23 | // author : renaud.vernet@cern.ch | |
24 | //////////////////////////////////////////////// | |
25 | ||
26 | #include "AliCFPair.h" | |
27 | #include "AliESDtrack.h" | |
28 | #include "AliESDv0.h" | |
29 | #include "AliESDEvent.h" | |
30 | #include "TMath.h" | |
31 | ||
32 | ClassImp(AliCFPair) | |
33 | ||
34 | AliCFPair::AliCFPair(AliESDtrack*t1, AliESDtrack*t2) : | |
35 | AliVParticle(), | |
36 | fIsV0(0), | |
37 | fTrackNeg(t1), | |
38 | fTrackPos(t2), | |
39 | fV0(0x0) | |
40 | { | |
41 | // | |
42 | // 2-track ctor | |
43 | // | |
44 | } | |
45 | AliCFPair::AliCFPair(AliESDv0* v0, AliESDEvent* esd) : | |
46 | AliVParticle(), | |
47 | fIsV0(1), | |
48 | fTrackNeg(esd->GetTrack(v0->GetNindex())), | |
49 | fTrackPos(esd->GetTrack(v0->GetPindex())), | |
50 | fV0(v0) | |
51 | { | |
52 | // | |
53 | // V0 ctor | |
54 | // | |
55 | } | |
56 | AliCFPair::AliCFPair(const AliCFPair& c) : | |
57 | AliVParticle(c), | |
58 | fIsV0(c.fIsV0), | |
59 | fTrackNeg(c.fTrackNeg), | |
60 | fTrackPos(c.fTrackPos), | |
61 | fV0(c.fV0) | |
62 | { | |
63 | // | |
64 | // Copy constructor. | |
65 | // | |
66 | } | |
67 | AliCFPair& AliCFPair::operator=(const AliCFPair& c) { | |
68 | // | |
69 | // assignment operator. | |
70 | // | |
71 | ||
72 | if (this!=&c) { | |
73 | AliVParticle::operator=(c); | |
74 | fIsV0 = c.fIsV0; | |
75 | fTrackNeg = c.fTrackNeg ; | |
76 | fTrackPos = c.fTrackPos ; | |
77 | fV0 = c.fV0 ; | |
78 | } | |
79 | return *this; | |
80 | } | |
81 | Bool_t AliCFPair::PxPyPz(Double_t p[3]) const { | |
82 | // | |
83 | // sets pair total momentum in vector p | |
84 | // | |
85 | if (fIsV0) | |
86 | fV0->GetPxPyPz(p[0],p[1],p[2]); | |
87 | else { | |
88 | Double32_t p1[3], p2[3]; | |
89 | fTrackNeg->PxPyPz(p1); | |
90 | fTrackPos->PxPyPz(p2); | |
91 | p[0]=p1[0]+p2[0]; | |
92 | p[1]=p1[1]+p2[1]; | |
93 | p[2]=p1[2]+p2[2]; | |
94 | } | |
95 | return kTRUE; | |
96 | } | |
97 | ||
98 | Double32_t AliCFPair::P() const { | |
99 | // | |
100 | // returns pair total momentum norm | |
101 | // | |
102 | Double32_t mom[3]; | |
103 | PxPyPz(mom); | |
104 | return TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]); | |
105 | } | |
106 | ||
107 | Double32_t AliCFPair::Px() const { | |
108 | // | |
109 | // returns pair X-projected momentum | |
110 | // | |
111 | Double32_t mom[3]; | |
112 | PxPyPz(mom); | |
113 | return mom[0]; | |
114 | } | |
115 | Double32_t AliCFPair::Py() const { | |
116 | // | |
117 | // returns pair Y-projected momentum | |
118 | // | |
119 | Double32_t mom[3]; | |
120 | PxPyPz(mom); | |
121 | return mom[1]; | |
122 | } | |
123 | Double32_t AliCFPair::Pz() const { | |
124 | // | |
125 | // returns pair Z-projected momentum | |
126 | // | |
127 | Double32_t mom[3]; | |
128 | PxPyPz(mom); | |
129 | return mom[2]; | |
130 | } | |
131 | Double32_t AliCFPair::Pt() const { | |
132 | // | |
133 | // returns pair transverse (XY) momentum | |
134 | // | |
135 | Double32_t mom[3]; | |
136 | PxPyPz(mom); | |
137 | return sqrt(mom[0]*mom[0]+mom[1]*mom[1]); | |
138 | } | |
139 | Double32_t AliCFPair::E() const { | |
140 | // | |
141 | // returns pair total energy according to ESD-calculated mass | |
142 | // | |
143 | Double32_t mom[3]; | |
144 | PxPyPz(mom); | |
145 | Double32_t mass=M() ; | |
146 | return TMath::Sqrt(mass*mass + mom[0]*mom[0]+ mom[1]*mom[1]+ mom[2]*mom[2]); | |
147 | } | |
148 | Bool_t AliCFPair::XvYvZv(Double_t x[3]) const { | |
149 | // | |
150 | // sets pair position to x | |
151 | // since this class is designed for resonances, the assumed pair position | |
152 | // should be the same for both tracks. neg track position is kept here | |
153 | // | |
154 | ||
155 | if (fIsV0) | |
156 | fV0->GetXYZ(x[0],x[1],x[2]); | |
157 | else { | |
158 | Double32_t x1[3]; | |
159 | fTrackNeg->PxPyPz(x1); | |
160 | x[0]=x1[0]; | |
161 | x[1]=x1[1]; | |
162 | x[2]=x1[2]; | |
163 | } | |
164 | return kTRUE; | |
165 | } | |
166 | Double32_t AliCFPair::Xv() const { | |
167 | // | |
168 | // returns pair X-projected position | |
169 | // | |
170 | Double32_t pos[3]; | |
171 | XvYvZv(pos); | |
172 | return pos[0]; | |
173 | } | |
174 | Double32_t AliCFPair::Yv() const { | |
175 | // | |
176 | // returns pair Y-projected position | |
177 | // | |
178 | Double32_t pos[3]; | |
179 | XvYvZv(pos); | |
180 | return pos[1]; | |
181 | } | |
182 | Double32_t AliCFPair::Zv() const { | |
183 | // | |
184 | // returns pair Z-projected position | |
185 | // | |
186 | Double32_t pos[3]; | |
187 | XvYvZv(pos); | |
188 | return pos[2]; | |
189 | } | |
190 | Double32_t AliCFPair::Phi() const { | |
191 | // | |
192 | // returns pair phi angle (in transverse plane) | |
193 | // | |
194 | return TMath::Pi()+TMath::ATan2(-Py(),-Px()); | |
195 | } | |
196 | Double32_t AliCFPair::Theta() const { | |
197 | // | |
198 | // returns pair theta angle (in YZ plane) | |
199 | // | |
200 | return (Pz()==0)?TMath::PiOver2():TMath::ACos(Pz()/P()); | |
201 | } | |
202 | Double32_t AliCFPair::Eta() const { | |
203 | // | |
204 | // returns pair pseudo-rapidity | |
205 | // | |
206 | Double32_t pmom = P(); | |
207 | Double32_t pz = Pz(); | |
208 | if (pmom != TMath::Abs(pz)) return 0.5*TMath::Log((pmom+pz)/(pmom-pz)); | |
209 | else return 999; | |
210 | } | |
211 | Double32_t AliCFPair::Y() const { | |
212 | // | |
213 | // returns pair rapidity | |
214 | // | |
215 | Double32_t e = E(); | |
216 | Double32_t pz = Pz(); | |
217 | ||
218 | if (e == pz || e == -pz) { | |
219 | printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result"); | |
220 | return 999; | |
221 | } | |
222 | if (e < pz) { | |
223 | printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result"); | |
224 | return 999; | |
225 | } | |
226 | Double32_t y = 0.5 * log((e + pz) / (e - pz)); | |
227 | return y; | |
228 | } | |
229 | Double32_t AliCFPair::M() const { | |
230 | // | |
231 | // returns pair invariant mass | |
232 | // in case of a V0, returns the current mass hypothesis | |
233 | // otherwise returns ESD-calculated mass | |
234 | // | |
235 | ||
236 | Double32_t minv ; | |
237 | ||
238 | if (fIsV0) minv = (Double32_t)fV0->GetEffMass(); | |
239 | else { | |
240 | Double32_t p = P() ; | |
241 | Double32_t e = fTrackNeg->E() + fTrackPos->E() ; | |
242 | minv = TMath::Sqrt(e*e-p*p); | |
243 | } | |
244 | return minv ; | |
245 | } |