BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSBunchPtc.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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 "BDSBunch.hh"
23
24#include "globals.hh"
25
26#include <vector>
27
34class BDSBunchPtc: public BDSBunch
35{
36public:
38 virtual ~BDSBunchPtc();
39 virtual void SetOptions(const BDSParticleDefinition* beamParticle,
40 const GMAD::Beam& beam,
41 const BDSBunchType& distrType,
42 G4Transform3D beamlineTransformIn = G4Transform3D::Identity,
43 const G4double beamlineS = 0);
45
46private:
48 void LoadPtcFile();
49
51 void SetDistrFile(const G4String& distrFileNameIn);
52
54 G4int nRays;
55 G4String fileName;
56 G4int iRay;
57 std::vector<double*> ptcData;
58 G4bool loopedOver;
59 G4double beta;
60};
61
62#endif
A bunch distribution that reads a PTC inrays file.
Definition: BDSBunchPtc.hh:35
std::vector< double * > ptcData
Data.
Definition: BDSBunchPtc.hh:57
G4bool loopedOver
Whether we've reset to loop over the file again.
Definition: BDSBunchPtc.hh:58
G4String fileName
File name.
Definition: BDSBunchPtc.hh:55
void LoadPtcFile()
Load the PTC file into memory.
Definition: BDSBunchPtc.cc:50
G4bool matchDistrFileLength
Whether to only run the number of particles in the file.
Definition: BDSBunchPtc.hh:53
virtual BDSParticleCoordsFull GetNextParticleLocal()
Definition: BDSBunchPtc.cc:153
G4int nRays
Number of rays in file (1 counting).
Definition: BDSBunchPtc.hh:54
void SetDistrFile(const G4String &distrFileNameIn)
Assign the distribution file by finding the full path of it.
Definition: BDSBunchPtc.cc:148
G4double beta
Velocity w.r.t. speed of light. Needed to convert mom. to energy.
Definition: BDSBunchPtc.hh:59
G4int iRay
Iterator counter for current ray.
Definition: BDSBunchPtc.hh:56
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
Definition: BDSBunchPtc.cc:131
The base class for bunch distribution generators.
Definition: BDSBunch.hh:47
G4double beamlineS
Beamline initial S position.
Definition: BDSBunch.hh:201
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