StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtSmearedHiddenInfo.cxx
1 /*******************************************************************
2  * The StHbtSmearedHiddenInfo class
3  * Author: Adam Kisiel
4  *******************************************************************/
5 #include "StHbtMaker/ThCorrFctn/StHbtSmearedHiddenInfo.h"
6 #include "TMath.h"
7 #define DEGTORAD 0.017453293
8 
9 StHbtSmearedHiddenInfo::StHbtSmearedHiddenInfo()
10 {/* no-op */};
11 
12 StHbtSmearedHiddenInfo::StHbtSmearedHiddenInfo(const StHbtLorentzVector& aInitialMom,
13  const StHbtLorentzVector& aFreezeOut,
14  const int& aPid,
15  TRandom* aRand,
16  const StHbtMomRes* aMomRes)
17  :
18  mPid(aPid)
19 {
20  setInitialMom(&aInitialMom, aRand, aMomRes);
21  setFreezeOut(&aFreezeOut);
22 }
23 
24 StHbtSmearedHiddenInfo::StHbtSmearedHiddenInfo(const StHbtSmearedHiddenInfo& aHiddenInfo)
25  :
26  mSmearedMom(aHiddenInfo.getSmearedMom()),
27  mPid(aHiddenInfo.getPid())
28 {
29  mFreezeOut = new StHbtLorentzVector(aHiddenInfo.getFreezeOut());
30 };
31 
32 StHbtSmearedHiddenInfo::StHbtSmearedHiddenInfo(const StHbtLorentzVector& aSmearedMom,
33  const StHbtLorentzVector& aFreezeOut,
34  const int& aPid):
35  mSmearedMom(aSmearedMom),
36  mPid(aPid)
37 {
38  mFreezeOut = new StHbtLorentzVector(aFreezeOut);
39 };
40 
41 StHbtSmearedHiddenInfo::~StHbtSmearedHiddenInfo()
42 {
43  if (mFreezeOut) delete mFreezeOut;
44 };
45 
46 inline const StHbtLorentzVector& StHbtSmearedHiddenInfo::getSmearedMom() const {
47  return mSmearedMom;
48 }
49 
50 inline StHbtLorentzVector& StHbtSmearedHiddenInfo::getFreezeOut() const
51 {
52  return *mFreezeOut;
53 }
54 
55 inline int StHbtSmearedHiddenInfo::getPid() const
56  {return mPid;}
57 
58 inline void StHbtSmearedHiddenInfo::setInitialMom(const StHbtLorentzVector* aP, TRandom* aRand, const StHbtMomRes* aMomRes) {
59  /* Smears the initial momentum according to the
60  * power-law parametrization and stores the
61  * smeared momentum as a hidden information */
62 
63  /* Getting the initial momentum */
64  Float_t px = aP->x();
65  Float_t py = aP->y();
66  Float_t pz = aP->z();
67 
68  /* Calculating helper veriables */
69  Float_t totmom = sqrt ((px * px) + (py * py) + (pz * pz));
70  Float_t per = aMomRes->getPtError(totmom);
71  Float_t thetaan = TMath::ATan2(hypot(px,py),pz);
72  Float_t phier = aMomRes->getPhiError(totmom);
73  Float_t thetaer = aMomRes->getThetaError(totmom);
74  Float_t pshift = aMomRes->getPShift(totmom);
75 
76  /* Rescale the momnentum components according to the P shift */
77  // Float_t rescale = (totmom - (pshift * totmom)) / totmom;
78  // pP shift now an absolute value
79  Float_t rescale = (totmom - pshift) / totmom;
80  // cout << "Rescale: " << rescale << endl;
81 
82  /* Getting the error distribution widths */
83  // Float_t Deltapx = px * pter - py * phier * DEGTORAD;
84  // Float_t Deltapy = py * pter + px * phier * DEGTORAD;
85  // Float_t Deltapz = pz * pter + ptmom * thetaer * DEGTORAD / (::pow((ptmom/pz),2));
86  // Angles now in readians - do not recalculate them!
87  Float_t Deltapx = TMath::Abs(px) * per + TMath::Abs(py) * phier + TMath::Abs(px * (1/TMath::Tan(thetaan))) * thetaer;
88  Float_t Deltapy = TMath::Abs(py) * per + TMath::Abs(px) * phier + TMath::Abs(py * (1/TMath::Tan(thetaan))) * thetaer;
89  Float_t Deltapz = TMath::Abs(pz) * per + TMath::Abs(pz * TMath::Tan(thetaan)) * thetaer;
90 
91 
92  /* storing the smeared momentum in the hidden info */
93  mSmearedMom.setX((px + aRand->Gaus(0,fabs(Deltapx))) * rescale);
94  mSmearedMom.setY((py + aRand->Gaus(0,fabs(Deltapy))) * rescale);
95  mSmearedMom.setZ((pz + aRand->Gaus(0,fabs(Deltapz))) * rescale);
96 
97  /* Calclating the energy */
98  switch (abs(mPid)) {
99  case 211:
100  mSmearedMom.setT(::sqrt((0.139*0.139 + mSmearedMom.x() * mSmearedMom.x() + mSmearedMom.y() * mSmearedMom.y() + mSmearedMom.z() * mSmearedMom.z())));
101  break;
102  case 321:
103  mSmearedMom.setT(::sqrt((0.493*0.493 + mSmearedMom.x() * mSmearedMom.x() + mSmearedMom.y() * mSmearedMom.y() + mSmearedMom.z() * mSmearedMom.z())));
104  break;
105  case 2212:
106  mSmearedMom.setT(::sqrt((0.938*0.938 + mSmearedMom.x() * mSmearedMom.x() + mSmearedMom.y() * mSmearedMom.y() + mSmearedMom.z() * mSmearedMom.z())));
107  break;
108 
109  }
110 }
111 
112 inline void StHbtSmearedHiddenInfo:: setPid(int aPid)
113 { mPid=aPid; }
114 
115 inline void StHbtSmearedHiddenInfo:: setFreezeOut(const StHbtLorentzVector* aFreezeOut)
116 { mFreezeOut = new StHbtLorentzVector(*aFreezeOut); }
117 
118 inline StHbtHiddenInfo* StHbtSmearedHiddenInfo::getParticleHiddenInfo()
119  const
120 {return new StHbtSmearedHiddenInfo(mSmearedMom, *mFreezeOut, mPid);}
121 
122 inline StHbtLorentzVector& StHbtSmearedHiddenInfo::getMomentum()
123 {
124  return mSmearedMom;
125 }
126