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),
51 fAvarageDistance(0.0),
52 fAvarageDistanceNotCalc(kTRUE),
64 fGammaCMSLCNotCalc(kTRUE),
67 //value of rev defines if it is Swaped
68 //if you pass kTRUE swpaped pair will NOT be created
69 //though you wont be able to get the swaped pair from this pair
71 if(!rev) fSwapedPair = new AliHBTPair(kTRUE); //if false create swaped pair
74 /************************************************************************/
76 AliHBTPair::AliHBTPair(AliHBTParticle* part1, AliHBTParticle* part2, Bool_t rev):
81 fQSideCMSLCNotCalc(kTRUE),
83 fQOutCMSLCNotCalc(kTRUE),
85 fQLongCMSLCNotCalc(kTRUE),
89 fInvMassNotCalc(kTRUE),
101 fMassSqrNotCalc(kTRUE),
103 fQInvLNotCalc(kTRUE),
105 fWeightNotCalc(kTRUE),
106 fAvarageDistance(0.0),
107 fAvarageDistanceNotCalc(kTRUE),
117 fDiffsNotCalc(kTRUE),
119 fGammaCMSLCNotCalc(kTRUE),
122 //value of rev defines if it is Swaped
123 //if you pass kTRUE swpaped pair will NOT be created
124 //though you wont be able to get the swaped pair from this pair
126 if(!rev) fSwapedPair = new AliHBTPair(part2,part1,kTRUE); //if false create swaped pair
129 /************************************************************************/
130 AliHBTPair::AliHBTPair(const AliHBTPair& in):
136 fQSideCMSLCNotCalc(kTRUE),
138 fQOutCMSLCNotCalc(kTRUE),
140 fQLongCMSLCNotCalc(kTRUE),
144 fInvMassNotCalc(kTRUE),
148 fKStarNotCalc(kTRUE),
156 fMassSqrNotCalc(kTRUE),
158 fQInvLNotCalc(kTRUE),
160 fWeightNotCalc(kTRUE),
161 fAvarageDistance(0.0),
162 fAvarageDistanceNotCalc(kTRUE),
172 fDiffsNotCalc(kTRUE),
174 fGammaCMSLCNotCalc(kTRUE),
180 /************************************************************************/
182 AliHBTPair& AliHBTPair::operator=(const AliHBTPair& in)
188 /************************************************************************/
190 Double_t AliHBTPair::GetInvMass()
192 //Returns qinv value for a pair
195 CalculateInvMassSqr(); //method is inline so we not waste th time for jumping into method
197 if(fInvMassSqr<0) fInvMass = TMath::Sqrt(-fInvMassSqr);
198 else fInvMass = TMath::Sqrt(fInvMassSqr);
200 fInvMassNotCalc = kFALSE;
204 /************************************************************************/
206 Double_t AliHBTPair::GetQSideCMSLC()
208 //return Q Side in Central Of Mass System in Longitudialy Comoving Frame
210 if (fQSideCMSLCNotCalc)
212 fQSideCMSLC = (fPart1->Px()*fPart2->Py()-fPart2->Px()*fPart1->Py())/GetKt();
213 fQSideCMSLCNotCalc = kFALSE;
217 /************************************************************************/
219 Double_t AliHBTPair::GetQOutCMSLC()
221 //caculates Qout in Center Of Mass Longitudionally Co-Moving
222 if(fQOutCMSLCNotCalc)
227 if (fPart1->GetMass() != fPart2->GetMass())
231 Double_t beta = fPzSum/fESum;
232 Double_t gamma = GetGammaToCMSLC();
233 Double_t el = gamma * (fPart1->Energy() - beta * fPart1->Pz());
234 Double_t x = ( fPart1->Px()*fPxSum + fPart1->Py()*fPySum) / ( 2.0*GetKt() );
235 beta = 2.0*GetKt()/GetMt();
236 gamma = GetMt()/GetQInv();
237 fQOutCMSLC = gamma * (x - beta * el);
240 //beta=fPzSum/fESum; // Longit. V == beta
241 Double_t beta=fPzSum/fESum;
242 Double_t gamma = GetGammaToCMSLC();
244 Double_t cosphi=fPxSum/(2.0*GetKt()); // cos(phi)
245 Double_t sinphi=fPySum/(2.0*GetKt()); // sin(phi)
247 // ROTATE(part1Px,part1Py,SPHI,CPHI,part1Px,part1Py);//ROT8
248 // ROTATE(part2Px,part2Py,SPHI,CPHI,part2Px,part2Py);//ROT8
250 tmp = fPart1->Px()*cosphi + fPart1->Py()*sinphi;
251 Double_t part1Py = fPart1->Py()*cosphi - fPart1->Px()*sinphi;
252 Double_t part1Px = tmp;
254 tmp = fPart2->Px()*cosphi + fPart2->Py()*sinphi;
255 Double_t part2Py = fPart2->Py()*cosphi - fPart2->Px()*sinphi;
256 Double_t part2Px = tmp;
259 // LTR(part1Pz,E1,beta,GetGammaToCMSLC(),part1Pz,E1a);
260 // LTR(part2Pz,E2,beta,GetGammaToCMSLC(),part2Pz,E2a);
261 Double_t part1Pz=gamma*(fPart1->Pz()-beta*fPart1->Energy());
262 Double_t part2Pz=gamma*(fPart2->Pz()-beta*fPart2->Energy());
264 Double_t part1P2=part1Px*part1Px+part1Py*part1Py+part1Pz*part1Pz;
265 Double_t part2P2=part2Px*part2Px+part2Py*part2Py+part2Pz*part2Pz;
266 Double_t part1E=TMath::Sqrt(fPart1->GetMass()*fPart1->GetMass()+part1P2);
267 Double_t part2E=TMath::Sqrt(fPart2->GetMass()*fPart2->GetMass()+part2P2);
268 Double_t sumE=part1E+part2E;
269 Double_t sumPx=part1Px+part2Px;
270 Double_t sumPy=part1Py+part2Py;
271 Double_t sumPZ=part1Pz+part2Pz;
272 Double_t sumP2=sumPx*sumPx+sumPy*sumPy+sumPZ*sumPZ;
274 Double_t relmass=TMath::Sqrt(sumE*sumE-sumP2);
275 Double_t hf = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/(relmass*relmass);
276 fQOutCMSLC=(part1Px-part2Px);//== id
277 fQOutCMSLC=fQOutCMSLC-sumPx*hf; //sumPx == fPxSum ale po rotacji i transf
281 Double_t k2 = fPxSum*fPxDiff+fPySum*fPyDiff;
282 fQOutCMSLC = 0.5*k2/GetKt();
283 // if (non-id) fQOutCMSLC=fQOutCMSLC - sumPx*HF;
287 fQOutCMSLCNotCalc = kFALSE;
291 /************************************************************************/
293 Double_t AliHBTPair::GetQLongCMSLC()
295 //return Q Long in Central Of Mass System in Longitudialy Comoving Frame
296 if (fQLongCMSLCNotCalc)
300 Double_t beta = fPzSum/fESum;
301 fQLongCMSLC = GetGammaToCMSLC() * ( fPzDiff - beta*fEDiff );
302 fQLongCMSLCNotCalc = kFALSE;
306 /************************************************************************/
308 Double_t AliHBTPair::GetKt()
310 //calculates the evarage momentum of the pair
314 fKt = 0.5*TMath::Hypot(fPxSum,fPySum);
319 /************************************************************************/
321 Double_t AliHBTPair::GetKStar()
323 //calculates invariant velocity difference
328 Double_t ptrans = fPxSum*fPxSum + fPySum*fPySum;
329 Double_t mtrans = fESum*fESum - fPzSum*fPzSum;
330 Double_t pinv = TMath::Sqrt(mtrans - ptrans);
332 Double_t q = (fPart1->GetMass()*fPart1->GetMass() - fPart2->GetMass()*fPart2->GetMass())/pinv;
339 Info("GetKStar","q = %f",q);
347 fKStarNotCalc = kFALSE;
351 /************************************************************************/
353 Double_t AliHBTPair::GetQInv()
356 //warning for non-id particles you want to use 2*KStar
360 fQInv = TMath::Sqrt(TMath::Abs(fQInvL));
361 fQInvNotCalc = kFALSE;
365 /************************************************************************/
367 Double_t AliHBTPair::GetGammaToCMSLC()
369 //calculates gamma factor of the boost to CMSLC
370 if(fGammaCMSLCNotCalc)
373 Double_t beta = fPzSum/fESum;
374 fGammaCMSLC = 1.0/TMath::Sqrt(1.0 - beta*beta);
375 fGammaCMSLCNotCalc = kFALSE;
379 /************************************************************************/
381 Double_t AliHBTPair::GetMt()
383 //Calculates transverse mass of the pair
387 fMt = TMath::Sqrt(fESum*fESum - fPzSum*fPzSum);
392 /************************************************************************/
394 Double_t AliHBTPair::GetWeight()
396 //returns and buffers weight for this pair
399 fWeight = AliHBTWeights::Weight(this);
400 fWeightNotCalc = kFALSE;
404 /************************************************************************/
406 Double_t AliHBTPair::GetAvarageDistance()
408 //returns and buffers avarage distance between two tracks calculated
409 // out of track points (see AliHBTTrackPoints class)
411 if (fAvarageDistanceNotCalc)
413 fAvarageDistance = AvDistance();
414 fAvarageDistanceNotCalc = kFALSE;
416 return fAvarageDistance;
418 /************************************************************************/
420 Double_t AliHBTPair::AvDistance()
422 //returns avarage distance between two tracks in range
423 //as defined in Track-Points of AliHBTParticle
424 //returns negative value if error uccured f.g. tracks do not have track-points
425 AliHBTTrackPoints* tpts1 = fPart1->GetTrackPoints();
427 {//it could be simulated pair
428 // Warning("GetValue","Track 1 does not have Track Points. Pair NOT Passed.");
432 AliHBTTrackPoints* tpts2 = fPart2->GetTrackPoints();
435 // Warning("GetValue","Track 2 does not have Track Points. Pair NOT Passed.");
439 return tpts1->AvarageDistance(*tpts2);