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) 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 "BDSElectronOccupancy.hh"
19#include "BDSPolarizationState.hh"
20
21#include "BDSUserTrackInformation.hh"
22
23#include "G4DynamicParticle.hh"
24
25
26BDSUserTrackInformation::BDSUserTrackInformation(const G4DynamicParticle* particle,
27 const BDSPolarizationState* defaultPolarizationStateIn):
28 G4VUserTrackInformation("BDSUserTrackInformation"),
29 electronOccupancy(nullptr),
30 polarizationState(nullptr)
31{
32 if (defaultPolarizationStateIn)
33 {polarizationState = new BDSPolarizationState(*defaultPolarizationStateIn);}
34 else
35 {polarizationState = new BDSPolarizationState();}
36
37 // copy the default polarization state for this track so it can be updated as it propagates
38 if (particle->GetTotalOccupancy() > 0)
39 {
40 totalElectrons = particle->GetTotalOccupancy();
41 if (totalElectrons <= 2)
42 {
43 electronOccupancy = new BDSElectronOccupancy(1);
44 electronOccupancy->SetTotalElectrons(totalElectrons);
45 electronOccupancy->PopulateLevels();
46 }
47 else if (totalElectrons <= 10)
48 {
49 electronOccupancy = new BDSElectronOccupancy(2);
50 electronOccupancy->SetTotalElectrons(totalElectrons);
51 electronOccupancy->PopulateLevels();
52 }
53 else if (totalElectrons <= 30)
54 {
55 electronOccupancy = new BDSElectronOccupancy(3);
56 electronOccupancy->SetTotalElectrons(totalElectrons);
57 electronOccupancy->PopulateLevels();
58 }
59 else if (totalElectrons <= 64)
60 {
61 electronOccupancy = new BDSElectronOccupancy(4);
62 electronOccupancy->SetTotalElectrons(totalElectrons);
63 electronOccupancy->PopulateLevels();
64 }
65 else
66 {
67 electronOccupancy = new BDSElectronOccupancy(7);
68 electronOccupancy->SetTotalElectrons(totalElectrons);
69 electronOccupancy->PopulateLevels();
70 }
71 }
72 comptonScattered = false;
73}
74
75BDSUserTrackInformation::~BDSUserTrackInformation()
76{
77 delete electronOccupancy;
78 delete polarizationState;
79}
80
81BDSPolarizationState* BDSUserTrackInformation::GetPolarizationState()
82{
83 return polarizationState;
84}
85
86BDSElectronOccupancy* BDSUserTrackInformation::GetElectronOccupancy()
87{
88 return electronOccupancy;
89}
Electron Occupancy for more than just n quantum number.
Polarization state to pass to processes.