BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSParticle.hh
1 /*
2 Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3 University of London 2001 - 2018.
4 
5 This file is part of BDSIM.
6 
7 BDSIM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published
9 by the Free Software Foundation version 3 of the License.
10 
11 BDSIM is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef BDSPARTICLE_H
20 #define BDSPARTICLE_H
21 
22 #include "G4ThreeVector.hh"
23 #include "G4Types.hh"
24 
25 #include <ostream>
26 
37 {
38 public:
39  BDSParticle();
40  BDSParticle(G4double x,
41  G4double y,
42  G4double z,
43  G4double xp,
44  G4double yp,
45  G4double zp,
46  G4double totalEnergyIn,
47  G4double globalTimeIn = 0.0,
48  G4double weightIn = 1.,
49  G4int trackIDIn = -1,
50  G4int parentIDIn = -1);
51  BDSParticle(G4ThreeVector pos,
52  G4ThreeVector mom,
53  G4double totalEnergyIn,
54  G4double globalTimeIn = 0.0,
55  G4double weightIn = 1.,
56  G4int trackIDIn = -1,
57  G4int parentIDIn = -1);
58 
60  friend std::ostream& operator<< (std::ostream& out, BDSParticle const& p);
61 
62 private:
64  G4ThreeVector position;
65 
67  G4ThreeVector momentum;
68 
70  G4double totalEnergy;
71 
73  G4double T;
74 
75  // optional
77  G4double weight;
78 
80  G4int trackID;
81 
83  G4int parentID;
84 
85 public:
86  G4double GetX() const {return position.x();}
87  G4double GetY() const {return position.y();}
88  G4double GetZ() const {return position.z();}
89  G4double GetXp()const {return momentum.x();}
90  G4double GetYp()const {return momentum.y();}
91  G4double GetZp()const {return momentum.z();}
92 
93  G4double GetTotalEnergy() const {return totalEnergy;}
94  G4double GetT() const {return T;}
95  G4double GetWeight() const {return weight;}
96  G4int GetTrackID() const {return trackID;}
97  G4int GetParentID() const {return parentID;}
98 };
99 
100 #endif
G4int trackID
track ID
Definition: BDSParticle.hh:80
G4ThreeVector position
position
Definition: BDSParticle.hh:64
G4double weight
weight
Definition: BDSParticle.hh:77
G4ThreeVector momentum
momentum
Definition: BDSParticle.hh:67
G4int parentID
track ID of parent
Definition: BDSParticle.hh:83
G4double totalEnergy
energy
Definition: BDSParticle.hh:70
G4double T
time since event began (global time)
Definition: BDSParticle.hh:73
friend std::ostream & operator<<(std::ostream &out, BDSParticle const &p)
Output stream.
Definition: BDSParticle.cc:69
a particle definition
Definition: BDSParticle.hh:36