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

#include <G4Event.hh>

Public Types

using ProfilerConfig = G4ProfilerConfig< G4ProfileType::Event >
 

Public Member Functions

 G4Event ()=default
 
 G4Event (G4int evID)
 
 ~G4Event ()
 
 G4Event (const G4Event &)=delete
 
G4Eventoperator= (const G4Event &)=delete
 
void * operator new (std::size_t)
 
void operator delete (void *anEvent)
 
G4bool operator== (const G4Event &right) const
 
G4bool operator!= (const G4Event &right) const
 
void Print () const
 
void Draw () const
 
void SetEventID (G4int i)
 
void SetHCofThisEvent (G4HCofThisEvent *value)
 
void SetDCofThisEvent (G4DCofThisEvent *value)
 
void SetTrajectoryContainer (G4TrajectoryContainer *value)
 
void SetEventAborted ()
 
void SetRandomNumberStatus (G4String &st)
 
void SetRandomNumberStatusForProcessing (G4String &st)
 
void KeepTheEvent (G4bool vl=true)
 
G4bool ToBeKept () const
 
void KeepForPostProcessing () const
 
void PostProcessingFinished () const
 
G4int GetNumberOfGrips () const
 
G4int GetEventID () const
 
void AddPrimaryVertex (G4PrimaryVertex *aPrimaryVertex)
 
G4int GetNumberOfPrimaryVertex () const
 
G4PrimaryVertexGetPrimaryVertex (G4int i=0) const
 
G4HCofThisEventGetHCofThisEvent () const
 
G4DCofThisEventGetDCofThisEvent () const
 
G4TrajectoryContainerGetTrajectoryContainer () const
 
G4bool IsAborted () const
 
void SetUserInformation (G4VUserEventInformation *anInfo)
 
G4VUserEventInformationGetUserInformation () const
 
const G4StringGetRandomNumberStatus () const
 
const G4StringGetRandomNumberStatusForProcessing () const
 

Detailed Description

Definition at line 54 of file G4Event.hh.

Member Typedef Documentation

◆ ProfilerConfig

Constructor & Destructor Documentation

◆ G4Event() [1/3]

G4Event::G4Event ( )
default

◆ G4Event() [2/3]

G4Event::G4Event ( G4int  evID)
explicit

Definition at line 43 of file G4Event.cc.

44 : eventID(evID)
45{
46}

◆ ~G4Event()

G4Event::~G4Event ( )

Definition at line 48 of file G4Event.cc.

49{
50 G4PrimaryVertex* nextVertex = thePrimaryVertex;
51 while(nextVertex != nullptr)
52 {
53 G4PrimaryVertex* thisVertex = nextVertex;
54 nextVertex = thisVertex->GetNext();
55 thisVertex->ClearNext();
56 delete thisVertex;
57 }
58 thePrimaryVertex = nullptr;
59 delete HC;
60 delete DC;
61 if(trajectoryContainer != nullptr)
62 {
63 trajectoryContainer->clearAndDestroy();
64 delete trajectoryContainer;
65 }
66 delete userInfo;
67 delete randomNumberStatus;
68 delete randomNumberStatusForProcessing;
69}
G4PrimaryVertex * GetNext() const

◆ G4Event() [3/3]

G4Event::G4Event ( const G4Event )
delete

Member Function Documentation

◆ AddPrimaryVertex()

void G4Event::AddPrimaryVertex ( G4PrimaryVertex aPrimaryVertex)
inline

Definition at line 121 of file G4Event.hh.

122 {
123 // This method sets a new primary vertex. This method must be invoked
124 // exclusively by G4VPrimaryGenerator concrete class.
125
126 if( thePrimaryVertex == nullptr )
127 { thePrimaryVertex = aPrimaryVertex; }
128 else
129 { thePrimaryVertex->SetNext( aPrimaryVertex ); }
130 ++numberOfPrimaryVertex;
131 }
void SetNext(G4PrimaryVertex *nv)

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries(), G4RTPrimaryGeneratorAction::GeneratePrimaries(), G4HEPEvtInterface::GeneratePrimaryVertex(), G4ParticleGun::GeneratePrimaryVertex(), G4SingleParticleSource::GeneratePrimaryVertex(), and G4RayShooter::Shoot().

◆ Draw()

void G4Event::Draw ( ) const

Definition at line 86 of file G4Event.cc.

