BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSPhysicsSynchRad.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 "BDSPhysicsSynchRad.hh"
19
20#include "globals.hh" // geant4 types / globals
21#include "G4AutoDelete.hh"
22#include "G4Gamma.hh"
23#include "G4LeptonConstructor.hh"
24#include "G4OpticalPhoton.hh"
25#include "G4ParticleDefinition.hh"
26#include "G4SynchrotronRadiation.hh"
27#include "G4Version.hh"
28
29BDSPhysicsSynchRad::BDSPhysicsSynchRad():
30 G4VPhysicsConstructor("BDSPhysicsSynchRad")
31{;}
32
33BDSPhysicsSynchRad::~BDSPhysicsSynchRad()
34{;}
35
37{
38 G4LeptonConstructor::ConstructParticle();
39 G4Gamma::Gamma();
40 G4OpticalPhoton::OpticalPhotonDefinition();
41}
42
44{
45 if (Activated())
46 {return;}
47
48 G4SynchrotronRadiation* synchrotron = new G4SynchrotronRadiation();
49 G4AutoDelete::Register(synchrotron);
50
51 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
52
53#if G4VERSION_NUMBER > 1029
54 auto aParticleIterator = GetParticleIterator();
55#endif
56 aParticleIterator->reset();
57 while( (*aParticleIterator)() )
58 {
59 G4ParticleDefinition* particle = aParticleIterator->value();
60 // add to charged particles
61 if (particle->GetPDGCharge() != 0)
62 {ph->RegisterProcess(synchrotron, particle);}
63 }
64
66}
67
68
virtual void ConstructProcess()
Construct and attach G4SynchrotronRadiation to all charged particles.
virtual void ConstructParticle()
Construct all leptons and the photon.
G4bool Activated() const
Get whether this instance has been activated.
void SetActivated()
Flag this instance as activated for later querying.