BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSFieldGaborLens.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 "BDSDebug.hh"
20#include "BDSException.hh"
21#include "BDSFieldGaborLens.hh"
22#include "BDSMagnetStrength.hh"
23#include "BDSUtilities.hh"
24
25#include "CLHEP/Units/PhysicalConstants.h"
26#include "globals.hh"
27#include "G4ThreeVector.hh"
28
29#include "TMath.h"
30
31#include <cmath>
32#include <utility>
33
34
36plasmaEfield((*strength)["plasmaEfield"]),
37anodeRadius((*strength)["equatorradius"])
38{}
39
40std::pair<G4ThreeVector, G4ThreeVector> BDSFieldGaborLens::GetField(const G4ThreeVector& position,
41 const G4double /*t*/) const
42{
43 G4double Ex = plasmaEfield * position.x();
44 G4double Ey = plasmaEfield * position.y();
45
46 G4ThreeVector plasmaE = G4ThreeVector(0, 0, 0);
47
48 G4TwoVector transPos = G4TwoVector(position.getX(), position.getY());
49 if (transPos.mag() < anodeRadius) // no plasma field outside of anode radius
50 {plasmaE = G4ThreeVector(Ex, Ey, 0);}
51
52 // TODO: Add local B and E plasma confinement fields:
53 G4ThreeVector LocalB = G4ThreeVector(0, 0, 0);
54 G4ThreeVector LocalE = G4ThreeVector(0, 0, 0);
55
56 LocalE += plasmaE;
57
58 return std::make_pair(LocalB, LocalE);;
59}
G4double anodeRadius
anode radius
BDSFieldGaborLens()
Private constructor to force use of provided one.
virtual std::pair< G4ThreeVector, G4ThreeVector > GetField(const G4ThreeVector &position, const G4double t) const
Accessor to get B and E field.
G4double plasmaEfield
plasma e-field strength
Efficient storage of magnet strengths.