BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicsChannelling.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#include "G4Version.hh"
20#if G4VERSION_NUMBER > 1039
21#include "BDSGlobalConstants.hh"
22#include "BDSPhysicsChannelling.hh"
23
24#include "G4AutoDelete.hh"
25#include "G4BaryonConstructor.hh"
26#include "G4BosonConstructor.hh"
27#include "G4Channeling.hh"
28#include "G4Gamma.hh"
29#include "G4GenericIon.hh"
30#include "G4IonConstructor.hh"
31#include "G4LeptonConstructor.hh"
32#include "G4MesonConstructor.hh"
33#include "G4ParticleDefinition.hh"
34#include "G4ProcessManager.hh"
35
36BDSPhysicsChannelling::BDSPhysicsChannelling():
37 G4VPhysicsConstructor("BDSPhysicsChannelling")
38{;}
39
40void BDSPhysicsChannelling::ConstructParticle()
41{
42 G4BosonConstructor pBosonConstructor;
43 pBosonConstructor.ConstructParticle();
44
45 G4LeptonConstructor pLeptonConstructor;
46 pLeptonConstructor.ConstructParticle();
47
48 G4MesonConstructor pMesonConstructor;
49 pMesonConstructor.ConstructParticle();
50
51 G4BaryonConstructor pBaryonConstructor;
52 pBaryonConstructor.ConstructParticle();
53
54 G4IonConstructor pIonConstructor;
55 pIonConstructor.ConstructParticle();
56}
57
59{
60 if (Activated())
61 {return;}
62
63 G4Channeling* channelling = new G4Channeling();
64 G4AutoDelete::Register(channelling);
65 //#if G4VERSION_NUMBER > 1049 || CUSTOMCHANNELING
66#if CUSTOMCHANNELING
67 channelling->SetMinimumEnergy(BDSGlobalConstants::Instance()->MinimumKineticEnergy());
68#endif
69
70#if G4VERSION_NUMBER > 1029
71 auto aParticleIterator = GetParticleIterator();
72#endif
73 aParticleIterator->reset();
74
75 while((*aParticleIterator)())
76 {
77 G4ParticleDefinition* particle = aParticleIterator->value();
78 G4double particleCharge = particle->GetPDGCharge();
79
80 if (particleCharge !=0)
81 {
82 G4ProcessManager* pManager = particle->GetProcessManager();
83 pManager->AddDiscreteProcess(channelling);
84 }
85 }
86
88}
89
90#endif
static BDSGlobalConstants * Instance()
Access method.
virtual void ConstructProcess()
Construct and attach the processes to the relevant particles.
G4bool Activated() const
Get whether this instance has been activated.
void SetActivated()
Flag this instance as activated for later querying.