Skip to content
1 change: 1 addition & 0 deletions offline/packages/TrackingDiagnostics/TrackResiduals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,7 @@ void TrackResiduals::createBranches()
m_clustree->Branch("timebucket", &m_timebucket, "m_timebucket/I");
m_clustree->Branch("segtype", &m_segtype, "m_segtype/I");
m_clustree->Branch("tile", &m_tileid, "m_tileid/I");
m_clustree->Branch("layer", &m_scluslayer, "m_scluslayer/I");

m_tree = new TTree("residualtree", "A tree with track, cluster, and state info");
m_tree->Branch("run", &m_runnumber, "m_runnumber/I");
Expand Down
70 changes: 56 additions & 14 deletions offline/packages/trackreco/PHActsSiliconSeeding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,13 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
float avgtriplety = 0;
for (auto& pos : clusters)
{
avgtripletx += std::cos(std::atan2(pos(1), pos(0)));
avgtriplety += std::sin(std::atan2(pos(1), pos(0)));

avgtripletx += std::cos(getPhiFromBeamSpot(pos(1), pos(0)));
avgtriplety += std::sin(getPhiFromBeamSpot(pos(1), pos(0)));
}

float avgtripletphi = std::atan2(avgtriplety, avgtripletx);

std::vector<TrkrDefs::cluskey> dummykeys = keys;
std::vector<Acts::Vector3> dummyclusters = clusters;

Expand Down Expand Up @@ -889,19 +892,31 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
// get an estimate of the phi of the track at this layer
// to know which hitsetkeys to look at
float layerradius = 0;
float x0 = 0.0;
float y0 = 0.0;

if (layer > 2)
{
layerradius = m_geomContainerIntt->GetLayerGeom(layer)->get_radius();
}
else
{
layerradius = m_geomContainerMvtx->GetLayerGeom(layer)->get_radius();
x0 = m_mvtx_x0;
y0 = m_mvtx_y0;
}
float xfitradius_moved = fitpars[1] - x0;
float yfitradius_moved = fitpars[2] - y0;
const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection(layerradius, fitpars[0],
fitpars[1], fitpars[2]);

float approximate_phi1 = atan2(yplus, xplus);
float approximate_phi2 = atan2(yminus, xminus);
xfitradius_moved, yfitradius_moved);
float xp = xplus + x0;
float xm = xminus + x0;
float yp = yplus + y0;
float ym = yminus + y0;