87{
89 if(pVVisManager == nullptr) return;
90
91 if(trajectoryContainer != nullptr)
92 {
93 std::size_t n_traj = trajectoryContainer->entries();
94 for(std::size_t i=0; i<n_traj; ++i)
95 { (*trajectoryContainer)[i]->DrawTrajectory(); }
96 }
97
98 if(HC != nullptr)
99 {
100 std::size_t n_HC = HC->GetCapacity();
101 for(std::size_t j=0; j<n_HC; ++j)
102 {
103 G4VHitsCollection* VHC = HC->GetHC((G4int)j);
104 if(VHC != nullptr) VHC->DrawAllHits();
105 }
106 }
107
108 if(DC != nullptr)
109 {
110 std::size_t n_DC = DC->GetCapacity();
111 for(std::size_t j=0; j<n_DC; ++j)
112 {
113 G4VDigiCollection* VDC = DC->GetDC((G4int)j);
114 if(VDC != nullptr) VDC->DrawAllDigi();
115 }
116 }
117}
int G4int
Definition: G4Types.hh:85
G4VDigiCollection * GetDC(G4int i) const
size_t GetCapacity() const
G4VHitsCollection * GetHC(G4int i)
std::size_t entries() const
virtual void DrawAllDigi()
virtual void DrawAllHits()
static G4VVisManager * GetConcreteInstance()

◆ GetDCofThisEvent()

G4DCofThisEvent * G4Event::GetDCofThisEvent ( ) const
inline

Definition at line 158 of file G4Event.hh.

159 { return DC; }

Referenced by G4DigiManager::GetDigiCollection(), G4DigiManager::SetDigiCollection(), and G4PersistencyManager::Store().

◆ GetEventID()

◆ GetHCofThisEvent()

G4HCofThisEvent * G4Event::GetHCofThisEvent ( ) const
inline

Definition at line 156 of file G4Event.hh.

157 { return HC; }

Referenced by G4DigiManager::GetHitsCollection(), G4PersistencyManager::Store(), and G4RunManager::UpdateScoring().

◆ GetNumberOfGrips()

G4int G4Event::GetNumberOfGrips ( ) const
inline

Definition at line 115 of file G4Event.hh.

116 { return grips; }

Referenced by G4RunManager::CleanUpUnnecessaryEvents(), and G4RunManager::StackPreviousEvent().

◆ GetNumberOfPrimaryVertex()

G4int G4Event::GetNumberOfPrimaryVertex ( ) const
inline

Definition at line 133 of file G4Event.hh.

134 { return numberOfPrimaryVertex; }

◆ GetPrimaryVertex()

G4PrimaryVertex * G4Event::GetPrimaryVertex ( G4int  i = 0) const
inline

Definition at line 137 of file G4Event.hh.

138 {
139 if( i == 0 )
140 { return thePrimaryVertex; }
141 if( i > 0 && i < numberOfPrimaryVertex )
142 {
143 G4PrimaryVertex* primaryVertex = thePrimaryVertex;
144 for( G4int j=0; j<i; ++j )
145 {
146 if( primaryVertex == nullptr ) return nullptr;
147 primaryVertex = primaryVertex->GetNext();
148 }
149 return primaryVertex;
150 }
151
152 return nullptr;
153 }

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries(), and G4PrimaryTransformer::GimmePrimaries().

◆ GetRandomNumberStatus()

const G4String & G4Event::GetRandomNumberStatus ( ) const
inline

Definition at line 177 of file G4Event.hh.

178 {
179 if(!validRandomNumberStatus)
180 { G4Exception(
181 "G4Event::GetRandomNumberStatus","Event0701",JustWarning,
182 "Random number status is not available for this event."); }
183 return *randomNumberStatus;
184 }
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

◆ GetRandomNumberStatusForProcessing()

const G4String & G4Event::GetRandomNumberStatusForProcessing ( ) const
inline

Definition at line 185 of file G4Event.hh.

186 {
187 if(!validRandomNumberStatusForProcessing)
188 { G4Exception(
189 "G4Event::GetRandomNumberStatusForProcessing","Event0702",
191 "Random number status is not available for this event."); }
192 return *randomNumberStatusForProcessing;
193 }

◆ GetTrajectoryContainer()

G4TrajectoryContainer * G4Event::GetTrajectoryContainer ( ) const
inline

Definition at line 160 of file G4Event.hh.

161 { return trajectoryContainer; }

Referenced by G4TheRayTracer::GenerateColour(), and G4RTRun::RecordEvent().

◆ GetUserInformation()

G4VUserEventInformation * G4Event::GetUserInformation ( ) const
inline

Definition at line 173 of file G4Event.hh.

174 { return userInfo; }

