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) 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 "BDSElectronQuantumLevel.hh"
19
20#include "CLHEP/Units/PhysicalConstants.h"
21#include "CLHEP/Units/SystemOfUnits.h"
22
23
24BDSElectronQuantumLevel::BDSElectronQuantumLevel(G4int nPrincipleNumberIn,
25 G4int lAngularNumberIn,
26 G4double jSpinOrbitCouplingIn):
27 nPrincipleNumber(nPrincipleNumberIn),
28 lAngularNumber(lAngularNumberIn),
29 jSpinOrbitCoupling(jSpinOrbitCouplingIn),
30 maxOccupancy(0),
31 currentOccupancy(0),
32 excitedLifetime(0),
33 timeOfExcitement(0)
34{
35 maxOccupancy = ((G4int)jSpinOrbitCoupling*2)+1;
36 levelEnergy = DiracEnergyNJ(nPrincipleNumberIn, (G4int)jSpinOrbitCouplingIn);
37}
38
39G4double BDSElectronQuantumLevel::DiracEnergyNJ(G4int n, G4int j) const
40{
41 G4double a = CLHEP::fine_structure_const;
42 G4double c = CLHEP::c_light;
43 return ((c*c*a*a)/(n*n))*(1+((a*a)/(n*n))*((n/(j+0.5))+0.75));
44}
45
46void BDSElectronQuantumLevel::AddElectrons(G4int number)
47{
48 if (maxOccupancy - currentOccupancy >= number)
49 {currentOccupancy +=number;}
50 //else{error}
51}
52
53
54void BDSElectronQuantumLevel::RemoveElectrons(G4int number)
55{
56 if (currentOccupancy >= number)
57 {currentOccupancy = currentOccupancy - number;}
58 //else error
59}