@@ -818,10 +818,13 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
818818 float avgtriplety = 0 ;
819819 for (auto & pos : clusters)
820820 {
821- avgtripletx += std::cos (std::atan2 (pos (1 ), pos (0 )));
822- avgtriplety += std::sin (std::atan2 (pos (1 ), pos (0 )));
821+
822+ avgtripletx += std::cos (getPhiFromBeamSpot (pos (1 ), pos (0 )));
823+ avgtriplety += std::sin (getPhiFromBeamSpot (pos (1 ), pos (0 )));
823824 }
825+
824826 float avgtripletphi = std::atan2 (avgtriplety, avgtripletx);
827+
825828 std::vector<TrkrDefs::cluskey> dummykeys = keys;
826829 std::vector<Acts::Vector3> dummyclusters = clusters;
827830
@@ -889,19 +892,31 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
889892 // get an estimate of the phi of the track at this layer
890893 // to know which hitsetkeys to look at
891894 float layerradius = 0 ;
895+ float x0 = 0.0 ;
896+ float y0 = 0.0 ;
897+
892898 if (layer > 2 )
893899 {
894900 layerradius = m_geomContainerIntt->GetLayerGeom (layer)->get_radius ();
895901 }
896902 else
897903 {
898904 layerradius = m_geomContainerMvtx->GetLayerGeom (layer)->get_radius ();
905+ x0 = m_mvtx_x0;
906+ y0 = m_mvtx_y0;
899907 }
908+ float xfitradius_moved = fitpars[1 ] - x0;
909+ float yfitradius_moved = fitpars[2 ] - y0;
900910 const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection (layerradius, fitpars[0 ],
901- fitpars[1 ], fitpars[2 ]);
902-
903- float approximate_phi1 = atan2 (yplus, xplus);
904- float approximate_phi2 = atan2 (yminus, xminus);
911+ xfitradius_moved, yfitradius_moved);
912+ float xp = xplus + x0;
913+ float xm = xminus + x0;
914+ float yp = yplus + y0;
915+ float ym = yminus + y0;
916+
917+
918+ float approximate_phi1 = getPhiFromBeamSpot (yp, xp);
919+ float approximate_phi2 = getPhiFromBeamSpot (ym, xm);
905920 float approximatephi = approximate_phi1;
906921 if (std::fabs (normPhi2Pi (approximate_phi2 - avgtripletphi)) < std::fabs (normPhi2Pi (approximate_phi1 - avgtripletphi)))
907922 {
@@ -911,7 +926,7 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
911926 {
912927 auto surf = m_tGeometry->maps ().getSiliconSurface (hitsetkey);
913928 auto surfcenter = surf->center (m_tGeometry->geometry ().geoContext );
914- float surfphi = atan2 (surfcenter.y (), surfcenter.x ());
929+ float surfphi = getPhiFromBeamSpot (surfcenter.y (), surfcenter.x ());
915930
916931 float dphi = normPhi2Pi (approximatephi - surfphi);
917932 // / Check that the projection is within some reasonable amount of the segment
@@ -1141,9 +1156,10 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
11411156 float avgtriplety = 0 ;
11421157 for (const auto & pos : positions)
11431158 {
1144- avgtripletx += std::cos (std::atan2 (pos (1 ), pos (0 )));
1145- avgtriplety += std::sin (std::atan2 (pos (1 ), pos (0 )));
1159+ avgtripletx += std::cos (getPhiFromBeamSpot (pos (1 ), pos (0 )));
1160+ avgtriplety += std::sin (getPhiFromBeamSpot (pos (1 ), pos (0 )));
11461161 }
1162+
11471163 float avgtripletphi = std::atan2 (avgtriplety, avgtripletx);
11481164
11491165 int layer34timebucket = std::numeric_limits<int >::max ();
@@ -1155,13 +1171,29 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
11551171 }
11561172 }
11571173
1174+ // move the fitted circle center the negative of the MVTX center position
1175+ float x0 = 0.0 ; // cm
1176+ float y0 = 0.0 ;
11581177 for (int layer = startLayer; layer < endLayer; ++layer)
11591178 {
11601179 float layerradius = m_geomContainerIntt->GetLayerGeom (layer)->get_radius ();
1161- const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection (layerradius, fitpars[0 ], fitpars[1 ], fitpars[2 ]);
1180+ if (layer < 3 )
1181+ {
1182+ x0 = m_mvtx_x0;
1183+ y0 = m_mvtx_y0;
1184+ }
11621185
1163- float approximate_phi1 = atan2 (yplus, xplus);
1164- float approximate_phi2 = atan2 (yminus, xminus);
1186+ float xfitradius_moved = fitpars[1 ] - x0;
1187+ float yfitradius_moved = fitpars[2 ] - y0;
1188+
1189+ const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection (layerradius, fitpars[0 ], xfitradius_moved, yfitradius_moved);
1190+
1191+ float xp = xplus + x0;
1192+ float xm = xminus + x0;
1193+ float yp = yplus + y0;
1194+ float ym = yminus + y0;
1195+ float approximate_phi1 = getPhiFromBeamSpot (yp, xp);
1196+ float approximate_phi2 = getPhiFromBeamSpot (ym, xm);
11651197 float approximatephi = approximate_phi1;
11661198 if (std::fabs (normPhi2Pi (approximate_phi2 - avgtripletphi)) < std::fabs (normPhi2Pi (approximate_phi1 - avgtripletphi)))
11671199 {
@@ -1171,7 +1203,7 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
11711203 {
11721204 auto surf = m_tGeometry->maps ().getSiliconSurface (hitsetkey);
11731205 auto surfcenter = surf->center (m_tGeometry->geometry ().geoContext );
1174- float surfphi = atan2 (surfcenter.y (), surfcenter.x ());
1206+ float surfphi = getPhiFromBeamSpot (surfcenter.y (), surfcenter.x ());
11751207 if (Verbosity () > 5 )
11761208 {
11771209 std::cout << " approximate phis " << approximate_phi1 << " " << approximate_phi2 << " using " << approximatephi
@@ -1404,7 +1436,8 @@ std::vector<const SpacePoint*> PHActsSiliconSeeding::getSiliconSpacePoints(Acts:
14041436 if (det == TrkrDefs::TrkrId::mvtxId)
14051437 {
14061438 auto strobeId = MvtxDefs::getStrobeId (hitsetkey);
1407- if (strobeId != strobe)
1439+ // if (strobeId != strobe)
1440+ if (abs (strobeId - strobe) > 1 )
14081441 {
14091442 continue ;
14101443 }
@@ -1713,6 +1746,15 @@ double PHActsSiliconSeeding::normPhi2Pi(const double phi)
17131746 return returnPhi;
17141747}
17151748
1749+ float PHActsSiliconSeeding::getPhiFromBeamSpot (float clusy, float clusx) const
1750+ {
1751+ // Calculate the phi value for (clusx, clusy) relative to the beam spot (x,y) position
1752+
1753+ float phirel = std::atan2 (clusy - m_beamSpoty, clusx - m_beamSpotx);
1754+
1755+ return phirel;
1756+ }
1757+
17161758void PHActsSiliconSeeding::largeGridSpacing (const bool spacing)
17171759{
17181760 if (!spacing)
0 commit comments