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