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
12 changes: 11 additions & 1 deletion include/MReadOutAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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;




Expand Down
22 changes: 8 additions & 14 deletions src/MModuleStripPairingMultiRoundChiSquare.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -359,11 +357,6 @@ tuple<vector<vector<unsigned int>>, vector<vector<unsigned int>>, 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) {

Expand Down Expand Up @@ -660,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"); // Set quality flag, but don't filter out event
}
// Plot the good events
else if ((HasExpos() == true) and Event->IsGood() == true) {
Expand Down Expand Up @@ -765,9 +756,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"); // Set quality flag but don't filter out event
}

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
Expand Down
20 changes: 16 additions & 4 deletions src/MReadOutAssembly.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -590,6 +592,11 @@ bool MReadOutAssembly::StreamDat(ostream& S, int Version)
if (m_StripPairingIncompleteString != "") S<<" ("<<m_StripPairingIncompleteString<<")";
S<<endl;
}
if (m_StripPairingQualityFlag == true) {
S<<"QA StripPairingQualityFlag";
if (m_StripPairingQualityFlagString != "") S<<" ("<<m_StripPairingQualityFlagString<<")";
S<<endl;
}
if (m_LLDEvent == true) {
S<<"BD LLDEvent";
if (m_LLDEventString != "") S<<" ("<<m_LLDEventString<<")";
Expand All @@ -614,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"<<endl;
S<<"QA Multiple Hits on LV Strip"<<endl;
break;
}
}
for (auto H : m_Hits) {
if (H->GetStripHitMultipleTimesY()) {
S<<"BD Multiple Hits on HV Strip"<<endl;
S<<"QA Multiple Hits on HV Strip"<<endl;
break;
}
}
Expand Down Expand Up @@ -690,6 +697,11 @@ void MReadOutAssembly::StreamEvta(ostream& S)
if (m_StripPairingIncompleteString != "") S<<" ("<<m_StripPairingIncompleteString<<")";
S<<endl;
}
if (m_StripPairingQualityFlag == true) {
S<<"QA StripPairingQualityFlag";
if (m_StripPairingQualityFlagString != "") S<<" ("<<m_StripPairingQualityFlagString<<")";
S<<endl;
}
if (m_LLDEvent == true) {
S<<"BD LLDEvent";
if (m_LLDEventString != "") S<<" ("<<m_LLDEventString<<")";
Expand All @@ -714,13 +726,13 @@ void MReadOutAssembly::StreamEvta(ostream& S)
}
for (auto H : m_Hits) {
if (H->GetStripHitMultipleTimesX()) {
S<<"BD Multiple Hits on LV Strip"<<endl;
S<<"QA Multiple Hits on LV Strip"<<endl;
break;
}
}
for (auto H : m_Hits) {
if (H->GetStripHitMultipleTimesY()) {
S<<"BD Multiple Hits on HV Strip"<<endl;
S<<"QA Multiple Hits on HV Strip"<<endl;
break;
}
}
Expand Down