EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CellularAutomaton_v1.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CellularAutomaton_v1.h
1 #ifndef G4HOUGH_CELLULARAUTOMATONV1_H
2 #define G4HOUGH_CELLULARAUTOMATONV1_H
3 
4 #include "CellularAutomaton.h"
5 
6 #include <HelixHough/SimpleHit3D.h>
7 #include <HelixHough/SimpleTrack3D.h> // for SimpleTrack3D
8 
9 #include <HelixHough/HelixKalmanState.h> // for HelixKalmanState
10 
11 #include <iostream> // for cout, ostream
12 #include <map> // for map
13 #include <set> // for set
14 #include <vector> // for vector
15 
16 class HelixHoughSpace;
17 class HelixKalmanFilter;
18 
19 class TrackSegment {
20  public:
22  : chi2(0.), ux(0.), uy(0.), kappa(0.), dkappa(0.), helicity(0), seed(0), bin(0), n_hits(0) {}
24 
25  float chi2;
26  float ux, uy;
27  float kappa;
28  float dkappa;
29  int helicity;
30  std::vector<unsigned int> hits; // cluster_ids
31  unsigned int seed;
32  unsigned int bin;
33  unsigned int n_hits;
34 };
35 
36 
37 
39 
40  public:
41 
42  CellularAutomaton_v1(std::vector<SimpleTrack3D>& input_tracks, std::vector<float>& radius, std::vector<float>& material);
43 // CellularAutomaton_v1(const CellularAutomaton_v1& cellular_automaton);
44  ~CellularAutomaton_v1() override {};
45 
46  // The "standard PHObject response" functions...
47  void identify(std::ostream& = std::cout) const override {};
48  void Reset() override;
49  int isValid() const override {return 1;}
50  CellularAutomaton* Clone() const override {return new CellularAutomaton_v1(*this);}
51 
52  void set_hough_space(HelixHoughSpace* hough_space) override;
53  void set_mag_field(float mag_field) override;
54  void set_pt_rescale(float pt_rescale) override;
55  void set_n_layers(unsigned int n_layers) override {nlayers = n_layers;}
56  void set_required_layers(unsigned int req_layers) override {rlayers = req_layers;}
57  void set_ca_chi2(float chi2_cut) override{ ca_chi2_cut = chi2_cut;}
58  void set_ca_chi2_layer(float chi2_layer_cut) override{ca_chi2_layer_cut = chi2_layer_cut;}
59  void set_ca_phi_cut(float phi_cut) override{ca_phi_cut = phi_cut;}
60  void set_ca_z_cut(float z_cut) override {ca_z_cut = z_cut;}
61  void set_ca_dcaxy_cut(float dcaxy_cut) override{ca_dcaxy_cut = dcaxy_cut;}
62  void set_propagate_forward(bool fwd) override {forward = fwd;}
63  void set_remove_hits(bool remove) override{remove_hits = remove;}
64  void set_remove_inner_hits(bool remove_inner) override{remove_inner_hits = remove_inner;}
65  void set_require_inner_hits(bool require_inner) override{require_inner_hits = require_inner;}
66  void set_triplet_mode(bool mod) override {triplet_mode = mod;}
67  void set_seeding_mode(bool mod) override {seeding_mode = mod;}
68  void set_hits_map(std::map<unsigned int, SimpleHit3D>& hits_map) override{_hits_map = hits_map;}
69  void set_verbose(int v) {verbose = v;}
70 
71  int run(std::vector<SimpleTrack3D>& output_tracks, std::vector<HelixKalmanState>& output_track_states, std::map<unsigned int, bool>& hits_used) override;
72 
73 
74  private:
75 
76  void set_detector_radii(std::vector<float>& radii) override;
77  void set_detector_materials(std::vector<float>& materials);
78  void set_input_tracks(std::vector<SimpleTrack3D>& input_tracks) override;
79  void set_cylinder_kalman() override;
80 
81  int init() override;
82  int process_tracks() override;
83  int process_single_track(SimpleTrack3D& track) override;
84  int process_single_triplet(SimpleTrack3D& track) override;
85  int get_ca_tracks(std::vector<SimpleTrack3D>& output_tracks, std::vector<HelixKalmanState>& output_track_states) override;
86 
88  float x1, float y1, float z1, float x2, float y2, float z2,
89  float x3, float y3, float z3,
90  float dx1, float dy1, float dz1, float dx2, float dy2, float dz2,
91  float dx3, float dy3, float dz3,
92  float& kappa, float& dkappa,
93  float& ux_mid, float& uy_mid, float& ux_end, float& uy_end,
94  float& dzdl_1, float& dzdl_2, float& ddzdl_1, float& ddzdl_2) override;
96  float x1, float y1, float z1, float x2, float y2, float z2,
97  float x3, float y3, float z3,
98  float dx1, float dy1, float dz1, float dx2, float dy2, float dz2,
99  float dx3, float dy3, float dz3,
100  float& kappa, float& dkappa,
101  float& ux_mid, float& uy_mid, float& ux_end, float& uy_end,
102  float& dzdl_1, float& dzdl_2, float& ddzdl_1, float& ddzdl_2,
103  float ca_sin_ang_cut, float inv_cos_ang_diff,
104  float cur_kappa, float cur_dkappa, float cur_ux, float cur_uy,
105  float cur_chi2, float& chi2) override;
106 
107  float kappa_to_pt(float kappa);
108  float shift_phi_range(float phi) override;
109 
112  std::vector<SimpleTrack3D> in_tracks;
113  std::vector<SimpleTrack3D> ca_tracks;
114  std::vector<HelixKalmanState> ca_track_states;
115 
116  std::vector<unsigned int> temp_combo;
117  std::set<std::vector<unsigned int> > combos;
118  std::vector<std::vector<SimpleHit3D> > layer_sorted;
119 
120  unsigned int nlayers; // number of layers for seeding
121  unsigned int rlayers; // number of layers with hits required for seeding
123 
125  float ca_chi2_cut;
127  float ca_phi_cut;
128  float ca_z_cut;
129  float ca_dcaxy_cut;
130 
134 
135 
136  float _pt_rescale;
137  float _mag_field;
138 
139  std::vector<float> _detector_radii;
140  std::vector<float> _detector_scatter;
141  std::vector<float> _detector_materials;
142  std::vector<float> _integrated_scatter;
143 
144  std::map<unsigned int, bool> _hits_used;
145  std::map<unsigned int, SimpleHit3D> _hits_map;
146 
147  double CAtime;
148  double KALtime;
149  bool forward;
155  int verbose;
156 
157 };
158 
159 #endif