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