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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSBunchFileBased.hh"
19
20#include "parser/beam.h"
21
22BDSBunchFileBased::BDSBunchFileBased(const G4String& distributionName):
23 BDSBunch(distributionName),
24 nOriginalEvents(0),
25 nEventsInFile(0),
26 nEventsInFileSkipped(0),
27 distrFileLoop(false),
28 distrFileLoopNTimes(0)
29{;}
30
31BDSBunchFileBased::~BDSBunchFileBased()
32{;}
33
35 const GMAD::Beam& beam,
36 const BDSBunchType& distrType,
37 G4Transform3D beamlineTransformIn,
38 const G4double beamlineSIn)
39{
40 BDSBunch::SetOptions(beamParticle, beam, distrType, beamlineTransformIn, beamlineSIn);
41 distrFileLoop = beam.distrFileLoop || beam.distrFileLoopNTimes > 1;
42 distrFileLoopNTimes = beam.distrFileLoopNTimes;
43}
44
45void BDSBunchFileBased::BeginOfRunAction(G4int /*numberOfEvents*/,
46 G4bool batchMode)
47{
48 // If interactive, we must permit looping as the user may request more
49 // events than are in a file, and they may not have explicitly set the
50 // right combination of options in the input.
51 distrFileLoop = !batchMode || distrFileLoop;
52}
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:46
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
Definition BDSBunch.cc:81
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
bool distrFileLoop
beam parameters
Definition beamBase.h:55
int distrFileLoopNTimes
beam parameters
Definition beamBase.h:56
Beam class.
Definition beam.h:43