diff --git a/source/digits_hits/include/GateActorManager.hh b/source/digits_hits/include/GateActorManager.hh index f5b2e4a49..6b85bece9 100644 --- a/source/digits_hits/include/GateActorManager.hh +++ b/source/digits_hits/include/GateActorManager.hh @@ -127,4 +127,21 @@ private: static GateActorManager *singleton_ActorManager; }; +/*! + Empty SD class doing nothing for removing existing SD from G4SDManager +*/ +// Created by tontyoutoure@gmail.com 2023/10/24 + +class GateEmptySD : public G4VSensitiveDetector +{ + + public: + //! Constructor. + //! The argument is the name of the sensitive detector + GateEmptySD(const G4String& name):G4VSensitiveDetector(name){Activate(false);} + + //! Reinplementation is mendatory. + G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) override {return true;} +}; + #endif /* end #define GATEACTORMANAGER_HH */ diff --git a/source/digits_hits/src/GateActorManager.cc b/source/digits_hits/src/GateActorManager.cc index d4f2ac331..db7093500 100644 --- a/source/digits_hits/src/GateActorManager.cc +++ b/source/digits_hits/src/GateActorManager.cc @@ -311,7 +311,7 @@ void GateActorManager::SetMultiFunctionalDetector(GateVActor * actor, GateVVolum G4String detectorName2 = "MSD_"+ num.str(); // Remove attached SD by replacing with a deactivated clone SD - G4VSensitiveDetector* replacementSD = volume->GetLogicalVolume()->GetSensitiveDetector()->Clone(); + G4VSensitiveDetector* replacementSD = new GateEmptySD(volume->GetLogicalVolume()->GetSensitiveDetector()->GetName()); G4SDManager::GetSDMpointer()->AddNewDetector(replacementSD); replacementSD->Activate(false);