BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSUserTrackInformation.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 "BDSElectronOccupancy.hh"
20#include "BDSPolarizationState.hh"
21
22#include "BDSUserTrackInformation.hh"
23#include "BDSParser.hh"
24
25#include "globals.hh"
26#include "G4DynamicParticle.hh"
27
28BDSUserTrackInformation::BDSUserTrackInformation(const G4DynamicParticle* particle):
29 G4VUserTrackInformation("BDSUserTrackInformation"),
30 electronOccupancy(nullptr),
31 polarizationState(nullptr)
32{
33 auto beamDefinition = BDSParser::Instance()->GetBeam();
34
35 polarizationState = new BDSPolarizationState(beamDefinition);
36
37 if(particle->GetTotalOccupancy()>0)
38 {
39 totalElectrons = particle->GetTotalOccupancy();
40 if(totalElectrons <= 2)
41 {
42 electronOccupancy = new BDSElectronOccupancy(1);
43 electronOccupancy->SetTotalElectrons(totalElectrons);
44 electronOccupancy->PopulateLevels();
45 }
46 else if (totalElectrons <= 10)
47 {
48 electronOccupancy = new BDSElectronOccupancy(2);
49 electronOccupancy->SetTotalElectrons(totalElectrons);
50 electronOccupancy->PopulateLevels();
51 }
52 else if (totalElectrons <= 30)
53 {
54 electronOccupancy = new BDSElectronOccupancy(3);
55 electronOccupancy->SetTotalElectrons(totalElectrons);
56 electronOccupancy->PopulateLevels();
57 }
58 else if (totalElectrons <= 64)
59 {
60 electronOccupancy = new BDSElectronOccupancy(4);
61 electronOccupancy->SetTotalElectrons(totalElectrons);
62 electronOccupancy->PopulateLevels();
63 }
64 else
65 {
66 electronOccupancy = new BDSElectronOccupancy(7);
67 electronOccupancy->SetTotalElectrons(totalElectrons);
68 electronOccupancy->PopulateLevels();
69 }
70 }
71 comptonScattered=false;
72}
73
74
75BDSUserTrackInformation::~BDSUserTrackInformation()
76{;}
77
78BDSPolarizationState* BDSUserTrackInformation::GetPolarizationState()
79{
80 return polarizationState;
81}
82
83
84BDSElectronOccupancy* BDSUserTrackInformation::GetElectronOccupancy()
85{
86 return electronOccupancy;
87}
Electron Occupancy for more than just n quantum number.
static BDSParser * Instance()
Access method.
Definition BDSParser.cc:30
const GMAD::Beam & GetBeam() const
Return beam.
Definition BDSParser.hh:57
Polarization state to pass to processes.