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 - 2024.
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.
G4String fileName
File name.
virtual void RecreateAdvanceToEvent(G4int eventOffset)
void LoadPtcFile()
Load the PTC file into memory.
G4bool matchDistrFileLength
Whether to only run the number of particles in the file.
virtual BDSParticleCoordsFull GetNextParticleLocal()
G4int nRays
Number of rays in file (1 counting).
G4double beta
Velocity w.r.t. speed of light. Needed to convert mom. to energy.
virtual void Initialise()
Any initialisation - to be used after SetOptions, then CheckParameters.
G4int iRay
Iterator counter for current ray.
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().
std::vector< std::array< double, 6 > > ptcData
Data.
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