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

#include <G4PrimaryVertex.hh>

Public Member Functions

 G4PrimaryVertex ()=default
 
 G4PrimaryVertex (G4double x0, G4double y0, G4double z0, G4double t0)
 
 G4PrimaryVertex (G4ThreeVector xyz0, G4double t0)
 
virtual ~G4PrimaryVertex ()
 
 G4PrimaryVertex (const G4PrimaryVertex &right)
 
G4PrimaryVertexoperator= (const G4PrimaryVertex &right)
 
G4bool operator== (const G4PrimaryVertex &right) const
 
G4bool operator!= (const G4PrimaryVertex &right) const
 
void * operator new (size_t)
 
void operator delete (void *aPrimaryVertex)
 
G4ThreeVector GetPosition () const
 
void SetPosition (G4double x0, G4double y0, G4double z0)
 
G4double GetX0 () const
 
G4double GetY0 () const
 
G4double GetZ0 () const
 
G4double GetT0 () const
 
void SetT0 (G4double t0)
 
G4int GetNumberOfParticle () const
 
void SetPrimary (G4PrimaryParticle *pp)
 
G4PrimaryParticleGetPrimary (G4int i=0) const
 
void SetNext (G4PrimaryVertex *nv)
 
void ClearNext ()
 
G4PrimaryVertexGetNext () const
 
G4double GetWeight () const
 
void SetWeight (G4double w)
 
void SetUserInformation (G4VUserPrimaryVertexInformation *info)
 
G4VUserPrimaryVertexInformationGetUserInformation () const
 
void Print () const
 

Detailed Description

Definition at line 50 of file G4PrimaryVertex.hh.

Constructor & Destructor Documentation

◆ G4PrimaryVertex() [1/4]

G4PrimaryVertex::G4PrimaryVertex ( )
default

Referenced by operator=().

◆ G4PrimaryVertex() [2/4]

G4PrimaryVertex::G4PrimaryVertex ( G4double x0,
G4double y0,
G4double z0,
G4double t0 )

Definition at line 44 of file G4PrimaryVertex.cc.

45 : X0(x0), Y0(y0), Z0(z0), T0(t0)
46{}

◆ G4PrimaryVertex() [3/4]

G4PrimaryVertex::G4PrimaryVertex ( G4ThreeVector xyz0,
G4double t0 )

Definition at line 48 of file G4PrimaryVertex.cc.

49 : X0(xyz0.x()), Y0(xyz0.y()), Z0(xyz0.z()), T0(t0)
50{}
double z() const
double x() const
double y() const

◆ ~G4PrimaryVertex()

G4PrimaryVertex::~G4PrimaryVertex ( )
virtual

Definition at line 57 of file G4PrimaryVertex.cc.

58{
59 if (theParticle != nullptr) {
60 G4PrimaryParticle* theNext = theParticle;
61 while (theNext != nullptr) {
62 G4PrimaryParticle* thisPrimary = theNext;
63 theNext = thisPrimary->GetNext();
64 thisPrimary->ClearNext();
65 delete thisPrimary;
66 }
67 theParticle = nullptr;
68 }
69 delete nextVertex;
70 nextVertex = nullptr;
71
72 theTail = nullptr;
73 tailVertex = nullptr;
74
75 delete userInfo;
76 userInfo = nullptr;
77}
G4PrimaryParticle * GetNext() const

◆ G4PrimaryVertex() [4/4]

G4PrimaryVertex::G4PrimaryVertex ( const G4PrimaryVertex & right)

Definition at line 52 of file G4PrimaryVertex.cc.

53{
54 *this = right;
55}

Member Function Documentation

◆ ClearNext()

void G4PrimaryVertex::ClearNext ( )
inline

Definition at line 193 of file G4PrimaryVertex.hh.

194{
195 nextVertex = nullptr;
196 tailVertex = nullptr;
197}

Referenced by G4Event::~G4Event().

◆ GetNext()

G4PrimaryVertex * G4PrimaryVertex::GetNext ( ) const
inline

Definition at line 199 of file G4PrimaryVertex.hh.

200{
201 return nextVertex;
202}

