32 if (conn_fileName.empty()) {
33 ATH_MSG_FATAL(
"Cannot find layer connections file " << conn_fileName);
34 return StatusCode::FAILURE;
38 std::ifstream ifs(conn_fileName.c_str());
45 ATH_MSG_INFO(
"Layer connections are initialized from file " << conn_fileName);
63 return StatusCode::SUCCESS;
75 const float cut_dphi_max =
m_LRTmode ? 0.07 : 0.012;
76 const float cut_dcurv_max =
m_LRTmode ? 0.015 : 0.001;
77 const float cut_tau_ratio_max =
m_LRTmode ? 0.015 : 0.007;
80 const float min_deltaPhi =
m_LRTmode ? 0.01f : 0.001f;
82 const float maxOuterRadius =
m_LRTmode ? 1050.0 : 550.0;
84 const float cut_zMinU = min_z0 + maxOuterRadius*roi.
dzdrMinus();
85 const float cut_zMaxU = max_z0 + maxOuterRadius*roi.
dzdrPlus();
87 const float ptCoeff = 0.29997*1.9972/2.0;
89 float tripletPtMin = 0.8*
m_minPt;
91 float maxCurv = ptCoeff/tripletPtMin;
93 const float maxKappa_high_eta =
m_LRTmode ? 1.0*maxCurv : std::sqrt(0.8)*maxCurv;
94 const float maxKappa_low_eta =
m_LRTmode ? 1.0*maxCurv : std::sqrt(0.6)*maxCurv;
95 const float dphi_coeff =
m_LRTmode ? 1.0*maxCurv : 0.68*maxCurv;
97 const float minDeltaRadius = 2.0;
101 unsigned int nConnections = 0;
107 for(
const auto&
bg :
m_geo->bin_groups()) {
111 if(B1.
empty())
continue;
115 for(
const auto& b2_idx :
bg.second) {
119 if(B2.
empty())
continue;
124 deltaPhi = min_deltaPhi + dphi_coeff*std::fabs(rb2-rb1);
127 unsigned int first_it = 0;
129 for(
unsigned int n1Idx = 0;n1Idx<B1.
m_vn.size();n1Idx++) {
131 std::vector<unsigned int>& v1In = B1.
m_in[n1Idx];
135 const std::array<float, 5>& n1pars = B1.
m_params[n1Idx];
137 float phi1 = n1pars[2];
138 float r1 = n1pars[3];
139 float z1 = n1pars[4];
146 for(
unsigned int n2PhiIdx = first_it; n2PhiIdx<B2.
m_vPhiNodes.size();n2PhiIdx++) {
154 if(phi2 > maxPhi)
break;
156 unsigned int n2Idx = B2.
m_vPhiNodes[n2PhiIdx].second;
158 const std::vector<unsigned int>& v2In = B2.
m_in[n2Idx];
162 const std::array<float, 5>& n2pars = B2.
m_params[n2Idx];
164 float r2 = n2pars[3];
168 if(
dr < minDeltaRadius) {
172 float z2 = n2pars[4];
176 float ftau = std::fabs(tau);
181 if(ftau < n1pars[0])
continue;
182 if(ftau > n1pars[1])
continue;
184 if(ftau < n2pars[0])
continue;
185 if(ftau > n2pars[1])
continue;
189 float z0 = z1 - r1*tau;
191 if(z0 < min_z0 || z0 > max_z0)
continue;
193 float zouter =
z0 + maxOuterRadius*tau;
195 if(zouter < cut_zMinU || zouter > cut_zMaxU)
continue;
198 float curv = (phi2-phi1)/
dr;
199 float abs_curv = std::abs(curv);
202 if(abs_curv > maxKappa_low_eta) {
207 if(abs_curv > maxKappa_high_eta) {
212 float exp_eta = std::sqrt(1+tau*tau)-tau;
216 bool isGood = v2In.size() <= 2;
220 float uat_1 = 1.0f/exp_eta;
222 for(
const auto& n2_in_idx : v2In) {
224 float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
225 float tau_ratio = tau2*uat_1 - 1.0f;
227 if(std::fabs(tau_ratio) > cut_tau_ratio_max){
240 float dPhi2 = curv*r2;
241 float dPhi1 = curv*r1;
245 edgeStorage.emplace_back(B1.
m_vn[n1Idx], B2.
m_vn[n2Idx], exp_eta, curv, phi1 + dPhi1);
249 int outEdgeIdx = nEdges;
251 float uat_2 = 1/exp_eta;
252 float Phi2 = phi2 + dPhi2;
255 for(
const auto& inEdgeIdx : v2In) {
261 float tau_ratio = pS->
m_p[0]*uat_2 - 1.0f;
263 if(std::abs(tau_ratio) > cut_tau_ratio_max){
267 float dPhi = Phi2 - pS->
m_p[2];
272 if(dPhi < -cut_dphi_max || dPhi > cut_dphi_max) {
276 float dcurv = curv2 - pS->
m_p[1];
278 if(dcurv < -cut_dcurv_max || dcurv > cut_dcurv_max) {
294 return std::make_pair(nEdges, nConnections);
299 const int maxIter = 15;
305 std::vector<TrigFTF_GNNR3_Edge*> v_old;
307 for(
int edgeIndex=0;edgeIndex<nEdges;edgeIndex++) {
310 if(pS->
m_nNei == 0)
continue;
318 std::vector<TrigFTF_GNNR3_Edge*> v_new;
320 v_new.reserve(v_old.size());
322 for(
auto pS : v_old) {
324 int next_level = pS->m_level;
326 for(
int nIdx=0;nIdx<pS->m_nNei;nIdx++) {
328 unsigned int nextEdgeIdx = pS->m_vNei[nIdx];
332 if(pS->m_level == pN->
m_level) {
339 pS->m_next = next_level;
346 for(
auto pS : v_new) {
347 if(pS->m_next != pS->m_level) {
349 pS->m_level = pS->m_next;
350 if(maxLevel < pS->m_level) maxLevel = pS->m_level;
354 if(nChanges == 0)
break;
357 v_old = std::move(v_new);