10 [[maybe_unused]]
void partitionSeeds0(
const TrackerInfo &trk_info,
14 const size_t size = in_seeds.size();
16 for (
size_t i = 0;
i <
size; ++
i) {
19 const bool z_dir_pos =
S.pz() > 0;
21 const auto &hot =
S.getLastHitOnTrack();
22 const float eta = eoh[hot.layer].refHit(hot.index).eta();
30 constexpr
int tib1_id = 4;
31 constexpr
int tob1_id = 10;
32 constexpr
int tecp1_id = 27;
33 constexpr
int tecn1_id = 54;
41 const LayerInfo &tec_first = z_dir_pos ? tecp1 : tecn1;
43 const float maxR =
S.maxReachRadius();
46 bool can_reach_outer_brl =
S.canReachRadius(outer_brl.
rout());
48 bool misses_first_tec;
49 if (can_reach_outer_brl) {
50 z_at_outer_brl =
S.zAtR(outer_brl.
rout());
52 misses_first_tec = z_at_outer_brl < tec_first.
zmin();
54 misses_first_tec = z_at_outer_brl > tec_first.
zmax();
56 z_at_maxr =
S.zAtR(maxR);
58 misses_first_tec = z_at_maxr < tec_first.
zmin();
60 misses_first_tec = z_at_maxr > tec_first.
zmax();
63 if (misses_first_tec) {
64 reg = TrackerInfo::Reg_Barrel;
68 reg = z_dir_pos ? TrackerInfo::Reg_Transition_Pos : TrackerInfo::Reg_Transition_Neg;
70 reg = z_dir_pos ? TrackerInfo::Reg_Endcap_Pos : TrackerInfo::Reg_Endcap_Neg;
74 part.m_region[
i] = reg;
75 if (
part.m_phi_eta_foo)
76 part.m_phi_eta_foo(eoh[hot.layer].refHit(hot.index).phi(),
eta);
80 [[maybe_unused]]
void partitionSeeds1(
const TrackerInfo &trk_info,
85 constexpr
int tib1_id = 4;
86 constexpr
int tob1_id = 10;
87 constexpr
int tidp1_id = 21;
88 constexpr
int tidn1_id = 48;
89 constexpr
int tecp1_id = 27;
90 constexpr
int tecn1_id = 54;
103 const auto &
L = trk_info;
104 const float tidp_rin =
std::min(
L[tidp1_id].rin(),
L[tidp1_id + 1].rin());
105 const float tidp_rout =
std::max(
L[tidp1_id].rout(),
L[tidp1_id + 1].rout());
106 const float tecp_rin =
std::min(
L[tecp1_id].rin(),
L[tecp1_id + 1].rin());
107 const float tecp_rout =
std::max(
L[tecp1_id].rout(),
L[tecp1_id + 1].rout());
108 const float tidn_rin =
std::min(
L[tidn1_id].rin(),
L[tidn1_id + 1].rin());
109 const float tidn_rout =
std::max(
L[tidn1_id].rout(),
L[tidn1_id + 1].rout());
110 const float tecn_rin =
std::min(
L[tecn1_id].rin(),
L[tecn1_id + 1].rin());
111 const float tecn_rout =
std::max(
L[tecn1_id].rout(),
L[tecn1_id + 1].rout());
115 const float tid_z_extra = 0.0f;
116 const float tec_z_extra = 0.0f;
118 const size_t size = in_seeds.size();
120 auto barrel_pos_check = [](
const Track &
S,
float maxR,
float rin,
float zmax) ->
bool {
121 bool inside = maxR > rin &&
S.zAtR(rin) <
zmax;
125 auto barrel_neg_check = [](
const Track &
S,
float maxR,
float rin,
float zmin) ->
bool {
126 bool inside = maxR > rin &&
S.zAtR(rin) >
zmin;
130 auto endcap_pos_check = [](
const Track &
S,
float maxR,
float rout,
float rin,
float zmin) ->
bool {
131 bool inside = maxR > rout ?
S.zAtR(rout) >
zmin : (maxR > rin &&
S.zAtR(maxR) >
zmin);
135 auto endcap_neg_check = [](
const Track &
S,
float maxR,
float rout,
float rin,
float zmax) ->
bool {
136 bool inside = maxR > rout ?
S.zAtR(rout) <
zmax : (maxR > rin &&
S.zAtR(maxR) <
zmax);
140 for (
size_t i = 0;
i <
size; ++
i) {
143 const auto &hot =
S.getLastHitOnTrack();
144 const float eta = eoh[hot.layer].refHit(hot.index).eta();
149 const bool z_dir_pos =
S.pz() > 0;
150 const float maxR =
S.maxReachRadius();
153 const bool in_tib = barrel_pos_check(
S, maxR, tib1.
rin(), tib1.
zmax());
154 const bool in_tob = barrel_pos_check(
S, maxR, tob1.
rin(), tob1.
zmax());
156 if (!in_tib && !in_tob) {
157 reg = TrackerInfo::Reg_Endcap_Pos;
159 const bool in_tid = endcap_pos_check(
S, maxR, tidp_rout, tidp_rin, tidp1.
zmin() - tid_z_extra);
160 const bool in_tec = endcap_pos_check(
S, maxR, tecp_rout, tecp_rin, tecp1.
zmin() - tec_z_extra);
162 if (!in_tid && !in_tec) {
163 reg = TrackerInfo::Reg_Barrel;
165 reg = TrackerInfo::Reg_Transition_Pos;
169 const bool in_tib = barrel_neg_check(
S, maxR, tib1.
rin(), tib1.
zmin());
170 const bool in_tob = barrel_neg_check(
S, maxR, tob1.
rin(), tob1.
zmin());
172 if (!in_tib && !in_tob) {
173 reg = TrackerInfo::Reg_Endcap_Neg;
175 const bool in_tid = endcap_neg_check(
S, maxR, tidn_rout, tidn_rin, tidn1.
zmax() + tid_z_extra);
176 const bool in_tec = endcap_neg_check(
S, maxR, tecn_rout, tecn_rin, tecn1.
zmax() + tec_z_extra);
178 if (!in_tid && !in_tec) {
179 reg = TrackerInfo::Reg_Barrel;
181 reg = TrackerInfo::Reg_Transition_Neg;
186 part.m_region[
i] = reg;
187 if (
part.m_phi_eta_foo)
188 part.m_phi_eta_foo(eoh[hot.layer].refHit(hot.index).phi(),
eta);
192 [[maybe_unused]]
void partitionSeeds1debug(
const TrackerInfo &trk_info,
197 constexpr
int tib1_id = 4;
198 constexpr
int tob1_id = 10;
199 constexpr
int tidp1_id = 21;
200 constexpr
int tidn1_id = 48;
201 constexpr
int tecp1_id = 27;
202 constexpr
int tecn1_id = 54;
215 const auto &
L = trk_info;
216 const float tidp_rin =
std::min(
L[tidp1_id].rin(),
L[tidp1_id + 1].rin());
217 const float tidp_rout =
std::max(
L[tidp1_id].rout(),
L[tidp1_id + 1].rout());
218 const float tecp_rin =
std::min(
L[tecp1_id].rin(),
L[tecp1_id + 1].rin());
219 const float tecp_rout =
std::max(
L[tecp1_id].rout(),
L[tecp1_id + 1].rout());
220 const float tidn_rin =
std::min(
L[tidn1_id].rin(),
L[tidn1_id + 1].rin());
221 const float tidn_rout =
std::max(
L[tidn1_id].rout(),
L[tidn1_id + 1].rout());
222 const float tecn_rin =
std::min(
L[tecn1_id].rin(),
L[tecn1_id + 1].rin());
223 const float tecn_rout =
std::max(
L[tecn1_id].rout(),
L[tecn1_id + 1].rout());
227 const float tid_z_extra = 0.0f;
228 const float tec_z_extra = 0.0f;
230 const int size = in_seeds.size();
232 auto barrel_pos_check = [](
const Track &
S,
float maxR,
float rin,
float zmax,
const char *det) ->
bool {
233 bool inside = maxR > rin &&
S.zAtR(rin) <
zmax;
235 printf(
" in_%s=%d maxR=%7.3f, rin=%7.3f -- ", det, inside, maxR, rin);
237 printf(
"maxR > rin: S.zAtR(rin) < zmax -- %.3f <? %.3f\n",
S.zAtR(rin),
zmax);
239 printf(
"maxR < rin: no pie.\n");
245 auto barrel_neg_check = [](
const Track &
S,
float maxR,
float rin,
float zmin,
const char *det) ->
bool {
246 bool inside = maxR > rin &&
S.zAtR(rin) >
zmin;
248 printf(
" in_%s=%d maxR=%7.3f, rin=%7.3f -- ", det, inside, maxR, rin);
250 printf(
"maxR > rin: S.zAtR(rin) > zmin -- %.3f >? %.3f\n",
S.zAtR(rin),
zmin);
252 printf(
"maxR < rin: no pie.\n");
258 auto endcap_pos_check = [](
const Track &
S,
float maxR,
float rout,
float rin,
float zmin,
const char *det) ->
bool {
259 bool inside = maxR > rout ?
S.zAtR(rout) >
zmin : (maxR > rin &&
S.zAtR(maxR) >
zmin);
261 printf(
" in_%s=%d maxR=%7.3f, rout=%7.3f, rin=%7.3f -- ", det, inside, maxR, rout, rin);
263 printf(
"maxR > rout: S.zAtR(rout) > zmin -- %.3f >? %.3f\n",
S.zAtR(rout),
zmin);
264 }
else if (maxR > rin) {
265 printf(
"maxR > rin: S.zAtR(maxR) > zmin) -- %.3f >? %.3f\n",
S.zAtR(maxR),
zmin);
267 printf(
"maxR < rin: no pie.\n");
273 auto endcap_neg_check = [](
const Track &
S,
float maxR,
float rout,
float rin,
float zmax,
const char *det) ->
bool {
274 bool inside = maxR > rout ?
S.zAtR(rout) <
zmax : (maxR > rin &&
S.zAtR(maxR) <
zmax);
276 printf(
" in_%s=%d maxR=%7.3f, rout=%7.3f, rin=%7.3f -- ", det, inside, maxR, rout, rin);
278 printf(
"maxR > rout: S.zAtR(rout) < zmax -- %.3f <? %.3f\n",
S.zAtR(rout),
zmax);
279 }
else if (maxR > rin) {
280 printf(
"maxR > rin: S.zAtR(maxR) < zmax -- %.3f <? %.3f\n",
S.zAtR(maxR),
zmax);
282 printf(
"maxR < rin: no pie.\n");
288 for (
int i = 0;
i <
size; ++
i) {
298 const bool z_dir_pos =
S.pz() > 0;
299 const float maxR =
S.maxReachRadius();
301 printf(
"partitionSeeds1debug seed index %d, z_dir_pos=%d (pz=%.3f), maxR=%.3f\n",
i, z_dir_pos,
S.pz(), maxR);
304 bool in_tib = barrel_pos_check(
S, maxR, tib1.
rin(), tib1.
zmax(),
"TIBp");
305 bool in_tob = barrel_pos_check(
S, maxR, tob1.
rin(), tob1.
zmax(),
"TOBp");
307 if (!in_tib && !in_tob) {
308 reg = TrackerInfo::Reg_Endcap_Pos;
309 printf(
" --> region = %d, endcap pos\n", reg);
311 bool in_tid = endcap_pos_check(
S, maxR, tidp_rout, tidp_rin, tidp1.
zmin() - tid_z_extra,
"TIDp");
312 bool in_tec = endcap_pos_check(
S, maxR, tecp_rout, tecp_rin, tecp1.
zmin() - tec_z_extra,
"TECp");
314 if (!in_tid && !in_tec) {
315 reg = TrackerInfo::Reg_Barrel;
316 printf(
" --> region = %d, barrel\n", reg);
318 reg = TrackerInfo::Reg_Transition_Pos;
319 printf(
" --> region = %d, transition pos\n", reg);
323 bool in_tib = barrel_neg_check(
S, maxR, tib1.
rin(), tib1.
zmin(),
"TIBn");
324 bool in_tob = barrel_neg_check(
S, maxR, tob1.
rin(), tob1.
zmin(),
"TOBn");
326 if (!in_tib && !in_tob) {
327 reg = TrackerInfo::Reg_Endcap_Neg;
328 printf(
" --> region = %d, endcap neg\n", reg);
330 bool in_tid = endcap_neg_check(
S, maxR, tidn_rout, tidn_rin, tidn1.
zmax() + tid_z_extra,
"TIDn");
331 bool in_tec = endcap_neg_check(
S, maxR, tecn_rout, tecn_rin, tecn1.
zmax() + tec_z_extra,
"TECn");
333 if (!in_tid && !in_tec) {
334 reg = TrackerInfo::Reg_Barrel;
335 printf(
" --> region = %d, barrel\n", reg);
337 reg = TrackerInfo::Reg_Transition_Neg;
338 printf(
" --> region = %d, transition neg\n", reg);
343 part.m_region[
i] = reg;
344 if (
part.m_phi_eta_foo)
350 register_seed_partitioners() {
351 IterationConfig::register_seed_partitioner(
"phase1:0", partitionSeeds0);
352 IterationConfig::register_seed_partitioner(
"phase1:1", partitionSeeds1);
353 IterationConfig::register_seed_partitioner(
"phase1:1:debug", partitionSeeds1debug);
const LayerInfo & outer_barrel_layer() const
bool is_within_z_limits(float z) const
const LayerInfo & layer(int l) const
std::vector< Track > TrackVec