BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSIonExcitationEngine.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 "BDSIonExcitationEngine.hh"
19#include "BDSLaser.hh"
20
21#include "globals.hh"
22#include "G4LorentzVector.hh"
23#include "Randomize.hh"
24
25#include "CLHEP/Units/PhysicalConstants.h"
26#include "CLHEP/Units/SystemOfUnits.h"
27
28#include <cmath>
29
30BDSIonExcitationEngine::BDSIonExcitationEngine()
31{;}
32
33BDSIonExcitationEngine::~BDSIonExcitationEngine()
34{;}
35
36G4double BDSIonExcitationEngine::CrossSection(G4double photonEnergy)
37{
38 G4double degenerancyG1 = 2.0;
39 G4double degenerancyG2 = 2.0;
40 G4double wavelengthShift = (CLHEP::h_Planck*CLHEP::c_light)/photonEnergy;
41 // G4double cs=(wavelengthShift*wavelengthShift*degenerancyG2)/(CLHEP::twopi*degenerancyG1);
42 // hard coded as mm for now but need to consider how to get this for each beam
43 return (wavelengthShift*wavelengthShift*degenerancyG2)/(CLHEP::twopi*degenerancyG1);
44}
45
46void BDSIonExcitationEngine::PhotonAbsorption(G4ThreeVector boost)
47{
48 // modify ion momentum for gamma absorption in ion rest frame
49 scatteredIonAbsorbed.setPx(incomingGamma.px());
50 scatteredIonAbsorbed.setPy(incomingGamma.py());
51 scatteredIonAbsorbed.setPz(incomingGamma.pz());
52 scatteredIonAbsorbed.setE(incomingGamma.e()+incomingIon.e());
53
54 //boost back to lab
55 scatteredIonAbsorbed.boost(boost);
56}
57
58void BDSIonExcitationEngine::PhotonEmission(G4ThreeVector boost)
59{
60 //random angles for direction of emitted gamma in rest frame of ion
61 G4double theta = G4UniformRand()*CLHEP::twopi;
62 //G4double phi = G4UniformRand()*CLHEP::twopi;
63 G4double V = G4UniformRand();
64 G4double phi = acos(2.0*V-1.0);
65 // emitted gamma energy = transition energy (no variation is exact to transition energy)
66 G4double emittedGammaEnergy = 230.16*CLHEP::eV;
67 // create vector for emitted gamma in ion rest frame
68 G4ThreeVector emittedGammaUnitVector;
69 //G4double sinTheta = std::sin(theta);
70 //G4double cosTheta = std::cos(theta);
71 //G4double sinPhi = std::sin(phi);
72 //G4double cosPhi = std::cos(phi);
73 //emittedGammaUnitVector.set(sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
74 G4double z = cos(phi);
75 G4double x = std::sqrt(1-z*z)*cos(theta);
76 G4double y = std::sqrt(1-z*z)*sin(theta);
77 emittedGammaUnitVector.set(x,y,z);
78 //set lorentz vector
79 emittedGamma.setPx(emittedGammaUnitVector.x()*emittedGammaEnergy);
80 emittedGamma.setPy(emittedGammaUnitVector.y()*emittedGammaEnergy);
81 emittedGamma.setPz(emittedGammaUnitVector.z()*emittedGammaEnergy);
82 emittedGamma.setE(emittedGammaEnergy);
83
84 // modify the ions momentum and energy for correct kinematics
85 scatteredIonEmission.setPx(incomingIon.px()-emittedGamma.px());
86 scatteredIonEmission.setPy(incomingIon.py()-emittedGamma.py());
87 scatteredIonEmission.setPz(incomingIon.pz()-emittedGamma.pz());
88 scatteredIonEmission.setE(incomingIon.e()-emittedGammaEnergy);
89
90 // boost both lorentz vectors into lab frame
91 emittedGamma.boost(boost);
92 scatteredIonEmission.boost(boost);
93
94}