2 #include "oneapi/tbb/parallel_for.h"
10 const float a,
const float b,
const float hit1_x,
const float hit1_y,
float& lay2_x,
float& lay2_y) {
11 const float a2 = a *
a;
12 const float b2 = b *
b;
13 const float a2b2 = a2 +
b2;
14 const float lay2rad2 = (Config::fRadialSpacing * Config::fRadialSpacing) * 9.0
f;
18 std::sqrt(2.0
f * maxCurvR2 * (a2b2 + lay2rad2) - (a2b2 - lay2rad2) * (a2b2 - lay2rad2) - maxCurvR2 * maxCurvR2);
19 const float pos[2] = {(a2 * a + a * (b2 + lay2rad2 - maxCurvR2) - b * quad) / a2b2,
20 (b2 * b + b * (a2 + lay2rad2 - maxCurvR2) + a * quad) / a2b2};
21 const float neg[2] = {(a2 * a + a * (b2 + lay2rad2 - maxCurvR2) + b * quad) / a2b2,
22 (b2 * b + b * (a2 + lay2rad2 - maxCurvR2) - a * quad) / a2b2};
25 if (
getHypot(pos[0] - hit1_x, pos[1] - hit1_y) <
getHypot(neg[0] - hit1_x, neg[1] - hit1_y)) {
35 std::vector<LayerOfHits>& evt_lay_hits,
45 const float seed_z2cut =
56 [&](
const tbb::blocked_range<int>&
i) {
58 for (
int ihit1 = i.begin(); ihit1 < i.end(); ++ihit1) {
59 const Hit& hit1 = lay1_hits.
refHit(ihit1);
60 const float hit1_z = hit1.
z();
63 <<
" z: " << hit1.
z());
67 std::vector<int> cand_hit0_indices;
70 for (
auto&& ihit0 : cand_hit0_indices) {
71 const Hit& hit0 = lay0_hits.
refHit(ihit0);
72 const float hit0_z = hit0.
z();
73 const float hit0_x = hit0.
x();
74 const float hit0_y = hit0.
y();
75 const float hit1_x = hit1.
x();
76 const float hit1_y = hit1.
y();
77 const float hit01_r2 =
getRad2(hit0_x - hit1_x, hit0_y - hit1_y);
82 const float aneg = 0.5f * ((hit0_x + hit1_x) - (hit0_y - hit1_y) * quad);
83 const float bneg = 0.5f * ((hit0_y + hit1_y) + (hit0_x - hit1_x) * quad);
86 float lay2_negx = 0.0f, lay2_negy = 0.0f;
89 const float lay2_negphi =
getPhi(lay2_negx, lay2_negy);
93 const float apos = 0.5f * ((hit0_x + hit1_x) + (hit0_y - hit1_y) * quad);
94 const float bpos = 0.5f * ((hit0_y + hit1_y) - (hit0_x - hit1_x) * quad);
97 float lay2_posx = 0.0f, lay2_posy = 0.0f;
100 const float lay2_posphi =
getPhi(lay2_posx, lay2_posy);
103 std::vector<int> cand_hit2_indices;
109 <<
" z: " << hit0.
z());
110 dprint(
" predphi: " << (lay2_posphi + lay2_negphi) / 2.0
f <<
"+/-" << (lay2_posphi - lay2_negphi) / 2.0
f
111 <<
" predz: " << 2.0
f * hit1_z - hit0_z <<
"+/-" << seed_z2cut << std::endl);
116 for (
size_t idx = 0; idx < cand_hit2_indices.size(); ++idx) {
117 const int ihit2 = cand_hit2_indices[idx];
118 const Hit& hit2 = lay2_hits.
refHit(ihit2);
120 const float lay1_predz = (hit0_z + hit2.
z()) / 2.0
f;
125 const float hit2_x = hit2.
x();
126 const float hit2_y = hit2.
y();
129 const float mr = (hit1_y - hit0_y) / (hit1_x - hit0_x);
130 const float mt = (hit2_y - hit1_y) / (hit2_x - hit1_x);
131 const float a = (mr * mt * (hit2_y - hit0_y) + mr * (hit1_x + hit2_x) - mt * (hit0_x + hit1_x)) /
133 const float b = -1.0f * (a - (hit0_x + hit1_x) / 2.0
f) / mr + (hit0_y + hit1_y) / 2.0
f;
134 const float r =
getHypot(hit0_x - a, hit0_y - b);
141 <<
" phi: " << hit2.
phi() <<
" z: " << hit2.
z());
143 temp_thr_seed_idcs.emplace_back(
TripletIdx{{ihit0, ihit1, ihit2}});
147 seed_idcs.grow_by(temp_thr_seed_idcs.begin(), temp_thr_seed_idcs.end());
constexpr float dEtaSeedTrip
constexpr float lay01angdiff
Exp< T >::type exp(const T &t)
void intersectThirdLayer(const float a, const float b, const float hit1_x, const float hit1_y, float &lay2_x, float &lay2_y)
int mcTrackID(const MCHitInfoVec &globalMCHitInfo) const
std::array< int, 3 > TripletIdx
constexpr float seed_d0cut
void findSeedsByRoadSearch(TripletIdxConVec &seed_idcs, std::vector< LayerOfHits > &evt_lay_hits, int lay1_size, Event *&ev)
float getRad2(float x, float y)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
float getHypot(float x, float y)
MCHitInfoVec simHitsInfo_
constexpr float seed_z1cut
float getPhi(float x, float y)
const Hit & refHit(int i) const
constexpr float seed_z0cut
static constexpr float b2
std::vector< TripletIdx > TripletIdxVec