File indexing completed on 2025-01-18 09:58:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifndef G4PrimaryVertex_hh
0039 #define G4PrimaryVertex_hh 1
0040
0041 #include "G4Allocator.hh"
0042 #include "G4PrimaryParticle.hh"
0043 #include "G4ThreeVector.hh"
0044 #include "globals.hh"
0045
0046 #include "pwdefs.hh"
0047
0048 class G4VUserPrimaryVertexInformation;
0049
0050 class G4PrimaryVertex
0051 {
0052 public:
0053
0054 G4PrimaryVertex() = default;
0055 G4PrimaryVertex(G4double x0, G4double y0, G4double z0, G4double t0);
0056 G4PrimaryVertex(G4ThreeVector xyz0, G4double t0);
0057
0058
0059 virtual ~G4PrimaryVertex();
0060
0061
0062 G4PrimaryVertex(const G4PrimaryVertex& right);
0063 G4PrimaryVertex& operator=(const G4PrimaryVertex& right);
0064
0065
0066 G4bool operator==(const G4PrimaryVertex& right) const;
0067 G4bool operator!=(const G4PrimaryVertex& right) const;
0068
0069
0070 inline void* operator new(size_t);
0071 inline void operator delete(void* aPrimaryVertex);
0072
0073
0074
0075 inline G4ThreeVector GetPosition() const;
0076 inline void SetPosition(G4double x0, G4double y0, G4double z0);
0077 inline G4double GetX0() const;
0078 inline G4double GetY0() const;
0079 inline G4double GetZ0() const;
0080 inline G4double GetT0() const;
0081 inline void SetT0(G4double t0);
0082 inline G4int GetNumberOfParticle() const;
0083 inline void SetPrimary(G4PrimaryParticle* pp);
0084 G4PrimaryParticle* GetPrimary(G4int i = 0) const;
0085 inline void SetNext(G4PrimaryVertex* nv);
0086 inline void ClearNext();
0087 inline G4PrimaryVertex* GetNext() const;
0088 inline G4double GetWeight() const;
0089 inline void SetWeight(G4double w);
0090 inline void SetUserInformation(G4VUserPrimaryVertexInformation* info);
0091 inline G4VUserPrimaryVertexInformation* GetUserInformation() const;
0092
0093 void Print() const;
0094
0095 private:
0096 G4double X0 = 0.0;
0097 G4double Y0 = 0.0;
0098 G4double Z0 = 0.0;
0099 G4double T0 = 0.0;
0100 G4PrimaryParticle* theParticle = nullptr;
0101 G4PrimaryParticle* theTail = nullptr;
0102 G4PrimaryVertex* nextVertex = nullptr;
0103 G4PrimaryVertex* tailVertex = nullptr;
0104 G4double Weight0 = 1.0;
0105 G4VUserPrimaryVertexInformation* userInfo = nullptr;
0106 G4int numberOfParticle = 0;
0107 };
0108
0109 extern G4PART_DLL G4Allocator<G4PrimaryVertex>*& aPrimaryVertexAllocator();
0110
0111
0112
0113
0114
0115 inline void* G4PrimaryVertex::operator new(std::size_t)
0116 {
0117 if (aPrimaryVertexAllocator() == nullptr) {
0118 aPrimaryVertexAllocator() = new G4Allocator<G4PrimaryVertex>;
0119 }
0120 return (void*)aPrimaryVertexAllocator()->MallocSingle();
0121 }
0122
0123 inline void G4PrimaryVertex::operator delete(void* aPrimaryVertex)
0124 {
0125 aPrimaryVertexAllocator()->FreeSingle((G4PrimaryVertex*)aPrimaryVertex);
0126 }
0127
0128 inline G4ThreeVector G4PrimaryVertex::GetPosition() const
0129 {
0130 return G4ThreeVector(X0, Y0, Z0);
0131 }
0132
0133 inline void G4PrimaryVertex::SetPosition(G4double x0, G4double y0, G4double z0)
0134 {
0135 X0 = x0;
0136 Y0 = y0;
0137 Z0 = z0;
0138 }
0139
0140 inline G4double G4PrimaryVertex::GetX0() const
0141 {
0142 return X0;
0143 }
0144
0145 inline G4double G4PrimaryVertex::GetY0() const
0146 {
0147 return Y0;
0148 }
0149
0150 inline G4double G4PrimaryVertex::GetZ0() const
0151 {
0152 return Z0;
0153 }
0154
0155 inline G4double G4PrimaryVertex::GetT0() const
0156 {
0157 return T0;
0158 }
0159
0160 inline void G4PrimaryVertex::SetT0(G4double t0)
0161 {
0162 T0 = t0;
0163 }
0164
0165 inline G4int G4PrimaryVertex::GetNumberOfParticle() const
0166 {
0167 return numberOfParticle;
0168 }
0169
0170 inline void G4PrimaryVertex::SetPrimary(G4PrimaryParticle* pp)
0171 {
0172 if (theParticle == nullptr) {
0173 theParticle = pp;
0174 }
0175 else {
0176 theTail->SetNext(pp);
0177 }
0178 theTail = pp;
0179 ++numberOfParticle;
0180 }
0181
0182 inline void G4PrimaryVertex::SetNext(G4PrimaryVertex* nv)
0183 {
0184 if (nextVertex == nullptr) {
0185 nextVertex = nv;
0186 }
0187 else {
0188 tailVertex->SetNext(nv);
0189 }
0190 tailVertex = nv;
0191 }
0192
0193 inline void G4PrimaryVertex::ClearNext()
0194 {
0195 nextVertex = nullptr;
0196 tailVertex = nullptr;
0197 }
0198
0199 inline G4PrimaryVertex* G4PrimaryVertex::GetNext() const
0200 {
0201 return nextVertex;
0202 }
0203
0204 inline G4double G4PrimaryVertex::GetWeight() const
0205 {
0206 return Weight0;
0207 }
0208
0209 inline void G4PrimaryVertex::SetWeight(G4double w)
0210 {
0211 Weight0 = w;
0212 }
0213
0214 inline void G4PrimaryVertex::SetUserInformation(G4VUserPrimaryVertexInformation* info)
0215 {
0216 userInfo = info;
0217 }
0218
0219 inline G4VUserPrimaryVertexInformation* G4PrimaryVertex::GetUserInformation() const
0220 {
0221 return userInfo;
0222 }
0223
0224 #endif