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