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