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,...)
10 // more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html
12 ////////////////////////////////////////////////////////////////////////////
14 #include "AliHBTParticle.h"
15 #include "AliHBTWeights.h"
16 #include "AliHBTTrackPoints.h"
20 /************************************************************************/
21 AliHBTPair::AliHBTPair(Bool_t rev):
26 fQSideCMSLCNotCalc(kTRUE),
28 fQOutCMSLCNotCalc(kTRUE),
30 fQLongCMSLCNotCalc(kTRUE),
34 fInvMassNotCalc(kTRUE),
46 fMassSqrNotCalc(kTRUE),
50 fWeightNotCalc(kTRUE),
62 fGammaCMSLCNotCalc(kTRUE),
65 //value of rev defines if it is Swaped
66 //if you pass kTRUE swpaped pair will NOT be created
67 //though you wont be able to get the swaped pair from this pair
69 if(!rev) fSwapedPair = new AliHBTPair(kTRUE); //if false create swaped pair
72 /************************************************************************/
74 AliHBTPair::AliHBTPair(AliHBTParticle* part1, AliHBTParticle* part2, Bool_t rev):
79 fQSideCMSLCNotCalc(kTRUE),
81 fQOutCMSLCNotCalc(kTRUE),
83 fQLongCMSLCNotCalc(kTRUE),
87 fInvMassNotCalc(kTRUE),
99 fMassSqrNotCalc(kTRUE),
101 fQInvLNotCalc(kTRUE),
103 fWeightNotCalc(kTRUE),
113 fDiffsNotCalc(kTRUE),
115 fGammaCMSLCNotCalc(kTRUE),
118 //value of rev defines if it is Swaped
119 //if you pass kTRUE swpaped pair will NOT be created
120 //though you wont be able to get the swaped pair from this pair
122 if(!rev) fSwapedPair = new AliHBTPair(part2,part1,kTRUE); //if false create swaped pair
125 /************************************************************************/
126 AliHBTPair::AliHBTPair(const AliHBTPair& in):
132 fQSideCMSLCNotCalc(kTRUE),
134 fQOutCMSLCNotCalc(kTRUE),
136 fQLongCMSLCNotCalc(kTRUE),
140 fInvMassNotCalc(kTRUE),
144 fKStarNotCalc(kTRUE),
152 fMassSqrNotCalc(kTRUE),
154 fQInvLNotCalc(kTRUE),
156 fWeightNotCalc(kTRUE),
166 fDiffsNotCalc(kTRUE),
168 fGammaCMSLCNotCalc(kTRUE),
174 /************************************************************************/
176 AliHBTPair& AliHBTPair::operator=(const AliHBTPair& in)
182 /************************************************************************/
184 Double_t AliHBTPair::GetInvMass()
186 //Returns qinv value for a pair
189 CalculateInvMassSqr(); //method is inline so we not waste th time for jumping into method
191 if(fInvMassSqr<0) fInvMass = TMath::Sqrt(-fInvMassSqr);
192 else fInvMass = TMath::Sqrt(fInvMassSqr);
194 fInvMassNotCalc = kFALSE;
198 /************************************************************************/
199 Double_t AliHBTPair::GetQSideCMSLC()
201 //return Q Side in Central Of Mass System in Longitudialy Comoving Frame
203 if (fQSideCMSLCNotCalc)
205 fQSideCMSLC = (fPart1->Px()*fPart2->Py()-fPart2->Px()*fPart1->Py())/GetKt();
206 fQSideCMSLCNotCalc = kFALSE;
210 /************************************************************************/
211 Double_t AliHBTPair::GetQOutCMSLC()
213 //caculates Qout in Center Of Mass Longitudionally Co-Moving
214 if(fQOutCMSLCNotCalc)
219 if (fPart1->GetMass() != fPart2->GetMass())
223 Double_t beta = fPzSum/fESum;
224 Double_t gamma = GetGammaToCMSLC();
225 Double_t el = gamma * (fPart1->Energy() - beta * fPart1->Pz());
226 Double_t x = ( fPart1->Px()*fPxSum + fPart1->Py()*fPySum) / ( 2.0*GetKt() );
227 beta = 2.0*GetKt()/GetMt();
228 gamma = GetMt()/GetQInv();
229 fQOutCMSLC = gamma * (x - beta * el);
232 //beta=fPzSum/fESum; // Longit. V == beta
233 Double_t beta=fPzSum/fESum;
234 Double_t gamma = GetGammaToCMSLC();
236 Double_t cosphi=fPxSum/(2.0*GetKt()); // cos(phi)
237 Double_t sinphi=fPySum/(2.0*GetKt()); // sin(phi)
239 // ROTATE(part1Px,part1Py,SPHI,CPHI,part1Px,part1Py);//ROT8
240 // ROTATE(part2Px,part2Py,SPHI,CPHI,part2Px,part2Py);//ROT8
242 tmp = fPart1->Px()*cosphi + fPart1->Py()*sinphi;
243 Double_t part1Py = fPart1->Py()*cosphi - fPart1->Px()*sinphi;
244 Double_t part1Px = tmp;
246 tmp = fPart2->Px()*cosphi + fPart2->Py()*sinphi;
247 Double_t part2Py = fPart2->Py()*cosphi - fPart2->Px()*sinphi;
248 Double_t part2Px = tmp;
251 // LTR(part1Pz,E1,beta,GetGammaToCMSLC(),part1Pz,E1a);
252 // LTR(part2Pz,E2,beta,GetGammaToCMSLC(),part2Pz,E2a);
253 Double_t part1Pz=gamma*(fPart1->Pz()-beta*fPart1->Energy());
254 Double_t part2Pz=gamma*(fPart2->Pz()-beta*fPart2->Energy());
256 Double_t part1P2=part1Px*part1Px+part1Py*part1Py+part1Pz*part1Pz;
257 Double_t part2P2=part2Px*part2Px+part2Py*part2Py+part2Pz*part2Pz;
258 Double_t part1E=TMath::Sqrt(fPart1->GetMass()*fPart1->GetMass()+part1P2);
259 Double_t part2E=TMath::Sqrt(fPart2->GetMass()*fPart2->GetMass()+part2P2);
260 Double_t sumE=part1E+part2E;
261 Double_t sumPx=part1Px+part2Px;
262 Double_t sumPy=part1Py+part2Py;
263 Double_t sumPZ=part1Pz+part2Pz;
264 Double_t sumP2=sumPx*sumPx+sumPy*sumPy+sumPZ*sumPZ;
266 Double_t relmass=TMath::Sqrt(sumE*sumE-sumP2);
267 Double_t hf = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/(relmass*relmass);
268 fQOutCMSLC=(part1Px-part2Px);//== id
269 fQOutCMSLC=fQOutCMSLC-sumPx*hf; //sumPx == fPxSum ale po rotacji i transf
273 Double_t k2 = fPxSum*fPxDiff+fPySum*fPyDiff;
274 fQOutCMSLC = 0.5*k2/GetKt();
275 // if (non-id) fQOutCMSLC=fQOutCMSLC - sumPx*HF;
279 fQOutCMSLCNotCalc = kFALSE;
283 /************************************************************************/
284 Double_t AliHBTPair::GetQLongCMSLC()
286 //return Q Long in Central Of Mass System in Longitudialy Comoving Frame
287 if (fQLongCMSLCNotCalc)
291 Double_t beta = fPzSum/fESum;
292 fQLongCMSLC = GetGammaToCMSLC() * ( fPzDiff - beta*fEDiff );
293 fQLongCMSLCNotCalc = kFALSE;
297 /************************************************************************/
298 Double_t AliHBTPair::GetKt()
300 //calculates the evarage momentum of the pair
304 fKt = 0.5*TMath::Hypot(fPxSum,fPySum);
309 /************************************************************************/
311 Double_t AliHBTPair::GetKStar()
313 //calculates invariant velocity difference
318 Double_t ptrans = fPxSum*fPxSum + fPySum*fPySum;
319 Double_t mtrans = fESum*fESum - fPzSum*fPzSum;
320 Double_t pinv = TMath::Sqrt(mtrans - ptrans);
322 Double_t q = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/pinv;
329 Info("GetKStar","q = %f",q);
337 fKStarNotCalc = kFALSE;
341 /************************************************************************/
343 Double_t AliHBTPair::GetQInv()
346 //warning for non-id particles you want to use 2*KStar
350 fQInv = TMath::Sqrt(TMath::Abs(fQInvL));
351 fQInvNotCalc = kFALSE;
355 /************************************************************************/
357 Double_t AliHBTPair::GetGammaToCMSLC()
359 //calculates gamma factor of the boost to CMSLC
360 if(fGammaCMSLCNotCalc)
363 Double_t beta = fPzSum/fESum;
364 fGammaCMSLC = 1.0/TMath::Sqrt(1.0 - beta*beta);
365 fGammaCMSLCNotCalc = kFALSE;
369 /************************************************************************/
371 Double_t AliHBTPair::GetMt()
373 //Calculates transverse mass of the pair
377 fMt = TMath::Sqrt(fESum*fESum - fPzSum*fPzSum);
382 /************************************************************************/
384 Double_t AliHBTPair::GetWeight()
386 //returns and buffers weight for this pair
389 fWeight = AliHBTWeights::Weight(this);
390 fWeightNotCalc = kFALSE;
395 /************************************************************************/
397 Double_t AliHBTPair::GetAvarageDistance()
399 //returns avarage distance between two tracks in range
400 //as defined in Track-Points of AliHBTParticle
401 //returns negative value if error uccured f.g. tracks do not have track-points
402 AliHBTTrackPoints* tpts1 = fPart1->GetTrackPoints();
404 {//it could be simulated pair
405 // Warning("GetValue","Track 1 does not have Track Points. Pair NOT Passed.");
409 AliHBTTrackPoints* tpts2 = fPart2->GetTrackPoints();
412 // Warning("GetValue","Track 2 does not have Track Points. Pair NOT Passed.");
416 return tpts1->AvarageDistance(*tpts2);