Skip to content

Separate TAC calibration and cuts - #194

Merged
ckierans merged 18 commits into
cositools:develop/emfrom
NicoleRodriguezCavero:taccal_separated
Sep 15, 2026
Merged

ckierans merged 18 commits into
cositools:develop/emfrom
NicoleRodriguezCavero:taccal_separated

Conversation

@NicoleRodriguezCavero

@NicoleRodriguezCavero NicoleRodriguezCavero commented Aug 14, 2026 •

Copy link
Copy Markdown

Currently, MModuleTACCut performs the TAC calibration and applied the TAC cuts all within the AnalyzeEvent() functions. This PR:

  • Separates the ApplyTACCal() and ApplyTACCuts() functions and calls them in AnalyzeEvent()
  • No longer requires a taccut file and instead has a GUI option to set the coincidence window used in the TAC cuts
  • All non-GR events regardless of whether they have slow or fast timing are now calibrated to ns
  • Renames module from MModuleTACCut to MModuleTACCalibration
  • Renames XMLtags from TACcut to TACcalibration addressing part of Consistent use of XML tags #193

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The TAC cal window now looks like this:
Image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We can now do the TAC calibration with or without applying TAC cuts.
For non-GR hits with fast timing:
Image

@NicoleRodriguezCavero

NicoleRodriguezCavero commented Aug 14, 2026 •

Copy link
Copy Markdown
Author
  • Create separate function for TAC calibrationApplyTACCal() and call that within AnalyzeEvent()

@fhagemann

Copy link
Copy Markdown

The unit tests fail because the changes seem to affect the end-to-end test results on both 406-1 and 542-1.
(I updated the .cfg files locally, but I'm also getting different results now)

@fhagemann

Copy link
Copy Markdown

Pushing some changes to the nuclearizer config file to work with the new XML tags.

</XmlTagTACcut>
<ApplyTACCuts>true</ApplyTACCuts>
<TACCut>
<CoincidenceWindow>600</CoincidenceWindow>

@fhagemann fhagemann Aug 14, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small comment on the 600: I know the previous taccut files had 500 in them, but that value was never used (previously, the coincidence value was always set to the hard-coded value of 600 in the code). So this setting will make sure that the unit tests are run with the same settings as before.

@NicoleRodriguezCavero
NicoleRodriguezCavero marked this pull request as ready for review August 14, 2026 21:50
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread src/MModuleTACcal.cxx Outdated
Comment thread include/MModuleTACCalibration.h
Comment thread include/MAssembly.h Outdated

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These tabs were relabeled because they show the TAC distribution and energy spectra after TAC cuts (not calibrations) are applied

Image

@fhagemann fhagemann added the cleanup Code cleanup label Aug 18, 2026
@fhagemann fhagemann linked an issue Aug 18, 2026 that may be closed by this pull request

@ckierans ckierans left a comment

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.

Nice rework, @NicoleRodriguezCavero! I just have a few questions about the error messages, and the ordering of the modules.

Will this PR close either Issue #64 or #63 ?

Comment thread src/MSubModuleDepthReadout.cxx Outdated
MModuleTACcut TACcut;
TACcut.SetTACCalFileName(m_TACCalFileName);
if (TACcut.LoadTACCalFile(m_TACCalFileName) == true) {
MModuleTACCalibration TACcal;

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.

Nitpicky, but maybe use TACCal vs TACcal as the MModuleTACCalibration instance to be consistent with the capitalization of the "C" in Cal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Probably best to call this variable TACCalibration ;)

Comment thread src/MModuleTACCalibration.cxx Outdated

// Set all modules, which can follow this module
AddSucceedingModuleType(MAssembly::c_StripPairing);
AddSucceedingModuleType(MAssembly::c_DepthCorrection);

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.

The DepthCorrection module isn't actually allowable here since it has it's own dependance that StripPairing must be performed first, so I think this can be removed.

Comment thread src/MModuleTACCalibration.cxx Outdated

// Set all modules, which have to be done before this module
AddPreceedingModuleType(MAssembly::c_EventLoader);
AddPreceedingModuleType(MAssembly::c_EnergyCalibration);

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.

So now we're enforcing the EnergyCalibration to happen before the TAC Calibration? This is different than what we previously had where we left it up to the user (I think I've always done TAC first then Energy), which is probably the wrong approach! Have we confirmed there is not change of behavior with TAC Calibration -> Energy Calibration vs Energy Calibration -> TAC Calibration? I don't think it should necessarily matter, but I want to make sure we're being intentional about the order.

