Skip to content

fix: make GateSpatialResolution do CheckIfEnoughLevelsAreDefined only once #622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions source/digits_hits/include/GateSpatialResolution.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ private:

GateSinglesDigitizer *m_digitizer;

G4bool m_IsFirstEntrance;

G4VoxelLimits limits;
G4double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
G4AffineTransform at;
Expand Down
17 changes: 11 additions & 6 deletions source/digits_hits/src/GateSpatialResolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ GateSpatialResolution::GateSpatialResolution(GateSinglesDigitizer *digitizer, G4
m_systemDepth(-1),
m_outputDigi(0),
m_OutputDigiCollection(0),
m_digitizer(digitizer)
m_digitizer(digitizer),
m_IsFirstEntrance(true)
{
G4String colName = digitizer->GetOutputName() ;
collectionName.push_back(colName);
Expand Down Expand Up @@ -99,12 +100,16 @@ void GateSpatialResolution::Digitize()

if (m_system==NULL) G4Exception( "GateSpatialResolution::Digitize", "Digitize", FatalException,
"Failed to get the system corresponding to that digitizer. Abort.\n");

if (!m_system->CheckIfEnoughLevelsAreDefined())
if (m_IsFirstEntrance)
{
GateError( " *** ERROR*** GateSpatialResolution::Digitize. Not all defined geometry levels has their mother levels defined."
"(Ex.: for cylindricalPET, the levels are: rsector, module, submodule, crystal). If you have defined submodule, you have to have resector and module defined as well."
"Please, add them to your geometry macro in /gate/systems/cylindricalPET/XXX/attach YYY. Abort.\n");
m_IsFirstEntrance=false;
if (!m_system->CheckIfEnoughLevelsAreDefined())
{
GateError( " *** ERROR*** GateSpatialResolution::Digitize. Not all defined geometry levels has their mother levels defined."
"(Ex.: for cylindricalPET, the levels are: rsector, module, submodule, crystal). If you have defined submodule, you have to have resector and module defined as well."
"Please, add them to your geometry macro in /gate/systems/cylindricalPET/XXX/attach YYY. Abort.\n");
}
}

m_systemDepth = m_system->GetTreeDepth();
Expand Down