BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicsLaserComptonScattering.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 "BDSLaserComptonScattering.hh"
19#include "BDSPhysicsLaserComptonScattering.hh"
20
21#include "globals.hh" // geant4 types / globals
22#include "G4AutoDelete.hh"
23#include "G4Electron.hh"
24#include "G4GenericIon.hh"
25#include "G4Hydrogen.hh"
26#include "G4IonTable.hh"
27#include "G4ParticleDefinition.hh"
28#include "G4ProcessManager.hh"
29#include "G4Gamma.hh"
30#include "G4Version.hh"
31
32BDSPhysicsLaserComptonScattering::BDSPhysicsLaserComptonScattering():
33 G4VPhysicsConstructor("BDSPhysicsLaserComptonScattering")
34{;}
35
36BDSPhysicsLaserComptonScattering::~BDSPhysicsLaserComptonScattering()
37{;}
38
39void BDSPhysicsLaserComptonScattering::ConstructParticle()
40{
41 G4Electron::ElectronDefinition();
42 G4Gamma::Gamma();
43}
44
45void BDSPhysicsLaserComptonScattering::ConstructProcess()
46{
47 if (Activated())
48 {return;}
49
50 BDSLaserComptonScattering* laserComptonScattering = new BDSLaserComptonScattering();
51 G4AutoDelete::Register(laserComptonScattering);
52#if G4VERSION_NUMBER > 1029
53 auto aParticleIterator = GetParticleIterator();
54#endif
55 aParticleIterator->reset();
56 G4String name = laserComptonScattering->GetProcessName();
57 while ((*aParticleIterator)())
58 {
59 G4ParticleDefinition* particle = aParticleIterator->value();
60 G4int particleID = particle->GetPDGEncoding();
61 if (abs(particleID)==11)
62 {
63 G4ProcessManager* pmanager = particle->GetProcessManager();
64 pmanager->AddDiscreteProcess(laserComptonScattering);
65 }
66 if (particleID==18)
67 {
68 G4ProcessManager* pmanager = particle->GetProcessManager();
69 pmanager->AddDiscreteProcess(laserComptonScattering);
70 }
71 }
72
74}
G4bool Activated() const
Get whether this instance has been activated.
void SetActivated()
Flag this instance as activated for later querying.