StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtShiftedHiddenInfo.cxx
1 /*******************************************************************
2  * The StHbtShiftedHiddenInfo class
3  * Author: Adam Kisiel
4  *******************************************************************/
5 #include "StHbtMaker/ThCorrFctn/StHbtShiftedHiddenInfo.h"
6 
7 #define DEGTORAD 0.017453293
8 
9 StHbtShiftedHiddenInfo::StHbtShiftedHiddenInfo() {/* no-op */};
10 StHbtShiftedHiddenInfo::StHbtShiftedHiddenInfo(const StHbtLorentzVector& aInitialMom,
11  const int& aPid,
12  TRandom* aRand,
13  const StHbtMomRes* aMomRes,
14  const double momShift,
15  const ShiftType aShiftType)
16  :
17  mPid(aPid), mMomShift(momShift), mShiftType(aShiftType)
18 {
19  setInitialMom(&aInitialMom, aRand, aMomRes);
20 }
21 
22 StHbtShiftedHiddenInfo::StHbtShiftedHiddenInfo(const StHbtShiftedHiddenInfo& aHiddenInfo)
23  :
24  mShiftedMom(aHiddenInfo.getShiftedMom()),
25  mPid(aHiddenInfo.getPid())
26 { /* no-op */ };
27 
28 StHbtShiftedHiddenInfo::StHbtShiftedHiddenInfo(const StHbtLorentzVector& aShiftedMom,
29  const int& aPid):
30  mShiftedMom(aShiftedMom),
31  mPid(aPid)
32 { /* no-op */ };
33 
34 StHbtShiftedHiddenInfo::~StHbtShiftedHiddenInfo()
35 {/* no-op */};
36 
37 
38 inline const StHbtLorentzVector StHbtShiftedHiddenInfo::getShiftedMom() const {
39  return mShiftedMom;
40 }
41 
42 inline int StHbtShiftedHiddenInfo::getPid() const
43  {return mPid;}
44 
45 inline void StHbtShiftedHiddenInfo::setInitialMom(const StHbtLorentzVector* aP, TRandom* aRand, const StHbtMomRes* aMomRes) {
46  Double_t px = aP->x();
47  Double_t py = aP->y();
48  Double_t pz = aP->z();
49  Double_t shift;
50 
51  /* Shift the momentum based on the sign of the particle */
52  switch (mShiftType) {
53  case PSHIFT:
54  shift = (mPid > 0) ? 1.0 + mMomShift : shift = 1.0 - mMomShift;
55  px *= shift;
56  py *= shift;
57  pz *= shift;
58  break;
59  case PTSHIFT:
60  shift = (mPid > 0) ? 1.0 + mMomShift : shift = 1.0 - mMomShift;
61  px *= shift;
62  py *= shift;
63  break;
64  case PHISHIFT:
65  Double_t thephi = atan(py/px);
66  Double_t pt = hypot(px, py);
67 
68  if (px < 0)
69  thephi += 3.14159;
70 
71  // thephi += (1 - pt) * mMomShift * pt * (abs(mPid) / mPid);
72  if (abs(mPid) == 321)
73  thephi += mMomShift;
74  px = pt * cos(thephi);
75  py = pt * sin(thephi);
76  break;
77  }
78 
79  Double_t ptmom = hypot(px, py);
80  Double_t pter = aMomRes->getPtError(ptmom);
81  Double_t totmom = sqrt ((px * px) + (py * py) + (pz * pz));
82  Double_t phier = aMomRes->getPhiError(totmom);
83  Double_t thetaer = aMomRes->getThetaError(totmom);
84  Double_t Deltapx = px * pter - py * phier * DEGTORAD;
85  Double_t Deltapy = py * pter + px * phier * DEGTORAD;
86  Double_t Deltapz = pz * pter + ptmom * thetaer * DEGTORAD / (::pow((ptmom/pz),2));
87  mShiftedMom.setX(px + aRand->Gaus(0,fabs(Deltapx)));
88  mShiftedMom.setY(py + aRand->Gaus(0,fabs(Deltapy)));
89  mShiftedMom.setZ(pz + aRand->Gaus(0,fabs(Deltapz)));
90  switch (abs(mPid)) {
91  case 211:
92  mShiftedMom.setT(::sqrt((0.139*0.139 + mShiftedMom.x() * mShiftedMom.x() + mShiftedMom.y() * mShiftedMom.y() + mShiftedMom.z() * mShiftedMom.z())));
93  break;
94  case 321:
95  mShiftedMom.setT(::sqrt((0.493*0.493 + mShiftedMom.x() * mShiftedMom.x() + mShiftedMom.y() * mShiftedMom.y() + mShiftedMom.z() * mShiftedMom.z())));
96  break;
97  case 2212:
98  mShiftedMom.setT(::sqrt((0.938*0.938 + mShiftedMom.x() * mShiftedMom.x() + mShiftedMom.y() * mShiftedMom.y() + mShiftedMom.z() * mShiftedMom.z())));
99  break;
100 
101  }
102 }
103 
104 inline void StHbtShiftedHiddenInfo:: setPid(int aPid)
105 { mPid=aPid;}
106 
107 inline void StHbtShiftedHiddenInfo::setShiftType(ShiftType aShiftType)
108 { mShiftType = aShiftType; }
109 
110 inline StHbtHiddenInfo* StHbtShiftedHiddenInfo::getParticleHiddenInfo()
111  const
112 {return new StHbtShiftedHiddenInfo(mShiftedMom, mPid);}
113 
114 inline StHbtLorentzVector StHbtShiftedHiddenInfo::getMomentum() const
115 {
116  return mShiftedMom;
117 }
118 
119 inline void StHbtShiftedHiddenInfo::setShift(double momShift)
120 {
121  mMomShift = momShift;
122 }
123