BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSFieldMagGradient.hh
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#ifndef BDSFIELDMAGGRADIENT_H
19#define BDSFIELDMAGGRADIENT_H
20
21#include "globals.hh"
22
23#include <vector>
24
25class BDSFieldMag;
27class BDSFieldMagSkew;
28
42{
43public:
46
48 BDSMagnetStrength* CalculateMultipoles(BDSFieldMag* BField, G4int order, G4double Brho=4);
49
51 G4double GetBy(BDSFieldMag* BField, G4double x, G4double y=0) const;
52
56 std::vector<G4double> PrepareValues(BDSFieldMag* field,
57 G4int order,
58 G4double centreX,
59 G4double h,
60 G4int& centreIndex) const;
61
65 std::vector<std::vector<G4double> > PrepareSkewValues(BDSFieldMag* field,
66 G4int order,
67 G4double centreX,
68 G4double h,
69 G4int& centreIndex) const;
70
74 G4double Derivative(const std::vector<G4double>& data,
75 const G4int order,
76 const G4int startIndex,
77 const G4double h) const;
78
79};
80
81#endif
Find multipole components of fieldmaps by numerical differentiation.
G4double Derivative(const std::vector< G4double > &data, const G4int order, const G4int startIndex, const G4double h) const
std::vector< G4double > PrepareValues(BDSFieldMag *field, G4int order, G4double centreX, G4double h, G4int &centreIndex) const
BDSMagnetStrength * CalculateMultipoles(BDSFieldMag *BField, G4int order, G4double Brho=4)
Find the Magnet strengths of a multipole field to nth order.
std::vector< std::vector< G4double > > PrepareSkewValues(BDSFieldMag *field, G4int order, G4double centreX, G4double h, G4int &centreIndex) const
G4double GetBy(BDSFieldMag *BField, G4double x, G4double y=0) const
Query a point on x axis (by default) for By.
A wrapper class for BDSFieldMag that rotates it.
Interface for static magnetic fields that may or may not be local.
Efficient storage of magnet strengths.