Skip to content

Conversation

@ckierans
Copy link
Collaborator

Julian reported that the slow threshold cut was dramatically decreasing the number of events in the final ARM plots (using cut of 35 keV).

I confirmed with HP52358-3 gse_20250709T113820.hdf that I recovered only 30% of Compton events in revan when the slow threshold of 35 keV was applied.

The changes implemented:

  • Updated the logic of the threshold loop so the other strip hits in the event are calibrated ("return false" meant the whole event was skipped if one SH was found to have below threshold energy)
  • Updated the error code so that a c_Warning is created for any SH below threshold, and the energy is included in the warning message
  • Updated the ReadAssembly so the events with a SH below threshold now get a "QA" flag instead of a "BD" flag so these events aren't filtered out in revan. (As part of the other issue to go through all BD flags in Nuclearizer (Check all BD flags! #50), some other flags will use this QA nomenclature)
  • ran clang-format on MModuleEnergyCalibrationUniversal so there are lots of formatting fixes

After these changes we now recover 71% of Compton events in revan with the 35 keV threshold (and 99.5% of the Compton events when using a slow threshold file with realistic thresholds ~10 keV). I confirmed the ARM isn't dramatically altered.

if (g_Verbosity >= c_Warning) {
cout << m_XmlTag << ": Strip Hit below threshold, deleting SH with Energy " << Energy << " keV " << endl;
}
Event->SetStripHitBelowThreshold(true, "with Energy " + to_string(Energy));
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we have multiples this gets overwritten. Do we want that?
Or do we want to keep the smallest value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Maybe instead we should track how many SH we loose and all of the energies...?
I can edit that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe:
AddStripHitBelowThreshold(Energy)
And add a bit of logic into the event to track it?
How many hits, and total loss seems reasonable.

if (m_SlowThresholdCutMode == MSlowThresholdCutModes::e_Fixed) { //check if user input threshold is enabled (one value applied to all strips)
Threshold = m_SlowThresholdCutFixedValue;
} else if (m_SlowThresholdCutMode == MSlowThresholdCutModes::e_File) { //check if threshold file is enabled (unique value applied to each strip)
double Threshold_map = m_ThresholdMap[R]; // if file enabled, declare value from map
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename to ThresholdFromFile

if (g_Verbosity >= c_Error) {
cout << m_XmlTag << ": Error: Threshold not found for read-out element " << R << endl;
}
Threshold = 15; // set default threshold if threshold not found
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is better to define "magic numbers" explicitly in the beginning:

const double DefaultSlowThreshold = 15.0;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Think about if this might actually be part of the map file ?

MString m_StripHitBelowThresholdString;


// Flags indicating the quality of the event: quality warning, but not to be filtered out
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although the names are already long:
...Incomplete always results in a bad flag
... Do you want something similar for the quality flags?

Think of soemthing - or something similar
m_StripHitBelowThresholdQF;
m_StripHitBelowThresholdQualityFlag;

@zoglauer
Copy link
Collaborator

I didn't check if it runs, I just reviewed the code.

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