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