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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 48 class G4VUserPrimaryVertexInformation;
 49 
 50 class G4PrimaryVertex
 51 {
 52   public:
 53     // Constructors
 54     G4PrimaryVertex() = default;
 55     G4PrimaryVertex(G4double x0, G4double y0, G4double z0, G4double t0);
 56     G4PrimaryVertex(G4ThreeVector xyz0, G4double t0);
 57 
 58     // Destructor
 59     virtual ~G4PrimaryVertex();
 60 
 61     // Copy constructor & assignment operator
 62     G4PrimaryVertex(const G4PrimaryVertex& right);
 63     G4PrimaryVertex& operator=(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);
 84     G4PrimaryParticle* GetPrimary(G4int i = 0) const;
 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);
 90     inline void SetUserInformation(G4VUserPrimaryVertexInformation* info);
 91     inline G4VUserPrimaryVertexInformation* GetUserInformation() const;
 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 
109 extern G4PART_DLL G4Allocator<G4PrimaryVertex>*& aPrimaryVertexAllocator();
110 
111 // ------------------------
112 // Inline methods
113 // ------------------------
114 
115 inline void* G4PrimaryVertex::operator new(std::size_t)
116 {
117   if (aPrimaryVertexAllocator() == nullptr) {
118     aPrimaryVertexAllocator() = new G4Allocator<G4PrimaryVertex>;
119   }
120   return (void*)aPrimaryVertexAllocator()->MallocSingle();
121 }
122 
123 inline void G4PrimaryVertex::operator delete(void* aPrimaryVertex)
124 {
125   aPrimaryVertexAllocator()->FreeSingle((G4PrimaryVertex*)aPrimaryVertex);
126 }
127 
128 inline G4ThreeVector G4PrimaryVertex::GetPosition() const
129 {
130   return G4ThreeVector(X0, Y0, Z0);
131 }
132 
133 inline void G4PrimaryVertex::SetPosition(G4double x0, G4double y0, G4double z0)
134 {
135   X0 = x0;
136   Y0 = y0;
137   Z0 = z0;
138 }
139 
140 inline G4double G4PrimaryVertex::GetX0() const
141 {
142   return X0;
143 }
144 
145 inline G4double G4PrimaryVertex::GetY0() const
146 {
147   return Y0;
148 }
149 
150 inline G4double G4PrimaryVertex::GetZ0() const
151 {
152   return Z0;
153 }
154 
155 inline G4double G4PrimaryVertex::GetT0() const
156 {
157   return T0;
158 }
159 
160 inline void G4PrimaryVertex::SetT0(G4double t0)
161 {
162   T0 = t0;
163 }
164 
165 inline G4int G4PrimaryVertex::GetNumberOfParticle() const
166 {
167   return numberOfParticle;
168 }
169 
170 inline void G4PrimaryVertex::SetPrimary(G4PrimaryParticle* pp)
171 {
172   if (theParticle == nullptr) {
173     theParticle = pp;
174   }
175   else {
176     theTail->SetNext(pp);
177   }
178   theTail = pp;
179   ++numberOfParticle;
180 }
181 
182 inline void G4PrimaryVertex::SetNext(G4PrimaryVertex* nv)
183 {
184   if (nextVertex == nullptr) {
185     nextVertex = nv;
186   }
187   else {
188     tailVertex->SetNext(nv);
189   }
190   tailVertex = nv;
191 }
192 
193 inline void G4PrimaryVertex::ClearNext()
194 {
195   nextVertex = nullptr;
196   tailVertex = nullptr;
197 }
198 
199 inline G4PrimaryVertex* G4PrimaryVertex::GetNext() const
200 {
201   return nextVertex;
202 }
203 
204 inline G4double G4PrimaryVertex::GetWeight() const
205 {
206   return Weight0;
207 }
208 
209 inline void G4PrimaryVertex::SetWeight(G4double w)
210 {
211   Weight0 = w;
212 }
213 
214 inline void G4PrimaryVertex::SetUserInformation(G4VUserPrimaryVertexInformation* info)
215 {
216   userInfo = info;
217 }
218 
219 inline G4VUserPrimaryVertexInformation* G4PrimaryVertex::GetUserInformation() const
220 {
221   return userInfo;
222 }
223 
224 #endif
225