StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFwdTrack.cxx
1 #include "StFwdTrack.h"
2 #include "StEvent/StFcsCluster.h"
3 #include "St_base/StMessMgr.h"
4 
5 StFwdTrack::StFwdTrack() {
6 
7 }
8 
9 
10 /* momentum
11  * get the track momentum at the first point (PV if included)
12  */
13 StThreeVectorD StFwdTrack::momentum() const{
14  return mPrimaryMomentum;
15 }
16 
17 /* momentumAt
18  * get the track momentum at the nthh point (if available)
19  */
20 StThreeVectorD StFwdTrack::momentumAt(size_t _id) const{
21  if ( _id >= mProjections.size() )
22  return StThreeVectorD( 0, 0, 0 );
23 
24  return mProjections[_id].mMom;
25 }
26 
27 char StFwdTrack::charge() const{
28  return mCharge;
29 }
30 
31 bool StFwdTrack::didFitConverge() const {
32  return mDidFitConverge;
33 }
34 
35 bool StFwdTrack::didFitConvergeFully() const {
36  return mDidFitConvergeFully;
37 }
38 
39 short StFwdTrack::numberOfFailedPoints() const {
40  return mNumberOfFailedPoints;
41 }
42 
43 double StFwdTrack::chi2() const {
44  return mChi2;
45 }
46 
47 double StFwdTrack::ndf() const {
48  return mNDF;
49 }
50 
51 double StFwdTrack::pval() const {
52  return mPval;
53 }
54 
55 short StFwdTrack::numberOfFitPoints() const {
56  return mNumberOfFitPoints;
57 }
58 
59 short StFwdTrack::numberOfSeedPoints() const {
60  return mNumberOfSeedPoints;
61 }
62 
63 
64 StPtrVecFcsCluster& StFwdTrack::ecalClusters() { return mEcalClusters; }
65 const StPtrVecFcsCluster& StFwdTrack::ecalClusters() const { return mEcalClusters; }
66 void StFwdTrack::addEcalCluster(StFcsCluster* p){mEcalClusters.push_back(p);}
67 void StFwdTrack::sortEcalClusterByET() {
68  std::sort(mEcalClusters.begin(), mEcalClusters.end(), [](StFcsCluster* a, StFcsCluster* b) {
69  return b->fourMomentum().perp() < a->fourMomentum().perp();
70  });
71 }
72 
73 StPtrVecFcsCluster& StFwdTrack::hcalClusters() { return mHcalClusters; }
74 const StPtrVecFcsCluster& StFwdTrack::hcalClusters() const { return mHcalClusters; }
75 void StFwdTrack::addHcalCluster(StFcsCluster* p){mHcalClusters.push_back(p);}
76 void StFwdTrack::sortHcalClusterByET() {
77  std::sort(mHcalClusters.begin(), mHcalClusters.end(), [](StFcsCluster* a, StFcsCluster* b) {
78  return b->fourMomentum().perp() < a->fourMomentum().perp();
79  });
80 }
81 
82 StFwdTrackProjection StFwdTrack::getProjectionFor( int detectorId,
83  size_t index ){
84  StFwdTrackProjection result;
85  size_t count = 0;
86  for ( auto proj : mProjections ){
87  if (proj.mDetId == detectorId){
88  result.set( proj );
89  if ( count == index )
90  return result;
91  count++;
92  }
93  }
94  StFwdTrackProjection resultNull;
95  return resultNull;
96 }