Referenced by G4EventManager::GetUserInformation().

◆ IsAborted()

G4bool G4Event::IsAborted ( ) const
inline

Definition at line 167 of file G4Event.hh.

167{ return eventAborted; }

◆ KeepForPostProcessing()

void G4Event::KeepForPostProcessing ( ) const
inline

Definition at line 104 of file G4Event.hh.

105 { ++grips; }

◆ KeepTheEvent()

void G4Event::KeepTheEvent ( G4bool  vl = true)
inline

Definition at line 100 of file G4Event.hh.

101 { keepTheEvent = vl; }

Referenced by G4EventManager::KeepTheCurrentEvent().

◆ operator delete()

void G4Event::operator delete ( void *  anEvent)
inline

Definition at line 244 of file G4Event.hh.

245{
246 anEventAllocator()->FreeSingle((G4Event*)anEvent);
247}
G4EVENT_DLL G4Allocator< G4Event > *& anEventAllocator()
Definition: G4Event.cc:37

◆ operator new()

void * G4Event::operator new ( std::size_t  )
inline

Definition at line 235 of file G4Event.hh.

236{
237 if (anEventAllocator() == nullptr)
238 {
240 }
241 return (void*)anEventAllocator()->MallocSingle();
242}

◆ operator!=()

G4bool G4Event::operator!= ( const G4Event right) const

Definition at line 76 of file G4Event.cc.

77{
78 return ( eventID != right.eventID );
79}

◆ operator=()

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

◆ operator==()

G4bool G4Event::operator== ( const G4Event right) const

Definition at line 71 of file G4Event.cc.

72{
73 return ( eventID == right.eventID );
74}

◆ PostProcessingFinished()

void G4Event::PostProcessingFinished ( ) const
inline

Definition at line 106 of file G4Event.hh.

107 {
108 --grips;
109 if (grips<0)
110 {
111 G4Exception("G4Event::Release()", "EVENT91001", FatalException,
112 "Number of grips is negative. This cannot be correct.");
113 }
114 }
@ FatalException

◆ Print()

void G4Event::Print ( ) const

Definition at line 81 of file G4Event.cc.

82{
83 G4cout << "G4Event " << eventID << G4endl;
84}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

◆ SetDCofThisEvent()

void G4Event::SetDCofThisEvent ( G4DCofThisEvent value)
inline

Definition at line 84 of file G4Event.hh.

85 { DC = value; }

Referenced by G4DigiManager::SetDigiCollection().

◆ SetEventAborted()

void G4Event::SetEventAborted ( )
inline

Definition at line 88 of file G4Event.hh.

89 { eventAborted = true; }

Referenced by G4RunManager::AbortEvent(), and G4RunManager::AbortRun().

◆ SetEventID()

◆ SetHCofThisEvent()

void G4Event::SetHCofThisEvent ( G4HCofThisEvent value)
inline

Definition at line 82 of file G4Event.hh.

83 { HC = value; }

◆ SetRandomNumberStatus()

void G4Event::SetRandomNumberStatus ( G4String st)
inline

Definition at line 90 of file G4Event.hh.

91 {
92 randomNumberStatus = new G4String(st);
93 validRandomNumberStatus = true;
94 }

Referenced by G4RunManager::GenerateEvent(), G4WorkerRunManager::GenerateEvent(), G4WorkerTaskRunManager::GenerateEvent(), and G4EventManager::ProcessOneEvent().

◆ SetRandomNumberStatusForProcessing()

void G4Event::SetRandomNumberStatusForProcessing ( G4String st)
inline

Definition at line 95 of file G4Event.hh.

96 {
97 randomNumberStatusForProcessing = new G4String(st);
98 validRandomNumberStatusForProcessing = true;
99 }

◆ SetTrajectoryContainer()

void G4Event::SetTrajectoryContainer ( G4TrajectoryContainer value)
inline

Definition at line 86 of file G4Event.hh.

87 { trajectoryContainer = value; }

◆ SetUserInformation()

void G4Event::SetUserInformation ( G4VUserEventInformation anInfo)
inline

Definition at line 171 of file G4Event.hh.

172 { userInfo = anInfo; }

Referenced by G4EventManager::SetUserInformation().

◆ ToBeKept()

G4bool G4Event::ToBeKept ( ) const
inline

Definition at line 102 of file G4Event.hh.

103 { return keepTheEvent; }

Referenced by G4RunManager::CleanUpPreviousEvents(), G4RunManager::CleanUpUnnecessaryEvents(), and G4RunManager::StackPreviousEvent().


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