BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSFieldEMVectorSum.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 BDSFIELDEMVECTORSUM_H
19#define BDSFIELDEMVECTORSUM_H
20
21#include "BDSFieldEM.hh"
22
23#include "G4ThreeVector.hh"
24#include "G4Types.hh"
25
26#include <utility>
27#include <vector>
28
36{
37public:
38 BDSFieldEMVectorSum() ;// = delete; RK - check this
39 explicit BDSFieldEMVectorSum(const std::vector<BDSFieldEM*>& fieldsIn,
40 const std::vector<G4ThreeVector>& fieldOffsetsIn,
41 const std::vector<double>& timeOffsetsIn,
42 const std::vector<double>& zLengthsIn);
43 virtual ~BDSFieldEMVectorSum();
44
45 virtual void PushBackField(const G4ThreeVector& positionOffset,
46 double timeOffset,
47 double zLength,
48 BDSFieldEM* emfield);
50 virtual std::pair<G4ThreeVector,G4ThreeVector> GetField(const G4ThreeVector& position,
51 const G4double t = 0) const;
52
53private:
54 std::vector<BDSFieldEM*> fields;
55 std::vector<G4ThreeVector> fieldOffsets;
56 std::vector<G4double> timeOffsets;
57 std::vector<double> zLengthsOver2; // store half lengths to save a flop at lookup time
58
59};
60
61#endif
A vector sum of multiple displaced EM fields.
virtual std::pair< G4ThreeVector, G4ThreeVector > GetField(const G4ThreeVector &position, const G4double t=0) const
Calculate the field value.
Interface for BDSIM electro-magnetic fields that may or may not be local.
Definition BDSFieldEM.hh:40