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) 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 BDSFIELDBUILDER_H
19#define BDSFIELDBUILDER_H
20
21#include "globals.hh" //G4 global constants & types
22
23#include <map>
24#include <set>
25#include <vector>
26
27class BDSFieldInfo;
28class BDSFieldObjects;
30class G4LogicalVolume;
31
47{
48public:
50 static BDSFieldBuilder* Instance();
51
53
59 G4LogicalVolume* logicalVolume,
60 const G4bool propagateToDaughters = false,
61 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
62 const G4String& scalingKey = "none");
63
66 const std::vector<G4LogicalVolume*>& logicalVolumes,
67 const G4bool propagateToDaughters = false,
68 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
69 const G4String& scalingKey = "none");
70
73 const std::set<G4LogicalVolume*>& logicalVolumes,
74 const G4bool propagateToDaughters = false,
75 const BDSMagnetStrength* magnetStrengthForScaling = nullptr,
76 const G4String& scalingKey = "none");
77
78 std::vector<BDSFieldObjects*> CreateAndAttachAll();
79
80private:
83
86
88 std::vector<const BDSFieldInfo*> infos;
89 std::vector<std::vector<G4LogicalVolume*> > lvs;
90 std::vector<G4bool> propagators;
92
94 std::map<G4int, const BDSMagnetStrength*> scalingStrengths;
95 std::map<G4int, G4String> scalingKeys;
97};
98
99#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.
A holder for all the Geant4 field related objects.
Efficient storage of magnet strengths.