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) 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#include "BDSParticleMilli.hh"
19#include "BDSPhysicsMilli.hh"
20
21#include "G4AutoDelete.hh"
22#include "G4BuilderType.hh"
23#include "G4hMultipleScattering.hh"
24#include "G4ParticleDefinition.hh"
25#include "G4ParticleTable.hh" // for iterator
26#include "G4PhysicsListHelper.hh"
27#include "G4ProcessManager.hh"
28#include "G4WentzelVIModel.hh"
29#include "G4StepLimiter.hh"
30#include "G4String.hh"
31#include "G4Version.hh"
32
33#include "CLHEP/Units/SystemOfUnits.h"
34
35
36BDSPhysicsMilli::BDSPhysicsMilli(const G4String& millichargeNameIn,
37 G4int verboseIn):
38 G4VPhysicsConstructor("G4millicharged"),
39 millichargeName(millichargeNameIn),
40 verbose(verboseIn)
41{
42 SetVerboseLevel(verbose); // base class method
43 G4EmParameters* param = G4EmParameters::Instance();
44 param->SetDefaults();
45 param->SetVerbose(verbose);
46 param->SetMinEnergy(100*CLHEP::eV);
47 param->SetMaxEnergy(10*CLHEP::TeV);
48 //param->SetLowestElectronEnergy(10*eV);
49 //param->SetNumberOfBinsPerDecade(20);
50 //param->ActivateAngularGeneratorForIonisation(true);
51 //param->SetMscThetaLimit(0.0);
52 //param->SetFluo(true);
53 //param->SetAuger(true);
54 //param->SetPixe(true);
55 SetPhysicsType((G4int)G4BuilderType::bElectromagnetic);
56}
57
58BDSPhysicsMilli::~BDSPhysicsMilli()
59{;}
60
62{
63 ParticleMilli::MillichargeDefinition();
64}
65
67{
68 //G4CoulombScattering* hCoul = nullptr;
69 //hCoul = new G4CoulombScattering();
70 auto* hMpl = new G4hMultipleScattering();
71 G4AutoDelete::Register(hMpl);
72 auto* modelmpl = new G4WentzelVIModel();
73 G4AutoDelete::Register(modelmpl);
74 modelmpl->SetActivationLowEnergyLimit(1.0*CLHEP::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 == millichargeName)
90 {
91 //ph->RegisterProcess(hCoul, particle);
92 ph->RegisterProcess(hMpl, particle);
93 ph->RegisterProcess(new G4StepLimiter(), particle);
94 continue;
95 }
96 }
97}
virtual void ConstructParticle()
Overloaded particle constructor to construct millicharged.
virtual void ConstructProcess()
Construct and attach the physics processes.