BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicsUtilities.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 BDSPHYSICSUTILITIES_H
20#define BDSPHYSICSUTILITIES_H
21
22#include "globals.hh"
23#include "G4Version.hh"
24
25#include "parser/fastlist.h"
26#include "parser/physicsbiasing.h"
27
28#include <set>
29#include <string>
30#include <utility>
31
33class G4DynamicParticle;
34class G4GenericBiasingPhysics;
35class G4ParticleDefinition;
36class G4VModularPhysicsList;
37
38#if G4VERSION_NUMBER > 1049
39// lots of extra code to disable bad particle killing in Geant4.10.5 series
40#include <utility>
41class G4CoupledTransportation;
42class G4Transportation;
43#endif
44
45namespace GMAD
46{
47 class Beam;
48}
49
50namespace BDS
51{
53 G4bool IsIon(const G4ParticleDefinition* particle);
54
56 G4bool IsIon(const G4DynamicParticle* paritlce);
57
60 G4VModularPhysicsList* BuildPhysics(const G4String& physicsList, G4int verbosity = 1);
61
63 G4int NBeamParametersSet(const GMAD::Beam& beamDefinition,
64 const std::set<std::string>& keys);
65
67 void ConflictingParametersSet(const GMAD::Beam& beamDefinition,
68 const std::set<std::string>& keys,
69 G4int nSet,
70 G4bool warnZeroParamsSet = true,
71 const G4String& unitString = "");
72
78 void ConstructDesignAndBeamParticle(const GMAD::Beam& beamDefinition,
79 G4double ffact,
80 BDSParticleDefinition*& designParticle,
81 BDSParticleDefinition*& beamParticle,
82 G4bool& beamDifferentFromDesignParticle);
83
88 BDSParticleDefinition* ConstructParticleDefinition(const G4String& particleNameIn,
89 G4double totalEnergyIn,
90 G4double kineticEnergyIn,
91 G4double momentumIn,
92 G4double ffact = 1);
93
96 void ConstructBeamParticleG4(const G4String& name);
97
101
105
108 void PrintPrimaryParticleProcesses(const G4String& primaryParticleName);
109
113
114 G4GenericBiasingPhysics* BuildAndAttachBiasWrapper(const GMAD::FastList<GMAD::PhysicsBiasing>& biases);
115
117 void BuildMuonBiasing(G4VModularPhysicsList* physicsList);
118
119#if G4VERSION_NUMBER > 1039
121 G4VModularPhysicsList* ChannellingPhysicsComplete(G4bool useEMD = false,
122 G4bool regular = false,
123 G4bool em4 = false,
124 G4bool emss = false);
125#endif
126
130 void SetRangeCuts(G4VModularPhysicsList* physicsList, G4int verbosity = 1);
131
135
136#if G4VERSION_NUMBER > 1049
138 void FixGeant105ThreshholdsForBeamParticle(const BDSParticleDefinition* particleDefinition);
139
142 void FixGeant105ThreshholdsForParticle(const G4ParticleDefinition* particleDefinition);
143
145 void ChangeLooperParameters(const G4ParticleDefinition* particleDef);
146
148 std::pair<G4Transportation*, G4CoupledTransportation*> FindTransportation(const G4ParticleDefinition* particleDef);
149#endif
150}
151
152#endif
Wrapper for particle definition.
Beam loader.
Definition: Beam.hh:37
Beam class.
Definition: beam.h:44
List with Efficient Lookup.
Definition: fastlist.h:42
Return either G4Tubs or G4CutTubs depending on flat face.
void SetRangeCuts(G4VModularPhysicsList *physicsList, G4int verbosity=1)
void ConstructBeamParticleG4(const G4String &name)
void PrintDefinedParticles()
std::pair< G4Transportation *, G4CoupledTransportation * > FindTransportation(const G4ParticleDefinition *particleDef)
Taken from Geant4 field01 example. Get the two possible transportation processes.
BDSParticleDefinition * ConstructParticleDefinition(const G4String &particleNameIn, G4double totalEnergyIn, G4double kineticEnergyIn, G4double momentumIn, G4double ffact=1)
void ConflictingParametersSet(const GMAD::Beam &beamDefinition, const std::set< std::string > &keys, G4int nSet, G4bool warnZeroParamsSet=true, const G4String &unitString="")
Throw an exception if too few or too many parameters are set for the supplied keys.
void PrintPrimaryParticleProcesses(const G4String &primaryParticleName)
void BuildMuonBiasing(G4VModularPhysicsList *physicsList)
Build muon splitting biasing and wrap the various processes in the physics list.
void CheckAndSetEnergyValidityRange()
void FixGeant105ThreshholdsForBeamParticle(const BDSParticleDefinition *particleDefinition)
Apply FixGeant105ThreshholdsForParticle to the beam particle definition.
void FixGeant105ThreshholdsForParticle(const G4ParticleDefinition *particleDefinition)
void ChangeLooperParameters(const G4ParticleDefinition *particleDef)
Taken from Geant4 field01 example. Set low values.
void ConstructExtendedParticleSet()
void ConstructDesignAndBeamParticle(const GMAD::Beam &beamDefinition, G4double ffact, BDSParticleDefinition *&designParticle, BDSParticleDefinition *&beamParticle, G4bool &beamDifferentFromDesignParticle)
G4int NBeamParametersSet(const GMAD::Beam &beamDefinition, const std::set< std::string > &keys)
Count how many out of the set of keys in a beam instance are set.
G4VModularPhysicsList * BuildPhysics(const G4String &physicsList, G4int verbosity=1)
G4bool IsIon(const G4ParticleDefinition *particle)
Whether a particle is an ion. A proton is counted NOT as an ion.
void ConstructMinimumParticleSet()
G4VModularPhysicsList * ChannellingPhysicsComplete(G4bool useEMD=false, G4bool regular=false, G4bool em4=false, G4bool emss=false)
Build the physics required for channelling to work correctly.
Parser namespace for GMAD language. Combination of Geant4 and MAD.