Skip to content

Conversation

@julianmgerber
Copy link

Summary of Changes
Strip Pairing Algorithm:

  1. Implement second round of strip pairing in which non-adjacent strips may be grouped together in order to account for multiple hits on a single strip
  2. Filter out events with a best reduced chi square > 25
  3. Correct energy of each potential pairing to account for charge trapping (still need to read in actual charge trapping parameters though)
  4. Split main strip pairing code into several functions
  5. Changed X and Y to LV and HV

Flags:

  1. Add bad flag for events with a reduced chi square > 25

Event Filter:

  1. Added option to filter on strip pairing chi square into the Event Filter module/GUI

GUIs:

  1. Strip pairing GUI includes more information (number of strip hits per hit, number of hits per event)

Class Attributes:

  1. Added LV and HV energies to MHit class that is then read out in StreamDAT
  2. Added Best Reduced Chi Square to MReadOutAssembly that is then read out in StreamDAT
  3. Added "Multiple hits on a single LV/HV strip" attribute to MReadOutAssembly that is then read out in StreamDAT

@zoglauer
Copy link
Collaborator

Great work!

Some comments:

  1. Put your name in the copyright notice
  2. Take a look at teh documentation of your header files with doxygen ("make doc"). If something is missing, add it.
  3. For example:

//Set flags for multiple hits on a single strip
void SetMultipleHitsOnLVStrip(bool MultipleHitsOnLV) { m_MultipleHitsOnLVStrip = MultipleHitsOnLV; }
void SetMultipleHitsOnHVStrip(bool MultipleHitsOnHV) { m_MultipleHitsOnHVStrip = MultipleHitsOnHV; }

Should be:
//! Set flag for multiple hits on a single LV strip
void SetMultipleHitsOnLVStrip(bool MultipleHitsOnLV) { m_MultipleHitsOnLVStrip = MultipleHitsOnLV; }
//! Set flag for multiple hits on a single HV strip
void SetMultipleHitsOnHVStrip(bool MultipleHitsOnHV) { m_MultipleHitsOnHVStrip = MultipleHitsOnHV; }

There are a few more instances

  1. Document all: vector<vector<vector<vector<vector<... What does each vector loop over

m_Mode->Add("Andreas's algorithm");
m_Mode->Add("Strip pairing - Chi Square Version (Updated - 2025)");
m_Mode->Add("Daniel's 'greedy' algorithm");

