-
Notifications
You must be signed in to change notification settings - Fork 42
feat(reco): make SecondaryVerticesHelix variadic and add far-forward-inclusive output #2928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
5
commits into
main
Choose a base branch
from
copilot/modify-secondaryverticeshelix-algorithm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+55
−37
Draft
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
126a721
feat(reco): add variadic inputs to SecondaryVerticesHelix
Copilot f1281f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] df5078a
fix: readability-braces-around-statements
wdconinc c00f087
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ed0622f
feat(reco): make SecondaryVerticesHelix variadic and add far-forward-…
epic-capybara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,8 +36,8 @@ void SecondaryVerticesHelix::init() {} | |||||||
| */ | ||||||||
| void SecondaryVerticesHelix::process(const SecondaryVerticesHelix::Input& input, | ||||||||
| const SecondaryVerticesHelix::Output& output) const { | ||||||||
| const auto [rcvtx, rcparts] = input; | ||||||||
| auto [out_secondary_vertices] = output; | ||||||||
| const auto [rcvtx, rcparts_collections] = input; | ||||||||
| auto [out_secondary_vertices] = output; | ||||||||
|
|
||||||||
| auto& particleSvc = algorithms::ParticleSvc::instance(); | ||||||||
|
|
||||||||
|
|
@@ -60,38 +60,44 @@ void SecondaryVerticesHelix::process(const SecondaryVerticesHelix::Input& input, | |||||||
| debug("Primary vertex = ({},{},{})cm \t b field = {} tesla", pVtxPos.x, pVtxPos.y, pVtxPos.z, | ||||||||
| b_field / dd4hep::tesla); | ||||||||
|
|
||||||||
| std::vector<Helix> hVec; | ||||||||
| hVec.clear(); | ||||||||
| std::vector<unsigned int> indexVec; | ||||||||
| indexVec.clear(); | ||||||||
| for (unsigned int i = 0; const auto& p : *rcparts) { | ||||||||
| if (p.getCharge() == 0) | ||||||||
| continue; | ||||||||
| Helix h(p, b_field); | ||||||||
| double dca = h.distance(pVtxPos) * edm4eic::unit::cm; | ||||||||
| if (dca < m_cfg.minDca) | ||||||||
| continue; | ||||||||
|
|
||||||||
| hVec.push_back(h); | ||||||||
| indexVec.push_back(i); | ||||||||
| ++i; | ||||||||
| } | ||||||||
| struct TrackCandidate { | ||||||||
| Helix helix; | ||||||||
| edm4eic::ReconstructedParticle particle; | ||||||||
| float field; | ||||||||
| }; | ||||||||
|
|
||||||||
| if (hVec.size() != indexVec.size()) | ||||||||
| return; | ||||||||
| std::vector<TrackCandidate> candidates; | ||||||||
| candidates.clear(); | ||||||||
|
|
||||||||
| for (std::size_t i_coll = 0; i_coll < rcparts_collections.size(); ++i_coll) { | ||||||||
| const auto& rcparts = rcparts_collections[i_coll]; | ||||||||
| const float trackField = (i_coll == 0) ? b_field : 0; | ||||||||
| for (const auto& p : *rcparts) { | ||||||||
| if (p.getCharge() == 0) { | ||||||||
| continue; | ||||||||
| } | ||||||||
| Helix h(p, trackField); | ||||||||
| double dca = h.distance(pVtxPos) * edm4eic::unit::cm; | ||||||||
| if (dca < m_cfg.minDca) { | ||||||||
| continue; | ||||||||
| } | ||||||||
| candidates.push_back({h, p, trackField}); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| debug("\tVector size {}, {}", hVec.size(), indexVec.size()); | ||||||||
| debug("\tVector size {}", candidates.size()); | ||||||||
|
|
||||||||
| for (unsigned int i1 = 0; i1 < hVec.size(); ++i1) { | ||||||||
| for (unsigned int i2 = i1 + 1; i2 < hVec.size(); ++i2) { | ||||||||
| const auto& p1 = (*rcparts)[indexVec[i1]]; | ||||||||
| const auto& p2 = (*rcparts)[indexVec[i2]]; | ||||||||
| for (unsigned int i1 = 0; i1 < candidates.size(); ++i1) { | ||||||||
| for (unsigned int i2 = i1 + 1; i2 < candidates.size(); ++i2) { | ||||||||
| const auto& p1 = candidates[i1].particle; | ||||||||
| const auto& p2 = candidates[i2].particle; | ||||||||
|
|
||||||||
| if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0)) | ||||||||
| if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0)) { | ||||||||
| continue; | ||||||||
| } | ||||||||
|
|
||||||||
|
wdconinc marked this conversation as resolved.
|
||||||||
| const auto& h1 = hVec[i1]; | ||||||||
| const auto& h2 = hVec[i2]; | ||||||||
| const auto& h1 = candidates[i1].helix; | ||||||||
| const auto& h2 = candidates[i2].helix; | ||||||||
|
|
||||||||
| // Helix function uses cm unit | ||||||||
| double dca1 = h1.distance(pVtxPos) * edm4eic::unit::cm; | ||||||||
|
|
@@ -110,8 +116,8 @@ void SecondaryVerticesHelix::process(const SecondaryVerticesHelix::Input& input, | |||||||
| continue; | ||||||||
| edm4hep::Vector3f pairPos = 0.5 * (h1AtDcaTo2 + h2AtDcaTo1); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
|
||||||||
| edm4hep::Vector3f h1MomAtDca = h1.momentumAt(ss.first, b_field); | ||||||||
| edm4hep::Vector3f h2MomAtDca = h2.momentumAt(ss.second, b_field); | ||||||||
| edm4hep::Vector3f h1MomAtDca = h1.momentumAt(ss.first, candidates[i1].field); | ||||||||
| edm4hep::Vector3f h2MomAtDca = h2.momentumAt(ss.second, candidates[i2].field); | ||||||||
| edm4hep::Vector3f pairMom = h1MomAtDca + h2MomAtDca; | ||||||||
|
|
||||||||
| double e1 = | ||||||||
|
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean expression can be simplified by DeMorgan's theorem