From 0a7f15f179b6394ff4be8f935a0ea5a9518b7e14 Mon Sep 17 00:00:00 2001 From: Julian Gerber Date: Mon, 19 Jan 2026 23:43:12 -0800 Subject: [PATCH 1/4] Adding strip pairing quality flag --- include/MReadOutAssembly.h | 12 +++++++++++- ...MModuleStripPairingMultiRoundChiSquare.cxx | 19 ++++++++++--------- src/MReadOutAssembly.cxx | 12 ++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/include/MReadOutAssembly.h b/include/MReadOutAssembly.h index 1a8b0aa..cc2d210 100644 --- a/include/MReadOutAssembly.h +++ b/include/MReadOutAssembly.h @@ -269,10 +269,15 @@ class MReadOutAssembly : public MReadOutSequence bool IsStripHitBelowThreshold() const { return m_StripHitBelowThreshold; } - //! Set the strip-pairing-incomplete flag + //! Set the strip-pairing-incomplete flag void SetStripPairingIncomplete(bool Flag = true, MString Text = "") { m_StripPairingIncomplete = Flag; m_StripPairingIncompleteString = Text; } //! Get the strip-pairing-incomplete flag bool IsStripPairingIncomplete() const { return m_StripPairingIncomplete; } + + //! Set the strip-pairing-incomplete flag + void SetStripPairingQualityFlag(bool Flag = true, MString Text = "") { m_StripPairingQualityFlag = Flag; m_StripPairingQualityFlagString = Text; } + //! Get the strip-pairing-incomplete flag + bool GetStripPairingQualityFlag() const { return m_StripPairingQualityFlag; } //! Set the LLD Event flag void SetLLDEvent(bool Flag = true, MString Text = "") { m_LLDEvent = Flag; m_LLDEventString = Text; } @@ -453,6 +458,11 @@ class MReadOutAssembly : public MReadOutSequence MString m_DepthCalibration_OutofRangeString; bool m_StripHitBelowThreshold; MString m_StripHitBelowThresholdString; + + // Flags indicating the quality of the event: quality warning, but not to be filtered out + bool m_StripPairingQualityFlag; + MString m_StripPairingQualityFlagString; + diff --git a/src/MModuleStripPairingMultiRoundChiSquare.cxx b/src/MModuleStripPairingMultiRoundChiSquare.cxx index a3e42f1..9774ad9 100644 --- a/src/MModuleStripPairingMultiRoundChiSquare.cxx +++ b/src/MModuleStripPairingMultiRoundChiSquare.cxx @@ -272,9 +272,7 @@ bool MModuleStripPairingMultiRoundChiSquare::EventSelection(MReadOutAssembly* Ev for (unsigned int d = 0; d < StripHits.size(); ++d) { // Detector loop 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->SetAnalysisProgress(MAssembly::c_StripPairing); - return false; + Event->SetStripPairingQualityFlag(true, "More than 6 hit strips on one side"); //Only set a quality flag, but don't filter out event } // Check if one side of the detector has no strip hits @@ -360,9 +358,9 @@ tuple>, vector>, double> MModul unsigned int MinSize = min(Combinations[d][0][lv].size(), Combinations[d][1][hv].size()); // Skip pairing if either side has more than 5 sets of strips - if (max(Combinations[d][0][lv].size(), Combinations[d][1][hv].size()) > MaxCombinations) { - continue; - } +// if (max(Combinations[d][0][lv].size(), Combinations[d][1][hv].size()) > MaxCombinations) { +// continue; +// } bool MorePermutations = true; while (MorePermutations == true) { @@ -765,9 +763,12 @@ bool MModuleStripPairingMultiRoundChiSquare::AnalyzeEvent(MReadOutAssembly* Even } // Flag events with a reduced chi square > 25 else if (BestChiSquare > 25) { - Event->SetStripPairingIncomplete(true, "Best reduced chi square is not below 25"); - Event->SetAnalysisProgress(MAssembly::c_StripPairing); - return false; + Event->SetStripPairingQualityFlag(true, "Best reduced chi square is not below 25"); + } + + if (max(BestLVSideCombo.size(), BestHVSideCombo.size()) > MaxCombinations) { + Event->SetStripPairingQualityFlag(true, "Best LV or HV combination has more than 5 strip groupings"); + // Set quality flag, but don't filter out event } // Assign the best reduced chi square to the event diff --git a/src/MReadOutAssembly.cxx b/src/MReadOutAssembly.cxx index 0c6a9fa..f429130 100644 --- a/src/MReadOutAssembly.cxx +++ b/src/MReadOutAssembly.cxx @@ -184,6 +184,8 @@ void MReadOutAssembly::Clear() m_EnergyResolutionCalibrationIncompleteString = ""; m_StripPairingIncomplete = false; m_StripPairingIncompleteString = ""; + m_StripPairingQualityFlag = false; + m_StripPairingQualityFlagString = ""; m_LLDEvent = false; m_LLDEventString = ""; m_DepthCalibrationIncomplete = false; @@ -590,6 +592,11 @@ bool MReadOutAssembly::StreamDat(ostream& S, int Version) if (m_StripPairingIncompleteString != "") S<<" ("< Date: Mon, 19 Jan 2026 23:49:47 -0800 Subject: [PATCH 2/4] Changing BD-->QA for multiple hits on single strip flag --- src/MReadOutAssembly.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MReadOutAssembly.cxx b/src/MReadOutAssembly.cxx index f429130..e02848b 100644 --- a/src/MReadOutAssembly.cxx +++ b/src/MReadOutAssembly.cxx @@ -621,13 +621,13 @@ bool MReadOutAssembly::StreamDat(ostream& S, int Version) } for (auto H : m_Hits) { if (H->GetStripHitMultipleTimesX()) { - S<<"BD Multiple Hits on LV Strip"<GetStripHitMultipleTimesY()) { - S<<"BD Multiple Hits on HV Strip"<GetStripHitMultipleTimesX()) { - S<<"BD Multiple Hits on LV Strip"<GetStripHitMultipleTimesY()) { - S<<"BD Multiple Hits on HV Strip"< Date: Tue, 20 Jan 2026 17:16:43 -0800 Subject: [PATCH 3/4] Putting 2.5 sigma error message into quality flag. Cleaning up code. --- src/MModuleStripPairingMultiRoundChiSquare.cxx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/MModuleStripPairingMultiRoundChiSquare.cxx b/src/MModuleStripPairingMultiRoundChiSquare.cxx index 9774ad9..2c0ddba 100644 --- a/src/MModuleStripPairingMultiRoundChiSquare.cxx +++ b/src/MModuleStripPairingMultiRoundChiSquare.cxx @@ -357,11 +357,6 @@ tuple>, vector>, double> MModul unsigned int MinSize = min(Combinations[d][0][lv].size(), Combinations[d][1][hv].size()); - // Skip pairing if either side has more than 5 sets of strips -// if (max(Combinations[d][0][lv].size(), Combinations[d][1][hv].size()) > MaxCombinations) { -// continue; -// } - bool MorePermutations = true; while (MorePermutations == true) { @@ -658,9 +653,7 @@ bool MModuleStripPairingMultiRoundChiSquare::CreateHits(unsigned int d, MReadOut // One last quality selection based on total event energies if ((EnergyTotal > max(LVEnergyTotal, HVEnergyTotal) + 2.5 * max(LVEnergyResTotal, HVEnergyResTotal) || EnergyTotal < min(LVEnergyTotal, HVEnergyTotal) - 2.5 * max(LVEnergyResTotal, HVEnergyResTotal))) { - Event->SetStripPairingIncomplete(true, "Strips not pairable wihin 2.5 sigma of measured energy"); - Event->SetAnalysisProgress(MAssembly::c_StripPairing); - return false; + Event->SetStripPairingQualityFlag(true, "Strips not pairable wihin 2.5 sigma of measured energy"); } // Plot the good events else if ((HasExpos() == true) and Event->IsGood() == true) { From e6e2c4d7190c7a1ca63eac260a4001545f6744b3 Mon Sep 17 00:00:00 2001 From: Julian Gerber Date: Tue, 20 Jan 2026 17:20:57 -0800 Subject: [PATCH 4/4] Commenting --- src/MModuleStripPairingMultiRoundChiSquare.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MModuleStripPairingMultiRoundChiSquare.cxx b/src/MModuleStripPairingMultiRoundChiSquare.cxx index 2c0ddba..7a75fe1 100644 --- a/src/MModuleStripPairingMultiRoundChiSquare.cxx +++ b/src/MModuleStripPairingMultiRoundChiSquare.cxx @@ -653,7 +653,7 @@ bool MModuleStripPairingMultiRoundChiSquare::CreateHits(unsigned int d, MReadOut // One last quality selection based on total event energies if ((EnergyTotal > max(LVEnergyTotal, HVEnergyTotal) + 2.5 * max(LVEnergyResTotal, HVEnergyResTotal) || EnergyTotal < min(LVEnergyTotal, HVEnergyTotal) - 2.5 * max(LVEnergyResTotal, HVEnergyResTotal))) { - Event->SetStripPairingQualityFlag(true, "Strips not pairable wihin 2.5 sigma of measured energy"); + Event->SetStripPairingQualityFlag(true, "Strips not pairable wihin 2.5 sigma of measured energy"); // Set quality flag, but don't filter out event } // Plot the good events else if ((HasExpos() == true) and Event->IsGood() == true) { @@ -756,7 +756,7 @@ bool MModuleStripPairingMultiRoundChiSquare::AnalyzeEvent(MReadOutAssembly* Even } // Flag events with a reduced chi square > 25 else if (BestChiSquare > 25) { - Event->SetStripPairingQualityFlag(true, "Best reduced chi square is not below 25"); + Event->SetStripPairingQualityFlag(true, "Best reduced chi square is not below 25"); // Set quality flag but don't filter out event } if (max(BestLVSideCombo.size(), BestHVSideCombo.size()) > MaxCombinations) {