diff --git a/include/MReadOutAssembly.h b/include/MReadOutAssembly.h index 743597db..57da95fb 100644 --- a/include/MReadOutAssembly.h +++ b/include/MReadOutAssembly.h @@ -245,10 +245,10 @@ class MReadOutAssembly : public MReadOutSequence //! Get the Strip Pairing quality flag bool HasStripPairing_QualityFlag() const { return m_StripPairing_QualityFlag; } - //! Set the Reduced Chi^2 used in MultiRoundChiSquare module - void SetStripPairingReducedChiSquare(double StripPairingReducedChiSquare) { m_StripPairingReducedChiSquare = StripPairingReducedChiSquare; } - //! Return the Reduced Chi^2 - double GetStripPairingReducedChiSquare() const { return m_StripPairingReducedChiSquare; } + //! Set the Reduced Chi^2 used in MultiRoundChiSquare module (one for each detector) + void SetStripPairingReducedChiSquare(double StripPairingReducedChiSquare) { m_StripPairingReducedChiSquare.push_back(StripPairingReducedChiSquare); } + //! Return all the Reduced Chi^2 (for each detector) + vector GetStripPairingReducedChiSquare() const { return m_StripPairingReducedChiSquare; } //! Set the Quality of this Event used in Greedy Strip pairing module //! TODO Change name of this variable to be more descriptive or get rid of Greedy algorithim all together @@ -430,7 +430,7 @@ class MReadOutAssembly : public MReadOutSequence vector m_StripPairingString_QualityFlag; //! Reduced Chi^2 of the Strip Paired Event - double m_StripPairingReducedChiSquare; + vector m_StripPairingReducedChiSquare; //! Quality of this event in Greedy strip pairing //! TODO change variable name or remove Greedy approach all together diff --git a/src/MModuleEventFilter.cxx b/src/MModuleEventFilter.cxx index 0134598c..23c81269 100644 --- a/src/MModuleEventFilter.cxx +++ b/src/MModuleEventFilter.cxx @@ -175,11 +175,18 @@ bool MModuleEventFilter::AnalyzeEvent(MReadOutAssembly* Event) } // Apply Chi^2 filter (as calculated in strip pairing) + + // Make sure there are actually reduced chi squares to filter on + const auto& ReducedChiSquareVector = Event->GetStripPairingReducedChiSquare(); + if (ReducedChiSquareVector.size() > 0) { + double Maximum = *max_element(ReducedChiSquareVector.begin(), ReducedChiSquareVector.end()); + double Minimum = *min_element(ReducedChiSquareVector.begin(), ReducedChiSquareVector.end()); - if (Event->GetStripPairingReducedChiSquare() < m_MinimumStripPairingReducedChiSquare || Event->GetStripPairingReducedChiSquare() > m_MaximumStripPairingReducedChiSquare) { - FilteredOut = true; + // Filter based on the minimum and maximum reduced chi square in list + if (Minimum < m_MinimumStripPairingReducedChiSquare || Maximum > m_MaximumStripPairingReducedChiSquare) { + FilteredOut = true; } - + } if (FilteredOut == true) { Event->SetFilteredOut(true); diff --git a/src/MReadOutAssembly.cxx b/src/MReadOutAssembly.cxx index 3b31e916..96b0c76a 100644 --- a/src/MReadOutAssembly.cxx +++ b/src/MReadOutAssembly.cxx @@ -185,7 +185,7 @@ void MReadOutAssembly::Clear() m_EventReconstructionError = false; m_EventReconstructionErrorString.clear(); - m_StripPairingReducedChiSquare = -1; + m_StripPairingReducedChiSquare.clear(); m_StripHitBelowThreshold_QualityFlag = false; m_StripHitBelowThresholdString_QualityFlag.clear(); @@ -541,7 +541,12 @@ bool MReadOutAssembly::StreamDat(ostream& S, int Version) S<<"ID "<