From 6faa88066c52bf30441f320ac13287ef1a68eb28 Mon Sep 17 00:00:00 2001 From: kochebina Date: Thu, 10 Aug 2023 22:24:54 +0200 Subject: [PATCH] SegFault correction: system def in CoinSorter --- .../digits_hits/src/GateCoincidenceSorter.cc | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/source/digits_hits/src/GateCoincidenceSorter.cc b/source/digits_hits/src/GateCoincidenceSorter.cc index 40ca8bbec..4ccb7a02b 100644 --- a/source/digits_hits/src/GateCoincidenceSorter.cc +++ b/source/digits_hits/src/GateCoincidenceSorter.cc @@ -162,8 +162,11 @@ void GateCoincidenceSorter::SetAcceptancePolicy4CC(const G4String &policy) void GateCoincidenceSorter::Digitize() { - //G4cout<<"GateCoincidenceSorter::Digitize "<< GetOutputName() <::iterator buf_iter; // presort buffer iterator @@ -177,7 +180,9 @@ void GateCoincidenceSorter::Digitize() //Input digi collection GateDigitizerMgr* digitizerMgr = GateDigitizerMgr::GetInstance(); GateSinglesDigitizer* inputDigitizer; + inputDigitizer = digitizerMgr->FindSinglesDigitizer(m_inputName);//m_collectionName); + //G4cout<<"m_inputName "<GetName()<m_SDlist.size()==1) { @@ -188,6 +193,14 @@ void GateCoincidenceSorter::Digitize() else GateError("ERROR: The name _"+ m_inputName+"_ is unknown for input singles digicollection! \n"); + if(!m_system) + { + //G4cout<<"Unindefined system"<GetSystem(); + } + //G4cout<GetName()<m_outputDigiCollectionID; //G4cout<<"inputCollID "<GetIsAnySystemDefined()) + if(!GateSystemListManager::GetInstance()->GetIsAnySystemDefined()) { // TODO GND define case if there is no system defiend! } - G4int blockID1 = m_system->GetMainComponentIDGND(digi1), blockID2 = m_system->GetMainComponentIDGND(digi2); @@ -681,7 +693,7 @@ G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, cons // the geometry construction of the scanner (spherical for system ecatAccel and cylindrical // for other systems as Ecat, CPET and cylindricalPET) - const G4String name = m_system->GetName(); + const G4String name = m_system->GetName(); G4String nameComp = "systems/ecatAccel"; //G4cout << "NAME OF THE SYSTEM: " << name << "; NAME TO COMPARE: " << nameComp << Gateendl; int comp = strcmp(name,nameComp); @@ -734,10 +746,10 @@ G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, cons if (nVerboseLevel>1) G4cout << "[GateCoincidenceSorter::IsForbiddenCoincidence]: coincidence between neighbour blocks --> refused\n"; return true; - } + } return false; - } + } } //------------------------------------------------------------------------------------------------------