From 2e90f2dc8eb6750fbeee4e8524cb7e5c7d13e011 Mon Sep 17 00:00:00 2001 From: kochebina Date: Thu, 27 Jul 2023 14:50:37 +0200 Subject: [PATCH] corrections in CoinSort --- source/digits_hits/include/GateDigi.hh | 5 +++++ source/digits_hits/src/GateCoincidenceSorter.cc | 13 +++++++++++-- .../src/GateDigitizerInitializationModule.cc | 1 + source/digits_hits/src/GateDigitizerMerger.cc | 6 +++--- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/source/digits_hits/include/GateDigi.hh b/source/digits_hits/include/GateDigi.hh index f6d411131..7be01d0ae 100644 --- a/source/digits_hits/include/GateDigi.hh +++ b/source/digits_hits/include/GateDigi.hh @@ -128,6 +128,9 @@ public: inline const GateOutputVolumeID& GetOutputVolumeID() const { return m_outputVolumeID; } inline G4int GetComponentID(size_t depth) const { return (m_outputVolumeID.size()>depth) ? m_outputVolumeID[depth] : -1; } + inline void SetSystemID(const G4int systemID) { m_systemID = systemID; } + inline G4int GetSystemID() const { return m_systemID; } + #ifdef GATE_USE_OPTICAL inline void SetOptical(G4bool optical = true) { m_optical = optical;} @@ -221,6 +224,8 @@ public: G4ThreeVector m_scannerPos; //!< Position of the scanner G4double m_scannerRotAngle; //!< Rotation angle of the scanner GateOutputVolumeID m_outputVolumeID; + G4int m_systemID; // system ID in for the multi-system approach + #ifdef GATE_USE_OPTICAL G4bool m_optical; //!< Is the pulse generated by optical photons #endif diff --git a/source/digits_hits/src/GateCoincidenceSorter.cc b/source/digits_hits/src/GateCoincidenceSorter.cc index 7d9264c8c..40ca8bbec 100644 --- a/source/digits_hits/src/GateCoincidenceSorter.cc +++ b/source/digits_hits/src/GateCoincidenceSorter.cc @@ -14,6 +14,7 @@ See LICENSE.md for further details #include "GateVolumeID.hh" #include "GateObjectStore.hh" +#include "GateSystemListManager.hh" #include "GateCoincidenceSorterMessenger.hh" @@ -665,7 +666,14 @@ G4int GateCoincidenceSorter::ComputeSectorID(const GateDigi& digi) // Check whether a coincidence is invalid: ring difference or sector difference too small... G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, const GateDigi* digi2) { - G4int blockID1 = m_system->GetMainComponentIDGND(digi1), + + 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); // Modif by D. Lazaro, February 25th, 2004 @@ -721,7 +729,8 @@ G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, cons G4int sectorDifference = std::min(sectorDiff1,sectorDiff2); //Compare the sector difference with the minimum differences for valid coincidences - if (sectorDifferenceGetSystemID()==digi2->GetSystemID())&& !m_forceMinSecDifferenceToZero ) { + //G4cout<GetSystemID()<<" "<GetSystemID()<1) G4cout << "[GateCoincidenceSorter::IsForbiddenCoincidence]: coincidence between neighbour blocks --> refused\n"; return true; diff --git a/source/digits_hits/src/GateDigitizerInitializationModule.cc b/source/digits_hits/src/GateDigitizerInitializationModule.cc index e9d2e3a1b..26165d81b 100644 --- a/source/digits_hits/src/GateDigitizerInitializationModule.cc +++ b/source/digits_hits/src/GateDigitizerInitializationModule.cc @@ -97,6 +97,7 @@ void GateDigitizerInitializationModule::Digitize() Digi->SetComptonVolumeName( (*inHC)[i]->GetComptonVolumeName() ); Digi->SetRayleighVolumeName( (*inHC)[i]->GetRayleighVolumeName() ); Digi->SetVolumeID( (*inHC)[i]->GetVolumeID() ); + Digi->SetSystemID( (*inHC)[i]->GetSystemID() ); Digi->SetScannerPos( (*inHC)[i]->GetScannerPos() ); Digi->SetScannerRotAngle( (*inHC)[i]->GetScannerRotAngle() ); #ifdef GATE_USE_OPTICAL diff --git a/source/digits_hits/src/GateDigitizerMerger.cc b/source/digits_hits/src/GateDigitizerMerger.cc index 11cd93f3c..22aed3159 100755 --- a/source/digits_hits/src/GateDigitizerMerger.cc +++ b/source/digits_hits/src/GateDigitizerMerger.cc @@ -120,9 +120,9 @@ void GateDigitizerMerger::Digitize() { //GateDigiCollection* IDCerror = 0; //G4String err = fDM->GetDigiCollection(m_DCID-1)->GetName(); - //TODO add more clean error messege - GateError("***ERROR*** Wrong usage of Merger Digitizer Module: the Digi collection that you want to use doesn't exist yet (not digitized yet). The Merger must be inserted as a module of last called sensitive detector\n " - "Please, read the description here: XXXX \n\n"); + GateError("***ERROR*** Wrong usage of Merger Digitizer Module: the Digi collection that you want to use doesn't exist yet (not digitized yet?). The Merger must be inserted as a module of last called sensitive detector\n " + "Please, read the description here: https://opengate.readthedocs.io/en/latest/digitizer_and_detector_modeling.html#id28 \n " + "It is also possible that your input collection is empty at the first event. This bug will be addressed soon. \n\n"); return; }