Geant4 11.3.0
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

Referenced by operator!=(), operator=(), and operator==().

◆ 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 38 of file G4SubEventTrackStack.cc.

Member Function Documentation

◆ clearAndDestroy()

void G4SubEventTrackStack::clearAndDestroy ( )

Definition at line 43 of file G4SubEventTrackStack.cc.

44{
45 if(fCurrentSE!=nullptr)
46 {
47 fCurrentSE->clearAndDestroy();
48 delete fCurrentSE;
49 fCurrentSE = nullptr;
50 }
51}

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 53 of file G4SubEventTrackStack.cc.

54{
55 if(fCurrentSE!=nullptr)
56 {
58 ed << fCurrentSE->size() << " sub-events still remains in the previous event. PANIC!!!";
59 G4Exception("G4SubEventTrackStack::PrepareNewEvent()","SubEvt7001",FatalException,ed);
60 }
61 fCurrentSE = nullptr;
62 fCurrentEvent = ev;
63}
@ 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 65 of file G4SubEventTrackStack.cc.

66{
67 if(fCurrentSE==nullptr)
68 {
69 fCurrentSE = new G4SubEvent(fSubEventType,fMaxEnt);
70 fCurrentSE->SetEvent(fCurrentEvent);
71 }
72 else if(fCurrentSE->size()==fMaxEnt)
73 {
74 // current sus-event is already full. Transfer it to G4Event and create a new sub-event.
76 ->StoreSubEvent(fCurrentEvent,fSubEventType,fCurrentSE);
77 if(verboseLevel>1)
78 {
79 G4cout << "### event id " << fCurrentEvent->GetEventID()
80 << " -- sub-evnet " << nSubEv << " with " << fCurrentSE->size()
81 << " tracks is stored" << G4endl;
82 }
83 fCurrentSE = new G4SubEvent(fSubEventType,fMaxEnt);
84 fCurrentSE->SetEvent(fCurrentEvent);
85 }
86
87 // Sanity check
88 if(fCurrentEvent == nullptr || fCurrentSE->GetEvent() == nullptr
89 || fCurrentEvent != fCurrentSE->GetEvent())
90 {
92 ed << "Event object is broken or storing tracks of more than one events. PANIC!!!";
93 G4Exception("G4SubEventTrackStack::PushToStack()","SubEvt7003",FatalException,ed);
94 }
95
96 fCurrentSE->PushToStack(aStackedTrack);
97}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4int StoreSubEvent(G4Event *, G4int &, G4SubEvent *)
static G4EventManager * GetEventManager()

◆ ReleaseSubEvent()

void G4SubEventTrackStack::ReleaseSubEvent ( )

Definition at line 99 of file G4SubEventTrackStack.cc.

100{
101 // This method should be invoked at the end of processing an event.
102 // A sub-event that is not yet full is transferred to G4Event for
103 // post-event-loop processing.
104 if(fCurrentEvent==nullptr)
105 {
106 G4Exception("G4SubEventTrackStack::ReleaseSubEvent()","SubEvt7002",FatalException,
107 "Valid pointer of the current event is not set. PANIC!!");
108 return; // NOLINT: Explicit return required to silence Coverity
109 }
110 if(fCurrentSE!=nullptr)
111 {
112 auto nSubEv = G4EventManager::GetEventManager()
113 ->StoreSubEvent(fCurrentEvent,fSubEventType,fCurrentSE);
114 if(verboseLevel>1)
115 {
116 G4cout << "### event id " << fCurrentEvent->GetEventID()
117 << " -- sub-evnet " << nSubEv << " with " << fCurrentSE->size()
118 << " tracks is stored" << G4endl;
119 }
120 fCurrentSE = nullptr;
121 }
122 fCurrentEvent = nullptr;
123}

◆ 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: