BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSElectronQuantumLevel.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 "BDSElectronQuantumLevel.hh"
20
21#include "G4Types.hh"
22
23#include "CLHEP/Units/PhysicalConstants.h"
24#include "CLHEP/Units/SystemOfUnits.h"
25
26BDSElectronQuantumLevel::BDSElectronQuantumLevel(G4int nPrincipleNumberIn,
27 G4int lAngularNumberIn,
28 G4double jSpinOrbitCouplingIn):
29 nPrincipleNumber(nPrincipleNumberIn),
30 lAngularNumber(lAngularNumberIn),
31 jSpinOrbitCoupling(jSpinOrbitCouplingIn),
32 maxOccupancy(0),
33 currentOccupancy(0),
34 excitedLifetime(0),
35 timeOfExcitement(0)
36{
37 maxOccupancy=(jSpinOrbitCoupling*2)+1;
38 levelEnergy=DiracEnergyNJ(nPrincipleNumberIn,jSpinOrbitCouplingIn);
39}
40
41BDSElectronQuantumLevel::~BDSElectronQuantumLevel()
42{;}
43
44G4double BDSElectronQuantumLevel::DiracEnergyNJ(G4int n, G4int j)
45{
46 G4double a = CLHEP::fine_structure_const;
47 G4double c = CLHEP::c_light;
48 return ((c*c*a*a)/(n*n))*(1+((a*a)/(n*n))*((n/(j+0.5))+0.75));
49}
50
51void BDSElectronQuantumLevel::AddElectrons(G4int number)
52{
53 if(maxOccupancy - currentOccupancy >= number)
54 {currentOccupancy +=number;}
55 //else{error}
56}
57
58
59void BDSElectronQuantumLevel::RemoveElectrons(G4int number)
60{
61 if (currentOccupancy >= number)
62 {currentOccupancy = currentOccupancy - number;}
63 //else error
64}