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) 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 BDSPHYSICSUTILITIES_H
19#define BDSPHYSICSUTILITIES_H
20
21#include "globals.hh"
22#include "G4Version.hh"
23
24#include "parser/fastlist.h"
25#include "parser/physicsbiasing.h"
26
27#include <set>
28#include <string>
29#include <utility>
30
32class G4DynamicParticle;
33class G4GenericBiasingPhysics;
34class G4ParticleDefinition;
35class G4VModularPhysicsList;
36
37#if G4VERSION_NUMBER > 1049
38// lots of extra code to disable bad particle killing in Geant4.10.5 series
39#include <utility>
40class G4CoupledTransportation;
41class G4Transportation;
42#endif
43
44namespace GMAD
45{
46 class Beam;
47}
48
49namespace BDS
50{
52 G4bool IsIon(const G4ParticleDefinition* particle);
53
55 G4bool IsIon(const G4DynamicParticle* particle);
56
59 G4VModularPhysicsList* BuildPhysics(const G4String& physicsList, G4int verbosity = 1);
60
62 G4int NBeamParametersSet(const GMAD::Beam& beamDefinition,
63 const std::set<std::string>& keys);
64
66 void ConflictingParametersSet(const GMAD::Beam& beamDefinition,
67 const std::set<std::string>& keys,
68 G4int nSet,
69 G4bool warnZeroParamsSet = true,
70 const G4String& unitString = "");
71
77 void ConstructDesignAndBeamParticle(const GMAD::Beam& beamDefinition,
78 G4double ffact,
79 BDSParticleDefinition*& designParticle,
80 BDSParticleDefinition*& beamParticle,
81 G4bool& beamDifferentFromDesignParticle);
82
87 BDSParticleDefinition* ConstructParticleDefinition(const G4String& particleNameIn,
88 G4double totalEnergyIn,
89 G4double kineticEnergyIn,
90 G4double momentumIn,
91 G4double ffact = 1);
92
95 void ConstructBeamParticleG4(const G4String& name);
96
100
104
107 void PrintPrimaryParticleProcesses(const G4String& primaryParticleName);
108
112
113 G4GenericBiasingPhysics* BuildAndAttachBiasWrapper(const GMAD::FastList<GMAD::PhysicsBiasing>& biases);
114
116 void BuildMuonBiasing(G4VModularPhysicsList* physicsList);
117
119 void ExtendPionDecayChannels(G4VModularPhysicsList* physicsList);
120
122 void TurnOffMuonDecay();
123
124#if G4VERSION_NUMBER > 1039
126 G4VModularPhysicsList* ChannellingPhysicsComplete(G4bool useEMD = false,
127 G4bool regular = false,
128 G4bool em4 = false,
129 G4bool emss = false);
130#endif
131
135 void SetRangeCuts(G4VModularPhysicsList* physicsList, G4int verbosity = 1);
136
140
141#if G4VERSION_NUMBER > 1049
143 void FixGeant105ThreshholdsForBeamParticle(const BDSParticleDefinition* particleDefinition);
144
147 void FixGeant105ThreshholdsForParticle(const G4ParticleDefinition* particleDefinition);
148
150 void ChangeLooperParameters(const G4ParticleDefinition* particleDef);
151
153 std::pair<G4Transportation*, G4CoupledTransportation*> FindTransportation(const G4ParticleDefinition* particleDef);
154#endif
155}
156
157#endif
Wrapper for particle definition.
Beam loader.
Definition Beam.hh:36
Beam class.
Definition beam.h:43
List with Efficient Lookup.
Definition fastlist.h:41
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 ExtendPionDecayChannels(G4VModularPhysicsList *physicsList)
Extend the default pi+- decay channels in Geant4.
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 TurnOffMuonDecay()
Set mu+- as stable so they won't decay.
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.