]>
Commit | Line | Data |
---|---|---|
78d7c6d3 | 1 | #ifndef AliAODPair_H |
2 | #define AliAODPair_H | |
3 | //_________________________________________________________________________ | |
4 | /////////////////////////////////////////////////////////////////////////// | |
5 | // | |
6 | // class AliAODPair | |
7 | // | |
8 | // class implements pair of particles and taking care of caluclation (almost) | |
9 | // all of pair properties (Qinv, InvMass,...) | |
10 | // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html | |
11 | // | |
12 | //////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #include <TObject.h> | |
15 | #include "AliVAODParticle.h" | |
16 | ||
17 | ||
18 | class AliAODPair: public TObject | |
19 | { | |
20 | public: | |
21 | AliAODPair(Bool_t rev = kFALSE); //contructor | |
22 | AliAODPair(AliVAODParticle* part1, AliVAODParticle* part2, Bool_t rev = kFALSE); //contructor | |
23 | AliAODPair(const AliAODPair& in); | |
24 | ||
25 | virtual ~AliAODPair(){} | |
26 | ||
27 | AliAODPair& operator=(const AliAODPair& in); | |
28 | ||
29 | void SetParticles(AliVAODParticle* p1,AliVAODParticle* p2); //sets particles in the pair | |
30 | AliAODPair* GetSwappedPair() {return fSwappedPair;} //returns pair with swapped particles | |
31 | ||
32 | AliVAODParticle* Particle1() const {return fPart1;} //returns pointer to first particle | |
33 | AliVAODParticle* Particle2() const {return fPart2;} //returns pointer to decond particle | |
34 | ||
35 | virtual void Changed(); | |
36 | //Center Mass System - Longitudinally Comoving | |
37 | ||
38 | virtual Double_t GetInvMass(); //returns invariant mass of the pair | |
39 | virtual Double_t GetMt(); | |
40 | virtual Double_t GetQInv(); //returns Q invariant | |
41 | virtual Double_t GetQSideLCMS(); //returns Q Side CMS longitudionally co-moving | |
42 | virtual Double_t GetQOutLCMS(); //returns Q out CMS longitudionally co-moving | |
43 | virtual Double_t GetQLongLCMS(); //returns Q Long CMS longitudionally co-moving | |
f422a7da | 44 | virtual Double_t GetQtLCMS(); //returns Q transverse CMS longitudionally co-moving |
45 | ||
fb629e2d | 46 | virtual Double_t GetQt(); //returns Q transverse to Kt |
78d7c6d3 | 47 | |
48 | ||
49 | virtual Double_t GetKt(); //returns K transverse | |
50 | virtual Double_t GetKStar(); | |
a40c0433 | 51 | virtual Double_t GetKStarOut(); //z.ch. |
52 | virtual Double_t GetKStarSide(); //z.ch. | |
53 | virtual Double_t GetKStarLong(); //z.ch. | |
78d7c6d3 | 54 | |
a40c0433 | 55 | |
78d7c6d3 | 56 | virtual Double_t GetAvarageDistance();//returns avarage distnace between two tracks |
57 | ||
b327f095 | 58 | virtual Double_t GetDeltaE(); //return difference of Energies |
59 | virtual Double_t GetDeltaP(); //return difference of momenta (scalar difference) | |
60 | virtual Double_t GetDeltaPvector(); //return legth of difference vector of momenta | |
78d7c6d3 | 61 | virtual Double_t GetDeltaPt(); |
62 | virtual Double_t GetDeltaPx(); | |
63 | virtual Double_t GetDeltaPy(); | |
64 | virtual Double_t GetDeltaPz(); | |
65 | ||
66 | virtual Double_t GetDeltaTheta(); | |
67 | virtual Double_t GetDeltaPhi(); | |
68 | ||
69 | virtual Double_t GetGammaToLCMS(); | |
fe3f2f54 | 70 | virtual Double_t GetGammaToTransverse(); |
78d7c6d3 | 71 | virtual Double_t GetPIDProb() const {return fPart1->GetPidProb()*fPart2->GetPidProb();} |
72 | ||
8ea30edc | 73 | virtual Double_t GetRStar() ; |
74 | virtual Double_t GetR() ;//returns distance between particle production points | |
75 | ||
af2872da | 76 | void MirrorSecond(); |
77 | void DeleteSecond(); | |
fe3f2f54 | 78 | |
79 | void Print(Option_t* /*option*/ = "" ) ; | |
80 | ||
78d7c6d3 | 81 | protected: |
82 | AliVAODParticle* fPart1; //pointer to first particle | |
83 | AliVAODParticle* fPart2; //pointer to second particle | |
84 | ||
85 | AliAODPair* fSwappedPair; //pointer to swapped pair | |
86 | ||
87 | /************************************************************/ | |
88 | /************CMS (LC) Q's *********************************/ | |
89 | /************************************************************/ | |
90 | //Center Mass System - Longitudinally Comoving | |
91 | ||
92 | Double_t fQSideLCMS; //value of Q side CMS longitudially co-moving | |
93 | Bool_t fQSideLCMSNotCalc; //flag indicating if fQSideLCMS is already calculated for this pair | |
94 | ||
95 | Double_t fQOutLCMS; //value of Q out CMS longitudially co-moving | |
96 | Bool_t fQOutLCMSNotCalc;//flag indicating if fQOutLCMS is already calculated for this pair | |
97 | ||
98 | Double_t fQLongLCMS; //value of Q long CMS longitudially co-moving | |
99 | Bool_t fQLongLCMSNotCalc;//flag indicating if fQLongLCMS is already calculated for this pair | |
f422a7da | 100 | |
fb629e2d | 101 | Double_t fQtLCMS; //value of Qt CMS longitudially co-moving (hypot(qsidelcms,qoutlcms)) |
f422a7da | 102 | Bool_t fQtLCMSNotCalc;//flag indicating if fQLongLCMS is already calculated for this pair |
fb629e2d | 103 | |
104 | Double_t fQt; //value of Qt, projection of 3-mom diff to Kt | |
105 | Bool_t fQtNotCalc;//flag indicating if fQt is already calculated for this pair | |
106 | ||
78d7c6d3 | 107 | /************************************************************/ |
108 | /************************************************************/ | |
109 | Double_t fQInv; //half of differnece of 4-momenta | |
110 | Bool_t fQInvNotCalc;//flag indicating if fQInv is already calculated for this pair | |
111 | ||
112 | Double_t fInvMass; //invariant mass | |
113 | Bool_t fInvMassNotCalc;//flag indicating if fInvMass is already calculated for this pair | |
114 | ||
115 | Double_t fKt; //K == sum vector of particle's momenta. Kt transverse component | |
116 | Bool_t fKtNotCalc;//flag indicating if fKt is already calculated for this pair | |
117 | ||
118 | Double_t fKStar; // KStar | |
119 | Bool_t fKStarNotCalc;// flag indicating if fKStar is calculated | |
a40c0433 | 120 | Double_t fKStarOut; // KStarOut z.ch. |
121 | Double_t fKStarSide;// KStarSide z.ch. | |
122 | Double_t fKStarLong;// KStarLong z.ch. | |
123 | ||
124 | Bool_t fKStarCompNotCalc; // flag indicating if CalcuteKStarComp() is calculated z.ch. | |
125 | ||
78d7c6d3 | 126 | Double_t fPInv; //invariant momentum |
127 | ||
128 | Double_t fQSide; //Q Side | |
129 | Double_t fOut;//Q Out | |
130 | Double_t fQLong;//Q Long | |
131 | ||
132 | Double_t fMt;//Transverse coordinate of Inv. Mass | |
133 | Bool_t fMtNotCalc;//flag indicating if Mt is calculated for current pair | |
134 | ||
135 | Double_t fInvMassSqr;//squre of invariant mass | |
136 | Bool_t fMassSqrNotCalc; //flag indicating if fInvMassSqr for this pair | |
137 | void CalculateInvMassSqr(); | |
138 | ||
139 | Double_t fQInvL; //Qinv in longitudional direction | |
140 | Bool_t fQInvLNotCalc;//flag indicating if fQInvL is calculated for current pair | |
141 | void CalculateQInvL(); | |
142 | ||
143 | Double_t fAvarageDistance;//value of the avarage distance calculated out of track points | |
144 | Bool_t fAvarageDistanceNotCalc;//flag indicating if the avarage distance is calculated | |
145 | ||
146 | Double_t fPxSum;// Sum of Px momenta | |
147 | Double_t fPySum;// Sum of Py momenta | |
148 | Double_t fPzSum;// Sum of Pz momenta | |
149 | Double_t fESum;// Sum of energies | |
150 | Bool_t fSumsNotCalc;//flag indicating if fPxSum,fPxSum,fPxSum and fESum is calculated for current pair | |
151 | void CalculateSums(); | |
a40c0433 | 152 | void CalculateKStarComp(); |
78d7c6d3 | 153 | |
154 | Double_t fPxDiff;// Difference of Px momenta | |
155 | Double_t fPyDiff;// Difference of Px momenta | |
156 | Double_t fPzDiff;// Difference of Px momenta | |
157 | Double_t fEDiff;// Difference of Px momenta | |
158 | Bool_t fDiffsNotCalc;//flag indicating if fPxDiff,fPxDiff,fPxDiff and fEDiff is calculated for current pair | |
159 | void CalculateDiffs(); | |
160 | ||
161 | Double_t fGammaLCMS;//gamma of boost in LCMS | |
162 | Bool_t fGammaLCMSNotCalc;//flag indicating if fGammaLCMS is calculated for current pair | |
163 | /***************************************************/ | |
164 | Bool_t fChanged;//flag indicating if object has been changed | |
165 | ||
166 | void CalculateBase(); | |
167 | Double_t AvDistance(); | |
168 | ||
169 | ||
170 | private: | |
171 | ClassDef(AliAODPair,1) | |
172 | }; | |
173 | /****************************************************************/ | |
174 | inline | |
175 | void AliAODPair::SetParticles(AliVAODParticle* p1,AliVAODParticle* p2) | |
176 | { | |
177 | //sets the particle to the pair | |
178 | ||
af2872da | 179 | fPart1 = p1; |
78d7c6d3 | 180 | fPart2 = p2; |
181 | if (fSwappedPair) //if we have Swapped (so we are not) | |
af2872da | 182 | fSwappedPair->SetParticles(fPart2,p1); //set particles for him too |
78d7c6d3 | 183 | Changed(); |
184 | //and do nothing until will be asked for | |
185 | } | |
186 | /****************************************************************/ | |
187 | ||
188 | inline | |
189 | void AliAODPair::Changed() | |
190 | { | |
191 | // Resel all calculations (flags) | |
192 | fChanged = kTRUE; | |
193 | fSumsNotCalc = kTRUE; | |
194 | fDiffsNotCalc = kTRUE; | |
195 | fMassSqrNotCalc = kTRUE; | |
196 | fInvMassNotCalc = kTRUE; | |
197 | fQInvNotCalc = kTRUE; | |
198 | fMtNotCalc = kTRUE; | |
199 | fQSideLCMSNotCalc = kTRUE; | |
200 | fQOutLCMSNotCalc = kTRUE; | |
201 | fQLongLCMSNotCalc = kTRUE; | |
fb629e2d | 202 | fQtLCMSNotCalc = kTRUE; |
203 | fQtNotCalc = kTRUE; | |
78d7c6d3 | 204 | fKtNotCalc = kTRUE; |
205 | fKStarNotCalc = kTRUE; | |
a40c0433 | 206 | fKStarCompNotCalc = kTRUE; |
78d7c6d3 | 207 | fQInvLNotCalc = kTRUE; |
208 | fGammaLCMSNotCalc = kTRUE; | |
209 | fAvarageDistanceNotCalc = kTRUE; | |
210 | } | |
211 | /****************************************************************/ | |
212 | inline | |
213 | void AliAODPair::CalculateInvMassSqr() | |
214 | { | |
215 | //calculates square of qinv | |
216 | if (fMassSqrNotCalc) | |
217 | { | |
218 | CalculateSums(); | |
219 | ||
220 | Double_t fPart12s= (fPxSum*fPxSum) + (fPySum*fPySum) + (fPzSum*fPzSum); | |
221 | ||
222 | fInvMassSqr=fESum*fESum-fPart12s; | |
223 | ||
224 | fMassSqrNotCalc = kFALSE; | |
225 | } | |
226 | } | |
227 | /****************************************************************/ | |
228 | inline | |
229 | void AliAODPair::CalculateQInvL() | |
230 | { | |
231 | //Calculates square root of Qinv | |
232 | if (fQInvLNotCalc) | |
233 | { | |
234 | CalculateDiffs(); | |
235 | fQInvL = fEDiff*fEDiff - ( fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff ); | |
236 | fQInvLNotCalc = kFALSE; | |
237 | } | |
238 | } | |
239 | /****************************************************************/ | |
240 | inline | |
241 | void AliAODPair::CalculateSums() | |
242 | { | |
243 | //calculates momenta and energy sums | |
244 | if(fSumsNotCalc) | |
245 | { | |
246 | fPxSum = fPart1->Px()+fPart2->Px(); | |
247 | fPySum = fPart1->Py()+fPart2->Py(); | |
248 | fPzSum = fPart1->Pz()+fPart2->Pz(); | |
249 | fESum = fPart1->E() + fPart2->E(); | |
250 | fSumsNotCalc = kFALSE; | |
251 | } | |
252 | } | |
a40c0433 | 253 | /****************************************************************/ |
254 | inline | |
255 | void AliAODPair::CalculateKStarComp() | |
256 | { | |
257 | ||
258 | if (fKStarCompNotCalc) | |
259 | { | |
260 | CalculateSums(); | |
261 | ||
262 | Double_t ptrans = fPxSum*fPxSum + fPySum*fPySum; | |
263 | Double_t mtrans = fESum*fESum - fPzSum*fPzSum; | |
264 | Double_t pinv = TMath::Sqrt(mtrans - ptrans); | |
265 | ptrans = TMath::Sqrt(ptrans); | |
266 | mtrans = TMath::Sqrt(mtrans); | |
267 | ||
268 | Double_t px1 = fPart1->Px(); | |
269 | Double_t py1 = fPart1->Py(); | |
270 | Double_t pz1 = fPart1->Pz(); | |
271 | Double_t pE1 = fPart1->E(); | |
272 | ||
273 | // boost to LCMS | |
274 | Double_t beta = fPzSum / fESum; | |
275 | Double_t gamma = fESum / mtrans; | |
276 | ||
277 | fKStarLong = gamma * (pz1 - beta * pE1); | |
278 | double temp = gamma * (pE1 - beta * pz1); | |
279 | ||
280 | // rotate in transverse plane | |
281 | fKStarSide = (-px1*fPySum + py1*fPxSum)/ptrans; | |
282 | fKStarOut = ( px1*fPxSum + py1*fPySum)/ptrans; | |
283 | ||
284 | // go from LCMS to CMS | |
285 | gamma = mtrans/pinv; | |
286 | beta = ptrans/mtrans; | |
287 | fKStarOut = gamma * (fKStarOut - beta * temp); | |
288 | ||
289 | fKStarCompNotCalc = kFALSE; | |
290 | } | |
291 | } | |
292 | ||
78d7c6d3 | 293 | /****************************************************************/ |
294 | inline | |
295 | void AliAODPair::CalculateDiffs() | |
296 | { | |
297 | //calculates momenta and energy differences | |
298 | if(fDiffsNotCalc) | |
299 | { | |
300 | fPxDiff = fPart1->Px()-fPart2->Px(); | |
301 | fPyDiff = fPart1->Py()-fPart2->Py(); | |
302 | fPzDiff = fPart1->Pz()-fPart2->Pz(); | |
303 | fEDiff = fPart1->E() - fPart2->E(); | |
304 | fDiffsNotCalc = kFALSE; | |
305 | } | |
306 | } | |
307 | ||
308 | /****************************************************************/ | |
b327f095 | 309 | |
310 | inline | |
311 | Double_t AliAODPair::GetDeltaE() | |
312 | { | |
313 | //returns difference of energies | |
314 | return fPart1->E() - fPart2->E(); | |
315 | } | |
316 | /****************************************************************/ | |
317 | ||
318 | inline | |
319 | Double_t AliAODPair::GetDeltaP() | |
320 | { | |
321 | //returns difference of momenta (scalars) | |
322 | return fPart1->P() - fPart2->P(); | |
323 | } | |
324 | /****************************************************************/ | |
325 | ||
78d7c6d3 | 326 | inline |
b327f095 | 327 | Double_t AliAODPair::GetDeltaPvector() //return difference of momenta |
78d7c6d3 | 328 | { |
b327f095 | 329 | //returns legth of the momenta difference vector |
78d7c6d3 | 330 | CalculateDiffs(); |
331 | return TMath::Sqrt(fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff); | |
332 | } | |
333 | /****************************************************************/ | |
334 | ||
335 | inline | |
336 | Double_t AliAODPair::GetDeltaPt() | |
337 | { | |
338 | //returns difference of Pz | |
339 | return fPart1->Pt()-fPart2->Pt(); | |
340 | } | |
341 | /****************************************************************/ | |
342 | ||
343 | inline | |
344 | Double_t AliAODPair::GetDeltaPx() | |
345 | { | |
346 | //returns difference of Pz | |
347 | CalculateDiffs(); | |
348 | return fPxDiff; | |
349 | } | |
350 | /****************************************************************/ | |
351 | inline | |
352 | Double_t AliAODPair::GetDeltaPy() | |
353 | { | |
354 | //returns difference of Py | |
355 | CalculateDiffs(); | |
356 | return fPyDiff; | |
357 | } | |
358 | ||
359 | /****************************************************************/ | |
360 | inline | |
361 | Double_t AliAODPair::GetDeltaPz() | |
362 | { | |
363 | //returns difference of Pz | |
364 | CalculateDiffs(); | |
365 | return fPzDiff; | |
366 | } | |
367 | /****************************************************************/ | |
368 | ||
369 | inline | |
370 | Double_t AliAODPair::GetDeltaPhi() | |
371 | { | |
372 | //returns difference of Phi | |
373 | Double_t phi1 = fPart1->Phi(); | |
374 | Double_t phi2 = fPart2->Phi(); | |
375 | Double_t diff = phi1-phi2; | |
376 | if (TMath::Abs(diff) > TMath::Pi()) | |
377 | { | |
378 | if (phi1 > TMath::Pi()) | |
379 | { | |
380 | phi1-=TMath::TwoPi(); | |
381 | } | |
382 | else | |
383 | { | |
384 | phi2-=TMath::TwoPi(); | |
385 | } | |
386 | diff = phi1-phi2; | |
387 | } | |
388 | return diff; | |
389 | } | |
390 | /****************************************************************/ | |
391 | ||
392 | inline | |
393 | Double_t AliAODPair::GetDeltaTheta() | |
394 | { | |
395 | //returns difference of Theta | |
396 | return fPart1->Theta()-fPart2->Theta(); | |
397 | } | |
398 | /****************************************************************/ | |
399 | ||
400 | ||
401 | #endif |