From 417dafff3acdd3ab5a7bd2c91a773e14cbb995a7 Mon Sep 17 00:00:00 2001 From: Jeet-bhai <108902343+Jeet-bhai@users.noreply.github.com> Date: Wed, 10 Jan 2024 18:17:15 -0600 Subject: [PATCH] fixed Seed charge calculation (#1213) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Briefly, what does this PR introduce? This pull request modifies the calculation of the seed charge for real seeding for particles generated off the beam axis. The diagram below shows the proposed change Screenshot 2024-01-10 at 3 03 59 PM Here is some statistics to validate this request: N=10k events, muon with eta -4 to 4, and momentum 0.5 to 20 GeV Negative muon at (0,0,0) Total seeds: 25774 Wrong charge seeds (pre-fix): 301 (1.2%) Wrong charge seeds (post-fix): 224 (0.87%) Negative muon at (1,0,0) mm Total seeds: 25521 Wrong charge seeds(pre-fix): 5407 (21.1%) Wrong charge seeds(post-fix): 230 (0.9%) Positive muon at (1,0,0) mm Total seeds: 27688 Wrong charge seeds(pre-fix): 5376 (19.4%) Wrong charge seeds(post-fix): 368 (1.3%) This shows that the results are stable for particle generated at z=0. for particles generated off the beam axis, the results improve significantly for both positive and negative muon. ### What kind of change does this PR introduce? - [ X] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [x ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ x] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? none ### Does this PR change default behavior? yes, for real seeded tracking --------- Co-authored-by: Barak Schmookler --- src/algorithms/tracking/TrackSeeding.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/algorithms/tracking/TrackSeeding.cc b/src/algorithms/tracking/TrackSeeding.cc index 1da682b221..e0e06058fa 100644 --- a/src/algorithms/tracking/TrackSeeding.cc +++ b/src/algorithms/tracking/TrackSeeding.cc @@ -181,8 +181,18 @@ std::unique_ptr eicrecon::TrackSeeding::make } auto slopeZ0 = lineFit(rzHitPositions); + const auto xypos = findPCA(RX0Y0); + + //Determine charge + std::vector> xyrelPos; + + for ( const auto& spptr : seed.sp() ) + { + xyrelPos.emplace_back(spptr->x()-xypos.first, spptr->y()-xypos.second); + } + + int charge = determineCharge(xyrelPos); - int charge = determineCharge(xyHitPositions); float theta = atan(1./std::get<0>(slopeZ0)); // normalize to 0 eicrecon::TrackSeeding::make float p = pt * cosh(eta); float qOverP = charge / p; - const auto xypos = findPCA(RX0Y0); - //Calculate phi at xypos auto xpos = xypos.first; auto ypos = xypos.second;