Referenced by G4Event::GetPrimaryVertex(), G4PrimaryTransformer::GimmePrimaries(), operator=(), and G4Event::~G4Event().

◆ GetNumberOfParticle()

G4int G4PrimaryVertex::GetNumberOfParticle ( ) const
inline

Definition at line 165 of file G4PrimaryVertex.hh.

166{
167 return numberOfParticle;
168}

◆ GetPosition()

G4ThreeVector G4PrimaryVertex::GetPosition ( ) const
inline

Definition at line 128 of file G4PrimaryVertex.hh.

129{
130 return G4ThreeVector(X0, Y0, Z0);
131}
CLHEP::Hep3Vector G4ThreeVector

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetPrimary()

G4PrimaryParticle * G4PrimaryVertex::GetPrimary ( G4int i = 0) const

Definition at line 133 of file G4PrimaryVertex.cc.

134{
135 if (i >= 0 && i < numberOfParticle) {
136 G4PrimaryParticle* particle = theParticle;
137 for (G4int j = 0; j < i; ++j) {
138 if (particle == nullptr) return nullptr;
139 particle = particle->GetNext();
140 }
141 return particle;
142 }
143
144 return nullptr;
145}
int G4int
Definition G4Types.hh:85

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

◆ GetT0()

G4double G4PrimaryVertex::GetT0 ( ) const
inline

Definition at line 155 of file G4PrimaryVertex.hh.

156{
157 return T0;
158}

Referenced by G4PrimaryTransformer::GenerateTracks().

◆ GetUserInformation()

G4VUserPrimaryVertexInformation * G4PrimaryVertex::GetUserInformation ( ) const
inline

Definition at line 219 of file G4PrimaryVertex.hh.

220{
221 return userInfo;
222}

◆ GetWeight()

G4double G4PrimaryVertex::GetWeight ( ) const
inline

Definition at line 204 of file G4PrimaryVertex.hh.

205{
206 return Weight0;
207}

Referenced by G4PrimaryTransformer::GenerateTracks().

◆ GetX0()

G4double G4PrimaryVertex::GetX0 ( ) const
inline

Definition at line 140 of file G4PrimaryVertex.hh.

141{
142 return X0;
143}

Referenced by G4PrimaryTransformer::GenerateTracks().

◆ GetY0()

G4double G4PrimaryVertex::GetY0 ( ) const
inline

Definition at line 145 of file G4PrimaryVertex.hh.

146{
147 return Y0;
148}

Referenced by G4PrimaryTransformer::GenerateTracks().

◆ GetZ0()

G4double G4PrimaryVertex::GetZ0 ( ) const
inline

Definition at line 150 of file G4PrimaryVertex.hh.

151{
152 return Z0;
153}

Referenced by G4PrimaryTransformer::GenerateTracks().

◆ operator delete()

void G4PrimaryVertex::operator delete ( void * aPrimaryVertex)
inline

Definition at line 123 of file G4PrimaryVertex.hh.

124{
125 aPrimaryVertexAllocator()->FreeSingle((G4PrimaryVertex*)aPrimaryVertex);
126}
G4PART_DLL G4Allocator< G4PrimaryVertex > *& aPrimaryVertexAllocator()

◆ operator new()

void * G4PrimaryVertex::operator new ( size_t )
inline

Definition at line 115 of file G4PrimaryVertex.hh.

116{
117 if (aPrimaryVertexAllocator() == nullptr) {
119 }
120 return (void*)aPrimaryVertexAllocator()->MallocSingle();
121}

◆ operator!=()

G4bool G4PrimaryVertex::operator!= ( const G4PrimaryVertex & right) const

Definition at line 128 of file G4PrimaryVertex.cc.

129{
130 return (this != &right);
131}

◆ operator=()

G4PrimaryVertex & G4PrimaryVertex::operator= ( const G4PrimaryVertex & right)

Definition at line 79 of file G4PrimaryVertex.cc.

