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

#include <G4MCTEvent.hh>

Public Types

using genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator
 
using simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator
 

Public Member Functions

 G4MCTEvent ()
 
virtual ~G4MCTEvent ()
 
 G4MCTEvent (const G4MCTEvent &right)
 
G4MCTEventoperator= (const G4MCTEvent &right)
 
void SetEventNumber (G4int n)
 
G4int GetEventNumber () const
 
G4MCTGenEventGetGenEvent () const
 
G4MCTSimEventGetSimEvent () const
 
G4int GetNofPrimaries () const
 
G4MCTSimParticleGetSimParticle (const G4MCTGenParticle &genpart) const
 
G4MCTGenParticle GetGenParticle (const G4MCTSimParticle *simpart) const
 
G4int AddPrimaryPair (const G4MCTGenParticle &genp, const G4MCTSimParticle *simp)
 
void ClearEvent ()
 
void Print (std::ostream &ostr=std::cout) const
 
genprimary_const_iterator genprimaries_begin () const
 
genprimary_const_iterator genprimaries_end () const
 
simprimary_const_iterator simprimaries_begin () const
 
simprimary_const_iterator simprimaries_end () const
 

Protected Attributes

G4int eventNumber = 0
 
G4MCTGenEventgenEvent = nullptr
 
G4MCTSimEventsimEvent = nullptr
 
MCTGen2SimParticleMap gen2simParticleMap
 
MCTSim2GenParticleMap sim2genParticleMap
 

Detailed Description

Definition at line 46 of file G4MCTEvent.hh.

Member Typedef Documentation

◆ genprimary_const_iterator

using G4MCTEvent::genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator

Definition at line 74 of file G4MCTEvent.hh.

◆ simprimary_const_iterator

using G4MCTEvent::simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator

Definition at line 78 of file G4MCTEvent.hh.

Constructor & Destructor Documentation

◆ G4MCTEvent() [1/2]

G4MCTEvent::G4MCTEvent ( )

Definition at line 38 of file G4MCTEvent.cc.

39{
40 genEvent = new G4MCTGenEvent(); // will be reused.
41 simEvent = new G4MCTSimEvent();
42}
G4MCTGenEvent * genEvent
Definition: G4MCTEvent.hh:85
G4MCTSimEvent * simEvent
Definition: G4MCTEvent.hh:86

◆ ~G4MCTEvent()

G4MCTEvent::~G4MCTEvent ( )
virtual

Definition at line 45 of file G4MCTEvent.cc.

46{
47 delete genEvent;
48 delete simEvent;
49}

◆ G4MCTEvent() [2/2]

G4MCTEvent::G4MCTEvent ( const G4MCTEvent right)
inline

Definition at line 97 of file G4MCTEvent.hh.

97{ *this = right; }

Member Function Documentation

◆ AddPrimaryPair()

G4int G4MCTEvent::AddPrimaryPair ( const G4MCTGenParticle genp,
const G4MCTSimParticle simp 
)

Definition at line 82 of file G4MCTEvent.cc.

84{
85 gen2simParticleMap.insert(std::make_pair(
86 const_cast<G4MCTGenParticle&>(genp), const_cast<G4MCTSimParticle*>(simp)));
87 sim2genParticleMap.insert(std::make_pair(
88 const_cast<G4MCTSimParticle*>(simp), const_cast<G4MCTGenParticle&>(genp)));
89
90 return gen2simParticleMap.size();
91}
std::pair< void *, void * > G4MCTGenParticle
MCTSim2GenParticleMap sim2genParticleMap
Definition: G4MCTEvent.hh:90
MCTGen2SimParticleMap gen2simParticleMap
Definition: G4MCTEvent.hh:89

◆ ClearEvent()

void G4MCTEvent::ClearEvent ( )

Definition at line 94 of file G4MCTEvent.cc.

95{
96 gen2simParticleMap.clear();
97 sim2genParticleMap.clear();
98
101}

◆ genprimaries_begin()

G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin ( ) const
inline

Definition at line 139 of file G4MCTEvent.hh.

140{
141 return gen2simParticleMap.cbegin();
142}

◆ genprimaries_end()

G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end ( ) const
inline

Definition at line 145 of file G4MCTEvent.hh.

146{
147 return gen2simParticleMap.cend();
148}

