StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFwdTrack.h
1 /***************************************************************************
2  *
3  * $Id: StFwdTrack.h,v 2.1 2021/01/11 20:25:37 ullrich Exp $
4  *
5  * Author: jdb, Feb 2022
6  ***************************************************************************
7  *
8  * Description: StFwdTrack stores the Forward tracks built from Fst and Ftt
9  *
10  ***************************************************************************
11  *
12  * $Log: StFwdTrack.h,v $
13  * Revision 2.1 2021/01/11 20:25:37 ullrich
14  * Initial Revision
15  *
16  **************************************************************************/
17 #ifndef StFwdTrack_hh
18 #define StFwdTrack_hh
19 
20 #include "Stiostream.h"
21 #include "StObject.h"
22 #include <vector>
23 #include "StThreeVectorD.hh"
24 #include "StContainers.h"
25 
26 class StFcsCluster;
27 
28 
29 struct StFwdTrackProjection : public StObject {
32  mXYZ = other.mXYZ;
33  mMom = other.mMom;
34  mDetId = other.mDetId;
35  memcpy( mCov, other.mCov, sizeof( mCov ) );
36  }
37  StFwdTrackProjection( unsigned short detId,
38  StThreeVectorD xyz,
39  StThreeVectorD mom,
40  float c[9] ) {
41  set( detId, xyz, mom, c );
42  }
43 
44  void set( unsigned short detId,
45  StThreeVectorD xyz,
46  StThreeVectorD mom,
47  float c[9]) {
48  mDetId = detId;
49  mXYZ = xyz;
50  mMom = mom;
51  memcpy( mCov, c, sizeof(mCov) );
52  }
53  void set(const StFwdTrackProjection &other ){
54  mDetId = other.mDetId;
55  mXYZ = other.mXYZ;
56  mMom = other.mMom;
57  memcpy( mCov, other.mCov, sizeof(mCov) );
58  }
59  StThreeVectorD mXYZ;
60  StThreeVectorD mMom;
61  unsigned char mDetId;
62  float mCov[9];
63 
64  float dx(){
65  return sqrt( mCov[0] );
66  }
67  float dy(){
68  return sqrt( mCov[4] );
69  }
70  float dz(){
71  return sqrt( mCov[8] );
72  }
73 
74  ClassDef(StFwdTrackProjection, 1)
75 };
76 
77 struct StFwdTrackSeedPoint : public StObject {
80  short sec,
81  unsigned short trackId,
82  float cov[9] ){
83  mXYZ = xyz;
84  mSector = sec;
85  mTrackId = trackId;
86  memcpy( mCov, cov, sizeof( mCov ));
87  }
88 
89  StThreeVectorD mXYZ;
90  unsigned short mTrackId;
91  short mSector;
92  float mCov[9];
93 
94  ClassDef(StFwdTrackSeedPoint, 1)
95 };
96 
97 class StFwdTrack : public StObject {
98 
99 public:
100  StFwdTrack( );
101 
102  vector<StFwdTrackProjection> mProjections;
103  vector<StFwdTrackSeedPoint> mFTTPoints;
104  vector<StFwdTrackSeedPoint> mFSTPoints;
105 
106  StFwdTrackProjection getProjectionFor( int detectorId,
107  size_t index = 0 );
108 
109  StThreeVectorD momentum() const;
110  StThreeVectorD momentumAt(size_t _id = 0) const;
111  char charge() const;
112 
113 
114  // Quality of the fit
115  bool didFitConverge() const;
116  bool didFitConvergeFully() const;
117  short numberOfFailedPoints() const;
118  double chi2() const;
119  double ndf() const;
120  double pval() const;
121 
122  // error on pT upper and lower 1-sigma values
123  // add access to cov matrix
124 
125  // Number of fit points used by GenFit
126  short numberOfFitPoints() const;
127  // unsigned int numberOfPossibleFitPoints() const;
128 
129  // Number of points used in the track seed step
130  short numberOfSeedPoints() const;
131 
132 
133  void setPrimaryMomentum( StThreeVectorD mom ) { mPrimaryMomentum = mom; }
134  void setDidFitConverge( bool lDidFitConverge ) { mDidFitConverge = lDidFitConverge; }
135  void setDidFitConvergeFully( bool lDidFitConvergeFully ) { mDidFitConvergeFully = lDidFitConvergeFully;}
136  void setNumberOfFailedPoints( short lNumberOfFailedPoints ) { mNumberOfFailedPoints = lNumberOfFailedPoints;}
137  void setNumberOfSeedPoints( short lNumberOfSeedPoints ) { mNumberOfSeedPoints = lNumberOfSeedPoints;}
138  void setNumberOfFitPoints( short lNumberOfFitPoints ) { mNumberOfFitPoints = lNumberOfFitPoints;}
139  void setChi2( float lChi2 ) { mChi2 = lChi2;}
140  void setNDF( float lNDF ) { mNDF = lNDF;}
141  void setPval( float lPval ) { mPval = lPval;}
142  void setCharge( short lCharge ) { mCharge = lCharge;}
143 
144  // ECAL clusters
145  StPtrVecFcsCluster& ecalClusters();
146  const StPtrVecFcsCluster& ecalClusters() const;
147  void addEcalCluster(StFcsCluster* p);
148  void sortEcalClusterByET();
149  // HCAL clusters
150  StPtrVecFcsCluster& hcalClusters();
151  const StPtrVecFcsCluster& hcalClusters() const;
152  void addHcalCluster(StFcsCluster* p);
153  void sortHcalClusterByET();
154 
155 
156 protected:
157 
158 
159 
160  // Track quality and convergence
161  bool mDidFitConverge;
162  bool mDidFitConvergeFully;
163  short mNumberOfFailedPoints;
164  short mNumberOfSeedPoints;
165  short mNumberOfFitPoints;
166  float mChi2;
167  float mNDF;
168  float mPval;
169  short mCharge;
170  StThreeVectorD mPrimaryMomentum;
171 
172 
173  StPtrVecFcsCluster mEcalClusters;
174  StPtrVecFcsCluster mHcalClusters;
175 
176  ClassDef(StFwdTrack,2)
177 
178 };
179 
180 #endif
181