KTrack.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 ///
3 /// \file KTrack.h
4 ///
5 /// \brief Basic Kalman filter track class, without error.
6 ///
7 /// \author H. Greenlee
8 ///
9 /// This class include the following attributes.
10 ///
11 /// 1. Surface.
12 /// 2. Track state vector.
13 /// 3. Track direction parameter.
14 /// 4. Particle id hypothesis.
15 ///
16 /// The surface attribute is polymorphic, and is held via
17 /// std::shared_ptr type of smart pointer, which handles memory
18 /// management using reference-counted shared ownership.
19 ///
20 ////////////////////////////////////////////////////////////////////////
21 
22 #ifndef KTRACK_H
23 #define KTRACK_H
24 
25 #include <iosfwd>
26 #include <memory>
29 
30 namespace trkf {
31 
32  class KTrack
33  {
34  public:
35 
36  /// Enum
37 
38  /// Default constructor.
39  KTrack();
40 
41  /// Constructor - specify surface only.
42  KTrack(const std::shared_ptr<const Surface>& psurf);
43 
44  /// Constructor - surface + track parameters.
45  KTrack(std::shared_ptr<const Surface> psurf,
46  const TrackVector& vec,
48  int pdg = 0);
49 
50  /// Destructor.
51  virtual ~KTrack();
52 
53  // Accessors.
54 
55  const std::shared_ptr<const Surface>& getSurface() const {return fSurf;} ///< Surface.
56  const TrackVector& getVector() const {return fVec;} ///< Track state vector.
57  Surface::TrackDirection getDirection() const; ///< Track direction.
58  int PdgCode() const {return fPdgCode;} ///< Pdg code.
59  double Mass() const; ///< Based on pdg code.
60 
61  // Modifiers.
62 
63  TrackVector& getVector() {return fVec;} ///< Modifiable state vector.
64 
65  /// Set surface.
66  void setSurface(const std::shared_ptr<const Surface>& psurf) {fSurf = psurf;}
67  void setVector(const TrackVector& vec) {fVec = vec;} ///< Set state vector.
68  void setDirection(Surface::TrackDirection dir) {fDir = dir;} ///< Set direction.
69  void setPdgCode(int pdg) {fPdgCode = pdg;} ///< Set pdg code.
70 
71  /// Test if track is valid.
72  bool isValid() const;
73 
74  /// Get position of track.
75  void getPosition(double xyz[3]) const;
76 
77  /// Get momentum vector of track.
78  void getMomentum(double mom[3]) const;
79 
80  /// Get x-latitude.
81  double XLatitude() const;
82 
83  /// Get x-longitude.
84  double XLongitude() const;
85 
86  /// Printout
87  virtual std::ostream& Print(std::ostream& out, bool doTitle = true) const;
88 
89  private:
90 
91  // Attributes.
92 
93  std::shared_ptr<const Surface> fSurf; ///< Track surface.
94  TrackVector fVec; ///< Track state vector.
95  Surface::TrackDirection fDir; ///< Track direction.
96  int fPdgCode; ///< Pdg id. hypothesis.
97  };
98 
99  /// Output operator.
100  std::ostream& operator<<(std::ostream& out, const KTrack& trk);
101 }
102 
103 #endif
TrackVector fVec
Track state vector.
Definition: KTrack.h:94
TrackDirection
Track direction enum.
Definition: Surface.h:56
std::shared_ptr< const Surface > fSurf
Track surface.
Definition: KTrack.h:93
double Mass() const
Based on pdg code.
Definition: KTrack.cxx:129
const std::shared_ptr< const Surface > & getSurface() const
Surface.
Definition: KTrack.h:55
double XLongitude() const
Get x-longitude.
Definition: KTrack.cxx:201
void setPdgCode(int pdg)
Set pdg code.
Definition: KTrack.h:69
void setVector(const TrackVector &vec)
Set state vector.
Definition: KTrack.h:67
void setDirection(Surface::TrackDirection dir)
Set direction.
Definition: KTrack.h:68
TrackVector & getVector()
Modifiable state vector.
Definition: KTrack.h:63
string dir
void setSurface(const std::shared_ptr< const Surface > &psurf)
Set surface.
Definition: KTrack.h:66
int fPdgCode
Pdg id. hypothesis.
Definition: KTrack.h:96
std::ostream & operator<<(std::ostream &out, const KGTrack &trg)
Output operator.
Definition: KGTrack.cxx:309
void getPosition(double xyz[3]) const
Get position of track.
Definition: KTrack.cxx:171
Base class for Kalman filter surface.
KTrack()
Enum.
Definition: KTrack.cxx:29
virtual ~KTrack()
Destructor.
Definition: KTrack.cxx:66
KVector< 5 >::type TrackVector
Track state vector, dimension 5.
virtual std::ostream & Print(std::ostream &out, bool doTitle=true) const
Printout.
Definition: KTrack.cxx:227
Surface::TrackDirection fDir
Track direction.
Definition: KTrack.h:95
Kalman filter linear algebra typedefs.
const TrackVector & getVector() const
Track state vector.
Definition: KTrack.h:56
int PdgCode() const
Pdg code.
Definition: KTrack.h:58
void getMomentum(double mom[3]) const
Get momentum vector of track.
Definition: KTrack.cxx:218
Surface::TrackDirection getDirection() const
Track direction.
Definition: KTrack.cxx:73
bool isValid() const
Test if track is valid.
Definition: KTrack.cxx:91
double XLatitude() const
Get x-latitude.
Definition: KTrack.cxx:184