StFms  0.0.0
FMS software in the STAR framework
StMuFmsPoint.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // $Log$
12 
13 #include <algorithm> // For std::min
14 #include <cmath>
15 
18 
19 StMuFmsPoint::StMuFmsPoint(int detectorId, float energy,
20  float x, float y, float z)
21  : mDetectorId(detectorId), mEnergy(energy), mX(x), mY(y), mZ(z) { }
22 
24  set(point);
25 }
26 
28 
29 TVector3 StMuFmsPoint::momentum(float m) const {
30  m = std::min(m, mEnergy); // Prevent m > E
31  TVector3 v(mX, mY, mZ);
32  if (std::fabs(m) > 0.f) {
33  v.SetMag(std::sqrt(std::pow(mEnergy, 2.f) - std::pow(m, 2.f)));
34  } else {
35  v.SetMag(mEnergy);
36  } // if
37  return v;
38 }
39 
40 TLorentzVector StMuFmsPoint::fourMomentum(float m) const {
41  return TLorentzVector(momentum(m), mEnergy);
42 }
43 
45  return static_cast<StMuFmsCluster*>(mCluster.GetObject());
46 }
47 
49  return static_cast<const StMuFmsCluster*>(mCluster.GetObject());
50 }
51 
52 void StMuFmsPoint::set(const StFmsPoint& point) {
53  mDetectorId = point.detectorId();
54  mEnergy = point.energy();
55  mX = point.x();
56  mY = point.y();
57  // Calculate z coordinate from StFmsPoint 4-momentum as it doesn't store
58  // z directly. z / x = pz / px, so...
59  const TLorentzVector vec4 = point.fourMomentum();
60  mZ = point.x() * vec4.Pz() / vec4.Px();
61 }
62 
64  mCluster = cluster;
65 }
void setCluster(StMuFmsCluster *cluster)
Declaration of StMuFmsPoint, the MuDST FMS "point" class.
StMuFmsCluster * cluster()
StMuFmsPoint(int detectorId=0, float energy=0.f, float x=0.f, float y=0.f, float z=0.f)
TRef mCluster
Parent cluster of this photon.
Definition: StMuFmsPoint.h:86
Float_t mZ
z at front face of sub-detector
Definition: StMuFmsPoint.h:85
Float_t y() const
Definition: StFmsPoint.h:40
TVector3 momentum(float m=0.f) const
Declaration of StFmsPoint, the StEvent FMS photon structure.
TLorentzVector fourMomentum(float m=0.f) const
void set(const StFmsPoint &)
UShort_t detectorId() const
Definition: StFmsPoint.h:34
Declaration of StMuFmsCluster, the MuDST FMS cluster class.
Float_t energy() const
Definition: StFmsPoint.h:36
Float_t x() const
Definition: StFmsPoint.h:38
TLorentzVector fourMomentum() const
Definition: StFmsPoint.h:52
Float_t mY
Mean y ("center of gravity")
Definition: StMuFmsPoint.h:84
UShort_t mDetectorId
Detector ID as defined in database.
Definition: StMuFmsPoint.h:81
virtual ~StMuFmsPoint()
Float_t mX
Mean x ("center of gravity")
Definition: StMuFmsPoint.h:83
Float_t mEnergy
Total energy contained in the point.
Definition: StMuFmsPoint.h:82