// Give your's a name
Multi-round chi square - Julian
Chi square - Andreas
Greedy - Clio & Daniel
6.
I assume this is the dat file, can you make a new version instead and leave the old ones as is, and ensure that it can be read in again?
f( Version == 1 ){
S<<"HT "<<m_Position.GetX()<<" "<<m_Position.GetY()<<" "<<m_Position.GetZ()<<" "<<m_Energy<<" "<<m_LVEnergy<<" "<<m_HVEnergy<<endl;
} else if( Version == 2 ){
//stream the hit information, then stream the strip hit info for this hit so that
//we will know which strip hits were associated with which hits
S<<"HT "<<m_Position.GetX()<<" "<<m_Position.GetY()<<" "<<m_Position.GetZ()<<" "<<m_Energy<<" "<<m_LVEnergy<<" "<<m_HVEnergy<<endl;

  1. See above: Give it a name which you can put as the title of the algorithm for your paper!
    i.e. not an updated chi-square approach
    src/MModuleStripPairingChiSquareUpdated.cxx

S<<"Red Chi^2: "<<m_RedChiSquare<<endl;
Use
QP: Quality factor strip pairing

@zoglauer
Copy link
Collaborator

Can you also check if pull request #13
#13
is now obsolete?

@julianmgerber
Copy link
Author

@zoglauer Hi Andreas! I think all the comments have been implemented. And yes, pull request #13 should now be obsolete.

I'm a bit confused on the different versions for the StreamDAT functions. I added a version 3 that reads out the LV/HV energies for each hit, but is there a way to toggle between versions? Or does which version we're on have to be hard coded in?

@zoglauer
Copy link
Collaborator

zoglauer commented Nov 4, 2025

Adding version 3 is good. It should always write the highest version, but read all lower versions for backwards compatibility.

@zoglauer
Copy link
Collaborator

zoglauer commented Nov 4, 2025

(1)
In MReadOutAssembly, you have:

//! Set flag for multiple hits on a single strip on LV side
void SetMultipleHitsOnLVStrip(bool MultipleHitsOnLV) { m_MultipleHitsOnLVStrip = MultipleHitsOnLV; }
//! Set flag for multiple hits on a single strip on HV side
void SetMultipleHitsOnHVStrip(bool MultipleHitsOnHV) { m_MultipleHitsOnHVStrip = MultipleHitsOnHV; }

But the same info is in the MHit's.
Can you just loop over the MHit's to get if one have multiple hits?

(2)
Can you rename:
m_RedChiSquare to m_ReducedChiSquare
and all other instances? MinimumRedChiSquare etc.
I don't want to confuse future grad students to figure our what a "red" chi square is :)

@julianmgerber
Copy link
Author

@zoglauer I implemented the new edits!

I removed the "Multiple hits on a single strip" flags from MReadOutAssembly, so now they're just on the MHit level. I then loop over all the hits in order to write the "BD" flag when reading out the events to a .dat or .evta file.

Also, I checked whether it's actually using Version 3 to write to the .dat files, and it doesn't seem to be working. In MModuleEventSaver it does:
else if (m_Mode == c_DatFile) {
Event->StreamDat(Out, 1);

So I think only Version 1 of StreamDat is actually called. Should I just change this to Version 3?

@zoglauer
Copy link
Collaborator

Yes change it to version 3

@julianmgerber
Copy link
Author

@zoglauer Okay, changed it to Version 3 and checked that it's reading out correctly. Now the .dat format should be:
HT [Hit information including LV and HV energies]
SH [All associated strip hits for that hit]
HT [Next hit]
etc.

With that, I believe all the comments have been implemented!

@zoglauer zoglauer merged commit 8eb29cd into cositools:develop/em Nov 18, 2025
ckierans pushed a commit to ckierans/nuclearizer that referenced this pull request Nov 25, 2025
* Merging select files from StripPairingTesting into StripPairingCleanUp so I can do pull request

* Clean up comments. Remove long debugging statements for readability

* Calling charge trapping correction function in chi square calculation and hit population

* Cleaning up comments

* Reformatting strip pairing module

* Update copywrite. Change name of module.

* Fixing documentation in header files

* Change how strip pairing chi square is read out to .dat file

* Adding comments for all the nested vectors

* Adding new version to StreamDat that reads out LV and HV energy of each hit

* Adding Sean's new strip pairing expos to chi square version of strip pairing

* Changing all instances of RedChiSquare to ReducedChiSquare for clarity

* Flags for multiple hits on a single strip are now defined on the MHit level

* Initializing m_StripHitMultipleTimesX and m_StripHitMultipleTimesY to false

* Changing StreamDAT version from Version 1 to Version 3

* Rebased and fixed merge conflict with strip pairing

---------

Co-authored-by: Julian Gerber <jmgerber@ucsd.edu>
@ckierans ckierans mentioned this pull request Dec 9, 2025
ckierans pushed a commit to ckierans/nuclearizer that referenced this pull request Dec 10, 2025
* Merging select files from StripPairingTesting into StripPairingCleanUp so I can do pull request

* Clean up comments. Remove long debugging statements for readability

* Calling charge trapping correction function in chi square calculation and hit population

* Cleaning up comments

* Reformatting strip pairing module

* Update copywrite. Change name of module.

* Fixing documentation in header files

* Change how strip pairing chi square is read out to .dat file

* Adding comments for all the nested vectors

* Adding new version to StreamDat that reads out LV and HV energy of each hit

* Adding Sean's new strip pairing expos to chi square version of strip pairing

* Changing all instances of RedChiSquare to ReducedChiSquare for clarity

* Flags for multiple hits on a single strip are now defined on the MHit level

* Initializing m_StripHitMultipleTimesX and m_StripHitMultipleTimesY to false

* Changing StreamDAT version from Version 1 to Version 3

* Rebased and fixed merge conflict with strip pairing

---------

Co-authored-by: Julian Gerber <jmgerber@ucsd.edu>
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