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) 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 "BDSDebug.hh"
19#include "BDSException.hh"
20#include "BDSFieldGaborLens.hh"
21#include "BDSMagnetStrength.hh"
22#include "BDSUtilities.hh"
23
24#include "CLHEP/Units/PhysicalConstants.h"
25#include "globals.hh"
26#include "G4ThreeVector.hh"
27
28#include "TMath.h"
29
30#include <cmath>
31#include <utility>
32
33
35plasmaEfield((*strength)["plasmaEfield"]),
36anodeRadius((*strength)["equatorradius"])
37{}
38
39std::pair<G4ThreeVector, G4ThreeVector> BDSFieldGaborLens::GetField(const G4ThreeVector& position,
40 const G4double /*t*/) const
41{
42 G4double Ex = plasmaEfield * position.x();
43 G4double Ey = plasmaEfield * position.y();
44
45 G4ThreeVector plasmaE = G4ThreeVector(0, 0, 0);
46
47 G4TwoVector transPos = G4TwoVector(position.getX(), position.getY());
48 if (transPos.mag() < anodeRadius) // no plasma field outside of anode radius
49 {plasmaE = G4ThreeVector(Ex, Ey, 0);}
50
51 // TODO: Add local B and E plasma confinement fields:
52 G4ThreeVector LocalB = G4ThreeVector(0, 0, 0);
53 G4ThreeVector LocalE = G4ThreeVector(0, 0, 0);
54
55 LocalE += plasmaE;
56
57 return std::make_pair(LocalB, LocalE);;
58}
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.