BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSBunchPtc.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 BDSBUNCHPTC_H
20#define BDSBUNCHPTC_H
21
22#include "BDSBunchFileBased.hh"
23
24#include "G4String.hh"
25#include "G4Types.hh"
26
27#include <array>
28#include <vector>
29
37{
38public:
40 virtual ~BDSBunchPtc();
41 virtual void SetOptions(const BDSParticleDefinition* beamParticle,
42 const GMAD::Beam& beam,
43 const BDSBunchType& distrType,
44 G4Transform3D beamlineTransformIn = G4Transform3D::Identity,
45 const G4double beamlineS = 0);
46
47 virtual void Initialise();
48
50
51 virtual void RecreateAdvanceToEvent(G4int eventOffset);
52
53private:
55 void LoadPtcFile();
56
58 G4int nRays;
59 G4String fileName;
60 G4int iRay;
61 std::vector<std::array<double, 6>> ptcData;
62 G4double beta;
63 G4int nlinesSkip;
64 G4int lineCounter;
65};
66
67#endif
An intermediate layer for any bunch classes that are file based.
A bunch distribution that reads a PTC inrays file.
Definition: BDSBunchPtc.hh:37
G4String fileName
File name.
Definition: BDSBunchPtc.hh:59
virtual void RecreateAdvanceToEvent(G4int eventOffset)
Definition: BDSBunchPtc.cc:253
void LoadPtcFile()
Load the PTC file into memory.
Definition: BDSBunchPtc.cc:56
G4bool matchDistrFileLength
Whether to only run the number of particles in the file.
Definition: BDSBunchPtc.hh:57
virtual BDSParticleCoordsFull GetNextParticleLocal()
Definition: BDSBunchPtc.cc:221
G4int nRays
Number of rays in file (1 counting).
Definition: BDSBunchPtc.hh:58
G4double beta
Velocity w.r.t. speed of light. Needed to convert mom. to energy.
Definition: BDSBunchPtc.hh:62
virtual void Initialise()
Any initialisation - to be used after SetOptions, then CheckParameters.
Definition: BDSBunchPtc.cc:156
G4int iRay
Iterator counter for current ray.
Definition: BDSBunchPtc.hh:60
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().
Definition: BDSBunchPtc.cc:143
std::vector< std::array< double, 6 > > ptcData
Data.
Definition: BDSBunchPtc.hh:61
G4double beamlineS
Beamline initial S position.
Definition: BDSBunch.hh:219
A set of particle coordinates including energy and weight.
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
Beam class.
Definition: beam.h:44