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) 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#ifndef BDSBUNCHPTC_H
19#define BDSBUNCHPTC_H
20
21#include "BDSBunchFileBased.hh"
22
23#include "G4String.hh"
24#include "G4Types.hh"
25
26#include <array>
27#include <vector>
28
36{
37public:
39 virtual ~BDSBunchPtc();
40 virtual void SetOptions(const BDSParticleDefinition* beamParticle,
41 const GMAD::Beam& beam,
42 const BDSBunchType& distrType,
43 G4Transform3D beamlineTransformIn = G4Transform3D::Identity,
44 const G4double beamlineS = 0);
45
46 virtual void Initialise();
47
49
50 virtual void RecreateAdvanceToEvent(G4int eventOffset);
51
52private:
54 void LoadPtcFile();
55
57 G4int nRays;
58 G4String fileName;
59 G4int iRay;
60 std::vector<std::array<double, 6>> ptcData;
61 G4double beta;
62 G4int nlinesSkip;
63 G4int lineCounter;
64};
65
66#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:218
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:43