Changes in material definitions
[u/mrichter/AliRoot.git] / ANALYSIS / AliAODPair.h
CommitLineData
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
18class 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();
51
52 virtual Double_t GetAvarageDistance();//returns avarage distnace between two tracks
53
b327f095 54 virtual Double_t GetDeltaE(); //return difference of Energies
55 virtual Double_t GetDeltaP(); //return difference of momenta (scalar difference)
56 virtual Double_t GetDeltaPvector(); //return legth of difference vector of momenta
78d7c6d3 57 virtual Double_t GetDeltaPt();
58 virtual Double_t GetDeltaPx();
59 virtual Double_t GetDeltaPy();
60 virtual Double_t GetDeltaPz();
61
62 virtual Double_t GetDeltaTheta();
63 virtual Double_t GetDeltaPhi();
64
65 virtual Double_t GetGammaToLCMS();
66 virtual Double_t GetPIDProb() const {return fPart1->GetPidProb()*fPart2->GetPidProb();}
67
68 protected:
69 AliVAODParticle* fPart1; //pointer to first particle
70 AliVAODParticle* fPart2; //pointer to second particle
71
72 AliAODPair* fSwappedPair; //pointer to swapped pair
73
74/************************************************************/
75/************CMS (LC) Q's *********************************/
76/************************************************************/
77 //Center Mass System - Longitudinally Comoving
78
79 Double_t fQSideLCMS; //value of Q side CMS longitudially co-moving
80 Bool_t fQSideLCMSNotCalc; //flag indicating if fQSideLCMS is already calculated for this pair
81
82 Double_t fQOutLCMS; //value of Q out CMS longitudially co-moving
83 Bool_t fQOutLCMSNotCalc;//flag indicating if fQOutLCMS is already calculated for this pair
84
85 Double_t fQLongLCMS; //value of Q long CMS longitudially co-moving
86 Bool_t fQLongLCMSNotCalc;//flag indicating if fQLongLCMS is already calculated for this pair
f422a7da 87
fb629e2d 88 Double_t fQtLCMS; //value of Qt CMS longitudially co-moving (hypot(qsidelcms,qoutlcms))
f422a7da 89 Bool_t fQtLCMSNotCalc;//flag indicating if fQLongLCMS is already calculated for this pair
fb629e2d 90
91 Double_t fQt; //value of Qt, projection of 3-mom diff to Kt
92 Bool_t fQtNotCalc;//flag indicating if fQt is already calculated for this pair
93
78d7c6d3 94/************************************************************/
95/************************************************************/
96 Double_t fQInv; //half of differnece of 4-momenta
97 Bool_t fQInvNotCalc;//flag indicating if fQInv is already calculated for this pair
98
99 Double_t fInvMass; //invariant mass
100 Bool_t fInvMassNotCalc;//flag indicating if fInvMass is already calculated for this pair
101
102 Double_t fKt; //K == sum vector of particle's momenta. Kt transverse component
103 Bool_t fKtNotCalc;//flag indicating if fKt is already calculated for this pair
104
105 Double_t fKStar; // KStar
106 Bool_t fKStarNotCalc;// flag indicating if fKStar is calculated
107
108 Double_t fPInv; //invariant momentum
109
110 Double_t fQSide; //Q Side
111 Double_t fOut;//Q Out
112 Double_t fQLong;//Q Long
113
114 Double_t fMt;//Transverse coordinate of Inv. Mass
115 Bool_t fMtNotCalc;//flag indicating if Mt is calculated for current pair
116
117 Double_t fInvMassSqr;//squre of invariant mass
118 Bool_t fMassSqrNotCalc; //flag indicating if fInvMassSqr for this pair
119 void CalculateInvMassSqr();
120
121 Double_t fQInvL; //Qinv in longitudional direction
122 Bool_t fQInvLNotCalc;//flag indicating if fQInvL is calculated for current pair
123 void CalculateQInvL();
124
125 Double_t fAvarageDistance;//value of the avarage distance calculated out of track points
126 Bool_t fAvarageDistanceNotCalc;//flag indicating if the avarage distance is calculated
127
128 Double_t fPxSum;// Sum of Px momenta
129 Double_t fPySum;// Sum of Py momenta
130 Double_t fPzSum;// Sum of Pz momenta
131 Double_t fESum;// Sum of energies
132 Bool_t fSumsNotCalc;//flag indicating if fPxSum,fPxSum,fPxSum and fESum is calculated for current pair
133 void CalculateSums();
134
135 Double_t fPxDiff;// Difference of Px momenta
136 Double_t fPyDiff;// Difference of Px momenta
137 Double_t fPzDiff;// Difference of Px momenta
138 Double_t fEDiff;// Difference of Px momenta
139 Bool_t fDiffsNotCalc;//flag indicating if fPxDiff,fPxDiff,fPxDiff and fEDiff is calculated for current pair
140 void CalculateDiffs();
141
142 Double_t fGammaLCMS;//gamma of boost in LCMS
143 Bool_t fGammaLCMSNotCalc;//flag indicating if fGammaLCMS is calculated for current pair
144 /***************************************************/
145 Bool_t fChanged;//flag indicating if object has been changed
146
147 void CalculateBase();
148 Double_t AvDistance();
149
150
151 private:
152 ClassDef(AliAODPair,1)
153};
154/****************************************************************/
155inline
156void AliAODPair::SetParticles(AliVAODParticle* p1,AliVAODParticle* p2)
157{
158 //sets the particle to the pair
159
160 fPart1 = p1;
161 fPart2 = p2;
162 if (fSwappedPair) //if we have Swapped (so we are not)
163 fSwappedPair->SetParticles(p2,p1); //set particles for him too
164 Changed();
165 //and do nothing until will be asked for
166}
167/****************************************************************/
168
169inline
170void AliAODPair::Changed()
171{
172 // Resel all calculations (flags)
173 fChanged = kTRUE;
174 fSumsNotCalc = kTRUE;
175 fDiffsNotCalc = kTRUE;
176 fMassSqrNotCalc = kTRUE;
177 fInvMassNotCalc = kTRUE;
178 fQInvNotCalc = kTRUE;
179 fMtNotCalc = kTRUE;
180 fQSideLCMSNotCalc = kTRUE;
181 fQOutLCMSNotCalc = kTRUE;
182 fQLongLCMSNotCalc = kTRUE;
fb629e2d 183 fQtLCMSNotCalc = kTRUE;
184 fQtNotCalc = kTRUE;
78d7c6d3 185 fKtNotCalc = kTRUE;
186 fKStarNotCalc = kTRUE;
187 fQInvLNotCalc = kTRUE;
188 fGammaLCMSNotCalc = kTRUE;
189 fAvarageDistanceNotCalc = kTRUE;
190}
191/****************************************************************/
192inline
193void AliAODPair::CalculateInvMassSqr()
194 {
195 //calculates square of qinv
196 if (fMassSqrNotCalc)
197 {
198 CalculateSums();
199
200 Double_t fPart12s= (fPxSum*fPxSum) + (fPySum*fPySum) + (fPzSum*fPzSum);
201
202 fInvMassSqr=fESum*fESum-fPart12s;
203
204 fMassSqrNotCalc = kFALSE;
205 }
206 }
207/****************************************************************/
208inline
209void AliAODPair::CalculateQInvL()
210 {
211 //Calculates square root of Qinv
212 if (fQInvLNotCalc)
213 {
214 CalculateDiffs();
215 fQInvL = fEDiff*fEDiff - ( fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff );
216 fQInvLNotCalc = kFALSE;
217 }
218 }
219/****************************************************************/
220inline
221void AliAODPair::CalculateSums()
222 {
223 //calculates momenta and energy sums
224 if(fSumsNotCalc)
225 {
226 fPxSum = fPart1->Px()+fPart2->Px();
227 fPySum = fPart1->Py()+fPart2->Py();
228 fPzSum = fPart1->Pz()+fPart2->Pz();
229 fESum = fPart1->E() + fPart2->E();
230 fSumsNotCalc = kFALSE;
231 }
232 }
233/****************************************************************/
234inline
235void AliAODPair::CalculateDiffs()
236 {
237 //calculates momenta and energy differences
238 if(fDiffsNotCalc)
239 {
240 fPxDiff = fPart1->Px()-fPart2->Px();
241 fPyDiff = fPart1->Py()-fPart2->Py();
242 fPzDiff = fPart1->Pz()-fPart2->Pz();
243 fEDiff = fPart1->E() - fPart2->E();
244 fDiffsNotCalc = kFALSE;
245 }
246 }
247
248/****************************************************************/
b327f095 249
250inline
251Double_t AliAODPair::GetDeltaE()
252{
253 //returns difference of energies
254 return fPart1->E() - fPart2->E();
255}
256/****************************************************************/
257
258inline
259Double_t AliAODPair::GetDeltaP()
260{
261 //returns difference of momenta (scalars)
262 return fPart1->P() - fPart2->P();
263}
264/****************************************************************/
265
78d7c6d3 266inline
b327f095 267Double_t AliAODPair::GetDeltaPvector() //return difference of momenta
78d7c6d3 268{
b327f095 269 //returns legth of the momenta difference vector
78d7c6d3 270 CalculateDiffs();
271 return TMath::Sqrt(fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff);
272}
273/****************************************************************/
274
275inline
276Double_t AliAODPair::GetDeltaPt()
277 {
278 //returns difference of Pz
279 return fPart1->Pt()-fPart2->Pt();
280 }
281/****************************************************************/
282
283inline
284Double_t AliAODPair::GetDeltaPx()
285 {
286 //returns difference of Pz
287 CalculateDiffs();
288 return fPxDiff;
289 }
290/****************************************************************/
291inline
292Double_t AliAODPair::GetDeltaPy()
293 {
294 //returns difference of Py
295 CalculateDiffs();
296 return fPyDiff;
297 }
298
299/****************************************************************/
300inline
301Double_t AliAODPair::GetDeltaPz()
302 {
303 //returns difference of Pz
304 CalculateDiffs();
305 return fPzDiff;
306 }
307/****************************************************************/
308
309inline
310Double_t AliAODPair::GetDeltaPhi()
311 {
312 //returns difference of Phi
313 Double_t phi1 = fPart1->Phi();
314 Double_t phi2 = fPart2->Phi();
315 Double_t diff = phi1-phi2;
316 if (TMath::Abs(diff) > TMath::Pi())
317 {
318 if (phi1 > TMath::Pi())
319 {
320 phi1-=TMath::TwoPi();
321 }
322 else
323 {
324 phi2-=TMath::TwoPi();
325 }
326 diff = phi1-phi2;
327 }
328 return diff;
329 }
330/****************************************************************/
331
332inline
333Double_t AliAODPair::GetDeltaTheta()
334 {
335 //returns difference of Theta
336 return fPart1->Theta()-fPart2->Theta();
337 }
338/****************************************************************/
339
340
341#endif