BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicsMilli.cc
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
20#include "BDSDebug.hh"
21#include "BDSGlobalConstants.hh"
22#include "BDSParticleMilli.hh"
23#include "BDSPhysicsMilli.hh"
24
25#include "G4SystemOfUnits.hh"
26#include "G4ParticleDefinition.hh"
27#include "G4ParticleTable.hh"
28#include "G4LossTableManager.hh"
29#include "G4EmParameters.hh"
30#include "G4PhysicsListHelper.hh"
31#include "G4Version.hh"
32#include "G4BuilderType.hh"
33
34//#include "G4CoulombScattering.hh"
35#include "G4hMultipleScattering.hh"
36#include "G4WentzelVIModel.hh"
37#include "G4ProcessManager.hh"
38#include "G4StepLimiter.hh"
39
40BDSPhysicsMilli::BDSPhysicsMilli(const G4String&, G4int ver): G4VPhysicsConstructor("G4millicharged"), verbose(ver)
41{
42 G4EmParameters* param = G4EmParameters::Instance();
43 param->SetDefaults();
44 param->SetVerbose(verbose);
45 param->SetMinEnergy(100*eV);
46 param->SetMaxEnergy(10*TeV);
47 //param->SetLowestElectronEnergy(10*eV);
48 //param->SetNumberOfBinsPerDecade(20);
49 //param->ActivateAngularGeneratorForIonisation(true);
50 //param->SetMscThetaLimit(0.0);
51 //param->SetFluo(true);
52 //param->SetAuger(true);
53 //param->SetPixe(true);
54 SetPhysicsType(bElectromagnetic);
55}
56
57BDSPhysicsMilli::~BDSPhysicsMilli()
58{;}
59
61{
62 ParticleMilli::MillichargeDefinition();
63}
64
66{
67 //G4CoulombScattering* hCoul = nullptr;
68 //hCoul = new G4CoulombScattering();
69
70 G4hMultipleScattering* hMpl = nullptr;
71 hMpl = new G4hMultipleScattering();
72 G4WentzelVIModel* modelmpl = nullptr;
73 modelmpl = new G4WentzelVIModel();
74 modelmpl->SetActivationLowEnergyLimit(1.*MeV);
75 hMpl->SetEmModel(modelmpl, 1);
76
77 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
78
79#if G4VERSION_NUMBER > 1029
80 auto aParticleIterator = GetParticleIterator();
81#endif
82 aParticleIterator->reset();
83
84 while( (*aParticleIterator)() )
85 {
86 G4ParticleDefinition* particle = aParticleIterator->value();
87 G4String particleName = particle->GetParticleName();
88
89 if(particleName == BDSGlobalConstants::Instance()->millichargeName())
90 {
91 //ph->RegisterProcess(hCoul, particle);
92 ph->RegisterProcess(hMpl, particle);
93 ph->RegisterProcess(new G4StepLimiter(), particle);
94 continue;
95 }
96 }
97}
static BDSGlobalConstants * Instance()
Access method.
virtual void ConstructParticle()
Overloaded particle constructor to construct millicharged.
virtual void ConstructProcess()
Construct and attach the physics processes.