]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPair.h
TwoKStar Correl. Fctn. added
[u/mrichter/AliRoot.git] / HBTAN / AliHBTPair.h
1 #ifndef ALIHBTPAIR_H
2 #define ALIHBTPAIR_H
3
4 #include <TObject.h>
5
6
7 #include "AliHBTParticle.h"
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 class AliHBTPair: public TObject
13 {
14  public:
15    AliHBTPair(Bool_t rev = kFALSE); //contructor
16    ~AliHBTPair(){}
17    void SetParticles(AliHBTParticle*,AliHBTParticle*); //sets particles in the pair
18    AliHBTPair* GetSwapedPair() {return fSwapedPair;} //returns pair with swapped particles
19    
20    AliHBTParticle* Particle1() const {return fPart1;} //returns pointer to first particle
21    AliHBTParticle* Particle2() const {return fPart2;} //returns pointer to decond particle
22    
23    //Center Mass System - Longitudinally Comoving
24    
25    Double_t GetInvMass(); //returns invariant mass of the pair
26    
27
28    Double_t GetQInv(); //returns Q invariant
29    Double_t GetQSideCMSLC(); //returns Q Side CMS longitudionally co-moving
30    Double_t GetQOutCMSLC(); //returns Q out CMS longitudionally co-moving
31    Double_t GetQLongCMSLC(); //returns Q Long CMS longitudionally co-moving
32    
33    
34    Double_t GetKt();  //returns K transverse
35    Double_t GetKStar();
36    
37    Double_t GetDeltaP(); //return difference of momenta
38    Double_t GetDeltaPx();
39    Double_t GetDeltaPy();
40    Double_t GetDeltaPz();
41    
42  protected:
43    AliHBTParticle* fPart1;  //pointer to first particle
44    AliHBTParticle* fPart2;  //pointer to second particle
45   
46    AliHBTPair* fSwapedPair; //pointer to swapped pair
47    
48 /************************************************************/
49 /************CMS (LC) Q's   *********************************/
50 /************************************************************/
51    //Center Mass System - Longitudinally Comoving
52    
53    Double_t fQSideCMSLC;  //value of Q side CMS longitudially co-moving
54    Bool_t   fQSideCMSLCNotCalc; //flag indicating if fQSideCMSLC is already calculated for this pair
55    
56    Double_t fQOutCMSLC; //value of Q out CMS longitudially co-moving
57    Bool_t   fQOutCMSLCNotCalc;//flag indicating if fQOutCMSLC is already calculated for this pair
58    
59    Double_t fQLongCMSLC; //value of Q long CMS longitudially co-moving
60    Bool_t   fQLongCMSLCNotCalc;//flag indicating if fQLongCMSLC is already calculated for this pair
61 /************************************************************/
62 /************************************************************/
63    Double_t fQInv;  //half of differnece of 4-momenta
64    Bool_t   fQInvNotCalc;//flag indicating if fQInv is already calculated for this pair
65    
66    Double_t fInvMass;  //invariant mass
67    Bool_t   fInvMassNotCalc;//flag indicating if fInvMass is already calculated for this pair
68    
69    Double_t fKt; //K == sum vector of particle's momenta. Kt transverse component
70    Bool_t   fKtNotCalc;//flag indicating if fKt is already calculated for this pair
71    
72    Double_t fKStar; //
73    Bool_t   fKStarNotCalc;
74    
75    Double_t fPInv;  //invariant momentum
76    Double_t fQSide; //Q Side
77    Double_t fOut;//Q Out
78    Double_t fQLong;//Q Long
79
80    
81    Double_t fInvMassSqr;//squre of invariant mass
82    Bool_t   fMassSqrNotCalc; //
83    void     CalculateInvMassSqr();
84    
85    Double_t fQInvL;
86    Bool_t   fQInvLNotCalc;
87    void     CalculateQInvL();
88    
89    Double_t fPxSum;
90    Double_t fPySum;
91    Double_t fPzSum;
92    Double_t fESum;
93    Bool_t   fSumsNotCalc;
94    void     CalculateSums();
95    
96    Double_t fPxDiff;
97    Double_t fPyDiff;
98    Double_t fPzDiff;
99    Double_t fEDiff;
100    Bool_t   fDiffsNotCalc;
101    void     CalculateDiffs();
102    
103    
104    /***************************************************/
105    void CalculateBase();
106    Bool_t fChanged;
107    
108    
109  private:
110  public:
111   ClassDef(AliHBTPair,1)
112 };
113 /****************************************************************/
114 inline
115 void AliHBTPair::SetParticles(AliHBTParticle* p1,AliHBTParticle* p2)
116 {
117  //sets the particle to the pair
118  
119  fPart1 = p1;
120  fPart2 = p2;
121  if (fSwapedPair) //if we have Swaped (so we are not)
122    fSwapedPair->SetParticles(p2,p1); //set particles for him too
123  
124  // Resel all calculations (flags)
125
126  fChanged           = kTRUE;
127  fSumsNotCalc       = kTRUE;
128  fDiffsNotCalc      = kTRUE;
129  fMassSqrNotCalc    = kTRUE;
130  fInvMassNotCalc    = kTRUE;
131  fQInvNotCalc       = kTRUE;
132  fQSideCMSLCNotCalc = kTRUE;
133  fQOutCMSLCNotCalc  = kTRUE;
134  fQLongCMSLCNotCalc = kTRUE;
135  fKtNotCalc         = kTRUE;
136  fKStarNotCalc      = kTRUE;
137  fQInvLNotCalc      = kTRUE;
138  
139  //and do nothing until will be asked for
140 }
141 /****************************************************************/
142 /****************************************************************/
143 inline 
144 void AliHBTPair::CalculateInvMassSqr()
145  {
146   if (fMassSqrNotCalc)
147    {
148      CalculateSums();
149  
150      Double_t fPart12s= (fPxSum*fPxSum) + (fPySum*fPySum) + (fPzSum*fPzSum);
151  
152      fInvMassSqr=fESum*fESum-fPart12s;
153
154      fMassSqrNotCalc = kFALSE;
155    }
156  }
157 /****************************************************************/
158 inline 
159 void AliHBTPair::CalculateQInvL()
160  {
161  //Calculates square root of Qinv
162   if (fQInvLNotCalc)
163   {
164    CalculateDiffs();
165    fQInvL = fEDiff*fEDiff - ( fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff );
166    fQInvLNotCalc = kFALSE;
167   }
168  }
169 /****************************************************************/ 
170 inline 
171 void AliHBTPair::CalculateSums()
172  {
173    if(fSumsNotCalc)
174     {
175      fPxSum = fPart1->Px()+fPart2->Px();
176      fPySum = fPart1->Py()+fPart2->Py();
177      fPzSum = fPart1->Pz()+fPart2->Pz();
178      fESum  = fPart1->Energy() + fPart2->Energy();
179      fSumsNotCalc = kFALSE;
180     }
181  }
182 /****************************************************************/
183 inline 
184 void AliHBTPair::CalculateDiffs()
185  {
186    if(fDiffsNotCalc)
187     {
188      fPxDiff = fPart1->Px()-fPart2->Px();
189      fPyDiff = fPart1->Py()-fPart2->Py();
190      fPzDiff = fPart1->Pz()-fPart2->Pz();
191      fEDiff  = fPart1->Energy() - fPart2->Energy();
192      fDiffsNotCalc = kFALSE;
193     }
194  }
195
196 /****************************************************************/
197 inline 
198 Double_t AliHBTPair::GetDeltaP() //return difference of momenta
199 {
200  CalculateDiffs();
201  return TMath::Sqrt(fPxDiff*fPxDiff + fPyDiff*fPyDiff + fPzDiff*fPzDiff);
202 }
203 /****************************************************************/
204 inline 
205 Double_t AliHBTPair::GetDeltaPx()
206  {
207    CalculateDiffs();
208    return fPxDiff;
209  }
210 /****************************************************************/
211 inline 
212 Double_t AliHBTPair::GetDeltaPy()
213  {
214    CalculateDiffs();
215    return fPyDiff;
216  }
217
218 /****************************************************************/
219 inline 
220 Double_t AliHBTPair::GetDeltaPz()
221  {
222    CalculateDiffs();
223    return fPzDiff;
224  }
225
226
227 #endif