[824] | 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 | // |
---|
| 27 | // $Id: G4PrimaryVertex.hh,v 1.4 2006/07/20 15:14:43 gcosmo Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[824] | 29 | // |
---|
| 30 | // |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | #ifndef G4PrimaryVertex_h |
---|
| 34 | #define G4PrimaryVertex_h 1 |
---|
| 35 | |
---|
| 36 | #include "globals.hh" |
---|
| 37 | #include "G4Allocator.hh" |
---|
| 38 | #include "G4ThreeVector.hh" |
---|
| 39 | #include "G4PrimaryParticle.hh" |
---|
| 40 | class G4VUserPrimaryVertexInformation; |
---|
| 41 | |
---|
| 42 | // class description: |
---|
| 43 | // |
---|
| 44 | // This is the class which represents a primary vertex. The ofject of this |
---|
| 45 | // class is set to G4Event objct by G4VPrimaryGenerator concrete class. |
---|
| 46 | // This class object has one or more G4PrimaryParticle objects as primary |
---|
| 47 | // particles. |
---|
| 48 | |
---|
| 49 | class G4PrimaryVertex |
---|
| 50 | { |
---|
| 51 | public: |
---|
| 52 | inline void *operator new(size_t); |
---|
| 53 | inline void operator delete(void *aStackedTrack); |
---|
| 54 | |
---|
| 55 | G4PrimaryVertex(); |
---|
| 56 | G4PrimaryVertex(G4double x0,G4double y0,G4double z0,G4double t0); |
---|
| 57 | G4PrimaryVertex(G4ThreeVector xyz0,G4double t0); |
---|
| 58 | ~G4PrimaryVertex(); |
---|
| 59 | |
---|
| 60 | const G4PrimaryVertex & operator=(const G4PrimaryVertex &right); |
---|
| 61 | G4int operator==(const G4PrimaryVertex &right) const; |
---|
| 62 | G4int operator!=(const G4PrimaryVertex &right) const; |
---|
| 63 | |
---|
| 64 | void Print() const; |
---|
| 65 | |
---|
| 66 | private: |
---|
| 67 | G4double X0; |
---|
| 68 | G4double Y0; |
---|
| 69 | G4double Z0; |
---|
| 70 | G4double T0; |
---|
| 71 | G4PrimaryParticle * theParticle; |
---|
| 72 | G4PrimaryParticle * theTail; |
---|
| 73 | G4PrimaryVertex* nextVertex; |
---|
| 74 | G4PrimaryVertex* tailVertex; |
---|
| 75 | G4int numberOfParticle; |
---|
| 76 | G4double Weight0; |
---|
| 77 | G4VUserPrimaryVertexInformation* userInfo; |
---|
| 78 | |
---|
| 79 | public: |
---|
| 80 | inline G4ThreeVector GetPosition() const |
---|
| 81 | { return G4ThreeVector(X0,Y0,Z0); } |
---|
| 82 | inline void SetPosition(G4double x0,G4double y0,G4double z0) |
---|
| 83 | { X0 = x0; Y0 = y0; Z0 = z0; } |
---|
| 84 | inline G4double GetX0() const |
---|
| 85 | { return X0; } |
---|
| 86 | inline G4double GetY0() const |
---|
| 87 | { return Y0; } |
---|
| 88 | inline G4double GetZ0() const |
---|
| 89 | { return Z0; } |
---|
| 90 | inline G4double GetT0() const |
---|
| 91 | { return T0; } |
---|
| 92 | inline void SetT0(G4double t0) |
---|
| 93 | { T0 = t0; } |
---|
| 94 | inline G4int GetNumberOfParticle() const |
---|
| 95 | { return numberOfParticle; } |
---|
| 96 | inline void SetPrimary(G4PrimaryParticle * pp) |
---|
| 97 | { |
---|
| 98 | if(theParticle == 0) |
---|
| 99 | { theParticle = pp; } |
---|
| 100 | else |
---|
| 101 | { theTail->SetNext(pp); } |
---|
| 102 | theTail = pp; |
---|
| 103 | numberOfParticle++; |
---|
| 104 | } |
---|
| 105 | inline G4PrimaryParticle* GetPrimary(G4int i=0) const |
---|
| 106 | { |
---|
| 107 | if( i == 0 ) |
---|
| 108 | { return theParticle; } |
---|
| 109 | else if( i > 0 && i < numberOfParticle ) |
---|
| 110 | { |
---|
| 111 | G4PrimaryParticle* particle = theParticle; |
---|
| 112 | for( G4int j=0; j<i; j++ ) |
---|
| 113 | { |
---|
| 114 | if( particle == 0 ) return 0; |
---|
| 115 | particle = particle->GetNext(); |
---|
| 116 | } |
---|
| 117 | return particle; |
---|
| 118 | } |
---|
| 119 | else |
---|
| 120 | { return 0; } |
---|
| 121 | } |
---|
| 122 | inline void SetNext(G4PrimaryVertex* nv) |
---|
| 123 | { |
---|
| 124 | if(nextVertex == 0) |
---|
| 125 | { nextVertex = nv; } |
---|
| 126 | else |
---|
| 127 | { tailVertex->SetNext(nv); } |
---|
| 128 | tailVertex = nv; |
---|
| 129 | } |
---|
| 130 | inline G4PrimaryVertex* GetNext() const |
---|
| 131 | { return nextVertex; } |
---|
| 132 | inline G4double GetWeight() const |
---|
| 133 | { return Weight0; } |
---|
| 134 | inline void SetWeight(G4double w) |
---|
| 135 | { Weight0 = w; } |
---|
| 136 | inline void SetUserInformation(G4VUserPrimaryVertexInformation* anInfo) |
---|
| 137 | { userInfo = anInfo; } |
---|
| 138 | inline G4VUserPrimaryVertexInformation* GetUserInformation() const |
---|
| 139 | { return userInfo; } |
---|
| 140 | }; |
---|
| 141 | |
---|
| 142 | #if defined G4PARTICLES_ALLOC_EXPORT |
---|
| 143 | extern G4DLLEXPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator; |
---|
| 144 | #else |
---|
| 145 | extern G4DLLIMPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator; |
---|
| 146 | #endif |
---|
| 147 | |
---|
| 148 | inline void * G4PrimaryVertex::operator new(size_t) |
---|
| 149 | { |
---|
| 150 | void * aPrimaryVertex; |
---|
| 151 | aPrimaryVertex = (void *) aPrimaryVertexAllocator.MallocSingle(); |
---|
| 152 | return aPrimaryVertex; |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | inline void G4PrimaryVertex::operator delete(void * aPrimaryVertex) |
---|
| 156 | { |
---|
| 157 | aPrimaryVertexAllocator.FreeSingle((G4PrimaryVertex *) aPrimaryVertex); |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | #endif |
---|
| 162 | |
---|