Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PrimaryVertex.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4PrimaryVertex
27//
28// class description:
29//
30// This is the class which represents a primary vertex. The object of this
31// class is set to G4Event by a G4VPrimaryGenerator concrete class.
32// This class object has one or more G4PrimaryParticle objects as primary
33// particles.
34
35// Authors: G.Cosmo, 2 December 1995 - Design, based on object model
36// M.Asai, 29 January 1996 - First implementation
37// --------------------------------------------------------------------
38#ifndef G4PrimaryVertex_hh
39#define G4PrimaryVertex_hh 1
40
41#include "G4Allocator.hh"
42#include "G4PrimaryParticle.hh"
43#include "G4ThreeVector.hh"
44#include "globals.hh"
45
46#include "pwdefs.hh"
47
49
51{
52 public:
53 // Constructors
54 G4PrimaryVertex() = default;
57
58 // Destructor
59 virtual ~G4PrimaryVertex();
60
61 // Copy constructor & assignment operator
62 G4PrimaryVertex(const G4PrimaryVertex& right);
64
65 // Equality operators
66 G4bool operator==(const G4PrimaryVertex& right) const;
67 G4bool operator!=(const G4PrimaryVertex& right) const;
68
69 // Overloaded new/delete operators
70 inline void* operator new(size_t);
71 inline void operator delete(void* aPrimaryVertex);
72
73 // Accessors & modifiers
74
75 inline G4ThreeVector GetPosition() const;
76 inline void SetPosition(G4double x0, G4double y0, G4double z0);
77 inline G4double GetX0() const;
78 inline G4double GetY0() const;
79 inline G4double GetZ0() const;
80 inline G4double GetT0() const;
81 inline void SetT0(G4double t0);
82 inline G4int GetNumberOfParticle() const;
83 inline void SetPrimary(G4PrimaryParticle* pp);
85 inline void SetNext(G4PrimaryVertex* nv);
86 inline void ClearNext();
87 inline G4PrimaryVertex* GetNext() const;
88 inline G4double GetWeight() const;
89 inline void SetWeight(G4double w);
92
93 void Print() const;
94
95 private:
96 G4double X0 = 0.0;
97 G4double Y0 = 0.0;
98 G4double Z0 = 0.0;
99 G4double T0 = 0.0;
100 G4PrimaryParticle* theParticle = nullptr;
101 G4PrimaryParticle* theTail = nullptr;
102 G4PrimaryVertex* nextVertex = nullptr;
103 G4PrimaryVertex* tailVertex = nullptr;
104 G4double Weight0 = 1.0;
105 G4VUserPrimaryVertexInformation* userInfo = nullptr;
106 G4int numberOfParticle = 0;
107};
108
110
111// ------------------------
112// Inline methods
113// ------------------------
114
115inline void* G4PrimaryVertex::operator new(std::size_t)
116{
117 if (aPrimaryVertexAllocator() == nullptr) {
119 }
120 return (void*)aPrimaryVertexAllocator()->MallocSingle();
121}
122
123inline void G4PrimaryVertex::operator delete(void* aPrimaryVertex)
124{
125 aPrimaryVertexAllocator()->FreeSingle((G4PrimaryVertex*)aPrimaryVertex);
126}
127
129{
130 return G4ThreeVector(X0, Y0, Z0);
131}
132
134{
135 X0 = x0;
136 Y0 = y0;
137 Z0 = z0;
138}
139
141{
142 return X0;
143}
144
146{
147 return Y0;
148}
149
151{
152 return Z0;
153}
154
156{
157 return T0;
158}
159
161{
162 T0 = t0;
163}
164
166{
167 return numberOfParticle;
168}
169
171{
172 if (theParticle == nullptr) {
173 theParticle = pp;
174 }
175 else {
176 theTail->SetNext(pp);
177 }
178 theTail = pp;
179 ++numberOfParticle;
180}
181
183{
184 if (nextVertex == nullptr) {
185 nextVertex = nv;
186 }
187 else {
188 tailVertex->SetNext(nv);
189 }
190 tailVertex = nv;
191}
192
194{
195 nextVertex = nullptr;
196 tailVertex = nullptr;
197}
198
200{
201 return nextVertex;
202}
203
205{
206 return Weight0;
207}
208
210{
211 Weight0 = w;
212}
213
215{
216 userInfo = info;
217}
218
220{
221 return userInfo;
222}
223
224#endif
G4PART_DLL G4Allocator< G4PrimaryVertex > *& aPrimaryVertexAllocator()
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
void SetNext(G4PrimaryParticle *np)
G4double GetT0() const
G4bool operator==(const G4PrimaryVertex &right) const
virtual ~G4PrimaryVertex()
void SetNext(G4PrimaryVertex *nv)
G4PrimaryVertex * GetNext() const
G4double GetWeight() const
G4VUserPrimaryVertexInformation * GetUserInformation() const
G4PrimaryVertex & operator=(const G4PrimaryVertex &right)
G4double GetZ0() const
G4bool operator!=(const G4PrimaryVertex &right) const
void SetPosition(G4double x0, G4double y0, G4double z0)
G4double GetX0() const
G4double GetY0() const
G4ThreeVector GetPosition() const
void SetPrimary(G4PrimaryParticle *pp)
void SetWeight(G4double w)
G4PrimaryVertex()=default
void SetT0(G4double t0)
void SetUserInformation(G4VUserPrimaryVertexInformation *info)
G4PrimaryParticle * GetPrimary(G4int i=0) const
G4int GetNumberOfParticle() const
#define G4PART_DLL
Definition pwdefs.hh:45