20 #include "StHbtMaker/Base/StHbtThPair.hh"
21 #include "StHbtMaker/Base/StHbtFsiWeight.hh"
27 StHbtThPair::StHbtThPair(){
28 mMomentum1=mMomentum2=mEmPoint1=mEmPoint2=0;
32 mWeightNum=mWeightDen=1.;
37 void StHbtThPair::setVariables(
const StHbtPair*){
41 void StHbtThPair::setMomRes1(
int aPid){
42 if(aPid==7 || aPid==8){
57 if(aPid==11 || aPid==12){
61 void StHbtThPair::setMomRes2(
int aPid){
62 if(aPid==7 || aPid==8){
77 if(aPid==11 || aPid==12){
83 void StHbtThPair::UpdateWeight() {
85 mWeightNum=mWeight->GetWeight(
this);
86 mWeightNum=(mWeightNum-1.)*mPairPurity+1.;
87 mWeightDen=mWeight->GetWeightDen();
88 if(mWeightNum<=0. || mWeightNum>1000.){
89 std::ostringstream tCom;
90 tCom <<
"echo ---> " << mWeightNum <<
" "
91 << mEmPoint1 <<
" " << mEmPoint2 <<
" "
92 << mMomentum1 <<
" " << mMomentum2 <<
" >> Err.txt" << ends;
93 system(tCom.str().c_str());
97 cout <<
"StHbtThPair Error - No Weight Generator plugged - set to 1 " <<endl;
98 mWeightNum=mWeightDen=1.;
103 StHbtString StHbtThPair::Report() {
104 std::ostringstream tStr;
105 tStr <<
"Default StHbtThPair Report" << endl;
107 tStr << mWeight->Report() << endl;
109 tStr <<
"No Weight Generator plugged - Weight set to 1 " << endl;
111 StHbtString returnThis = tStr.str();
115 double StHbtThPair::RealqSideCMS()
const {
116 double x1 = mMomentum1->x();
double y1 = mMomentum1->y();
117 double x2 = mMomentum2->x();
double y2 = mMomentum2->y();
119 double xt = x1+x2;
double yt = y1+y2;
120 double k1 = ::sqrt(xt*xt+yt*yt);
122 double tmp = 2.0*(x1*y2-x2*y1)/k1;
126 double StHbtThPair::RealqOutCMS()
const {
127 double dx = mMomentum1->x() - mMomentum2->x();
128 double xt = mMomentum1->x() + mMomentum2->x();
130 double dy = mMomentum1->y() - mMomentum2->y();
131 double yt = mMomentum1->y() + mMomentum2->y();
133 double k1 = (::sqrt(xt*xt+yt*yt));
134 double k2 = (dx*xt+dy*yt);
138 double StHbtThPair::RealqLongCMS()
const {
139 double dz = mMomentum1->z() - mMomentum2->z();
140 double zz = mMomentum1->z() + mMomentum2->z();
142 double dt = mMomentum1->t() - mMomentum2->t();
143 double tt = mMomentum1->t() + mMomentum2->t();
146 double gamma = 1.0/::sqrt(1.0 - beta*beta);
148 double temp = gamma*(dz - beta*dt);
153 double StHbtThPair::RealqOutPf()
const
155 double dt = mMomentum1->t() - mMomentum2->t();
156 double tt = mMomentum1->t() + mMomentum2->t();
158 double xt = mMomentum1->x() + mMomentum2->x();
159 double yt = mMomentum1->y() + mMomentum2->y();
161 double k1 = ::sqrt(xt*xt + yt*yt);
163 double gOut = 1.0/::sqrt(1.0 - bOut*bOut);
165 double temp = gOut*(this->RealqOutCMS() - bOut*dt);
170 double StHbtThPair::RealqSidePf()
const
172 return(this->RealqSideCMS());
177 double StHbtThPair::RealqLongPf()
const
179 return(this->RealqLongCMS());
184 void StHbtThPair::calcMomParameters()
const{
187 double tPx1(mMomentum1->px());
188 double tPy1(mMomentum1->py());
189 double tPz1(mMomentum1->pz());
190 double tE1(mMomentum1->e());
191 double tPx(tPx1+mMomentum2->px());
192 double tPy(tPy1+mMomentum2->py());
193 double tPz(tPz1+mMomentum2->pz());
194 double tE(tE1 +mMomentum2->e());
195 mPt = tPx*tPx + tPy*tPy;
197 double tMt = tE*tE - tP;
200 double tM = ::sqrt(tMt - mPt);
207 double tBeta = tPz/tE;
208 double tGamma = tE/tMt;
209 mKStarLong = tGamma * (tPz1 - tBeta * tE1);
210 double tE1L = tGamma * (tE1 - tBeta * tPz1);
213 mKStarOut = ( tPx1*tPx + tPy1*tPy)/mPt;
214 mKStarSide = (-tPx1*tPy + tPy1*tPx)/mPt;
217 mKStarOut = tMt/tM * (mKStarOut - mPt/tMt * tE1L);
219 mKStar = ::sqrt(mKStarOut*mKStarOut+mKStarSide*mKStarSide+
220 mKStarLong*mKStarLong);
222 mCVK = (mKStarOut*mPt + mKStarLong*tPz)/mKStar/mCVK;
223 mKStarLong = (tPz>=0)* mKStarLong - (tPz<0)*mKStarLong;
228 void StHbtThPair::calcPosParameters()
const{
231 double tPx = mMomentum1->px()+mMomentum2->px();
232 double tPy = mMomentum1->py()+mMomentum2->py();
233 double tPz = mMomentum1->pz()+mMomentum2->pz();
234 double tE = mMomentum1->e()+mMomentum2->e();
235 double tPt = tPx*tPx + tPy*tPy;
236 double tMt = tE*tE - tPz*tPz;
237 double tM = ::sqrt(tMt - tPt);
241 double tDX = mEmPoint1->x()-mEmPoint2->x();
242 double tDY = mEmPoint1->y()-mEmPoint2->y();
243 mRLong = mEmPoint1->z()-mEmPoint2->z();
244 mDTime = mEmPoint1->t()-mEmPoint2->t();
246 mRTrans = tDX>0.? ::sqrt(tDX*tDX+tDY*tDY) : -1.*::sqrt(tDX*tDX+tDY*tDY);
247 mROut = (tDX*tPx + tDY*tPy)/tPt;
248 mRSide = (-tDX*tPy + tDY*tPx)/tPt;
249 mRSidePairCMS = mRSide;
252 double tBeta = tPz/tE;
253 double tGamma = tE/tMt;
254 mRLongPairCMS = tGamma*(mRLong - tBeta* mDTime);
255 mDTimePairLCMS = tGamma*(mDTime - tBeta* mRLong);
258 mROutPairCMS = tGamma*(mROut - tBeta* mDTimePairLCMS);
259 mDTimePairCMS = tGamma*(mDTimePairLCMS - tBeta* mROut);
260 mRStar = ::sqrt(mROutPairCMS*mROutPairCMS + mRSidePairCMS*mRSidePairCMS +
261 mRLongPairCMS*mRLongPairCMS);