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