Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SvtxTrack_v4.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SvtxTrack_v4.h
1 #ifndef TRACKBASEHISTORIC_SVTXTRACKV4_H
2 #define TRACKBASEHISTORIC_SVTXTRACKV4_H
3 
4 #include "SvtxTrack.h"
5 #include "SvtxTrackState.h"
6 #include "TrackSeed.h"
7 
8 #include <trackbase/TrkrDefs.h>
9 
10 #include <cmath>
11 #include <cstddef> // for size_t
12 #include <iostream>
13 #include <map>
14 #include <utility> // for pair
15 
16 class PHObject;
17 
18 class SvtxTrack_v4: public SvtxTrack
19 {
20  public:
21  SvtxTrack_v4();
22 
23  //* base class copy constructor
24  SvtxTrack_v4( const SvtxTrack& );
25 
26  //* copy constructor
27  SvtxTrack_v4(const SvtxTrack_v4& );
28 
29  //* assignment operator
30  SvtxTrack_v4& operator=(const SvtxTrack_v4& track);
31 
32  //* destructor
33  ~SvtxTrack_v4() override;
34 
35  // The "standard PHObject response" functions...
36  void identify(std::ostream& os = std::cout) const override;
37  void Reset() override { *this = SvtxTrack_v4(); }
38  int isValid() const override;
39  PHObject* CloneMe() const override { return new SvtxTrack_v4(*this); }
40 
42  using PHObject::CopyFrom;
43  // copy content from base class
44  void CopyFrom( const SvtxTrack& ) override;
45  void CopyFrom( SvtxTrack* source ) override
46  { CopyFrom( *source ); }
47 
48  //
49  // basic track information ---------------------------------------------------
50  //
51 
52  unsigned int get_id() const override { return _track_id; }
53  void set_id(unsigned int id) override { _track_id = id; }
54 
55  TrackSeed* get_tpc_seed() const override { return _tpc_seed; }
56  void set_tpc_seed(TrackSeed* seed) override { _tpc_seed = seed; }
57 
58  TrackSeed* get_silicon_seed() const override { return _silicon_seed; }
60 
61  short int get_crossing() const override { return _track_crossing; }
62  void set_crossing(short int cross) override { _track_crossing = cross; }
63 
64  unsigned int get_vertex_id() const override { return _vertex_id; }
65  void set_vertex_id(unsigned int id) override { _vertex_id = id; }
66 
67  bool get_positive_charge() const override { return _is_positive_charge; }
68  void set_positive_charge(bool ispos) override { _is_positive_charge = ispos; }
69 
70  int get_charge() const override { return (get_positive_charge()) ? 1 : -1; }
71  void set_charge(int charge) override { (charge > 0) ? set_positive_charge(true) : set_positive_charge(false); }
72 
73  float get_chisq() const override { return _chisq; }
74  void set_chisq(float chisq) override { _chisq = chisq; }
75 
76  unsigned int get_ndf() const override { return _ndf; }
77  void set_ndf(int ndf) override { _ndf = ndf; }
78 
79  float get_quality() const override { return (_ndf != 0) ? _chisq / _ndf : NAN; }
80 
81  float get_x() const override { return _states.find(0.0)->second->get_x(); }
82  void set_x(float x) override { _states[0.0]->set_x(x); }
83 
84  float get_y() const override { return _states.find(0.0)->second->get_y(); }
85  void set_y(float y) override { _states[0.0]->set_y(y); }
86 
87  float get_z() const override { return _states.find(0.0)->second->get_z(); }
88  void set_z(float z) override { _states[0.0]->set_z(z); }
89 
90  float get_pos(unsigned int i) const override { return _states.find(0.0)->second->get_pos(i); }
91 
92  float get_px() const override { return _states.find(0.0)->second->get_px(); }
93  void set_px(float px) override { _states[0.0]->set_px(px); }
94 
95  float get_py() const override { return _states.find(0.0)->second->get_py(); }
96  void set_py(float py) override { _states[0.0]->set_py(py); }
97 
98  float get_pz() const override { return _states.find(0.0)->second->get_pz(); }
99  void set_pz(float pz) override { _states[0.0]->set_pz(pz); }
100 
101  float get_mom(unsigned int i) const override { return _states.find(0.0)->second->get_mom(i); }
102 
103  float get_p() const override { return sqrt(pow(get_px(), 2) + pow(get_py(), 2) + pow(get_pz(), 2)); }
104  float get_pt() const override { return sqrt(pow(get_px(), 2) + pow(get_py(), 2)); }
105  float get_eta() const override { return asinh(get_pz() / get_pt()); }
106  float get_phi() const override { return atan2(get_py(), get_px()); }
107 
108  float get_error(int i, int j) const override { return _states.find(0.0)->second->get_error(i, j); }
109  void set_error(int i, int j, float value) override { return _states[0.0]->set_error(i, j, value); }
110 
111  //
112  // state methods -------------------------------------------------------------
113  //
114  bool empty_states() const override { return _states.empty(); }
115  size_t size_states() const override { return _states.size(); }
116  size_t count_states(float pathlength) const override { return _states.count(pathlength); }
117  // cppcheck-suppress virtualCallInConstructor
118  void clear_states() override;
119 
120  const SvtxTrackState* get_state(float pathlength) const override;
121  SvtxTrackState* get_state(float pathlength) override;
123  size_t erase_state(float pathlength) override;
124 
125  ConstStateIter begin_states() const override { return _states.begin(); }
126  ConstStateIter find_state(float pathlength) const override { return _states.find(pathlength); }
127  ConstStateIter end_states() const override { return _states.end(); }
128 
129  StateIter begin_states() override { return _states.begin(); }
130  StateIter find_state(float pathlength) override { return _states.find(pathlength); }
131  StateIter end_states() override { return _states.end(); }
132 
133  private:
134 
135  // track information
136  TrackSeed* _tpc_seed = nullptr;
138  unsigned int _track_id = UINT_MAX;
139  unsigned int _vertex_id = UINT_MAX;
140  bool _is_positive_charge = false;
141  float _chisq = NAN;
142  unsigned int _ndf = 0;
143  short int _track_crossing = SHRT_MAX;
144 
145  // track state information
146  StateMap _states; //< path length => state object
147 
149 };
150 
151 #endif