StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtSmearPair.cxx
1 /***************************************
2  * $Id: StHbtSmearPair.cxx,v 1.2 2003/09/02 17:58:32 perev Exp $
3  *
4  * Author: Mike Lisa, Ohio State lisa@mps.ohio-state.edu
5  ****************************************
6  *
7  * Description: given a StHbtPair, this class provides a corresponding
8  * StHbtPair whose constituent StHbtParticles' momenta have been
9  * smeared according to a parameterization of the STAR momentum
10  * resolution.
11  * >> The input StHbtPair is not altered in anyway <<
12  *
13  ******************************************
14  *
15  * $Log: StHbtSmearPair.cxx,v $
16  * Revision 1.2 2003/09/02 17:58:32 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.1 2001/05/23 00:19:05 lisa
20  * Add in Smearing classes and methods needed for momentum resolution studies and correction
21  *
22  *
23  ******************************************/
24 
25 #include "StHbtSmearPair.h"
26 #include "StRandom.hh"
27 
28 #ifdef __ROOT__
29 ClassImp(StHbtSmearPair)
30 #endif
31 
32 
33 //______________________________________
34 StHbtSmearPair::StHbtSmearPair(){
35  setup();
36 }
37 //______________________________________
38 StHbtSmearPair::StHbtSmearPair(const StHbtPair* unSmearedPair){
39  setup();
40  SetUnsmearedPair(unSmearedPair);
41 }
42 //______________________________________
43 void StHbtSmearPair::setup(){
44  mSmearedPair.SetTrack1(&mParticle1);
45  mSmearedPair.SetTrack2(&mParticle2);
46 }
47 //______________________________________
48 void StHbtSmearPair::SetUnsmearedPair(const StHbtPair* unSmearedPair){
49  mParticle1.ResetFourMomentum(SmearedMomentum(unSmearedPair->track1()->FourMomentum()));
50  mParticle2.ResetFourMomentum(SmearedMomentum(unSmearedPair->track2()->FourMomentum()));
51 }
52 //______________________________________
53 // philosophy behind this smearing is as follows:
54 // what we *measure* is pT (via curvature), and the angles phi and theta
55 // momentum is related to this via
56 // px = pT*cos(phi) --> Dpx = DpT*cos(phi) - pT*sin(phi)*Dphi = px*DpT/pT - py*Dphi
57 // py = pT*sin(phi) --> Dpy = DpT*sin(phi) + pT*cos(phi)*Dphi = py*DpT/pT + px*Dphi
58 // pz = pT/tan(theta) --> Dpz = DpT/tan(theta) - pT*Dtheta/(sin(theta))^2
59 // = pT*(DpT/pT)/tan(theta) - pT*Dtheta/(sin(theta))^2
60 // = pz*DpT/pT - pT*Dtheta/(sin(theta))^2
61 //______________________________________
62 StHbtLorentzVector StHbtSmearPair::SmearedMomentum(StHbtLorentzVector fourmom){
63  double pT = fourmom.perp();
64  double mass2 = fourmom.m2();
65  double px = fourmom.x();
66  double py = fourmom.y();
67  double pz = fourmom.z();
68  double sin2theta = sin(fourmom.theta());
69  sin2theta = sin2theta*sin2theta;
70  //
71  double DpT_div_pT = StRandom::gauss(0.0,mFracPtRes);
72  double Dphi = StRandom::gauss(0.0,mPhi_a+mPhi_b*::pow(pT,mPhi_alpha));
73  double Dtheta = StRandom::gauss(0.0,mTheta_a+mTheta_b*::pow(pT,mTheta_alpha));
74  //
75  fourmom.setX(px*(1.0+DpT_div_pT) - py*Dphi);
76  fourmom.setY(py*(1.0+DpT_div_pT) + px*Dphi);
77  fourmom.setZ(pz*(1.0+DpT_div_pT) - pT*Dtheta/sin2theta);
78  fourmom.setE(::sqrt(mass2 + fourmom.x()*fourmom.x()+fourmom.y()*fourmom.y()+fourmom.z()*fourmom.z()));
79  //
80  return fourmom;
81 }
82