BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPrimaryGeneratorAction.hh
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#ifndef BDSPRIMARYGENERATORACTION_H
20#define BDSPRIMARYGENERATORACTION_H
21
22#include "BDSExtent.hh"
23
24#include "globals.hh"
25#include "G4VUserPrimaryGeneratorAction.hh"
26
27class BDSBunch;
28class BDSOutputLoader;
31class G4Event;
32class G4ParticleGun;
33
34namespace GMAD
35{
36 class Beam;
37}
38
39
45class BDSPrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction
46{
47public:
50 const GMAD::Beam& beam,
51 G4bool batchMode);
53
55 virtual void GeneratePrimaries(G4Event*);
56
58 inline void SetWorldExtent(const BDSExtent worldExtentIn) {worldExtent = worldExtentIn;}
62
63private:
65 void GeneratePrimariesFromFile(G4Event* anEvent);
66
67 G4ParticleGun* particleGun;
71 G4bool recreate;
74 G4bool ionPrimary;
76
79
82 G4bool ionCached;
83
86
87 BDSPrimaryGeneratorFile* generatorFromFile;
88};
89
90#endif
The base class for bunch distribution generators.
Definition: BDSBunch.hh:47
Holder for +- extents in 3 dimensions.
Definition: BDSExtent.hh:39
Loader of ROOT Event output for recreating events.
Class to load and use PTC 1 turn map.
Generates primary particle vertices using BDSBunch.
G4bool recreate
Whether to load seed state at start of event from rootevent file.
G4ParticleGun * particleGun
Geant4 particle gun that creates single particles.
G4int eventOffset
The offset in the file to read events from when setting the seed.
G4bool useASCIISeedState
Whether to use the ascii seed state each time.
G4bool ionPrimary
The primary particle will be an ion.
G4bool distrFileMatchLength
Match external file length for event generator.
void RegisterPTCOneTurnMap(BDSPTCOneTurnMap *otmIn)
void GeneratePrimariesFromFile(G4Event *anEvent)
For a file-based event generator there are a few checks we have to do - put in a function to keep tid...
void SetWorldExtent(const BDSExtent worldExtentIn)
Set the world extent that particle coordinates will be checked against.
BDSExtent worldExtent
World extent that particle coordinates are checked against to ensure they're inside it.
BDSBunch * bunch
BDSIM particle generator.
virtual void GeneratePrimaries(G4Event *)
Main interface for Geant4. Prepare primary(ies) for the event.
BDSPTCOneTurnMap * oneTurnMap
Cached OTM for setting first turn primary coords.
G4bool writeASCIISeedState
Cache of whether to write seed state as ASCII per event.
BDSOutputLoader * recreateFile
Optional output handler for restoring seed state.
Common interface for any primary generators that are file based.
Beam loader.
Definition: Beam.hh:37
Beam class.
Definition: beam.h:44
Parser namespace for GMAD language. Combination of Geant4 and MAD.