BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSFieldBuilder.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
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#ifndef BDSFIELDBUILDER_H
20#define BDSFIELDBUILDER_H
21
22#include "globals.hh" //G4 global constants & types
23
24#include <map>
25#include <set>
26#include <vector>
27
28class BDSFieldInfo;
29class BDSFieldObjects;
31class G4LogicalVolume;
32
48{
49public:
51 static BDSFieldBuilder* Instance();
52
54
60 G4LogicalVolume* logicalVolume,
61 const G4bool propagateToDaughters = false,
62 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
63 const G4String& scalingKey = "none");
64
67 const std::vector<G4LogicalVolume*>& logicalVolumes,
68 const G4bool propagateToDaughters = false,
69 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
70 const G4String& scalingKey = "none");
71
74 const std::set<G4LogicalVolume*>& logicalVolumes,
75 const G4bool propagateToDaughters = false,
76 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
77 const G4String& scalingKey = "none");
78
79 std::vector<BDSFieldObjects*> CreateAndAttachAll();
80
81private:
84
87
89 std::vector<const BDSFieldInfo*> infos;
90 std::vector<std::vector<G4LogicalVolume*> > lvs;
91 std::vector<G4bool> propagators;
93
95 std::map<G4int, const BDSMagnetStrength*> scalingStrengths;
96 std::map<G4int, G4String> scalingKeys;
98};
99
100#endif
Register for all fields to be built and volumes to be attached to.
std::map< G4int, G4String > scalingKeys
Optional register of scaling strengths and keys.
std::vector< const BDSFieldInfo * > infos
Register of components to build.
std::map< G4int, const BDSMagnetStrength * > scalingStrengths
Optional register of scaling strengths and keys.
std::vector< G4bool > propagators
Register of components to build.
void RegisterFieldForConstruction(const BDSFieldInfo *info, G4LogicalVolume *logicalVolume, const G4bool propagateToDaughters=false, const BDSMagnetStrength *magnetStrengthForScaling=nullptr, const G4String &scalingKey="none")
std::vector< std::vector< G4LogicalVolume * > > lvs
Register of components to build.
static BDSFieldBuilder * instance
Singleton instance.
BDSFieldBuilder()
Private default constructor to enforce singleton pattern.
static BDSFieldBuilder * Instance()
Singleton pattern accessor.
All info required to build complete field of any type.
Definition: BDSFieldInfo.hh:66
A holder for all the Geant4 field related objects.
Efficient storage of magnet strengths.