-
Notifications
You must be signed in to change notification settings - Fork 225
Back to original try. No change in previous classes. And new v6 class. #4291
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /** | ||
| * @file trackbase/TrkrClusterv6.cc | ||
| * @author Ishan Goel | ||
| * @date May 2026 | ||
| * @brief Implementation of TrkrClusterv6 | ||
| */ | ||
| #include "TrkrClusterv6.h" | ||
|
|
||
| #include <cmath> | ||
| #include <utility> // for swap | ||
|
|
||
| namespace | ||
| { | ||
| // square convenience function | ||
| template <class T> | ||
| constexpr T square(const T& x) | ||
| { | ||
| return x * x; | ||
| } | ||
| } // namespace | ||
|
|
||
| void TrkrClusterv6::identify(std::ostream& os) const | ||
| { | ||
| os << "---TrkrClusterv6--------------------" << std::endl; | ||
|
|
||
| os << " (rphi,z) = (" << getLocalX(); | ||
| os << ", " << getLocalY() << ") cm "; | ||
|
|
||
| os << " valid = " << isValid() << std::endl; | ||
|
|
||
| os << std::endl; | ||
| os << "-----------------------------------------------" << std::endl; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| int TrkrClusterv6::isValid() const | ||
| { | ||
| for (int i = 0; i < 2; ++i) | ||
| { | ||
| if (std::isnan(getPosition(i))) | ||
| { | ||
| return 0; | ||
| } | ||
| } | ||
| if (m_adc == 0xFFFF) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| return 1; | ||
| } | ||
|
|
||
| void TrkrClusterv6::CopyFrom(const TrkrCluster& source) | ||
| { | ||
| // do nothing if copying onto oneself | ||
| if (this == &source) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| // parent class method | ||
| TrkrCluster::CopyFrom(source); | ||
|
|
||
| setLocalX(source.getLocalX()); | ||
| setLocalY(source.getLocalY()); | ||
| setSubSurfKey(source.getSubSurfKey()); | ||
| setAdc(source.getAdc()); | ||
| setMaxAdc(source.getMaxAdc()); | ||
| setCenAdc(source.getCenAdc()); | ||
| setPadCen(source.getPadCen()); | ||
| setTBinCen(source.getTBinCen()); | ||
| setPadMax(source.getPadMax()); | ||
| setTBinMax(source.getTBinMax()); | ||
| setPhiError(source.getRPhiError()); | ||
| setZError(source.getZError()); | ||
| setRSize(source.getRSize()); | ||
| setPhiSize(source.getPhiSize()); | ||
| setZSize(source.getZSize()); | ||
| setOverlap(source.getOverlap()); | ||
| setEdge(source.getEdge()); | ||
| setSLEdge(source.getSLEdge()); | ||
| setSREdge(source.getSREdge()); | ||
| setTLEdge(source.getTLEdge()); | ||
| setTREdge(source.getTREdge()); | ||
| setDLEdge(source.getDLEdge()); | ||
| setDREdge(source.getDREdge()); | ||
| setHLEdge(source.getHLEdge()); | ||
| setHREdge(source.getHREdge()); | ||
| setSLMix(source.getSLMix()); | ||
| setSRMix(source.getSRMix()); | ||
| setTLMix(source.getTLMix()); | ||
| setTRMix(source.getTRMix()); | ||
| setPhiBinLo(source.getPhiBinLo()); | ||
| setPhiBinHi(source.getPhiBinHi()); | ||
| setTBinLo(source.getTBinLo()); | ||
| setTBinHi(source.getTBinHi()); | ||
| setPadPhase(source.getPadPhase()); | ||
| setTBinPhase(source.getTBinPhase()); | ||
| } | ||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 1706
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 5306
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 327
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 327
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 60
🏁 Script executed:
Repository: sPHENIX-Collaboration/coresoftware
Length of output: 4010
Guard sentinel-to-narrow assignments in
TrkrClusterv6::CopyFromto prevent corrupted cluster state.TrkrClusterbase getters returnNANforgetRSize/getPhiSize/getZSizeandstd::numeric_limits<int>::max()forgetSLMix/getSRMix/getTLMix/getTRMix.TrkrClusterv6::CopyFromthen writes these directly into narrow types (setRSize(unsigned char),setPhiSize(char),setZSize(char), andset*Mix(char)) at lines 118-120 and 131-134, soNAN→integer conversion is undefined andINT_MAX→charproduces invalid/corrupted values for non-v6 sources.Add sentinel/range checks (or only copy these fields when the source is known-valid for v6) before calling the narrow setters.