◆ GetEventNumber()

G4int G4MCTEvent::GetEventNumber ( ) const
inline

Definition at line 117 of file G4MCTEvent.hh.

118{
119 return eventNumber;
120}
G4int eventNumber
Definition: G4MCTEvent.hh:84

Referenced by G4Pevent::G4Pevent().

◆ GetGenEvent()

G4MCTGenEvent * G4MCTEvent::GetGenEvent ( ) const
inline

Definition at line 132 of file G4MCTEvent.hh.

133{
134 return genEvent;
135}

◆ GetGenParticle()

G4MCTGenParticle G4MCTEvent::GetGenParticle ( const G4MCTSimParticle simpart) const

Definition at line 67 of file G4MCTEvent.cc.

69{
70 auto pos = sim2genParticleMap.find(const_cast<G4MCTSimParticle*>(simpart));
71 if(pos != sim2genParticleMap.cend())
72 {
73 return pos->second;
74 }
75 else
76 {
77 return G4MCTGenParticle((void*) 0, (void*) 0);
78 }
79}

◆ GetNofPrimaries()

G4int G4MCTEvent::GetNofPrimaries ( ) const
inline

Definition at line 122 of file G4MCTEvent.hh.

123{
124 return gen2simParticleMap.size();
125}

◆ GetSimEvent()

G4MCTSimEvent * G4MCTEvent::GetSimEvent ( ) const
inline

Definition at line 127 of file G4MCTEvent.hh.

128{
129 return simEvent;
130}

◆ GetSimParticle()

G4MCTSimParticle * G4MCTEvent::GetSimParticle ( const G4MCTGenParticle genpart) const

Definition at line 52 of file G4MCTEvent.cc.

54{
55 auto pos = gen2simParticleMap.find(genpart);
56 if(pos != gen2simParticleMap.cend())
57 {
58 return pos->second;
59 }
60 else
61 {
62 return nullptr;
63 }
64}

◆ operator=()

G4MCTEvent & G4MCTEvent::operator= ( const G4MCTEvent right)
inline

Definition at line 99 of file G4MCTEvent.hh.

100{
101 eventNumber = right.eventNumber;
102
103 simEvent = right.simEvent; // shallow copy...
104 genEvent = right.genEvent;
105
108
109 return *this;
110}

◆ Print()

void G4MCTEvent::Print ( std::ostream &  ostr = std::cout) const

Definition at line 104 of file G4MCTEvent.cc.

105{
106 ostr << "Event#:" << eventNumber << G4endl;
107 simEvent->Print(ostr);
108}
#define G4endl
Definition: G4ios.hh:57
void Print(std::ostream &ostr=std::cout) const

◆ SetEventNumber()

void G4MCTEvent::SetEventNumber ( G4int  n)
inline

Definition at line 112 of file G4MCTEvent.hh.

113{
114 eventNumber = n;
115}

◆ simprimaries_begin()

G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin ( ) const
inline

Definition at line 151 of file G4MCTEvent.hh.

152{
153 return sim2genParticleMap.cbegin();
154}

◆ simprimaries_end()

G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end ( ) const
inline

Definition at line 157 of file G4MCTEvent.hh.

158{
159 return sim2genParticleMap.cend();
160}

Member Data Documentation

◆ eventNumber

G4int G4MCTEvent::eventNumber = 0
protected

Definition at line 84 of file G4MCTEvent.hh.

Referenced by GetEventNumber(), operator=(), Print(), and SetEventNumber().

◆ gen2simParticleMap

MCTGen2SimParticleMap G4MCTEvent::gen2simParticleMap
protected

◆ genEvent

G4MCTGenEvent* G4MCTEvent::genEvent = nullptr
protected

Definition at line 85 of file G4MCTEvent.hh.

Referenced by ClearEvent(), G4MCTEvent(), GetGenEvent(), operator=(), and ~G4MCTEvent().

◆ sim2genParticleMap

MCTSim2GenParticleMap G4MCTEvent::sim2genParticleMap
protected

◆ simEvent

G4MCTSimEvent* G4MCTEvent::simEvent = nullptr
protected

Definition at line 86 of file G4MCTEvent.hh.

Referenced by ClearEvent(), G4MCTEvent(), GetSimEvent(), operator=(), Print(), and ~G4MCTEvent().


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