Skip to content

BD and QA event flag overhaul#89

Merged
zoglauer merged 8 commits intocositools:develop/emfrom
ckierans:bad_and_qa_flags
Feb 3, 2026
Merged

BD and QA event flag overhaul#89
zoglauer merged 8 commits intocositools:develop/emfrom
ckierans:bad_and_qa_flags

Conversation

@ckierans
Copy link
Copy Markdown
Collaborator

I've done an overhaul on the BD and QA (quality) event flags, and MReadoutAssembly in general. I remove balloon code relics. And updated variable names so they're a bit easier to understand.

We now have 4 BD errors:

  • m_EnergyCalibrationError
  • m_StripPairingError
  • m_DepthCalibrationError
  • m_EventReconstructionError
    where each error flag can come with text that describes the error in more detail, i.e. "No calibration coefficients", or "Out of Range", etc.

We now have QA flags indicating potentially suspect events, i.e. with strip hits removed below threshold, or poor quality strip pairing. These should be used elsewhere in the code whenever an event is altered (TAC cut).

@ckierans ckierans requested a review from zoglauer January 21, 2026 01:31
@ckierans ckierans linked an issue Jan 21, 2026 that may be closed by this pull request
Comment thread include/MReadOutAssembly.h Outdated
//! Set the energy-calibration-Error flag
void SetEnergyCalibrationError(bool Flag = true, MString Text = "") { m_EnergyCalibrationError = Flag; m_EnergyCalibrationErrorString = Text; }
//! Get the energy-calibration-Error flag
bool IsEnergyCalibrationError() const { return m_EnergyCalibrationError; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

HasEnergyCalibrationError() - same for all below

Comment thread include/MReadOutAssembly.h Outdated
//Track BD Flags

//! Set the energy-calibration-Error flag
void SetEnergyCalibrationError(bool Flag = true, MString Text = "") { m_EnergyCalibrationError = Flag; m_EnergyCalibrationErrorString = Text; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We are overwriting the string if we have multiples. Is that OK? Otherwise the error text should be a vector and we add to it.
Do we ever want to remove the error flag? If no, we don't need the "bool Flag = true". If yes, then it might be better to have a ClearEnergyCalibrationError() function?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This comment is the same for everthing below

Comment thread include/MReadOutAssembly.h Outdated
int GetStripHitBelowThreshold_Number() const { return m_StripHitBelowThreshold_Number;}

//! Set the Reduced Chi^2 used in MultiRoundChiSquare module
void SetReducedChiSquare(double ReducedChiSquare) { m_ReducedChiSquare = ReducedChiSquare; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

SetStripPairingReducedChiSquare


//! Set the Quality of this Event used in Greedy Strip pairing module
//! TODO Change name of this variable to be more descriptive
void SetEventQuality(double EventQuality){ m_EventQuality = EventQuality; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still want to keep Clio's approach around?
I don't like to have 2 strip pairing quality factors...
Think about it. I am ready to jettison it...

Comment thread src/MModuleDepthCalibration2024.cxx Outdated
Comment thread src/MModuleDepthCalibration2024.cxx Outdated

// Add the depth to the GUI histogram.
if (Event->IsStripPairingIncomplete()==false) {
if (Event->IsStripPairingError()==false) {
Copy link
Copy Markdown
Collaborator

@zoglauer zoglauer Jan 21, 2026

Choose a reason for hiding this comment

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

White space: ..() == false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The fixes to the depth calibration module will be accounted for in the Metrology PR since I did lots of formating changes there.

Comment thread src/MModuleStripPairingChiSquare.cxx Outdated
for (unsigned int side = 0; side <=1; ++side) { // side loop
if (StripHits[d][side].size() > MaxStripHits) {
Event->SetStripPairingIncomplete(true, "More than 6 hit strIps on one side");
Event->SetStripPairingError(true, "More than 6 hit strIps on one side");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Typo: strIps

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll leave this for @julianmgerber to fix in his next PR since he's touching the strip pairing errors/quality flags

Comment thread src/MModuleStripPairingChiSquare.cxx Outdated

if (StripHits[d][0].size() == 0 || StripHits[d][1].size() == 0) {
Event->SetStripPairingIncomplete(true, "One detector side has not strip hits");
Event->SetStripPairingError(true, "One detector side has not strip hits");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

has no strip hits?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@julianmgerber another one for you

@zoglauer
Copy link
Copy Markdown
Collaborator

Think also about to remove the old greedy strip paring approach and the old depth calibration modules.

@ckierans
Copy link
Copy Markdown
Collaborator Author

ckierans commented Feb 3, 2026

I've added an issue for removing the old greedy strip pairing method since I didn't want to do too much more with this PR.

This should now address your comments @zoglauer . The only thing I wasn't sure of was the proper way to overload the << operator to print out the contents of the vectorized error messages. I've added some code to the MReadoutAssembly.cxx to do that locally, and it works well. But let me know if that should go somewhere else.

Comment thread include/MReadOutAssembly.h Outdated
//Track BD Flags

//! Set the energy-calibration-Error flag
void SetEnergyCalibrationError(bool Flag = true, MString Text = "") { m_EnergyCalibrationError = Flag; m_EnergyCalibrationErrorString.push_back(Text); }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. Don't push an empty string
  2. If the error flag is set to true, and strings are set - if we set the flag to false, do we want to clear all events and clear the string vector? Is there a way we want to clear the calibration error?

This holds for all the other errors below

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We don't have anything in the code that would remove any of the BD or QA flags. Not sure if we ever would want that. So I don't know that we want to create the capability to clear the error flag and string until we have a use case for it.

Could this line then just be:
void SetEnergyCalibrationError(bool Flag, MString Text) { m_EnergyCalibrationError = Flag; m_EnergyCalibrationErrorString.push_back(Text); }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we do not want to remove this flag, then I would do:
void SetEnergyCalibrationError(MString Text = "") { m_EnergyCalibrationError = true; if (Text != "") { m_EnergyCalibrationErrorString.push_back(Text); } }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Okay, got it! Thanks for the help!


bool m_EnergyResolutionCalibrationIncomplete;
MString m_EnergyResolutionCalibrationIncompleteString;
// Flags indicating bad events:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please describe each flag and parameter - since people might just read the oxygen documentation

Holds for everything below

Comment thread src/MReadOutAssembly.cxx Outdated
delete m_Aspect;
m_Aspect = nullptr;
}
}//
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That // can be removed

Comment thread src/MReadOutAssembly.cxx Outdated
return os;
}


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No.... !!!
There is a reason there is no such converter, since S can be anything.
Just do your little for loop in the Streamer

Comment thread src/MReadOutAssembly.cxx Outdated
if (m_EnergyCalibrationIncompleteString != "") S<<" ("<<m_EnergyCalibrationIncompleteString<<")";
if (m_EnergyCalibrationError == true) {
S<<"BD EnergyCalibrationError";
if (m_EnergyCalibrationErrorString.empty() == false) S<<" ("<<m_EnergyCalibrationErrorString<<")";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You just have a space between the strings - this makes them indistinguishable.
Do it in this format, so that we can more easily distinguish the messages:
[Error Message 1] [Error Message 2]

@zoglauer
Copy link
Copy Markdown
Collaborator

zoglauer commented Feb 3, 2026

Email me when I can review it again.

@ckierans
Copy link
Copy Markdown
Collaborator Author

ckierans commented Feb 3, 2026

@zoglauer should be good to review again. Thanks!

@zoglauer zoglauer merged commit af52dfc into cositools:develop/em Feb 3, 2026
@ckierans ckierans deleted the bad_and_qa_flags branch March 16, 2026 19:02
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.

Check all BD flags!

2 participants