Honestly, this got me looking at the other Nuclearizer dependancies, and I do think we should enforce only one option for the order for TAC/Energy, so I'm happy to see this change!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I am moving this discussion to issue #207 because (1) we might need further tests with NN and module orders and (2) there will be upcoming analysis work that might want to use these modules independently. I think this should be done independently from this PR.

Comment thread src/MModuleTACCalibration.cxx Outdated
<<" on side "<<Side
<<" does not have enough TAC calibration parameters - skipping event"
<<endl;
return false;

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 you mean to use return false or continue here? Return false will stop the whole Nuclearizer run if one of these conditions are met, it won't just skip the event. continue will just skip the event currently being processed. See for example lines 168 -- 174 in the MModuleEnergyCalibration for when there is no valid energy calibration for a striphit. If we want to not throw a full error and stop Nuclearizer if a TAC Calibration for a single strip is unknown, then we probably should introduce a TACCalibrationError flag, similar to the EnergyCalibrationError flag, and downgrade this to a Warning vs an Error.

I'm also wondering if it makes more sense to combine the valid calibration parameters + at least two parameters describing the calibration into one warning/error.

Take a closer look at these error messages and think about when we really need to stop Nuclearizer, and when we just need a flag for an event.

if (Passed == true) {
++i;
} else {
Event->RemoveStripHit(i);

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.

Is there any reason to track the events for which we've removed striphits with the TAC cut? Does this give any indication of the quality of the event, or any information about the rest of the striphits?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I don't think we need to track events where strip hits are removed by the TAC cuts. These cuts are removing hits associated with the ASIC timing bug or chance-coincident hits which should not affect the quality of the remaining hits in the event.

@NicoleRodriguezCavero NicoleRodriguezCavero linked an issue Aug 24, 2026 that may be closed by this pull request
@NicoleRodriguezCavero

Copy link
Copy Markdown
Author

Addressing @ckierans comments (thank you!!)

Will this PR close either Issue #64 or #63 ?

This PR will resolve Issue #63, we have established that is the cut that we want. It should not resolve Issue #64 since that is more of an analysis/simulation task.

So now we're enforcing the EnergyCalibration to happen before the TAC Calibration?

I created Issue #207 to address this concern separately from the PR.

Do you mean to use return false or continue here? Return false will stop the whole Nuclearizer run if one of these conditions are met, it won't just skip the event...

I have updated the function following the EnergyCalibration conventions. Missing/invalid TAC calibrations for an individual strip now gives a TACCalibrationError flag on the event and continues instead of returning false.

Fatal errors are now only applied when the calibration file or module cannot be initialized correctly.

I also combined the "missing calibration entry" and "fewer than two calibration parameters" as Carolyn suggested.

@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!
Very minor comments from my side only

Comment thread include/MModuleTACCalibration.h
Comment thread src/MGUIExpoPlotSpectrum.cxx Outdated
Comment thread include/MGUIOptionsTACCalibration.h Outdated
Co-authored-by: Felix Hagemann <hagemann@berkeley.edu>

@ckierans ckierans left a comment

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.

Thanks for the changes, Nicole! Things look good.

@ckierans
ckierans merged commit 8fab3a4 into cositools:develop/em Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refine TACcut TotalOffset Consistent use of XML tags

3 participants