BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSBunchFileBased.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
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 "BDSBunchFileBased.hh"
20
21#include "parser/beam.h"
22
23BDSBunchFileBased::BDSBunchFileBased(const G4String& distributionName):
24 BDSBunch(distributionName),
25 nOriginalEvents(0),
26 nEventsInFile(0),
27 nEventsInFileSkipped(0),
28 distrFileLoop(false),
29 distrFileLoopNTimes(0)
30{;}
31
32BDSBunchFileBased::~BDSBunchFileBased()
33{;}
34
36 const GMAD::Beam& beam,
37 const BDSBunchType& distrType,
38 G4Transform3D beamlineTransformIn,
39 const G4double beamlineSIn)
40{
41 BDSBunch::SetOptions(beamParticle, beam, distrType, beamlineTransformIn, beamlineSIn);
42 distrFileLoop = beam.distrFileLoop;
43 distrFileLoopNTimes = beam.distrFileLoopNTimes;
44}
45
46void BDSBunchFileBased::BeginOfRunAction(G4int /*numberOfEvents*/,
47 G4bool batchMode)
48{
49 // If interactive, we must permit looping as the user may request more
50 // events than are in a file, and they may not have explicitly set the
51 // right combination of options in the input.
52 distrFileLoop = !batchMode || distrFileLoop;
53}
virtual void BeginOfRunAction(G4int numberOfEvents, G4bool batchMode)
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
Pull out the relevant options and then pass through to BDSBunch::SetOptions().
The base class for bunch distribution generators.
Definition: BDSBunch.hh:47
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
Definition: BDSBunch.cc:82
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
bool distrFileLoop
beam parameters
Definition: beamBase.h:56
int distrFileLoopNTimes
beam parameters
Definition: beamBase.h:57
Beam class.
Definition: beam.h:44