Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SubEventTrackStack Class Reference

#include <G4SubEventTrackStack.hh>

Public Member Functions

 G4SubEventTrackStack ()=default
 
 G4SubEventTrackStack (G4int ty, std::size_t maxEnt)
 
 ~G4SubEventTrackStack ()
 
G4SubEventTrackStackoperator= (const G4SubEventTrackStack &)=delete
 
G4bool operator== (const G4SubEventTrackStack &) const =delete
 
G4bool operator!= (const G4SubEventTrackStack &) const =delete
 
void PushToStack (const G4StackedTrack &aStackedTrack)
 
void ReleaseSubEvent ()
 
void PrepareNewEvent (G4Event *ev)
 
void clearAndDestroy ()
 
G4int GetSubEventType () const
 
G4int GetNTrack () const
 
std::size_t GetMaxNTrack () const
 
void SetVerboseLevel (G4int val)
 

Detailed Description

Definition at line 42 of file G4SubEventTrackStack.hh.

Constructor & Destructor Documentation

◆ G4SubEventTrackStack() [1/2]

G4SubEventTrackStack::G4SubEventTrackStack ( )
default

◆ G4SubEventTrackStack() [2/2]

G4SubEventTrackStack::G4SubEventTrackStack ( G4int ty,
std::size_t maxEnt )
inlineexplicit

Definition at line 47 of file G4SubEventTrackStack.hh.

48 : fSubEventType(ty), fMaxEnt(maxEnt) {;}

◆ ~G4SubEventTrackStack()

G4SubEventTrackStack::~G4SubEventTrackStack ( )

Definition at line 37 of file G4SubEventTrackStack.cc.

Member Function Documentation

◆ clearAndDestroy()

void G4SubEventTrackStack::clearAndDestroy ( )

Definition at line 42 of file G4SubEventTrackStack.cc.

43{
44 if(fCurrentSE!=nullptr)
45 {
46 fCurrentSE->clearAndDestroy();
47 delete fCurrentSE;
48 fCurrentSE = nullptr;
49 }
50}
void clearAndDestroy()
Definition G4SubEvent.cc:40

Referenced by ~G4SubEventTrackStack().

◆ GetMaxNTrack()

std::size_t G4SubEventTrackStack::GetMaxNTrack ( ) const
inline

Definition at line 68 of file G4SubEventTrackStack.hh.

68{ return fMaxEnt; }

◆ GetNTrack()

G4int G4SubEventTrackStack::GetNTrack ( ) const
inline

Definition at line 63 of file G4SubEventTrackStack.hh.

64 {
65 if(fCurrentSE==nullptr) return 0;
66 return (G4int)fCurrentSE->size();
67 }
int G4int
Definition G4Types.hh:85

◆ GetSubEventType()

G4int G4SubEventTrackStack::GetSubEventType ( ) const
inline

Definition at line 62 of file G4SubEventTrackStack.hh.

62{ return fSubEventType; }

◆ operator!=()

G4bool G4SubEventTrackStack::operator!= ( const G4SubEventTrackStack & ) const
delete

◆ operator=()

G4SubEventTrackStack & G4SubEventTrackStack::operator= ( const G4SubEventTrackStack & )
delete

◆ operator==()

G4bool G4SubEventTrackStack::operator== ( const G4SubEventTrackStack & ) const
delete

◆ PrepareNewEvent()

void G4SubEventTrackStack::PrepareNewEvent ( G4Event * ev)

Definition at line 52 of file G4SubEventTrackStack.cc.

53{
54 if(fCurrentSE!=nullptr)
55 {
57 ed << fCurrentSE->size() << " sub-events still remains in the previous event. PANIC!!!";
58 G4Exception("G4SubEventTrackStack::PrepareNewEvent()","SubEvt7001",FatalException,ed);
59 }
60 fCurrentSE = nullptr;
61 fCurrentEvent = ev;
62}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription

◆ PushToStack()

void G4SubEventTrackStack::PushToStack ( const G4StackedTrack & aStackedTrack)

Definition at line 64 of file G4SubEventTrackStack.cc.

65{
66 if(fCurrentSE==nullptr)
67 {
68 fCurrentSE = new G4SubEvent(fSubEventType,fMaxEnt);
69 }
70 else if(fCurrentSE->size()==fMaxEnt)
71 {
72 // current sus-event is already full. Transfer it to G4Event and create a new sub-event.
73 auto nSubEv = fCurrentEvent->StoreSubEvent(fSubEventType,fCurrentSE);
74 if(verboseLevel>1)
75 {
76 G4cout << "### event id " << fCurrentEvent->GetEventID()
77 << " -- sub-evnet " << nSubEv << " with " << fCurrentSE->size()
78 << " tracks is stored" << G4endl;
79 }
80 fCurrentSE = new G4SubEvent(fSubEventType,fMaxEnt);
81 }
82 fCurrentSE->PushToStack(aStackedTrack);
83}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4int StoreSubEvent(G4int, G4SubEvent *)
Definition G4Event.cc:158
G4int GetEventID() const
Definition G4Event.hh:123
void PushToStack(const G4StackedTrack &aStackedTrack)
Definition G4SubEvent.hh:55

◆ ReleaseSubEvent()

void G4SubEventTrackStack::ReleaseSubEvent ( )

Definition at line 85 of file G4SubEventTrackStack.cc.

86{
87 // This method should be invoked at the end of processing an event.
88 // A sub-event that is not yet full is transferred to G4Event for
89 // post-event-loop processing.
90 if(fCurrentEvent==nullptr)
91 {
92 G4Exception("G4SubEventTrackStack::ReleaseSubEvent()","SubEvt7002",FatalException,
93 "Valid pointer of the current event is not set. PANIC!!");
94 return; // NOLINT: Explicit return required to silence Coverity
95 }
96 if(fCurrentSE!=nullptr)
97 {
98 auto nSubEv = fCurrentEvent->StoreSubEvent(fSubEventType,fCurrentSE);
99 if(verboseLevel>1)
100 {
101 G4cout << "### event id " << fCurrentEvent->GetEventID()
102 << " -- sub-evnet " << nSubEv << " with " << fCurrentSE->size()
103 << " tracks is stored" << G4endl;
104 }
105 fCurrentSE = nullptr;
106 }
107 fCurrentEvent = nullptr;
108}

◆ SetVerboseLevel()

void G4SubEventTrackStack::SetVerboseLevel ( G4int val)
inline

Definition at line 69 of file G4SubEventTrackStack.hh.

69{ verboseLevel = val; }

The documentation for this class was generated from the following files: