Skip to content
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

SegFault correction: system def in CoinSorter #634

Merged
merged 1 commit into from
Aug 11, 2023
Merged
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
28 changes: 20 additions & 8 deletions source/digits_hits/src/GateCoincidenceSorter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ void GateCoincidenceSorter::SetAcceptancePolicy4CC(const G4String &policy)

void GateCoincidenceSorter::Digitize()
{
//G4cout<<"GateCoincidenceSorter::Digitize "<< GetOutputName() <<G4endl;
//G4cout<< "m_inputName "<< m_inputName<<G4endl;
// G4cout<<"GateCoincidenceSorter::Digitize "<< GetOutputName() <<G4endl;
// G4cout<< "m_inputName "<< m_inputName<<G4endl;



GateDigi* digi;
std::list<GateDigi*>::iterator buf_iter; // presort buffer iterator

Expand All @@ -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 "<<inputDigitizer->GetName()<<G4endl;
if (!inputDigitizer)
if (digitizerMgr->m_SDlist.size()==1)
{
Expand All @@ -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"<<G4endl;
m_system=inputDigitizer->GetSystem();
}
//G4cout<<m_system->GetName()<<G4endl;


G4int inputCollID=inputDigitizer->m_outputDigiCollectionID;
//G4cout<<"inputCollID "<<inputCollID<<G4endl;
G4DigiManager *fDM = G4DigiManager::GetDMpointer();
Expand Down Expand Up @@ -654,7 +667,7 @@ G4int GateCoincidenceSorter::ComputeSectorID(const GateDigi& digi)
}
}

}
}x
else{
G4cout<<"[GateCoincidenceSorter]: Problems in CC accpetance policy"<<G4endl;
}
Expand All @@ -667,12 +680,11 @@ G4int GateCoincidenceSorter::ComputeSectorID(const GateDigi& digi)
G4bool GateCoincidenceSorter::IsForbiddenCoincidence(const GateDigi* digi1, const GateDigi* digi2)
{

if(!GateSystemListManager::GetInstance()->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);

Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
}

}
//------------------------------------------------------------------------------------------------------
Expand Down