StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtThPairGauss.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Laurent Conin, Fabrice Retiere, Subatech, France
6  ***************************************************************************
7  *
8  * Description : implementation of StHbtThPAirGAuss
9  *
10  ***************************************************************************
11  *
12  *
13  *
14  ***************************************************************************/
15 
16 #include "StHbtMaker/ThCorrFctn/StHbtThPairGauss.h"
17 #include "StHbtMaker/ThCorrFctn/StHbtEvtGenHiddenInfo.hh"
18 #include "StHbtMaker/Infrastructure/StHbtParticle.hh"
19 #include "StHbtMaker/Base/StHbtFsiWeight.hh"
20 
21 #ifdef __ROOT__
22 ClassImp(StHbtThPairGauss)
23 #endif
24 
25 StHbtThPairGauss::StHbtThPairGauss() : StHbtThPair(){
26  mEmPoint1=&mPos1;
27  mEmPoint2=&mPos2;
28  mUseHidMom=false;
29  mUseHidPid=false;
30  mMomentum1=&mMom1;
31  mMomentum2=&mMom2;
32  mRef=RCMS;
33  mSizeX=mSizeY=mSizeZ=1.;
34  mTime=0;
35  mBetaRCMS=0.;
36  mGammaRCMS=1.;
37 };
38 
39 StHbtThPairGauss::~StHbtThPairGauss()
40 { /* no-op */ };
41 
42 void StHbtThPairGauss::Set(const StHbtPair* aPair){
43  SetMomentum_PID (aPair);
44  SetPosition();
45  BoostPosition();
46 
47  mMomParCalculated=0;
48  mPosParCalculated=0;
49 
50  mMeasPair=aPair;
51  mWeightOk=false;
52 
53 }
54 
55 void StHbtThPairGauss::SetMomentum_PID( const StHbtPair* aPair ){
56 
57  const StHbtEvtGenHiddenInfo* tEvtGenHidInf1=0;
58  const StHbtEvtGenHiddenInfo* tEvtGenHidInf2=0;
59  if (mUseHidMom||mUseHidPid) {
60  tEvtGenHidInf1=dynamic_cast<const StHbtEvtGenHiddenInfo*>
61  (aPair->track1()->HiddenInfo());
62  tEvtGenHidInf2=dynamic_cast<const StHbtEvtGenHiddenInfo*>
63  (aPair->track2()->HiddenInfo());
64  if ((tEvtGenHidInf1==0)||(tEvtGenHidInf2==0)) {
65  cout << "Fatal Error in StHbtThPairGauss : "<< endl;
66  cout << " HiddenInfo does NOT inherit from StHbtEvtGenHiddenInfo , Or it is NULL " << endl;
67  exit(0);
68  }
69  }
70  if (mUseHidMom&&mUseHidPid) {
71  mMomentum1=new StHbtLorentzVector(*(tEvtGenHidInf1->getFreezeOutMomEn()));
72  mMomentum2=new StHbtLorentzVector(*(tEvtGenHidInf2->getFreezeOutMomEn()));
73  }else{
74  mMom1=aPair->track1()->FourMomentum();
75  mMom1.setE(::sqrt(mMassSq1+mMom1.vect().mag2()));
76  mMom2=aPair->track2()->FourMomentum();
77  mMom2.setE(::sqrt(mMassSq2+mMom2.vect().mag2()));
78  if ((!mUseHidMom)&&(mBetaRCMS>0)) {
79  double tE=mMom1.e();
80  mMom1.setE(mGammaRCMS*(tE-mBetaRCMS*mMom1.pz()));
81  mMom1.setPz(mGammaRCMS*(mMom1.pz()-mBetaRCMS*tE));
82  tE=mMom2.e();
83  mMom2.setE(mGammaRCMS*(tE-mBetaRCMS*mMom2.pz()));
84  mMom2.setPz(mGammaRCMS*(mMom2.pz()-mBetaRCMS*tE));
85  }
86  }
87  if (mUseHidPid) {
88  mPid1=tEvtGenHidInf1->getPid();
89  mPid2=tEvtGenHidInf2->getPid();
90  }
91 }
92 
93 void StHbtThPairGauss::SetPosition() {
94  float x,y,z,t;
95  mRand.Rannor(x,y);
96  mRand.Rannor(z,t);
97  mPos1.setX(x*mSizeX);
98  mPos1.setY(y*mSizeY);
99  mPos1.setZ(z*mSizeZ);
100  mPos1.setT(t*mTime);
101  mRand.Rannor(x,y);
102  mRand.Rannor(z,t);
103  mPos2.setX(x*mSizeX);
104  mPos2.setY(y*mSizeY);
105  mPos2.setZ(z*mSizeZ);
106  mPos2.setT(t*mTime);
107 };
108 
109 void StHbtThPairGauss::BoostPosition(){
110  double tBeta;
111  double tGamma;
112  double tT;
113  switch (mRef) {
114  case RCMS: break;
115  case LCMS:
116  tBeta=(mMomentum1->pz()+mMomentum2->pz())/(mMomentum1->e()+mMomentum2->e());
117  tGamma=::sqrt(1/1-tBeta*tBeta);
118  tT=mPos1.t();
119  mPos1.setT(tGamma*(tT-tBeta*mPos1.z()));
120  mPos1.setZ(tGamma*(tBeta*mPos1.z()-tBeta*tT));
121  tT=mPos2.t();
122  mPos2.setT(tGamma*(tT-tBeta*mPos2.z()));
123  mPos2.setZ(tGamma*(mPos2.z()-tBeta*tT));
124  break;
125  case PRF:
126  StHbtLorentzVector tBoost=*mMomentum1+*mMomentum2;
127  mPos1=mPos1.boost(tBoost);
128  mPos2=mPos2.boost(tBoost);
129  break;
130  }
131 };
132 
133 inline void StHbtThPairGauss::SetSize(double aSize,double aTime){mSizeX=aSize;mSizeY=aSize;mSizeZ=aSize;mTime=aTime;};
134 inline void StHbtThPairGauss::SetSize(double aSizeX,double aSizeY, double aSizeZ,double aTime)
135 {mSizeX=aSizeX;mSizeY=aSizeY;mSizeZ=aSizeZ;mTime=aTime;};
136 
137 inline void StHbtThPairGauss::UseHiddenMomentum(){mUseHidMom=1;};
138 inline void StHbtThPairGauss::UseParticleMomentum(){
139  mUseHidMom=0;
140  if (mUseHidPid){
141  mMomentum1=&mMom1;
142  mMomentum2=&mMom2;
143  }
144 };
145 
146 inline void StHbtThPairGauss::UseHiddenPid() {
147  mUseHidPid=true;
148  if (mUseHidMom){
149  mMomentum1=&mMom1;
150  mMomentum2=&mMom2;
151  }
152 };
153 
154 inline void StHbtThPairGauss::UseFixedPid( int const tPid1,double const tMass1,int const tPid2, double const tMass2) {
155  mUseHidPid=false;mPid1=tPid1;mPid2=tPid2;mMassSq1=tMass1*tMass1;mMassSq2=tMass2*tMass2;};
156 inline void StHbtThPairGauss::UseFixedPid( int const tPid1,double const tMass1) {
157  mUseHidPid=false;mPid1=tPid1;mPid2=tPid1;mMassSq1=tMass1*tMass1;mMassSq2=tMass1*tMass1;};
158 
159 inline void StHbtThPairGauss::SetRCMS() {mRef=RCMS;};
160 inline void StHbtThPairGauss::SetLCMS(){mRef=LCMS;};
161 inline void StHbtThPairGauss::SetPRF(){mRef=PRF;};
162 
163 inline void StHbtThPairGauss::SetBoostRCMS(double aPlab,double aMBeam, double aMTarget){
164  double tEBeamLab=::sqrt(aPlab*aPlab+aMBeam*aMBeam);
165  mGammaRCMS=(tEBeamLab+aMTarget)/::sqrt(aMBeam*aMBeam+aMTarget*aMTarget+2*tEBeamLab*aMTarget);
166  mBetaRCMS=::sqrt(1.-1/(mGammaRCMS*mGammaRCMS));
167 }
168