58 while(nextVertex !=
nullptr)
61 nextVertex = thisVertex->
GetNext();
65 thePrimaryVertex =
nullptr;
68 if(trajectoryContainer !=
nullptr)
70 trajectoryContainer->clearAndDestroy();
71 delete trajectoryContainer;
74 delete randomNumberStatus;
75 delete randomNumberStatusForProcessing;
78 for(
auto& sem : fSubEvtStackMap)
80 if((sem.second!=
nullptr)&&!(sem.second->empty()))
82 for(
auto& se : *(sem.second))
100 if(!(fSubEvtVector.empty()))
102 for(
auto& se : fSubEvtVector)
104 G4cout <<
"SubEvent " << se <<
" belongs to " << se->GetEvent()
105 <<
" (eventID=" << se->GetEvent()->GetEventID() <<
") that has "
106 << se->GetNTrack() <<
" stacked tracks"<<
G4endl;
109 ed <<
"Deleting G4Event (id:" << eventID <<
") that has "
110 << fSubEvtVector.size() <<
" sub-events still processing.";
118 if(!(fSubEventGarbageBin.empty()))
120 for(
auto& se : fSubEventGarbageBin)
122 fSubEventGarbageBin.clear();
128 return ( eventID == right.eventID );
133 return ( eventID != right.eventID );
144 if(pVVisManager ==
nullptr)
return;
146 if(trajectoryContainer !=
nullptr)
148 std::size_t n_traj = trajectoryContainer->entries();
149 for(std::size_t i=0; i<n_traj; ++i)
150 { (*trajectoryContainer)[i]->DrawTrajectory(); }
155 std::size_t n_HC = HC->GetCapacity();
156 for(std::size_t j=0; j<n_HC; ++j)
165 std::size_t n_DC = DC->GetCapacity();
166 for(std::size_t j=0; j<n_DC; ++j)
177 std::set<G4SubEvent*>* sev =
nullptr;
178 auto ses = fSubEvtStackMap.find(ty);
179 if(ses==fSubEvtStackMap.end())
181 sev =
new std::set<G4SubEvent*>;
182 fSubEvtStackMap[ty] = sev;
185 { sev = ses->second; }
187 return (
G4int)sev->size();
194 auto ses = fSubEvtStackMap.find(ty);
195 if(ses!=fSubEvtStackMap.end())
197 auto sev = ses->second;
200 se = sev->extract(sev->begin()).value();
212 auto ss = fSubEvtVector.find(se);
213 if(ss!=fSubEvtVector.end())
217 <<
" with " << se->
GetNTrack() <<
" tracks has already spawned.";
218 G4Exception(
"G4Event::SpawnSubEvent",
"SubEvent9001",
221 fSubEvtVector.insert(se);
222 return (
G4int)fSubEvtVector.size();
247 auto ss = fSubEvtVector.find(se);
248 if(ss==fSubEvtVector.end())
254 <<
" has never been spawned.";
255 G4Exception(
"G4Event::TerminateSubEvent",
"SubEvent9002",
259 fSubEvtVector.erase(ss);
261 ss = fSubEvtVector.find(se);
262 if(ss!=fSubEvtVector.end())
266 <<
" with " << se->
GetNTrack() <<
" appears more than once. PANIC!";
267 G4Exception(
"G4Event::TerminateSubEvent",
"SubEvent9003",
273 fSubEventGarbageBin.insert(se);
274 return (
G4int)fSubEvtVector.size();
282 auto tot = (
G4int)fSubEvtVector.size();
283 for(
auto& sem : fSubEvtStackMap)
284 { tot += (
G4int)sem.second->size(); }
G4TemplateAutoLock< G4Mutex > G4AutoLock
G4Allocator< G4Event > *& anEventAllocator()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
G4GLOB_DLL std::ostream G4cout
G4int StoreSubEvent(G4int, G4SubEvent *)
void MergeSubEventResults(const G4Event *se)
G4bool operator!=(const G4Event &right) const
G4SubEvent * PopSubEvent(G4int)
G4bool operator==(const G4Event &right) const
G4int TerminateSubEvent(G4SubEvent *)
G4int SpawnSubEvent(G4SubEvent *)
G4int GetNumberOfRemainingSubEvents() const
G4PrimaryVertex * GetNext() const
G4int GetSubEventType() const
std::size_t GetNTrack() const
G4Event * GetEvent() const
virtual void DrawAllDigi()
virtual void DrawAllHits()
static G4VVisManager * GetConcreteInstance()
#define G4ThreadLocalStatic