CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackerInfo.h
Go to the documentation of this file.
1 #ifndef RecoTracker_MkFitCore_interface_TrackerInfo_h
2 #define RecoTracker_MkFitCore_interface_TrackerInfo_h
3 
4 #include <string>
5 #include <vector>
6 
7 namespace mkfit {
8 
9  class IterationsInfo;
10 
11  //==============================================================================
12 
14 
15  struct WSR_Result {
16  // Could also store XHitSize count equivalent here : 16;
18  bool m_in_gap : 8;
19 
21 
22  WSR_Result(WithinSensitiveRegion_e wsr, bool in_gap) : m_wsr(wsr), m_in_gap(in_gap) {}
23  };
24 
25  //==============================================================================
26 
27  class LayerInfo {
28  public:
29  enum LayerType_e { Undef = -1, Barrel = 0, EndCapPos = 1, EndCapNeg = 2 };
30 
31  LayerInfo(int lid, LayerType_e type) : m_layer_id(lid), m_layer_type(type) {}
32 
34  void set_limits(float r1, float r2, float z1, float z2);
35  void set_propagate_to(float pto) { m_propagate_to = pto; }
36  void set_r_hole_range(float rh1, float rh2);
37  void set_q_bin(float qb) { m_q_bin = qb; }
38  void set_is_stereo(bool s) { m_is_stereo = s; }
39 
40  int layer_id() const { return m_layer_id; }
41  LayerType_e layer_type() const { return m_layer_type; }
42  float rin() const { return m_rin; }
43  float rout() const { return m_rout; }
44  float r_mean() const { return 0.5f * (m_rin + m_rout); }
45  float zmin() const { return m_zmin; }
46  float zmax() const { return m_zmax; }
47  float z_mean() const { return 0.5f * (m_zmin + m_zmax); }
48  float propagate_to() const { return m_propagate_to; }
49  float q_bin() const { return m_q_bin; }
50  bool is_stereo() const { return m_is_stereo; }
51 
52  bool is_barrel() const { return m_layer_type == Barrel; }
53 
54  bool is_within_z_limits(float z) const { return z > m_zmin && z < m_zmax; }
55  bool is_within_r_limits(float r) const { return r > m_rin && r < m_rout; }
56  bool is_within_q_limits(float q) const { return is_barrel() ? is_within_z_limits(q) : is_within_r_limits(q); }
57 
58  bool is_in_r_hole(float r) const { return m_has_r_range_hole ? is_in_r_hole_no_check(r) : false; }
59 
60  bool is_pixb_lyr() const { return m_is_pixb_lyr; }
61  bool is_pixe_lyr() const { return m_is_pixe_lyr; }
62  bool is_pix_lyr() const { return (m_is_pixb_lyr || m_is_pixe_lyr); }
63  bool is_tib_lyr() const { return m_is_tib_lyr; }
64  bool is_tob_lyr() const { return m_is_tob_lyr; }
65  bool is_tid_lyr() const { return m_is_tid_lyr; }
66  bool is_tec_lyr() const { return m_is_tec_lyr; }
67 
68  WSR_Result is_within_z_sensitive_region(float z, float dz) const {
69  if (z > m_zmax + dz || z < m_zmin - dz)
70  return WSR_Result(WSR_Outside, false);
71  if (z < m_zmax - dz && z > m_zmin + dz)
72  return WSR_Result(WSR_Inside, false);
73  return WSR_Result(WSR_Edge, false);
74  }
75 
77  if (r > m_rout + dr || r < m_rin - dr)
78  return WSR_Result(WSR_Outside, false);
79  if (r < m_rout - dr && r > m_rin + dr) {
80  if (m_has_r_range_hole) {
81  if (r < m_hole_r_max - dr && r > m_hole_r_min + dr)
82  return WSR_Result(WSR_Outside, true);
83  if (r < m_hole_r_max + dr && r > m_hole_r_min - dr)
84  return WSR_Result(WSR_Edge, true);
85  }
86  return WSR_Result(WSR_Inside, false);
87  }
88  return WSR_Result(WSR_Edge, false);
89  }
90 
91  void print_layer() const {
92  printf("Layer %2d r(%7.4f, %7.4f) z(% 9.4f, % 9.4f) is_brl=%d\n",
93  m_layer_id,
94  m_rin,
95  m_rout,
96  m_zmin,
97  m_zmax,
98  is_barrel());
99  }
100 
101  // To be cleaned out with other geometry cleanup
102  bool m_is_pixb_lyr = false;
103  bool m_is_pixe_lyr = false;
104  bool m_is_tib_lyr = false;
105  bool m_is_tob_lyr = false;
106  bool m_is_tid_lyr = false;
107  bool m_is_tec_lyr = false;
108 
109  private:
110  bool is_in_r_hole_no_check(float r) const { return r > m_hole_r_min && r < m_hole_r_max; }
111 
112  int m_layer_id = -1;
114 
117 
118  float m_q_bin; // > 0 - bin width, < 0 - number of bins
119  float m_hole_r_min, m_hole_r_max; // This could be turned into std::function when needed.
120  bool m_has_r_range_hole = false;
121  bool m_is_stereo = false;
122  };
123 
124  //==============================================================================
125 
126  class TrackerInfo {
127  public:
128  enum EtaRegion {
137  };
138 
139  void reserve_layers(int n_brl, int n_ec_pos, int n_ec_neg);
140  void create_layers(int n_brl, int n_ec_pos, int n_ec_neg);
144 
145  int n_layers() const { return m_layers.size(); }
146  const LayerInfo& layer(int l) const { return m_layers[l]; }
147  LayerInfo& layer_nc(int l) { return m_layers[l]; }
148 
149  const LayerInfo& operator[](int l) const { return m_layers[l]; }
150 
151  bool is_stereo(int i) const { return m_layers[i].is_stereo(); }
152  bool is_pixb_lyr(int i) const { return m_layers[i].is_pixb_lyr(); }
153  bool is_pixe_lyr(int i) const { return m_layers[i].is_pixe_lyr(); }
154  bool is_pix_lyr(int i) const { return m_layers[i].is_pix_lyr(); }
155  bool is_tib_lyr(int i) const { return m_layers[i].is_tib_lyr(); }
156  bool is_tob_lyr(int i) const { return m_layers[i].is_tob_lyr(); }
157  bool is_tid_lyr(int i) const { return m_layers[i].is_tid_lyr(); }
158  bool is_tec_lyr(int i) const { return m_layers[i].is_tec_lyr(); }
159 
160  const LayerInfo& outer_barrel_layer() const { return m_layers[m_barrel.back()]; }
161 
162  private:
164 
165  std::vector<LayerInfo> m_layers;
166 
167  std::vector<int> m_barrel;
168  std::vector<int> m_ecap_pos;
169  std::vector<int> m_ecap_neg;
170  };
171 
172 } // end namespace mkfit
173 #endif
void set_is_stereo(bool s)
Definition: TrackerInfo.h:38
bool is_pix_lyr(int i) const
Definition: TrackerInfo.h:154
bool is_in_r_hole_no_check(float r) const
Definition: TrackerInfo.h:110
bool is_within_z_limits(float z) const
Definition: TrackerInfo.h:54
bool is_pixb_lyr() const
Definition: TrackerInfo.h:60
const LayerInfo & layer(int l) const
Definition: TrackerInfo.h:146
bool is_pix_lyr() const
Definition: TrackerInfo.h:62
void set_r_hole_range(float rh1, float rh2)
Definition: TrackerInfo.cc:14
bool is_tec_lyr(int i) const
Definition: TrackerInfo.h:158
std::vector< int > m_barrel
Definition: TrackerInfo.h:167
void set_q_bin(float qb)
Definition: TrackerInfo.h:37
LayerInfo & new_barrel_layer()
Definition: TrackerInfo.cc:47
std::vector< int > m_ecap_neg
Definition: TrackerInfo.h:169
WSR_Result is_within_r_sensitive_region(float r, float dr) const
Definition: TrackerInfo.h:76
LayerInfo & new_ecap_neg_layer()
Definition: TrackerInfo.cc:57
float propagate_to() const
Definition: TrackerInfo.h:48
bool is_pixe_lyr(int i) const
Definition: TrackerInfo.h:153
WSR_Result(WithinSensitiveRegion_e wsr, bool in_gap)
Definition: TrackerInfo.h:22
LayerInfo & layer_nc(int l)
Definition: TrackerInfo.h:147
bool is_pixb_lyr(int i) const
Definition: TrackerInfo.h:152
const LayerInfo & outer_barrel_layer() const
Definition: TrackerInfo.h:160
float zmin() const
Definition: TrackerInfo.h:45
bool is_tid_lyr() const
Definition: TrackerInfo.h:65
bool is_within_q_limits(float q) const
Definition: TrackerInfo.h:56
float r_mean() const
Definition: TrackerInfo.h:44
bool is_tec_lyr() const
Definition: TrackerInfo.h:66
bool is_pixe_lyr() const
Definition: TrackerInfo.h:61
LayerType_e layer_type() const
Definition: TrackerInfo.h:41
void set_limits(float r1, float r2, float z1, float z2)
Definition: TrackerInfo.cc:7
int layer_id() const
Definition: TrackerInfo.h:40
bool is_stereo() const
Definition: TrackerInfo.h:50
bool is_within_r_limits(float r) const
Definition: TrackerInfo.h:55
float rin() const
Definition: TrackerInfo.h:42
void set_layer_type(LayerType_e t)
Definition: TrackerInfo.h:33
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
LayerInfo & new_ecap_pos_layer()
Definition: TrackerInfo.cc:52
int new_layer(LayerInfo::LayerType_e type)
Definition: TrackerInfo.cc:41
bool is_tob_lyr(int i) const
Definition: TrackerInfo.h:156
bool is_tob_lyr() const
Definition: TrackerInfo.h:64
void create_layers(int n_brl, int n_ec_pos, int n_ec_neg)
Definition: TrackerInfo.cc:31
bool is_barrel() const
Definition: TrackerInfo.h:52
bool is_tib_lyr() const
Definition: TrackerInfo.h:63
bool is_stereo(int i) const
Definition: TrackerInfo.h:151
float rout() const
Definition: TrackerInfo.h:43
WithinSensitiveRegion_e m_wsr
Definition: TrackerInfo.h:17
WSR_Result is_within_z_sensitive_region(float z, float dz) const
Definition: TrackerInfo.h:68
bool is_tib_lyr(int i) const
Definition: TrackerInfo.h:155
void print_layer() const
Definition: TrackerInfo.h:91
std::vector< int > m_ecap_pos
Definition: TrackerInfo.h:168
LayerType_e m_layer_type
Definition: TrackerInfo.h:113
float z_mean() const
Definition: TrackerInfo.h:47
LayerInfo(int lid, LayerType_e type)
Definition: TrackerInfo.h:31
void set_propagate_to(float pto)
Definition: TrackerInfo.h:35
int n_layers() const
Definition: TrackerInfo.h:145
float q_bin() const
Definition: TrackerInfo.h:49
float zmax() const
Definition: TrackerInfo.h:46
WithinSensitiveRegion_e
Definition: TrackerInfo.h:13
bool is_in_r_hole(float r) const
Definition: TrackerInfo.h:58
const LayerInfo & operator[](int l) const
Definition: TrackerInfo.h:149
std::vector< LayerInfo > m_layers
Definition: TrackerInfo.h:165
bool is_tid_lyr(int i) const
Definition: TrackerInfo.h:157
void reserve_layers(int n_brl, int n_ec_pos, int n_ec_neg)
Definition: TrackerInfo.cc:24