Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/MReadOutAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> 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
Expand Down Expand Up @@ -430,7 +430,7 @@ class MReadOutAssembly : public MReadOutSequence
vector<MString> m_StripPairingString_QualityFlag;

//! Reduced Chi^2 of the Strip Paired Event
double m_StripPairingReducedChiSquare;
vector<double> m_StripPairingReducedChiSquare;

//! Quality of this event in Greedy strip pairing
//! TODO change variable name or remove Greedy approach all together
Expand Down
13 changes: 10 additions & 3 deletions src/MModuleEventFilter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions src/MReadOutAssembly.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -541,7 +541,12 @@ bool MReadOutAssembly::StreamDat(ostream& S, int Version)
S<<"ID "<<m_ID<<endl;
S<<"CL "<<m_Time<<endl;
S<<"TI "<<m_EventTimeUTC<<endl;
S<<"QP "<<m_StripPairingReducedChiSquare<<endl; // Read out strip pairing qualiy factor
S<<"QP";
// iterate through the vectorized strip pairing reduced chi squares
for (auto i : m_StripPairingReducedChiSquare) {
S<<" "<<i;
}
S<<endl;
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.

You only have the streaming defined for the .dat file, but we also will want this in the evta file - that's the standard format for revan. This should probably be incorporated in the StreamBDFlags function where you already have the Strip Pairing quality flag printout. Unless there's a reason you had this pulled out separately?


for (MSimIA& IA: m_SimIAs) {
S<<IA.ToSimString()<<endl;
Expand Down