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