Skip to content

CHG: MReadOutAssembly class clean up#167

Open
zoglauer wants to merge 1 commit into
cositools:develop/emfrom
zoglauer:feature/MReadOutAssembly-cleanup
Open

CHG: MReadOutAssembly class clean up#167
zoglauer wants to merge 1 commit into
cositools:develop/emfrom
zoglauer:feature/MReadOutAssembly-cleanup

Conversation

@zoglauer

Copy link
Copy Markdown
Collaborator

Lot's of changes, but 99% are just code, documentation & formatting clean-up.
Unit tests should pass.

@zoglauer zoglauer requested review from ckierans, fhagemann and snpike and removed request for snpike June 23, 2026 19:28

@fhagemann fhagemann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me.
Mostly style guide changes but also:

  • Removing StripHitTOnly methods
  • Changing m_InDetector from bool[16] to array<bool,16>
  • Adding a comment about a BUG? --> If the bug still persists, keep track of it in an issue?

Comment on lines +229 to 236
void SetStripHitBelowThreshold_QualityFlag(const MString& Text = "") { m_StripHitBelowThreshold_QualityFlag = true; if (Text != "") m_StripHitBelowThresholdString_QualityFlag.push_back(Text); }
//! Get the Strip Hit Below Threshold quality flag
bool HasStripHitBelowThreshold_QualityFlag() const { return m_StripHitBelowThreshold_QualityFlag; }

//! Set the Strip Pairing quality flag
void SetStripPairing_QualityFlag(MString Text = ""){ m_StripPairing_QualityFlag = true;
if (Text != "") { m_StripPairingString_QualityFlag.push_back(Text); }}
void SetStripPairing_QualityFlag(const MString& Text = "") { m_StripPairing_QualityFlag = true; if (Text != "") m_StripPairingString_QualityFlag.push_back(Text); }
//! Get the Strip Pairing quality flag
bool HasStripPairing_QualityFlag() const { return m_StripPairing_QualityFlag; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I guess this is more of a style comment, but StripPairing_QualityFlag: is the underscore intended?


//! Whether event contains strip hits in given detector
bool m_InDetector[16];
array<bool, 16> m_InDetector;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the advantage of using array here?

Comment thread src/MReadOutAssembly.cxx
Comment on lines -141 to -144

for (unsigned int DetectorID = 0; DetectorID < 16; ++DetectorID) {
m_InDetector[DetectorID] = false;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this the reason to choose array over bool[16]?

Comment thread src/MReadOutAssembly.cxx
Comment on lines +180 to +185

if (DetectorID >= 0 && DetectorID <= 15) {
return m_InDetector[DetectorID];
}

return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

or just

Suggested change
if (DetectorID >= 0 && DetectorID <= 15) {
return m_InDetector[DetectorID];
}
return false;
return DetectorID >= 0 && DetectorID <= 15 && m_InDetector[DetectorID];

?

Comment thread src/MReadOutAssembly.cxx
// Remove a strip hit

if (i < m_StripHits.size()) {
// BUG: MHit objects retain non-owning references to this strip hit if the caller deletes it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this bug still present or does it need to be fixed? If the latter: track as issue?

Comment thread src/MReadOutAssembly.cxx
void MReadOutAssembly::StreamEvta(ostream& S)
{
//! Stream the content in MEGAlib's evta format
// Stream the content in MEGAlib's evta format.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is the first time I'm seeing a full stop at the end of a comment.

Suggested change
// Stream the content in MEGAlib's evta format.
// Stream the content in MEGAlib's `.evta` format

Comment thread src/MReadOutAssembly.cxx
void MReadOutAssembly::StreamRoa(ostream& S, bool WithADCs, bool WithTACs, bool WithEnergies, bool WithTimings, bool WithTemperatures, bool WithFlags, bool WithOrigins, bool WithNearestNeighbors)
{
//! Stream the content in MEGAlib's evta format
// Stream the content in MEGAlib's roa format.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Never mind, second time ^^

Suggested change
// Stream the content in MEGAlib's roa format.
// Stream the content in MEGAlib's `.roa` format

Comment thread src/MReadOutAssembly.cxx
void MReadOutAssembly::StreamTra(ostream& S)
{
//! Stream the content in MEGAlib's evta format
// Stream the content in MEGAlib's tra format.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// Stream the content in MEGAlib's tra format.
// Stream the content in MEGAlib's `.tra` format

Comment thread src/MReadOutAssembly.cxx
void MReadOutAssembly::StreamBDFlags(ostream& S)
{
// Stream the BD and QA flags
// Stream the BD and QA flags for this assembly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All the comments in this function end with a full-stop now. Is this intended?
This was not the case in the comments before

Comment thread src/MReadOutAssembly.cxx

S<<"PQ";
// iterate through the vectorized strip pairing reduced chi squares
// Append the strip pairing reduced chi-square values.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we care about maximum consistency, this is also called chi^2 in other comments. --> decide on one naming

@fhagemann

Copy link
Copy Markdown

And the GitHub Action tests all pass :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants