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