1 #include "AliHBTPair.h"
2 //_________________________________________________________________________
3 ///////////////////////////////////////////////////////////////////////////
7 // class implements pair of particles and taking care of caluclation (almost)
8 // all of pair properties (Qinv, InvMass,...)
9 // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
11 ////////////////////////////////////////////////////////////////////////////
13 #include "AliHBTParticle.h"
14 #include "AliHBTWeights.h"
18 /************************************************************************/
19 AliHBTPair::AliHBTPair(Bool_t rev):
24 fQSideCMSLCNotCalc(kTRUE),
26 fQOutCMSLCNotCalc(kTRUE),
28 fQLongCMSLCNotCalc(kTRUE),
32 fInvMassNotCalc(kTRUE),
44 fMassSqrNotCalc(kTRUE),
48 fWeightNotCalc(kTRUE),
60 fGammaCMSLCNotCalc(kTRUE),
63 //value of rev defines if it is Swaped
64 //if you pass kTRUE swpaped pair will NOT be created
65 //though you wont be able to get the swaped pair from this pair
67 if(!rev) fSwapedPair = new AliHBTPair(kTRUE); //if false create swaped pair
70 /************************************************************************/
72 AliHBTPair::AliHBTPair(AliHBTParticle* part1, AliHBTParticle* part2, Bool_t rev):
77 fQSideCMSLCNotCalc(kTRUE),
79 fQOutCMSLCNotCalc(kTRUE),
81 fQLongCMSLCNotCalc(kTRUE),
85 fInvMassNotCalc(kTRUE),
97 fMassSqrNotCalc(kTRUE),
101 fWeightNotCalc(kTRUE),
111 fDiffsNotCalc(kTRUE),
113 fGammaCMSLCNotCalc(kTRUE),
116 //value of rev defines if it is Swaped
117 //if you pass kTRUE swpaped pair will NOT be created
118 //though you wont be able to get the swaped pair from this pair
120 if(!rev) fSwapedPair = new AliHBTPair(part2,part1,kTRUE); //if false create swaped pair
123 /************************************************************************/
125 Double_t AliHBTPair::GetInvMass()
127 //Returns qinv value for a pair
130 CalculateInvMassSqr(); //method is inline so we not waste th time for jumping into method
132 if(fInvMassSqr<0) fInvMass = TMath::Sqrt(-fInvMassSqr);
133 else fInvMass = TMath::Sqrt(fInvMassSqr);
135 fInvMassNotCalc = kFALSE;
139 /************************************************************************/
140 Double_t AliHBTPair::GetQSideCMSLC()
142 //return Q Side in Central Of Mass System in Longitudialy Comoving Frame
144 if (fQSideCMSLCNotCalc)
146 fQSideCMSLC = (fPart1->Px()*fPart2->Py()-fPart2->Px()*fPart1->Py())/GetKt();
147 fQSideCMSLCNotCalc = kFALSE;
151 /************************************************************************/
152 Double_t AliHBTPair::GetQOutCMSLC()
154 //caculates Qout in Center Of Mass Longitudionally Co-Moving
155 if(fQOutCMSLCNotCalc)
160 if (fPart1->GetMass() != fPart2->GetMass())
164 Double_t beta = fPzSum/fESum;
165 Double_t gamma = GetGammaToCMSLC();
166 Double_t el = gamma * (fPart1->Energy() - beta * fPart1->Pz());
167 Double_t x = ( fPart1->Px()*fPxSum + fPart1->Py()*fPySum) / ( 2.0*GetKt() );
168 beta = 2.0*GetKt()/GetMt();
169 gamma = GetMt()/GetQInv();
170 fQOutCMSLC = gamma * (x - beta * el);
173 //beta=fPzSum/fESum; // Longit. V == beta
174 Double_t beta=fPzSum/fESum;
175 Double_t gamma = GetGammaToCMSLC();
177 Double_t cosphi=fPxSum/(2.0*GetKt()); // cos(phi)
178 Double_t sinphi=fPySum/(2.0*GetKt()); // sin(phi)
180 // ROTATE(part1Px,part1Py,SPHI,CPHI,part1Px,part1Py);//ROT8
181 // ROTATE(part2Px,part2Py,SPHI,CPHI,part2Px,part2Py);//ROT8
183 tmp = fPart1->Px()*cosphi + fPart1->Py()*sinphi;
184 Double_t part1Py = fPart1->Py()*cosphi - fPart1->Px()*sinphi;
185 Double_t part1Px = tmp;
187 tmp = fPart2->Px()*cosphi + fPart2->Py()*sinphi;
188 Double_t part2Py = fPart2->Py()*cosphi - fPart2->Px()*sinphi;
189 Double_t part2Px = tmp;
192 // LTR(part1Pz,E1,beta,GetGammaToCMSLC(),part1Pz,E1a);
193 // LTR(part2Pz,E2,beta,GetGammaToCMSLC(),part2Pz,E2a);
194 Double_t part1Pz=gamma*(fPart1->Pz()-beta*fPart1->Energy());
195 Double_t part2Pz=gamma*(fPart2->Pz()-beta*fPart2->Energy());
197 Double_t part1P2=part1Px*part1Px+part1Py*part1Py+part1Pz*part1Pz;
198 Double_t part2P2=part2Px*part2Px+part2Py*part2Py+part2Pz*part2Pz;
199 Double_t part1E=TMath::Sqrt(fPart1->GetMass()*fPart1->GetMass()+part1P2);
200 Double_t part2E=TMath::Sqrt(fPart2->GetMass()*fPart2->GetMass()+part2P2);
201 Double_t sumE=part1E+part2E;
202 Double_t sumPx=part1Px+part2Px;
203 Double_t sumPy=part1Py+part2Py;
204 Double_t sumPZ=part1Pz+part2Pz;
205 Double_t sumP2=sumPx*sumPx+sumPy*sumPy+sumPZ*sumPZ;
207 Double_t relmass=TMath::Sqrt(sumE*sumE-sumP2);
208 Double_t hf = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/(relmass*relmass);
209 fQOutCMSLC=(part1Px-part2Px);//== id
210 fQOutCMSLC=fQOutCMSLC-sumPx*hf; //sumPx == fPxSum ale po rotacji i transf
214 Double_t k2 = fPxSum*fPxDiff+fPySum*fPyDiff;
215 fQOutCMSLC = 0.5*k2/GetKt();
216 // if (non-id) fQOutCMSLC=fQOutCMSLC - sumPx*HF;
220 fQOutCMSLCNotCalc = kFALSE;
224 /************************************************************************/
225 Double_t AliHBTPair::GetQLongCMSLC()
227 //return Q Long in Central Of Mass System in Longitudialy Comoving Frame
228 if (fQLongCMSLCNotCalc)
232 Double_t beta = fPzSum/fESum;
233 fQLongCMSLC = GetGammaToCMSLC() * ( fPzDiff - beta*fEDiff );
234 fQLongCMSLCNotCalc = kFALSE;
238 /************************************************************************/
239 Double_t AliHBTPair::GetKt()
241 //calculates the evarage momentum of the pair
245 fKt = 0.5*TMath::Hypot(fPxSum,fPySum);
250 /************************************************************************/
252 Double_t AliHBTPair::GetKStar()
254 //calculates invariant velocity difference
259 Double_t Ptrans = fPxSum*fPxSum + fPySum*fPySum;
260 Double_t Mtrans = fESum*fESum - fPzSum*fPzSum;
261 Double_t Pinv = TMath::Sqrt(Mtrans - Ptrans);
263 Double_t Q = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/Pinv;
270 Info("GetKStar","Q = %f",Q);
278 fKStarNotCalc = kFALSE;
282 /************************************************************************/
284 Double_t AliHBTPair::GetQInv()
287 //warning for non-id particles you want to use 2*KStar
291 fQInv = TMath::Sqrt(TMath::Abs(fQInvL));
292 fQInvNotCalc = kFALSE;
296 /************************************************************************/
298 Double_t AliHBTPair::GetGammaToCMSLC()
300 //calculates gamma factor of the boost to CMSLC
301 if(fGammaCMSLCNotCalc)
304 Double_t beta = fPzSum/fESum;
305 fGammaCMSLC = 1.0/TMath::Sqrt(1.0 - beta*beta);
306 fGammaCMSLCNotCalc = kFALSE;
310 /************************************************************************/
312 Double_t AliHBTPair::GetMt()
314 //Calculates transverse mass of the pair
318 fMt = TMath::Sqrt(fESum*fESum - fPzSum*fPzSum);
323 /************************************************************************/
325 Double_t AliHBTPair::GetWeight()
327 //returns and buffers weight for this pair
330 fWeight = AliHBTWeights::Weight(this);
331 fWeightNotCalc = kFALSE;