Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SvtxTrack_v3.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SvtxTrack_v3.h
1 #ifndef TRACKBASEHISTORIC_SVTXTRACKV3_H
2 #define TRACKBASEHISTORIC_SVTXTRACKV3_H
3 
4 #include "SvtxTrack.h"
5 #include "SvtxTrackState.h"
6 
7 #include <trackbase/TrkrDefs.h>
8 
9 #include <cmath>
10 #include <cstddef> // for size_t
11 #include <iostream>
12 #include <map>
13 #include <utility> // for pair
14 
15 class PHObject;
16 
17 class SvtxTrack_v3: public SvtxTrack
18 {
19  public:
20  SvtxTrack_v3();
21 
22  //* base class copy constructor
23  SvtxTrack_v3( const SvtxTrack& );
24 
25  //* copy constructor
26  SvtxTrack_v3(const SvtxTrack_v3& );
27 
28  //* assignment operator
29  SvtxTrack_v3& operator=(const SvtxTrack_v3& track);
30 
31  //* destructor
32  ~SvtxTrack_v3() override;
33 
34  // The "standard PHObject response" functions...
35  void identify(std::ostream& os = std::cout) const override;
36  void Reset() override { *this = SvtxTrack_v3(); }
37  int isValid() const override;
38  PHObject* CloneMe() const override { return new SvtxTrack_v3(*this); }
39 
41  using PHObject::CopyFrom;
42  // copy content from base class
43  void CopyFrom( const SvtxTrack& ) override;
44  void CopyFrom( SvtxTrack* source ) override
45  { CopyFrom( *source ); }
46 
47  //
48  // basic track information ---------------------------------------------------
49  //
50 
51  unsigned int get_id() const override { return _track_id; }
52  void set_id(unsigned int id) override { _track_id = id; }
53 
54  short int get_crossing() const override { return _track_crossing; }
55  void set_crossing(short int cross) override { _track_crossing = cross; }
56 
57  unsigned int get_vertex_id() const override { return _vertex_id; }
58  void set_vertex_id(unsigned int id) override { _vertex_id = id; }
59 
60  bool get_positive_charge() const override { return _is_positive_charge; }
61  void set_positive_charge(bool ispos) override { _is_positive_charge = ispos; }
62 
63  int get_charge() const override { return (get_positive_charge()) ? 1 : -1; }
64  void set_charge(int charge) override { (charge > 0) ? set_positive_charge(true) : set_positive_charge(false); }
65 
66  float get_chisq() const override { return _chisq; }
67  void set_chisq(float chisq) override { _chisq = chisq; }
68 
69  unsigned int get_ndf() const override { return _ndf; }
70  void set_ndf(int ndf) override { _ndf = ndf; }
71 
72  float get_quality() const override { return (_ndf != 0) ? _chisq / _ndf : NAN; }
73 
74  float get_dca() const override { return _dca; }
75  void set_dca(float dca) override { _dca = dca; }
76 
77  float get_dca_error() const override { return _dca_error; }
78  void set_dca_error(float dca_error) override { _dca_error = dca_error; }
79 
80  float get_dca2d() const override { return _dca2d; }
81  void set_dca2d(float dca2d) override { _dca2d = dca2d; }
82 
83  float get_dca2d_error() const override { return _dca2d_error; }
84  void set_dca2d_error(float error) override { _dca2d_error = error; }
85 
86  float get_dca3d_xy() const override { return _dca3d_xy; }
87  void set_dca3d_xy(float dcaxy) override { _dca3d_xy = dcaxy; }
88 
89  float get_dca3d_xy_error() const override { return _dca3d_xy_error; }
90  void set_dca3d_xy_error(float error) override { _dca3d_xy_error = error; }
91 
92  float get_dca3d_z() const override { return _dca3d_z; }
93  void set_dca3d_z(float dcaz) override { _dca3d_z = dcaz; }
94 
95  float get_dca3d_z_error() const override { return _dca3d_z_error; }
96  void set_dca3d_z_error(float error) override { _dca3d_z_error = error; }
97 
98  float get_x() const override { return _states.find(0.0)->second->get_x(); }
99  void set_x(float x) override { _states[0.0]->set_x(x); }
100 
101  float get_y() const override { return _states.find(0.0)->second->get_y(); }
102  void set_y(float y) override { _states[0.0]->set_y(y); }
103 
104  float get_z() const override { return _states.find(0.0)->second->get_z(); }
105  void set_z(float z) override { _states[0.0]->set_z(z); }
106 
107  float get_pos(unsigned int i) const override { return _states.find(0.0)->second->get_pos(i); }
108 
109  float get_px() const override { return _states.find(0.0)->second->get_px(); }
110  void set_px(float px) override { _states[0.0]->set_px(px); }
111 
112  float get_py() const override { return _states.find(0.0)->second->get_py(); }
113  void set_py(float py) override { _states[0.0]->set_py(py); }
114 
115  float get_pz() const override { return _states.find(0.0)->second->get_pz(); }
116  void set_pz(float pz) override { _states[0.0]->set_pz(pz); }
117 
118  float get_mom(unsigned int i) const override { return _states.find(0.0)->second->get_mom(i); }
119 
120  float get_p() const override { return sqrt(pow(get_px(), 2) + pow(get_py(), 2) + pow(get_pz(), 2)); }
121  float get_pt() const override { return sqrt(pow(get_px(), 2) + pow(get_py(), 2)); }
122  float get_eta() const override { return asinh(get_pz() / get_pt()); }
123  float get_phi() const override { return atan2(get_py(), get_px()); }
124 
125  float get_error(int i, int j) const override { return _states.find(0.0)->second->get_error(i, j); }
126  void set_error(int i, int j, float value) override { return _states[0.0]->set_error(i, j, value); }
127 
128  //
129  // state methods -------------------------------------------------------------
130  //
131  bool empty_states() const override { return _states.empty(); }
132  size_t size_states() const override { return _states.size(); }
133  size_t count_states(float pathlength) const override { return _states.count(pathlength); }
134  // cppcheck-suppress virtualCallInConstructor
135  void clear_states() override;
136 
137  const SvtxTrackState* get_state(float pathlength) const override;
138  SvtxTrackState* get_state(float pathlength) override;
140  size_t erase_state(float pathlength) override;
141 
142  ConstStateIter begin_states() const override { return _states.begin(); }
143  ConstStateIter find_state(float pathlength) const override { return _states.find(pathlength); }
144  ConstStateIter end_states() const override { return _states.end(); }
145 
146  StateIter begin_states() override { return _states.begin(); }
147  StateIter find_state(float pathlength) override { return _states.find(pathlength); }
148  StateIter end_states() override { return _states.end(); }
149 
150  //
151  // associated cluster ids methods --------------------------------------------
152  //
153 
154  // needed by old tracking
155  void clear_clusters() override { _cluster_ids.clear(); }
156  bool empty_clusters() const override { return _cluster_ids.empty(); }
157  size_t size_clusters() const override { return _cluster_ids.size(); }
158 
159  void insert_cluster(unsigned int clusterid) override { _cluster_ids.insert(clusterid); }
160  size_t erase_cluster(unsigned int clusterid) override { return _cluster_ids.erase(clusterid); }
161  ConstClusterIter begin_clusters() const override { return _cluster_ids.begin(); }
162  ConstClusterIter find_cluster(unsigned int clusterid) const override { return _cluster_ids.find(clusterid); }
163  ConstClusterIter end_clusters() const override { return _cluster_ids.end(); }
164  ClusterIter find_cluster(unsigned int clusterid) override { return _cluster_ids.find(clusterid); }
165  ClusterIter begin_clusters() override { return _cluster_ids.begin(); }
166  ClusterIter end_clusters() override { return _cluster_ids.end(); }
167 
168  // needed by new tracking
169  void clear_cluster_keys() override { _cluster_keys.clear(); }
170  bool empty_cluster_keys() const override { return _cluster_keys.empty(); }
171  size_t size_cluster_keys() const override { return _cluster_keys.size(); }
172 
173  void insert_cluster_key(TrkrDefs::cluskey clusterid) override { _cluster_keys.insert(clusterid); }
174  size_t erase_cluster_key(TrkrDefs::cluskey clusterid) override { return _cluster_keys.erase(clusterid); }
175  ConstClusterKeyIter find_cluster_key(TrkrDefs::cluskey clusterid) const override { return _cluster_keys.find(clusterid); }
176  ConstClusterKeyIter begin_cluster_keys() const override { return _cluster_keys.begin(); }
177  ConstClusterKeyIter end_cluster_keys() const override { return _cluster_keys.end(); }
178  ClusterKeyIter find_cluster_keys(unsigned int clusterid) override { return _cluster_keys.find(clusterid); }
179  ClusterKeyIter begin_cluster_keys() override { return _cluster_keys.begin(); }
180  ClusterKeyIter end_cluster_keys() override { return _cluster_keys.end(); }
181 
182  //
183  // calo projection methods ---------------------------------------------------
184  //
185  float get_cal_dphi(CAL_LAYER layer) const override;
186  void set_cal_dphi(CAL_LAYER layer, float dphi) override { _cal_dphi[layer] = dphi; }
187 
188  float get_cal_deta(CAL_LAYER layer) const override;
189  void set_cal_deta(CAL_LAYER layer, float deta) override { _cal_deta[layer] = deta; }
190 
191  float get_cal_energy_3x3(CAL_LAYER layer) const override;
192  void set_cal_energy_3x3(CAL_LAYER layer, float energy_3x3) override { _cal_energy_3x3[layer] = energy_3x3; }
193 
194  float get_cal_energy_5x5(CAL_LAYER layer) const override;
195  void set_cal_energy_5x5(CAL_LAYER layer, float energy_5x5) override { _cal_energy_5x5[layer] = energy_5x5; }
196 
197  unsigned int get_cal_cluster_id(CAL_LAYER layer) const override;
198  void set_cal_cluster_id(CAL_LAYER layer, unsigned int id) override { _cal_cluster_id[layer] = id; }
199 
202 
203  float get_cal_cluster_e(CAL_LAYER layer) const override;
204  void set_cal_cluster_e(CAL_LAYER layer, float e) override { _cal_cluster_e[layer] = e; }
205 
206  // ACTS track information for use by ACTS modules only
207  float get_acts_covariance(unsigned int i, unsigned int j) const override {return _acts_trajectory_covariance[i][j]; }
208  void set_acts_covariance(unsigned int i, unsigned int j, float value) override { _acts_trajectory_covariance[i][j] = value; }
209 
210  private:
211 
213  float _acts_trajectory_covariance[6][6] = {};
214 
215  // track information
216  unsigned int _track_id = UINT_MAX;
217  unsigned int _vertex_id = UINT_MAX;
218  bool _is_positive_charge = false;
219  float _chisq = NAN;
220  unsigned int _ndf = 0;
221  short int _track_crossing = SHRT_MAX;
222 
223  // extended track information (non-primary tracks only)
224  float _dca = NAN;
225  float _dca_error = NAN;
226  float _dca2d = NAN;
227  float _dca2d_error = NAN;
228  float _dca3d_xy = NAN;
229  float _dca3d_xy_error = NAN;
230  float _dca3d_z = NAN;
231  float _dca3d_z_error = NAN;
232 
233  // extended track information (primary tracks only)
234 
235  // track state information
236  StateMap _states; //< path length => state object
237 
238  // cluster contents
241 
242  // calorimeter matches
243  std::map<CAL_LAYER, float> _cal_dphi;
244  std::map<CAL_LAYER, float> _cal_deta;
245  std::map<CAL_LAYER, float> _cal_energy_3x3;
246  std::map<CAL_LAYER, float> _cal_energy_5x5;
247  std::map<CAL_LAYER, int> _cal_cluster_id;
248  std::map<CAL_LAYER, TrkrDefs::cluskey> _cal_cluster_key;
249  std::map<CAL_LAYER, float> _cal_cluster_e;
250 
252 };
253 
254 #endif