StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuFmsPoint.cxx
1 /*****************************************************************************
2  *
3  * $Id: StMuFmsPoint.cxx,v 1.2 2015/09/02 22:09:58 jdb Exp $
4  *
5  * Author: Thomas Burton, 2014
6  *****************************************************************************
7  *
8  * Description: Implementation of StMuFmsPoint, the MuDST FMS "point" class
9  *
10  *****************************************************************************
11  *
12  * $Log: StMuFmsPoint.cxx,v $
13  * Revision 1.2 2015/09/02 22:09:58 jdb
14  * Added Akios changes to Fms
15  *
16  *
17  *****************************************************************************/
18 #include "StMuFmsPoint.h"
19 
20 #include <algorithm> // For std::min
21 #include <cmath>
22 
23 #include "StFmsPoint.h"
24 #include "StMuFmsCluster.h"
25 
26 StMuFmsPoint::StMuFmsPoint(int detectorId, float energy,
27  float x, float y, int id)
28  : mDetectorId(detectorId), mEnergy(energy), mX(x), mY(y), mId(id) { }
29 
30 StMuFmsPoint::StMuFmsPoint(const StFmsPoint& point) {
31  set(point);
32 }
33 
34 StMuFmsPoint::~StMuFmsPoint() { }
35 
36 StThreeVectorF StMuFmsPoint::momentum(float m, float zvertex) const {
37  m = std::min(m, mEnergy); // Prevent m > E
38  StThreeVectorF v(mXYZ.x(),mXYZ.y(),mXYZ.z()-zvertex);
39  if (std::fabs(m) > 0.f) {
40  v.setMag(std::sqrt(std::pow(mEnergy, 2.f) - std::pow(m, 2.f)));
41  } else {
42  v.setMag(mEnergy);
43  } // if
44  return v;
45 }
46 
47 StLorentzVectorF StMuFmsPoint::fourMomentum(float m, float zvertex) const {
48  return StLorentzVectorF(momentum(m,zvertex), mEnergy);
49 }
50 
51 StMuFmsCluster* StMuFmsPoint::cluster() {
52  return static_cast<StMuFmsCluster*>(mCluster.GetObject());
53 }
54 
55 const StMuFmsCluster* StMuFmsPoint::cluster() const {
56  return static_cast<const StMuFmsCluster*>(mCluster.GetObject());
57 }
58 
59 void StMuFmsPoint::set(const StFmsPoint& point) {
60  mDetectorId = point.detectorId();
61  mEnergy = point.energy();
62  mX = point.x();
63  mY = point.y();
64  mId= point.id();
65  mXYZ = point.XYZ();
66  // Calculate z coordinate from StFmsPoint 4-momentum as it doesn't store
67  // z directly. z / x = pz / px, so...
68  // const StLorentzVectorF vec4 = point.fourMomentum();
69  // mZ = point.x() * vec4.pz() / vec4.px();
70 }
71 
72 void StMuFmsPoint::setCluster(StMuFmsCluster* cluster) {
73  mCluster = cluster;
74 }
Float_t mEnergy
Total energy contained in the point.
Definition: StMuFmsPoint.h:70
Float_t mX
Mean x (&quot;center of gravity&quot;)
Definition: StMuFmsPoint.h:71
TRef mCluster
Parent cluster of this photon.
Definition: StMuFmsPoint.h:75
Float_t mY
Mean y (&quot;center of gravity&quot;)
Definition: StMuFmsPoint.h:72
StThreeVectorF mXYZ
point Id
Definition: StMuFmsPoint.h:74
UShort_t mDetectorId
Detector ID as defined in database.
Definition: StMuFmsPoint.h:69