1 /***************************************************************************
3 * $Id: AliFemtoPair.cc,v 1.23
5 * Author: Brian Laziuk, Yale University
6 * slightly modified by Mike Lisa
7 ***************************************************************************
9 * Description: part of STAR HBT Framework: AliFemtoMaker package
10 * the Pair object is passed to the PairCuts for verification, and
11 * then to the AddRealPair and AddMixedPair methods of the
12 * Correlation Functions
14 ***************************************************************************
15 * Revision 1.23 2002/09/25 19:23:25 rcwells
16 * Added const to emissionAngle()
18 * Revision 1.22 2002/04/22 22:48:11 laue
19 * corrected calculation of opening angle
22 * Revision 1.1.1.1 2007/03/07 10:14:49 mchojnacki
23 * First version on CVS
25 * Revision 1.27 2003/09/02 17:58:32 perev
26 * gcc 3.2 updates + WarnOff
28 * Revision 1.26 2003/01/31 19:57:15 magestro
29 * Cleared up simple compiler warnings on i386_linux24
31 * Revision 1.25 2003/01/14 09:44:08 renault
32 * corrections on average separation calculation for tracks which doesn't cross
35 * Revision 1.24 2002/11/19 23:33:10 renault
36 * Enable average separation calculation for all combinaisons of
37 * V0 daughters and tracks
39 * Revision 1.21 2002/02/28 14:18:36 rcwells
40 * Added emissionAngle function to AliFemtoPair
42 * Revision 1.20 2001/12/14 23:11:30 fretiere
43 * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify AliFemtoTrack, AliFemtoParticle, AliFemtoHiddenInfo, AliFemtoPair to handle the hit information and cope with my code
45 * Revision 1.19 2001/04/25 18:05:09 perev
48 * Revision 1.18 2001/04/03 21:04:36 kisiel
51 * Changes needed to make the Theoretical code
52 * work. The main code is the ThCorrFctn directory.
53 * The most visible change is the addition of the
54 * HiddenInfo to AliFemtoPair.
56 * Revision 1.17 2001/03/28 22:35:20 flierl
57 * changes and bugfixes in qYKP*
60 * Revision 1.16 2001/02/15 19:23:00 rcwells
61 * Fixed sign in qSideCMS
63 * Revision 1.15 2001/01/22 22:56:41 laue
64 * Yano-Koonin-Podgoretskii Parametrisation added
66 * Revision 1.14 2000/12/11 21:44:30 rcwells
67 * Corrected qSideCMS function
69 * Revision 1.13 2000/10/26 16:09:16 lisa
70 * Added OpeningAngle PairCut class and method to AliFemtoPair
72 * Revision 1.12 2000/10/05 23:09:05 lisa
73 * Added kT-dependent radii to mixed-event simulator AND implemented AverageSeparation Cut and CorrFctn
75 * Revision 1.11 2000/07/17 20:03:16 lisa
76 * Implemented tools for addressing and assessing trackmerging
78 * Revision 1.10 2000/04/04 16:27:03 rcwells
79 * Removed an errant cout in AliFemtoPair.cc
81 * Revision 1.9 2000/04/04 16:13:09 lisa
82 * AliFemtoPair:quality() now returns normalized value (and so is double) and add a CorrFctn which looks at quality()
84 * Revision 1.8 2000/04/03 22:09:12 rcwells
85 * Add member function ... quality().
87 * Revision 1.7 2000/02/13 21:13:33 lisa
88 * changed ambiguous AliFemtoPair::fourMomentum() to fourMomentumSum() and fourMomentumDiff() and fixed related bug in QvecCorrFctn
90 * Revision 1.6 1999/07/29 16:16:34 lisa
91 * Selemons upgrade of AliFemtoPair class
93 * Revision 1.5 1999/07/22 18:49:10 lisa
94 * Implement idea of Fabrice to not create and delete AliFemtoPair all the time
96 * Revision 1.4 1999/07/12 18:57:05 lisa
97 * fixed small bug in fourMomentum method of AliFemtoPair
99 * Revision 1.3 1999/07/06 22:33:22 lisa
100 * Adjusted all to work in pro and new - dev itself is broken
102 * Revision 1.2 1999/06/29 17:50:27 fisyak
103 * formal changes to account new StEvent, does not complie yet
105 * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
106 * Installation of AliFemtoMaker
108 **************************************************************************/
110 #include "Infrastructure/AliFemtoPair.h"
112 double AliFemtoPair::fMaxDuInner = .8;
113 double AliFemtoPair::fMaxDzInner = 3.;
114 double AliFemtoPair::fMaxDuOuter = 1.4;
115 double AliFemtoPair::fMaxDzOuter = 3.2;
118 AliFemtoPair::AliFemtoPair(){
121 setDefaultHalfFieldMergingPar();
124 AliFemtoPair::AliFemtoPair(AliFemtoParticle* a, AliFemtoParticle* b)
125 : fTrack1(a), fTrack2(b)
127 setDefaultHalfFieldMergingPar();
130 void AliFemtoPair::setDefaultHalfFieldMergingPar(){
136 void AliFemtoPair::setDefaultFullFieldMergingPar(){
142 void AliFemtoPair::setMergingPar(double aMaxDuInner, double aMaxDzInner,
143 double aMaxDuOuter, double aMaxDzOuter){
144 fMaxDuInner = aMaxDuInner;
145 fMaxDzInner = aMaxDzInner;
146 fMaxDuOuter = aMaxDuOuter;
147 fMaxDzOuter = aMaxDzOuter;
150 AliFemtoPair::~AliFemtoPair() {/* no-op */}
152 //AliFemtoPair::AliFemtoPair(const AliFemtoPair &a) {/* missing */}
154 //AliFemtoPair& AliFemtoPair::operator=(const AliFemtoPair &a)
157 double AliFemtoPair::mInv() const
159 double InvariantMass = abs(fTrack1->FourMomentum() + fTrack2->FourMomentum());
160 return (InvariantMass);
163 double AliFemtoPair::kT() const
167 (fTrack1->FourMomentum() + fTrack2->FourMomentum()).perp();
173 double AliFemtoPair::rap() const
175 // longitudinal pair rapidity : Y = 0.5 ::log( E1 + E2 + pz1 + pz2 / E1 + E2 - pz1 - pz2 )
176 double tmp = 0.5 * log (
177 (fTrack1->FourMomentum().e() + fTrack2->FourMomentum().e() + fTrack1->FourMomentum().z() + fTrack2->FourMomentum().z()) /
178 (fTrack1->FourMomentum().e() + fTrack2->FourMomentum().e() - fTrack1->FourMomentum().z() - fTrack2->FourMomentum().z())
183 double AliFemtoPair::emissionAngle()const {
184 double pxTotal = this->fourMomentumSum().x();
185 double pyTotal = this->fourMomentumSum().y();
186 double angle = atan2(pyTotal,pxTotal)*180.0/3.1415926536;
187 if (angle<0.0) angle+=360.0;
191 // get rid of ambiguously-named method fourMomentum() and replace it with
192 // fourMomentumSum() and fourMomentumDiff() - mal 13feb2000
193 AliFemtoLorentzVector AliFemtoPair::fourMomentumSum() const
195 AliFemtoLorentzVector temp = fTrack1->FourMomentum()+fTrack2->FourMomentum();
198 AliFemtoLorentzVector AliFemtoPair::fourMomentumDiff() const
200 AliFemtoLorentzVector temp = fTrack1->FourMomentum()-fTrack2->FourMomentum();
203 //__________________________________
204 // Yano-Koonin-Podgoretskii Parametrisation in CMS
205 void AliFemtoPair::qYKPCMS(double& qP, double& qT, double& q0) const
208 // calculate momentum difference in source rest frame (= lab frame)
210 AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
211 AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
212 AliFemtoLorentzVector l ;
213 // random ordering of the particles
214 if ( rand()/(double)RAND_MAX > 0.50 )
218 // fill momentum differences into return variables
220 qT = l.vect().perp() ;
223 //___________________________________
224 // Yano-Koonin-Podgoretskii Parametrisation in LCMS
225 void AliFemtoPair::qYKPLCMS(double& qP, double& qT, double& q0) const
228 // calculate momentum difference in LCMS : frame where pz1 + pz2 = 0
230 AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
231 AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
232 // determine beta to LCMS
233 double beta = (l1.z()+l2.z()) / (l1.e()+l2.e()) ;
234 double beta2 = beta*beta ;
235 // unfortunately STAR Class lib knows only boost(particle) not boost(beta) :(
236 // -> create particle with velocity beta and mass 1.0
237 // actually this is : dummyPz = ::sqrt( (dummyMass*dummyMass*beta2) / (1-beta2) ) ;
238 double dummyPz = ::sqrt( (beta2) / (1-beta2) ) ;
239 // boost in the correct direction
240 if (beta>0.0) { dummyPz = -dummyPz; } ;
241 // create dummy particle
242 AliFemtoLorentzVector l(0.0, 0.0, dummyPz) ;
243 double dummyMass = 1.0 ;
244 l.setE(l.vect().massHypothesis(dummyMass) );
245 // boost particles along the beam into a frame with velocity beta
246 AliFemtoLorentzVector l1boosted = l1.boost(l) ;
247 AliFemtoLorentzVector l2boosted = l2.boost(l) ;
248 // caculate the momentum difference with random ordering of the particle
249 if ( rand()/(double)RAND_MAX >0.50)
250 { l = l1boosted-l2boosted ; }
252 { l = l2boosted-l1boosted ;} ;
253 // fill momentum differences into return variables
255 qT = l.vect().perp() ;
258 //___________________________________
259 // Yano-Koonin-Podgoretskii Parametrisation in pair rest frame
260 void AliFemtoPair::qYKPPF(double& qP, double& qT, double& q0) const
263 // calculate momentum difference in pair rest frame : frame where (pz1 + pz2, py1 + py2, px1 + px2) = (0,0,0)
265 AliFemtoLorentzVector l1 = fTrack1->FourMomentum() ;
266 AliFemtoLorentzVector l2 = fTrack2->FourMomentum() ;
267 // the center of gravity of the pair travels with l
268 AliFemtoLorentzVector l = l1 + l2 ;
272 AliFemtoLorentzVector l1boosted = l1.boost(l) ;
273 AliFemtoLorentzVector l2boosted = l2.boost(l) ;
274 // caculate the momentum difference with random ordering of the particle
275 if ( rand()/(double)RAND_MAX > 0.50)
276 { l = l1boosted-l2boosted ; }
278 { l = l2boosted-l1boosted ;} ;
279 // fill momentum differences into return variables
281 qT = l.vect().perp();
285 double AliFemtoPair::qOutCMS() const
287 AliFemtoThreeVector tmp1 = fTrack1->FourMomentum().vect();
288 AliFemtoThreeVector tmp2 = fTrack2->FourMomentum().vect();
290 double dx = tmp1.x() - tmp2.x();
291 double xt = tmp1.x() + tmp2.x();
293 double dy = tmp1.y() - tmp2.y();
294 double yt = tmp1.y() + tmp2.y();
296 double k1 = (::sqrt(xt*xt+yt*yt));
297 double k2 = (dx*xt+dy*yt);
302 double AliFemtoPair::qSideCMS() const
304 AliFemtoThreeVector tmp1 = fTrack1->FourMomentum().vect();
305 AliFemtoThreeVector tmp2 = fTrack2->FourMomentum().vect();
307 double x1 = tmp1.x(); double y1 = tmp1.y();
308 double x2 = tmp2.x(); double y2 = tmp2.y();
310 double xt = x1+x2; double yt = y1+y2;
311 double k1 = ::sqrt(xt*xt+yt*yt);
313 double tmp = 2.0*(x2*y1-x1*y2)/k1;
317 //_________________________
318 double AliFemtoPair::qLongCMS() const
320 AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
321 AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
323 double dz = tmp1.z() - tmp2.z();
324 double zz = tmp1.z() + tmp2.z();
326 double dt = tmp1.t() - tmp2.t();
327 double tt = tmp1.t() + tmp2.t();
330 double gamma = 1.0/::sqrt(1.0 - beta*beta);
332 double temp = gamma*(dz - beta*dt);
336 //________________________________
337 double AliFemtoPair::qOutPf() const
339 AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
340 AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
342 double dt = tmp1.t() - tmp2.t();
343 double tt = tmp1.t() + tmp2.t();
345 double xt = tmp1.x() + tmp2.x();
346 double yt = tmp1.y() + tmp2.y();
348 double k1 = ::sqrt(xt*xt + yt*yt);
350 double gOut = 1.0/::sqrt(1.0 - bOut*bOut);
352 double temp = gOut*(this->qOutCMS() - bOut*dt);
356 //___________________________________
357 double AliFemtoPair::qSidePf() const
359 return(this->qSideCMS());
362 //___________________________________
364 double AliFemtoPair::qLongPf() const
366 return(this->qLongCMS());
369 //___________________________________
370 double AliFemtoPair::qOutBf(double beta) const
372 return(this->qOutCMS());
375 //___________________________________
377 double AliFemtoPair::qSideBf(double beta) const
379 return(this->qSideCMS());
382 //___________________________________
383 double AliFemtoPair::qLongBf(double beta) const
385 AliFemtoLorentzVector tmp1 = fTrack1->FourMomentum();
386 AliFemtoLorentzVector tmp2 = fTrack2->FourMomentum();
388 double dz = tmp1.z() - tmp2.z();
389 double dt = tmp1.t() + tmp2.t();
391 double gamma = 1.0/::sqrt(1.0 - beta*beta);
393 double temp = gamma*(dz - beta*dt);
397 double AliFemtoPair::quality() const {
398 unsigned long mapMask0 = 0xFFFFFF00;
399 unsigned long mapMask1 = 0x1FFFFF;
400 unsigned long padRow1To24Track1 = fTrack1->TopologyMap(0) & mapMask0;
401 unsigned long padRow25To45Track1 = fTrack1->TopologyMap(1) & mapMask1;
402 unsigned long padRow1To24Track2 = fTrack2->TopologyMap(0) & mapMask0;
403 unsigned long padRow25To45Track2 = fTrack2->TopologyMap(1) & mapMask1;
405 unsigned long bothPads1To24 = padRow1To24Track1 & padRow1To24Track2;
406 unsigned long bothPads25To45 = padRow25To45Track1 & padRow25To45Track2;
408 unsigned long onePad1To24 = padRow1To24Track1 ^ padRow1To24Track2;
409 unsigned long onePad25To45 = padRow25To45Track1 ^ padRow25To45Track2;
413 double normQual = 0.0;
414 int MaxQuality = fTrack1->NumberOfHits() + fTrack2->NumberOfHits();
415 for (ibits=8;ibits<=31;ibits++) {
417 bitI |= 1UL<<(ibits);
418 if ( onePad1To24 & bitI ) {
423 if ( bothPads1To24 & bitI ) Quality--;
426 for (ibits=0;ibits<=20;ibits++) {
428 bitI |= 1UL<<(ibits);
429 if ( onePad25To45 & bitI ) {
434 if ( bothPads25To45 & bitI ) Quality--;
437 normQual = (double)Quality/( (double) MaxQuality );
442 double AliFemtoPair::quality2() const {
443 unsigned long mapMask0 = 0xFFFFFF00;
444 unsigned long mapMask1 = 0x1FFFFF;
445 unsigned long padRow1To24Track1 = fTrack1->TopologyMap(0) & mapMask0;
446 unsigned long padRow25To45Track1 = fTrack1->TopologyMap(1) & mapMask1;
447 unsigned long padRow1To24Track2 = fTrack2->TopologyMap(0) & mapMask0;
448 unsigned long padRow25To45Track2 = fTrack2->TopologyMap(1) & mapMask1;
451 //unsigned long bothPads1To24 = padRow1To24Track1 & padRow1To24Track2;
452 //unsigned long bothPads25To45 = padRow25To45Track1 & padRow25To45Track2;
455 unsigned long onePad1To24 = padRow1To24Track1 ^ padRow1To24Track2;
456 unsigned long onePad25To45 = padRow25To45Track1 ^ padRow25To45Track2;
460 double normQual = 0.0;
461 int MaxQuality = fTrack1->NumberOfHits() + fTrack2->NumberOfHits();
462 for (ibits=8;ibits<=31;ibits++) {
464 bitI |= 1UL<<(ibits);
465 if ( onePad1To24 & bitI ) {
470 //if ( bothPads1To24 & bitI ) Quality--;
473 for (ibits=0;ibits<=20;ibits++) {
475 bitI |= 1UL<<(ibits);
476 if ( onePad25To45 & bitI ) {
481 //if ( bothPads25To45 & bitI ) Quality--;
484 normQual = (double)Quality/( (double) MaxQuality );
490 double AliFemtoPair::NominalTpcExitSeparation() const {
491 AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->NominalTpcExitPoint();
495 double AliFemtoPair::NominalTpcEntranceSeparation() const {
496 AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->NominalTpcEntrancePoint();
500 double AliFemtoPair::NominalTpcAverageSeparation() const {
501 AliFemtoThreeVector diff;
504 if (fTrack1->fNominalPosSample && fTrack2->fNominalPosSample){
505 while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
506 fabs(fTrack1->fNominalPosSample[ipt].y())<9999. &&
507 fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
508 fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
509 fabs(fTrack2->fNominalPosSample[ipt].y())<9999. &&
510 fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
513 // for (int ipt=0; ipt<11; ipt++){
514 diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
516 AveSep += diff.mag();
518 AveSep = AveSep/(ipt+1.);
523 double AliFemtoPair::OpeningAngle() const {
524 return 57.296* fTrack1->FourMomentum().vect().angle( fTrack2->FourMomentum().vect() );
525 // AliFemtoThreeVector p1 = fTrack1->FourMomentum().vect();
526 // AliFemtoThreeVector p2 = fTrack2->FourMomentum().vect();
527 // return 57.296*(p1.phi()-p2.phi());
528 // //double dAngInv = 57.296*acos((p1.dot(p2))/(p1.mag()*p2.mag()));
529 // //return (dAngInv);
534 double AliFemtoPair::KStarFlipped() const {
535 AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
537 AliFmThreeVectorD qwe = tP1.vect();
538 qwe *= -1.; // flip it
541 AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
542 double tMass = abs(tSum);
543 AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect();
544 double tGamma = tSum.e()/tMass;
545 AliFmThreeVectorD tLongMom = ((tP1.vect()*tGammaBeta)/
546 (tGammaBeta*tGammaBeta))*tGammaBeta;
547 AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
548 tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
549 //VP tP1.vect() *= -1.; // unflip it
550 return tK.vect().mag();
553 //double AliFemtoPair::CVK() const{
554 //const AliFemtoLorentzVector& tP1 = fTrack1->FourMomentum();
555 //AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
556 //double tMass = abs(tSum);
557 //AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect();
558 //double tGamma = tSum.e()/tMass;
559 //AliFmThreeVectorD tLongMom = ((tP1.vect()*tGammaBeta)/
560 // (tGammaBeta*tGammaBeta))*tGammaBeta;
561 //AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
562 // tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
563 //return (tK.vect())*tGammaBeta/tK.vect().magnitude()/tGammaBeta.magnitude();
566 double AliFemtoPair::CVKFlipped() const{
567 AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
568 AliFmThreeVectorD qwe = tP1.vect();
569 qwe *= -1.; // flip it
572 AliFemtoLorentzVector tSum = (tP1+fTrack2->FourMomentum());
573 double tMass = abs(tSum);
574 AliFmThreeVectorD tGammaBeta = (1./tMass)*tSum.vect();
575 double tGamma = tSum.e()/tMass;
576 AliFmThreeVectorD tLongMom = ((tP1.vect()*tGammaBeta)/
577 (tGammaBeta*tGammaBeta))*tGammaBeta;
578 AliFmLorentzVectorD tK(tGamma*tP1.e() - tP1.vect()*tGammaBeta,
579 tP1.vect() + (tGamma-1.)*tLongMom - tP1.e()*tGammaBeta);
580 //VP tP1.vect() *= -1.; // unflip it
581 return (tK.vect())*tGammaBeta/tGamma;
584 double AliFemtoPair::pInv() const{
585 AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
586 AliFemtoLorentzVector tP2 = fTrack2->FourMomentum();
587 double tP = (tP1.px()+tP2.px())*(tP1.px()+tP2.px())+
588 (tP1.py()+tP2.py())*(tP1.py()+tP2.py())+
589 (tP1.pz()+tP2.pz())*(tP1.pz()+tP2.pz())-
590 (tP1.e() -tP2.e() )*(tP1.e() -tP2.e() );
591 return ::sqrt(fabs(tP));
594 double AliFemtoPair::qInvFlippedXY() const{
595 AliFemtoLorentzVector tP1 = fTrack1->FourMomentum();
596 tP1.setX(-1.*tP1.x());
597 tP1.setY(-1.*tP1.y());
598 AliFemtoLorentzVector tDiff = (tP1-fTrack2->FourMomentum());
599 return ( -1.* tDiff.m());
602 void AliFemtoPair::calcNonIdPar() const{ // fortran like function! faster?
603 fNonIdParNotCalculated=0;
604 double px1 = fTrack1->FourMomentum().vect().x();
605 double py1 = fTrack1->FourMomentum().vect().y();
606 double pz1 = fTrack1->FourMomentum().vect().z();
607 double pE1 = fTrack1->FourMomentum().e();
608 double Particle1Mass = ::sqrt(pE1*pE1 - px1*px1 - py1*py1 - pz1*pz1);
609 double px2 = fTrack2->FourMomentum().vect().x();
610 double py2 = fTrack2->FourMomentum().vect().y();
611 double pz2 = fTrack2->FourMomentum().vect().z();
612 double pE2 = fTrack2->FourMomentum().e();
613 double Particle2Mass = ::sqrt(pE2*pE2 - px2*px2 - py2*py2 - pz2*pz2);
620 double Ptrans = Px*Px + Py*Py;
621 double Mtrans = PE*PE - Pz*Pz;
622 double Pinv = ::sqrt(Mtrans - Ptrans);
623 Mtrans = ::sqrt(Mtrans);
624 Ptrans = ::sqrt(Ptrans);
626 double QinvL = (pE1-pE2)*(pE1-pE2) - (px1-px2)*(px1-px2) -
627 (py1-py2)*(py1-py2) - (pz1-pz2)*(pz1-pz2);
629 double Q = (Particle1Mass*Particle1Mass - Particle2Mass*Particle2Mass)/Pinv;
630 Q = sqrt ( Q*Q - QinvL);
636 double gamma = PE/Mtrans;
638 double pz1L = gamma * (pz1 - beta * pE1);
639 double pE1L = gamma * (pE1 - beta * pz1);
641 // fill histogram for beam projection ( z - axis )
644 // ad 2) rotation px -> Pt
645 double px1R = (px1*Px + py1*Py)/Ptrans;
646 double py1R = (-px1*Py + py1*Px)/Ptrans;
648 //fill histograms for side projection ( y - axis )
651 // ad 3) go from LCMS to CMS
652 beta = Ptrans/Mtrans;
655 double px1C = gamma * (px1R - beta * pE1L);
657 // fill histogram for out projection ( x - axis )
660 fCVK = (fDKOut*Ptrans + fDKLong*Pz)/kStarCalc/::sqrt(Ptrans*Ptrans+Pz*Pz);
664 /*void AliFemtoPair::calcNonIdParGlobal() const{ // fortran like function! faster?
665 fNonIdParNotCalculatedGlobal=0;
666 double px1 = fTrack1->Track()->PGlobal().x();
667 double py1 = fTrack1->Track()->PGlobal().y();
668 double pz1 = fTrack1->Track()->PGlobal().z();
669 double Particle1Mass = fTrack1->FourMomentum().m2();
670 double pE1 = ::sqrt(Particle1Mass + px1*px1 + py1*py1 + pz1*pz1);
671 Particle1Mass = ::sqrt(Particle1Mass);
673 double px2 = fTrack2->Track()->PGlobal().x();
674 double py2 = fTrack2->Track()->PGlobal().y();
675 double pz2 = fTrack2->Track()->PGlobal().z();
676 double Particle2Mass = fTrack2->FourMomentum().m2();
677 double pE2 = ::sqrt(Particle2Mass + px2*px2 + py2*py2 + pz2*pz2);
678 Particle2Mass = ::sqrt(Particle2Mass);
685 double Ptrans = Px*Px + Py*Py;
686 double Mtrans = PE*PE - Pz*Pz;
687 double Pinv = ::sqrt(Mtrans - Ptrans);
688 Mtrans = ::sqrt(Mtrans);
689 Ptrans = ::sqrt(Ptrans);
691 double QinvL = (pE1-pE2)*(pE1-pE2) - (px1-px2)*(px1-px2) -
692 (py1-py2)*(py1-py2) - (pz1-pz2)*(pz1-pz2);
694 double Q = (Particle1Mass*Particle1Mass - Particle2Mass*Particle2Mass)/Pinv;
695 Q = sqrt ( Q*Q - QinvL);
697 kStarCalcGlobal = Q/2;
701 double gamma = PE/Mtrans;
703 double pz1L = gamma * (pz1 - beta * pE1);
704 double pE1L = gamma * (pE1 - beta * pz1);
706 // fill histogram for beam projection ( z - axis )
707 fDKLongGlobal = pz1L;
709 // ad 2) rotation px -> Pt
710 double px1R = (px1*Px + py1*Py)/Ptrans;
711 double py1R = (-px1*Py + py1*Px)/Ptrans;
713 //fill histograms for side projection ( y - axis )
714 fDKSideGlobal = py1R;
716 // ad 3) go from LCMS to CMS
717 beta = Ptrans/Mtrans;
720 double px1C = gamma * (px1R - beta * pE1L);
722 // fill histogram for out projection ( x - axis )
725 fCVKGlobal = (fDKOutGlobal*Ptrans + fDKLongGlobal*Pz)/
726 kStarCalcGlobal/::sqrt(Ptrans*Ptrans+Pz*Pz);
731 double AliFemtoPair::dcaInsideTpc() const{
733 double tMinDist=NominalTpcEntranceSeparation();
734 double tExit = NominalTpcExitSeparation();
735 tMinDist = (tExit>tMinDist) ? tMinDist : tExit;
741 const AliFmPhysicalHelixD& tHelix1 = fTrack1->Helix();
742 const AliFmPhysicalHelixD& tHelix2 = fTrack2->Helix();
743 // --- One is a line and other one a helix
744 //if (tHelix1.mSingularity != tHelix2.mSingularity) return -999.;
745 // --- 2 lines : don't care right now
746 //if (tHelix1.mSingularity) return -999.;
748 double dx = tHelix2.xcenter() - tHelix1.xcenter();
749 double dy = tHelix2.ycenter() - tHelix1.ycenter();
750 double dd = ::sqrt(dx*dx + dy*dy);
751 double r1 = 1/tHelix1.curvature();
752 double r2 = 1/tHelix2.curvature();
753 double cosAlpha = (r1*r1 + dd*dd - r2*r2)/(2*r1*dd);
757 if (fabs(cosAlpha) < 1) { // two solutions
758 double sinAlpha = sin(acos(cosAlpha));
759 x = tHelix1.xcenter() + r1*(cosAlpha*dx - sinAlpha*dy)/dd;
760 y = tHelix1.ycenter() + r1*(sinAlpha*dx + cosAlpha*dy)/dd;
762 if( r > rMin && r < rMax &&
763 fabs(atan2(y,x)-fTrack1->NominalTpcEntrancePoint().phi())< 0.5
764 ){ // first solution inside
765 s = tHelix1.pathLength(x, y);
766 tInsideDist=tHelix2.distance(tHelix1.at(s));
767 if(tInsideDist<tMinDist) tMinDist = tInsideDist;
770 x = tHelix1.xcenter() + r1*(cosAlpha*dx + sinAlpha*dy)/dd;
771 y = tHelix1.ycenter() + r1*(cosAlpha*dy - sinAlpha*dx)/dd;
773 if( r > rMin && r < rMax &&
774 fabs(atan2(y,x)-fTrack1->NominalTpcEntrancePoint().phi())< 0.5
775 ) { // second solution inside
776 s = tHelix1.pathLength(x, y);
777 tInsideDist=tHelix2.distance(tHelix1.at(s));
778 if(tInsideDist<tMinDist) tMinDist = tInsideDist;
785 void AliFemtoPair::calcMergingPar() const{
786 fMergingParNotCalculated=0;
790 fFracOfMergedRow = 0.;
793 double tDistMax = 200.;
794 for(int ti=0 ; ti<45 ; ti++){
795 if(fTrack1->fSect[ti]==fTrack2->fSect[ti] && fTrack1->fSect[ti]!=-1){
796 tDu = fabs(fTrack1->fU[ti]-fTrack2->fU[ti]);
797 tDz = fabs(fTrack1->fZ[ti]-fTrack2->fZ[ti]);
800 fFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
801 tDist = ::sqrt(tDu*tDu/fMaxDuInner/fMaxDuInner+
802 tDz*tDz/fMaxDzInner/fMaxDzInner);
803 //fFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
806 fFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
807 tDist = ::sqrt(tDu*tDu/fMaxDuOuter/fMaxDuOuter+
808 tDz*tDz/fMaxDzOuter/fMaxDzOuter);
809 //fFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
812 fClosestRowAtDCA = ti+1;
815 fWeightedAvSep += tDist;
819 fWeightedAvSep /= tN;
820 fFracOfMergedRow /= tN;
823 fClosestRowAtDCA = -1;
824 fFracOfMergedRow = -1.;
825 fWeightedAvSep = -1.;
828 //________________V0 daughters exit/entrance/average separation calc.
829 //_______1st part is a track 2nd is a V0 considering Pos daughter
830 double AliFemtoPair::TpcExitSeparationTrackV0Pos() const {
831 AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->TpcV0PosExitPoint();
835 double AliFemtoPair::TpcEntranceSeparationTrackV0Pos() const {
836 AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
840 double AliFemtoPair::TpcAverageSeparationTrackV0Pos() const {
841 AliFemtoThreeVector diff;
844 if (fTrack1->fNominalPosSample && fTrack2->fNominalPosSample){
845 while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
846 fabs(fTrack1->fNominalPosSample[ipt].y())<9999. &&
847 fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
848 fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
849 fabs(fTrack2->fNominalPosSample[ipt].y())<9999. &&
850 fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
853 diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
855 AveSep += diff.mag();
857 AveSep = AveSep/(ipt+1.);
861 //_______1st part is a track 2nd is a V0 considering Neg daughter
862 double AliFemtoPair::TpcExitSeparationTrackV0Neg() const {
863 AliFemtoThreeVector diff = fTrack1->NominalTpcExitPoint() - fTrack2->TpcV0NegExitPoint();
867 double AliFemtoPair::TpcEntranceSeparationTrackV0Neg() const {
868 AliFemtoThreeVector diff = fTrack1->NominalTpcEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
872 double AliFemtoPair::TpcAverageSeparationTrackV0Neg() const {
873 AliFemtoThreeVector diff;
876 if (fTrack1->fNominalPosSample && fTrack2->fTpcV0NegPosSample){
877 while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
878 fabs(fTrack1->fNominalPosSample[ipt].y())<9999. &&
879 fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
880 fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
881 fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. &&
882 fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
885 diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
887 AveSep += diff.mag();
889 AveSep = AveSep/(ipt+1.);
894 //_______1st part is a V0 considering Pos daughter 2nd is a V0 considering Pos daughter
895 double AliFemtoPair::TpcExitSeparationV0PosV0Pos() const {
896 AliFemtoThreeVector diff = fTrack1->TpcV0PosExitPoint() - fTrack2->TpcV0PosExitPoint();
900 double AliFemtoPair::TpcEntranceSeparationV0PosV0Pos() const {
901 AliFemtoThreeVector diff = fTrack1->TpcV0PosEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
904 double AliFemtoPair::TpcAverageSeparationV0PosV0Pos() const {
905 AliFemtoThreeVector diff;
908 if (fTrack1->fNominalPosSample && (fTrack2->fNominalPosSample)){
909 while ((fabs(fTrack1->fNominalPosSample[ipt].x())<9999.) &&
910 (fabs(fTrack1->fNominalPosSample[ipt].y())<9999.) &&
911 (fabs(fTrack1->fNominalPosSample[ipt].z())<9999.) &&
912 (fabs(fTrack2->fNominalPosSample[ipt].x())<9999.) &&
913 (fabs(fTrack2->fNominalPosSample[ipt].y())<9999.) &&
914 (fabs(fTrack2->fNominalPosSample[ipt].z())<9999.) &&
917 diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
919 AveSep += diff.mag();
921 AveSep = AveSep/(ipt+1);
926 //_______1st part is a V0 considering Pos daughter 2nd is a V0 considering Neg daughter
927 double AliFemtoPair::TpcExitSeparationV0PosV0Neg() const {
928 AliFemtoThreeVector diff = fTrack1->TpcV0PosExitPoint() - fTrack2->TpcV0NegExitPoint();
932 double AliFemtoPair::TpcEntranceSeparationV0PosV0Neg() const {
933 AliFemtoThreeVector diff = fTrack1->TpcV0PosEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
936 double AliFemtoPair::TpcAverageSeparationV0PosV0Neg() const {
937 AliFemtoThreeVector diff;
940 if (fTrack1->fNominalPosSample && fTrack2->fTpcV0NegPosSample){
941 while (fabs(fTrack1->fNominalPosSample[ipt].x())<9999. &&
942 fabs(fTrack1->fNominalPosSample[ipt].y())<9999. &&
943 fabs(fTrack1->fNominalPosSample[ipt].z())<9999. &&
944 fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
945 fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. &&
946 fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
949 diff = fTrack1->fNominalPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
951 AveSep += diff.mag();
953 AveSep = AveSep/(ipt+1.);
957 //_______1st part is a V0 considering Neg daughter 2nd is a V0 considering Pos daughter
958 // this is to check the upper case
959 double AliFemtoPair::TpcExitSeparationV0NegV0Pos() const {
960 AliFemtoThreeVector diff = fTrack1->TpcV0NegExitPoint() - fTrack2->TpcV0PosExitPoint();
964 double AliFemtoPair::TpcEntranceSeparationV0NegV0Pos() const {
965 AliFemtoThreeVector diff = fTrack1->TpcV0NegEntrancePoint() - fTrack2->TpcV0PosEntrancePoint();
968 double AliFemtoPair::TpcAverageSeparationV0NegV0Pos() const {
969 AliFemtoThreeVector diff;
972 if ( fTrack1->fTpcV0NegPosSample && fTrack2->fNominalPosSample){
973 while (fabs(fTrack1->fTpcV0NegPosSample[ipt].x())<9999. &&
974 fabs(fTrack1->fTpcV0NegPosSample[ipt].y())<9999. &&
975 fabs(fTrack1->fTpcV0NegPosSample[ipt].z())<9999. &&
976 fabs(fTrack2->fNominalPosSample[ipt].x())<9999. &&
977 fabs(fTrack2->fNominalPosSample[ipt].y())<9999. &&
978 fabs(fTrack2->fNominalPosSample[ipt].z())<9999. &&
981 diff = fTrack1->fTpcV0NegPosSample[ipt] - fTrack2->fNominalPosSample[ipt];
983 AveSep += diff.mag();
985 AveSep = AveSep/(ipt+1);
989 //_______1st part is a V0 considering Neg daughter 2nd is a V0 considering Neg daughter
990 double AliFemtoPair::TpcExitSeparationV0NegV0Neg() const {
991 AliFemtoThreeVector diff = fTrack1->TpcV0NegExitPoint() - fTrack2->TpcV0NegExitPoint();
995 double AliFemtoPair::TpcEntranceSeparationV0NegV0Neg() const {
996 AliFemtoThreeVector diff = fTrack1->TpcV0NegEntrancePoint() - fTrack2->TpcV0NegEntrancePoint();
999 double AliFemtoPair::TpcAverageSeparationV0NegV0Neg() const {
1000 AliFemtoThreeVector diff;
1001 double AveSep = 0.0;
1003 if (fTrack1->fTpcV0NegPosSample && fTrack2->fTpcV0NegPosSample){
1004 while (fabs(fTrack1->fTpcV0NegPosSample[ipt].x())<9999. &&
1005 fabs(fTrack1->fTpcV0NegPosSample[ipt].y())<9999. &&
1006 fabs(fTrack1->fTpcV0NegPosSample[ipt].z())<9999. &&
1007 fabs(fTrack2->fTpcV0NegPosSample[ipt].x())<9999. &&
1008 fabs(fTrack2->fTpcV0NegPosSample[ipt].y())<9999. &&
1009 fabs(fTrack2->fTpcV0NegPosSample[ipt].z())<9999. &&
1012 diff = fTrack1->fTpcV0NegPosSample[ipt] - fTrack2->fTpcV0NegPosSample[ipt];
1014 AveSep += diff.mag();
1016 AveSep = AveSep/(ipt+1);
1021 //________________end V0 daughters exit/entrance/average separation calc.
1022 void AliFemtoPair::CalcMergingParFctn(short* tmpMergingParNotCalculatedFctn,
1023 float* tmpZ1,float* tmpU1,
1024 float* tmpZ2,float* tmpU2,
1025 int *tmpSect1,int *tmpSect2,
1026 double* tmpFracOfMergedRow,
1027 double* tmpClosestRowAtDCA
1029 tmpMergingParNotCalculatedFctn=0;
1032 *tmpFracOfMergedRow = 0.;
1033 *tmpClosestRowAtDCA = 0.;
1035 double tDistMax = 100000000.;
1036 for(int ti=0 ; ti<45 ; ti++){
1037 if(tmpSect1[ti]==tmpSect2[ti] && tmpSect1[ti]!=-1){
1038 tDu = fabs(tmpU1[ti]-tmpU2[ti]);
1039 tDz = fabs(tmpZ1[ti]-tmpZ2[ti]);
1042 *tmpFracOfMergedRow += (tDu<fMaxDuInner && tDz<fMaxDzInner);
1043 tDist = ::sqrt(tDu*tDu/fMaxDuInner/fMaxDuInner+
1044 tDz*tDz/fMaxDzInner/fMaxDzInner);
1047 *tmpFracOfMergedRow += (tDu<fMaxDuOuter && tDz<fMaxDzOuter);
1048 tDist = ::sqrt(tDu*tDu/fMaxDuOuter/fMaxDuOuter+
1049 tDz*tDz/fMaxDzOuter/fMaxDzOuter);
1052 fClosestRowAtDCA = ti+1;
1055 //fWeightedAvSep += tDist; // now, wrong but not used
1059 //fWeightedAvSep /= tN;
1060 *tmpFracOfMergedRow /= tN;
1063 *tmpClosestRowAtDCA = -1;
1064 *tmpFracOfMergedRow = -1.;
1065 //fWeightedAvSep = -1.;