float approximate_phi1 = getPhiFromBeamSpot(yp, xp);
float approximate_phi2 = getPhiFromBeamSpot(ym, xm);
float approximatephi = approximate_phi1;
if (std::fabs(normPhi2Pi(approximate_phi2 - avgtripletphi)) < std::fabs(normPhi2Pi(approximate_phi1 - avgtripletphi)))
{
Expand All @@ -911,7 +926,7 @@ std::vector<TrkrDefs::cluskey> PHActsSiliconSeeding::findMatches(
{
auto surf = m_tGeometry->maps().getSiliconSurface(hitsetkey);
auto surfcenter = surf->center(m_tGeometry->geometry().geoContext);
float surfphi = atan2(surfcenter.y(), surfcenter.x());
float surfphi = getPhiFromBeamSpot(surfcenter.y(), surfcenter.x());

float dphi = normPhi2Pi(approximatephi - surfphi);
/// Check that the projection is within some reasonable amount of the segment
Expand Down Expand Up @@ -1141,9 +1156,10 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
float avgtriplety = 0;
for (const auto& pos : positions)
{
avgtripletx += std::cos(std::atan2(pos(1), pos(0)));
avgtriplety += std::sin(std::atan2(pos(1), pos(0)));
avgtripletx += std::cos(getPhiFromBeamSpot(pos(1), pos(0)));
avgtriplety += std::sin(getPhiFromBeamSpot(pos(1), pos(0)));
}

float avgtripletphi = std::atan2(avgtriplety, avgtripletx);

int layer34timebucket = std::numeric_limits<int>::max();
Expand All @@ -1155,13 +1171,29 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
}
}

// move the fitted circle center the negative of the MVTX center position
float x0 = 0.0; // cm
float y0 = 0.0;
for (int layer = startLayer; layer < endLayer; ++layer)
{
float layerradius = m_geomContainerIntt->GetLayerGeom(layer)->get_radius();
const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection(layerradius, fitpars[0], fitpars[1], fitpars[2]);
if(layer < 3)
{
x0 = m_mvtx_x0;
y0 = m_mvtx_y0;
}

float approximate_phi1 = atan2(yplus, xplus);
float approximate_phi2 = atan2(yminus, xminus);
float xfitradius_moved = fitpars[1] - x0;
float yfitradius_moved = fitpars[2] - y0;

const auto [xplus, yplus, xminus, yminus] = TrackFitUtils::circle_circle_intersection(layerradius, fitpars[0], xfitradius_moved, yfitradius_moved);

float xp = xplus + x0;
float xm = xminus + x0;
float yp = yplus + y0;
float ym = yminus + y0;
float approximate_phi1 = getPhiFromBeamSpot(yp, xp);
float approximate_phi2 = getPhiFromBeamSpot(ym, xm);
float approximatephi = approximate_phi1;
if (std::fabs(normPhi2Pi(approximate_phi2 - avgtripletphi)) < std::fabs(normPhi2Pi(approximate_phi1 - avgtripletphi)))
{
Expand All @@ -1171,7 +1203,7 @@ std::vector<std::vector<TrkrDefs::cluskey>> PHActsSiliconSeeding::iterateLayers(
{
auto surf = m_tGeometry->maps().getSiliconSurface(hitsetkey);
auto surfcenter = surf->center(m_tGeometry->geometry().geoContext);
float surfphi = atan2(surfcenter.y(), surfcenter.x());
float surfphi = getPhiFromBeamSpot(surfcenter.y(), surfcenter.x());
if(Verbosity() > 5)
{
std::cout << "approximate phis " << approximate_phi1 << " " << approximate_phi2 << " using " << approximatephi
Expand Down Expand Up @@ -1404,7 +1436,8 @@ std::vector<const SpacePoint*> PHActsSiliconSeeding::getSiliconSpacePoints(Acts:
if (det == TrkrDefs::TrkrId::mvtxId)
{
auto strobeId = MvtxDefs::getStrobeId(hitsetkey);
if (strobeId != strobe)
//if (strobeId != strobe)
if (abs(strobeId - strobe) > 1)
{
continue;
}
Expand Down Expand Up @@ -1713,6 +1746,15 @@ double PHActsSiliconSeeding::normPhi2Pi(const double phi)
return returnPhi;
}

float PHActsSiliconSeeding::getPhiFromBeamSpot(float clusy, float clusx) const
{
// Calculate the phi value for (clusx, clusy) relative to the beam spot (x,y) position

float phirel = std::atan2(clusy - m_beamSpoty, clusx - m_beamSpotx);

return phirel;
}

void PHActsSiliconSeeding::largeGridSpacing(const bool spacing)
{
if (!spacing)
Expand Down
21 changes: 21 additions & 0 deletions offline/packages/trackreco/PHActsSiliconSeeding.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ class PHActsSiliconSeeding : public SubsysReco
{
m_minSeedPt = pt;
}
void set_mvtxCenterXY(const float X, const float Y)
{
m_mvtx_x0 = X;
m_mvtx_y0 = Y;
}
void set_beamSpotXY(const float X, const float Y)
{
m_beamSpotx = X;
m_beamSpoty = Y;
}

/// A function to run the seeder with large (true)
/// or small (false) grid spacing
Expand Down Expand Up @@ -243,6 +253,8 @@ class PHActsSiliconSeeding : public SubsysReco
short int getCrossingIntt(TrackSeed &si_track);
std::vector<short int> getInttCrossings(TrackSeed &si_track);

float getPhiFromBeamSpot(float clusy, float clusx) const;

void createHistograms();
void writeHistograms();
double normPhi2Pi(const double phi);
Expand Down Expand Up @@ -354,6 +366,15 @@ class PHActsSiliconSeeding : public SubsysReco
float m_inttzSearchWin = 2.0; // default to one strip width
double m_mvtxrPhiSearchWin = 0.2;
float m_mvtxzSearchWin = 0.5;

// collision point in sPHENIX coordinates, from vertex finder (pp run 3)
float m_beamSpotx = -0.072; // cm
float m_beamSpoty = 0.141; // cm

// center of MVTX barrel in sPHENIX coordinates - default is for Run 3 pp
float m_mvtx_x0 = 0.6; // cm
float m_mvtx_y0 = -0.1;

Comment on lines +370 to +377
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, check the file structure and context around these lines
wc -l offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 131


🏁 Script executed:

# Examine the code around these defaults to understand their purpose and usage
sed -n '350,390p' offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1473


🏁 Script executed:

# Search for where these member variables are used within the class
rg "m_beamSpot|m_mvtx_" offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 288


🏁 Script executed:

# Check if there's a corresponding .cc file to see how these are used
fd "PHActsSiliconSeeding\.cc" offline/packages/trackreco/

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 128


🏁 Script executed:

# Search for usage of these beam-spot/MVTX variables in the .cc file
rg "m_beamSpot|m_mvtx_" offline/packages/trackreco/PHActsSiliconSeeding.cc -A 3 | head -60

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 409


🏁 Script executed:

# Check the git log to see if these defaults recently changed
git log --oneline -20 -- offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 107


🏁 Script executed:

# Check git diff to see what changed in this PR for these specific lines
git diff HEAD~1 -- offline/packages/trackreco/PHActsSiliconSeeding.h | grep -A 5 -B 5 "beamSpot\|mvtx_"

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 106


🏁 Script executed:

# Check git status to understand the current state
git status

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 143


🏁 Script executed:

# Try to get the full git log with more context
git log --oneline -50 -- offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 107


🏁 Script executed:

# Check if there's a PR description or commit message
git log -1 --format="%B"

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 98


🏁 Script executed:

# Search for any recent changes to these defaults across the repository
git log -p --all -S "m_beamSpotx = -0.072" -- offline/packages/trackreco/PHActsSiliconSeeding.h | head -100

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 60


🏁 Script executed:

# Check if there's more commit history we can access
git log --all --oneline | head -50

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 2908


🏁 Script executed:

# Try to see the current file state and search for when these specific values were set
git log --all -p -- offline/packages/trackreco/PHActsSiliconSeeding.h | grep -B 10 -A 10 "0.6.*cm\|0.141" | head -80

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 164


🏁 Script executed:

# Look for any documentation about these parameters in comments
grep -B 5 -A 5 "Run 3 pp\|beam.spot" offline/packages/trackreco/PHActsSiliconSeeding.h

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 456


🏁 Script executed:

# Check if there are any related pull request files or documentation
find . -name "*README*" -o -name "*CHANGES*" -o -name "*NOTES*" | grep -i silicon | head -10

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 60


🏁 Script executed:

# Check what the current HEAD is and what changed
git show --stat 8bc0f1f7c

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 50391


🏁 Script executed:

# Check if the beam spot/mvtx defaults were changed in this commit
git show 8bc0f1f7c -- offline/packages/trackreco/PHActsSiliconSeeding.h | grep -B 5 -A 5 "beamSpot\|mvtx_"

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1020


🏁 Script executed:

# Look at the full diff for this file in this commit
git show 8bc0f1f7c -- offline/packages/trackreco/PHActsSiliconSeeding.h | head -150

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 3868


🏁 Script executed:

# Try to find PR-related files or documentation
find . -name "*.md" -o -name "*.txt" | grep -i "pull\|pr\|request" | head -20

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 112


🏁 Script executed:

# Check the commit message more thoroughly
git log -1 8bc0f1f7c --format="%B" | head -50

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 98


🏁 Script executed:

# Look for any PR description files in the repo root
ls -la | grep -i "pull\|pr\|description"

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 60


🏁 Script executed:

# Check the PR template to understand what should be documented
cat ./.github/pull_request_template.md

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1238


Document reconstruction impact and reprocessing requirements in PR description.

The beam-spot and MVTX center defaults are used directly in reconstruction (fitting calculations and phi angle computations). Changes to these geometry parameters affect track seeding outputs. State the expected analysis impact and whether existing data requires reprocessing.

/// Whether or not to use truth clusters in hit lookup
bool m_useTruthClusters = false;

Expand Down
2 changes: 1 addition & 1 deletion offline/packages/trackreco/PHSimpleVertexFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class PHSimpleVertexFinder : public SubsysReco
double _beamline_y_cut_hi = 0.2;
double _qual_cut = 10.0;
bool _require_mvtx = true;
unsigned int _nmvtx_required = 3;
unsigned int _nmvtx_required = 2;
double _track_pt_cut = 0.0;
double _outlier_cut = 0.015;

Expand Down