BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSBunchSphere.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSBunchSphere.hh"
20#include "BDSParticleCoordsFull.hh"
21
22#include "globals.hh"
23#include "G4RandomDirection.hh"
24
25BDSBunchSphere::BDSBunchSphere():
26 BDSBunch("sphere")
27{;}
28
30{
31 G4ThreeVector momentumUnitVector = G4RandomDirection();
32 G4double xp = momentumUnitVector.x();
33 G4double yp = momentumUnitVector.y();
34 G4double zp = momentumUnitVector.z();
35 return BDSParticleCoordsFull(X0,Y0,Z0,xp,yp,zp,T0,S0,E0,/*weight=*/1.0);
36}
virtual BDSParticleCoordsFull GetNextParticleLocal()
The base class for bunch distribution generators.
Definition: BDSBunch.hh:47
G4double T0
Centre of distributions.
Definition: BDSBunch.hh:164
G4double S0
Centre of distributions.
Definition: BDSBunch.hh:163
G4double Z0
Centre of distributions.
Definition: BDSBunch.hh:162
G4double X0
Centre of distributions.
Definition: BDSBunch.hh:160
G4double E0
Centre of distributions.
Definition: BDSBunch.hh:168
G4double Y0
Centre of distributions.
Definition: BDSBunch.hh:161
A set of particle coordinates including energy and weight.