CMS 3D CMS Logo

MkSeedPartitioners-phase2.cc
Go to the documentation of this file.
6 
7 namespace {
8  using namespace mkfit;
9 
10  // named constants for useful layers (l/u for lower/upper)
11  constexpr int tecp1l_id = 28;
12  constexpr int tecp1u_id = 29;
13  constexpr int tecp2l_id = 30;
14  constexpr int tecp2u_id = 31;
15  constexpr int tecn1l_id = 50;
16  constexpr int tecn1u_id = 51;
17  constexpr int tecn2l_id = 52;
18  constexpr int tecntu_id = 53;
19 
20  [[maybe_unused]] void partitionSeeds1(const TrackerInfo &trk_info,
21  const TrackVec &in_seeds,
22  const EventOfHits &eoh,
24  // Seeds are placed into eta regions and sorted on region + eta.
25 
26  // Merge mono and stereo limits for relevant layers / parameters.
27  // TrackerInfo could hold joint limits for sub-detectors.
28  const auto &L = trk_info;
29  const float tecp1_rin = std::min(L[tecp1l_id].rin(), L[tecp1u_id].rin());
30  const float tecp1_rout = std::max(L[tecp1l_id].rout(), L[tecp1u_id].rout());
31  const float tecp1_zmin = std::min(L[tecp1l_id].zmin(), L[tecp1u_id].zmin());
32 
33  const float tecp2_rin = std::min(L[tecp2l_id].rin(), L[tecp2u_id].rin());
34  const float tecp2_zmax = std::max(L[tecp2l_id].zmax(), L[tecp2u_id].zmax());
35 
36  const float tecn1_rin = std::min(L[tecn1l_id].rin(), L[tecn1u_id].rin());
37  const float tecn1_rout = std::max(L[tecn1l_id].rout(), L[tecn1u_id].rout());
38  const float tecn1_zmax = std::max(L[tecn1l_id].zmax(), L[tecn1u_id].zmax());
39 
40  const float tecn2_rin = std::min(L[tecn2l_id].rin(), L[tecntu_id].rin());
41  const float tecn2_zmin = std::min(L[tecn2l_id].zmin(), L[tecntu_id].zmin());
42 
43  const float tec_z_extra = 0.0f; // 10.0f;
44 
45  const int size = in_seeds.size();
46 
47  auto barrel_pos_check = [](const Track &S, float maxR, float rin, float zmax) -> bool {
48  bool inside = maxR > rin && S.zAtR(rin) < zmax;
49  return inside;
50  };
51 
52  auto barrel_neg_check = [](const Track &S, float maxR, float rin, float zmin) -> bool {
53  bool inside = maxR > rin && S.zAtR(rin) > zmin;
54  return inside;
55  };
56 
57  auto endcap_pos_check = [](const Track &S, float maxR, float rout, float rin, float zmin) -> bool {
58  bool inside = maxR > rout ? S.zAtR(rout) > zmin : (maxR > rin && S.zAtR(maxR) > zmin);
59  return inside;
60  };
61 
62  auto endcap_neg_check = [](const Track &S, float maxR, float rout, float rin, float zmax) -> bool {
63  bool inside = maxR > rout ? S.zAtR(rout) < zmax : (maxR > rin && S.zAtR(maxR) < zmax);
64  return inside;
65  };
66 
67  for (int i = 0; i < size; ++i) {
68  const Track &S = in_seeds[i];
69 
70  HitOnTrack hot = S.getLastHitOnTrack();
71  float eta = eoh[hot.layer].refHit(hot.index).eta();
72 
73  // Region to be defined by propagation / intersection tests
75 
76  const bool z_dir_pos = S.pz() > 0;
77  const float maxR = S.maxReachRadius();
78 
79  if (z_dir_pos) {
80  bool in_tec_as_brl = barrel_pos_check(S, maxR, tecp2_rin, tecp2_zmax);
81 
82  if (!in_tec_as_brl) {
84  } else {
85  bool in_tec = endcap_pos_check(S, maxR, tecp1_rout, tecp1_rin, tecp1_zmin - tec_z_extra);
86 
87  if (!in_tec) {
89  } else {
91  }
92  }
93  } else {
94  bool in_tec_as_brl = barrel_neg_check(S, maxR, tecn2_rin, tecn2_zmin);
95 
96  if (!in_tec_as_brl) {
98  } else {
99  bool in_tec = endcap_neg_check(S, maxR, tecn1_rout, tecn1_rin, tecn1_zmax + tec_z_extra);
100 
101  if (!in_tec) {
103  } else {
105  }
106  }
107  }
108 
109  part.m_region[i] = reg;
110  if (part.m_phi_eta_foo)
111  part.m_phi_eta_foo(eoh[hot.layer].refHit(hot.index).phi(), eta);
112  }
113  }
114 
115  [[maybe_unused]] void partitionSeeds1debug(const TrackerInfo &trk_info,
116  const TrackVec &in_seeds,
117  const EventOfHits &eoh,
119  // Seeds are placed into eta regions and sorted on region + eta.
120 
121  // Merge mono and stereo limits for relevant layers / parameters.
122  // TrackerInfo could hold joint limits for sub-detectors.
123  const auto &L = trk_info;
124  const float tecp1_rin = std::min(L[tecp1l_id].rin(), L[tecp1u_id].rin());
125  const float tecp1_rout = std::max(L[tecp1l_id].rout(), L[tecp1u_id].rout());
126  const float tecp1_zmin = std::min(L[tecp1l_id].zmin(), L[tecp1u_id].zmin());
127 
128  const float tecp2_rin = std::min(L[tecp2l_id].rin(), L[tecp2u_id].rin());
129  const float tecp2_zmax = std::max(L[tecp2l_id].zmax(), L[tecp2u_id].zmax());
130 
131  const float tecn1_rin = std::min(L[tecn1l_id].rin(), L[tecn1u_id].rin());
132  const float tecn1_rout = std::max(L[tecn1l_id].rout(), L[tecn1u_id].rout());
133  const float tecn1_zmax = std::max(L[tecn1l_id].zmax(), L[tecn1u_id].zmax());
134 
135  const float tecn2_rin = std::min(L[tecn2l_id].rin(), L[tecntu_id].rin());
136  const float tecn2_zmin = std::min(L[tecn2l_id].zmin(), L[tecntu_id].zmin());
137 
138  const float tec_z_extra = 0.0f; // 10.0f;
139 
140  const int size = in_seeds.size();
141 
142  auto barrel_pos_check = [](const Track &S, float maxR, float rin, float zmax, const char *det) -> bool {
143  bool inside = maxR > rin && S.zAtR(rin) < zmax;
144 
145  printf(" in_%s=%d maxR=%7.3f, rin=%7.3f -- ", det, inside, maxR, rin);
146  if (maxR > rin) {
147  printf("maxR > rin: S.zAtR(rin) < zmax -- %.3f <? %.3f\n", S.zAtR(rin), zmax);
148  } else {
149  printf("maxR < rin: no pie.\n");
150  }
151 
152  return inside;
153  };
154 
155  auto barrel_neg_check = [](const Track &S, float maxR, float rin, float zmin, const char *det) -> bool {
156  bool inside = maxR > rin && S.zAtR(rin) > zmin;
157 
158  printf(" in_%s=%d maxR=%7.3f, rin=%7.3f -- ", det, inside, maxR, rin);
159  if (maxR > rin) {
160  printf("maxR > rin: S.zAtR(rin) > zmin -- %.3f >? %.3f\n", S.zAtR(rin), zmin);
161  } else {
162  printf("maxR < rin: no pie.\n");
163  }
164 
165  return inside;
166  };
167 
168  auto endcap_pos_check = [](const Track &S, float maxR, float rout, float rin, float zmin, const char *det) -> bool {
169  bool inside = maxR > rout ? S.zAtR(rout) > zmin : (maxR > rin && S.zAtR(maxR) > zmin);
170 
171  printf(" in_%s=%d maxR=%7.3f, rout=%7.3f, rin=%7.3f -- ", det, inside, maxR, rout, rin);
172  if (maxR > rout) {
173  printf("maxR > rout: S.zAtR(rout) > zmin -- %.3f >? %.3f\n", S.zAtR(rout), zmin);
174  } else if (maxR > rin) {
175  printf("maxR > rin: S.zAtR(maxR) > zmin) -- %.3f >? %.3f\n", S.zAtR(maxR), zmin);
176  } else {
177  printf("maxR < rin: no pie.\n");
178  }
179 
180  return inside;
181  };
182 
183  auto endcap_neg_check = [](const Track &S, float maxR, float rout, float rin, float zmax, const char *det) -> bool {
184  bool inside = maxR > rout ? S.zAtR(rout) < zmax : (maxR > rin && S.zAtR(maxR) < zmax);
185 
186  printf(" in_%s=%d maxR=%7.3f, rout=%7.3f, rin=%7.3f -- ", det, inside, maxR, rout, rin);
187  if (maxR > rout) {
188  printf("maxR > rout: S.zAtR(rout) < zmax -- %.3f <? %.3f\n", S.zAtR(rout), zmax);
189  } else if (maxR > rin) {
190  printf("maxR > rin: S.zAtR(maxR) < zmax -- %.3f <? %.3f\n", S.zAtR(maxR), zmax);
191  } else {
192  printf("maxR < rin: no pie.\n");
193  }
194 
195  return inside;
196  };
197 
198  for (int i = 0; i < size; ++i) {
199  const Track &S = in_seeds[i];
200 
201  HitOnTrack hot = S.getLastHitOnTrack();
202  float eta = eoh[hot.layer].refHit(hot.index).eta();
203  // float eta = S.momEta();
204 
205  // Region to be defined by propagation / intersection tests
207 
208  const bool z_dir_pos = S.pz() > 0;
209  const float maxR = S.maxReachRadius();
210 
211  printf("partitionSeeds1debug seed index %d, z_dir_pos=%d (pz=%.3f), maxR=%.3f\n", i, z_dir_pos, S.pz(), maxR);
212 
213  if (z_dir_pos) {
214  bool in_tec_as_brl = barrel_pos_check(S, maxR, tecp2_rin, tecp2_zmax, "TECasBarrelp");
215 
216  if (!in_tec_as_brl) {
218  printf(" --> region = %d, endcap pos\n", reg);
219  } else {
220  bool in_tec = endcap_pos_check(S, maxR, tecp1_rout, tecp1_rin, tecp1_zmin - tec_z_extra, "TECp");
221 
222  if (!in_tec) {
224  printf(" --> region = %d, barrel\n", reg);
225  } else {
227  printf(" --> region = %d, transition pos\n", reg);
228  }
229  }
230  } else {
231  bool in_tec_as_brl = barrel_neg_check(S, maxR, tecn2_rin, tecn2_zmin, "TECasBarreln");
232 
233  if (!in_tec_as_brl) {
235  printf(" --> region = %d, endcap neg\n", reg);
236  } else {
237  bool in_tec = endcap_neg_check(S, maxR, tecn1_rout, tecn1_rin, tecn1_zmax + tec_z_extra, "TECn");
238 
239  if (!in_tec) {
241  printf(" --> region = %d, barrel\n", reg);
242  } else {
244  printf(" --> region = %d, transition neg\n", reg);
245  }
246  }
247  }
248 
249  part.m_region[i] = reg;
250  if (part.m_phi_eta_foo)
251  part.m_phi_eta_foo(eoh[hot.layer].refHit(hot.index).phi(), eta);
252  }
253  }
254 
255  CMS_SA_ALLOW struct register_seed_partitioners {
256  register_seed_partitioners() {
257  IterationConfig::register_seed_partitioner("phase2:1", partitionSeeds1);
258  IterationConfig::register_seed_partitioner("phase2:1:debug", partitionSeeds1debug);
259  }
260  } rsp_instance;
261 } // namespace
size
Write out results.
#define CMS_SA_ALLOW
static void register_seed_partitioner(const std::string &name, partition_seeds_func func)
std::vector< Track > TrackVec
part
Definition: HCALResponse.h:20