80{
81 if (this != &right) {
82 X0 = right.X0;
83 Y0 = right.Y0;
84 Z0 = right.Z0;
85 T0 = right.T0;
86 Weight0 = right.Weight0;
87 numberOfParticle = right.numberOfParticle;
88
89 delete theParticle;
90 theParticle = nullptr;
91 theTail = nullptr;
92 if (right.theParticle != nullptr) {
93 theParticle = new G4PrimaryParticle(*(right.theParticle));
94 theTail = theParticle;
95 G4PrimaryParticle* np = theParticle->GetNext();
96 while (np != nullptr) // Loop checking, 09.08.2015, K.Kurashige
97 {
98 theTail = np;
99 np = np->GetNext();
100 }
101 }
102
103 delete nextVertex;
104 nextVertex = nullptr;
105 tailVertex = nullptr;
106 if (right.nextVertex != nullptr) {
107 nextVertex = new G4PrimaryVertex(*(right.nextVertex));
108 tailVertex = nextVertex;
109 G4PrimaryVertex* nv = nextVertex->GetNext();
110 while (nv != nullptr) // Loop checking, 09.08.2015, K.Kurashige
111 {
112 tailVertex = nv;
113 nv = nv->GetNext();
114 }
115 }
116
117 // userInfo cannot be copied
118 userInfo = nullptr;
119 }
120 return *this;
121}
G4PrimaryVertex * GetNext() const
G4PrimaryVertex()=default

◆ operator==()

G4bool G4PrimaryVertex::operator== ( const G4PrimaryVertex & right) const

Definition at line 123 of file G4PrimaryVertex.cc.

124{
125 return (this == &right);
126}

◆ Print()

void G4PrimaryVertex::Print ( ) const

Definition at line 147 of file G4PrimaryVertex.cc.

148{
149 G4cout << "Vertex ( " << X0 / mm << "[mm], " << Y0 / mm << "[mm], " << Z0 / mm << "[mm], "
150 << T0 / ns << "[ns] )"
151 << " Weight " << Weight0 << G4endl;
152 if (userInfo != nullptr) userInfo->Print();
153 G4cout << " -- Primary particles :: "
154 << " # of primaries =" << numberOfParticle << G4endl;
155 if (theParticle != nullptr) theParticle->Print();
156 if (nextVertex != nullptr) {
157 G4cout << "Next Vertex " << G4endl;
158 nextVertex->Print();
159 }
160}
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
virtual void Print() const =0

Referenced by G4PrimaryTransformer::GenerateTracks(), and Print().

◆ SetNext()

void G4PrimaryVertex::SetNext ( G4PrimaryVertex * nv)
inline

Definition at line 182 of file G4PrimaryVertex.hh.

183{
184 if (nextVertex == nullptr) {
185 nextVertex = nv;
186 }
187 else {
188 tailVertex->SetNext(nv);
189 }
190 tailVertex = nv;
191}
void SetNext(G4PrimaryVertex *nv)

Referenced by G4Event::AddPrimaryVertex(), and SetNext().

◆ SetPosition()

void G4PrimaryVertex::SetPosition ( G4double x0,
G4double y0,
G4double z0 )
inline

Definition at line 133 of file G4PrimaryVertex.hh.

134{
135 X0 = x0;
136 Y0 = y0;
137 Z0 = z0;
138}

◆ SetPrimary()

void G4PrimaryVertex::SetPrimary ( G4PrimaryParticle * pp)
inline

Definition at line 170 of file G4PrimaryVertex.hh.

171{
172 if (theParticle == nullptr) {
173 theParticle = pp;
174 }
175 else {
176 theTail->SetNext(pp);
177 }
178 theTail = pp;
179 ++numberOfParticle;
180}
void SetNext(G4PrimaryParticle *np)

Referenced by G4RTPrimaryGeneratorAction::GeneratePrimaries().

◆ SetT0()

void G4PrimaryVertex::SetT0 ( G4double t0)
inline

Definition at line 160 of file G4PrimaryVertex.hh.

161{
162 T0 = t0;
163}

◆ SetUserInformation()

void G4PrimaryVertex::SetUserInformation ( G4VUserPrimaryVertexInformation * info)
inline

Definition at line 214 of file G4PrimaryVertex.hh.

215{
216 userInfo = info;
217}

◆ SetWeight()

void G4PrimaryVertex::SetWeight ( G4double w)
inline

Definition at line 209 of file G4PrimaryVertex.hh.

210{
211 Weight0 = w;
212}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().


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