BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSMagnet.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 BDSMAGNET_H
19#define BDSMAGNET_H
20
21#include "globals.hh"
22#include "BDSAcceleratorComponent.hh"
23#include "BDSFieldInfo.hh"
24#include "BDSMagnetType.hh"
25
26class BDSBeamPipe;
27class BDSBeamPipeInfo;
28class BDSMagnetOuter;
31
44{
45public:
49 const G4String& name,
50 G4double length,
53 BDSFieldInfo* vacuumFieldInfoIn,
54 G4double angle = 0,
55 BDSFieldInfo* outerFieldInfoIn = nullptr,
56 G4bool isThin = false);
57
58 virtual ~BDSMagnet();
59
60 inline const BDSMagnetStrength* MagnetStrength() const {return vacuumFieldInfo ? vacuumFieldInfo->MagnetStrength() : nullptr;}
61
63 void SetOuterField(BDSFieldInfo* outerFieldInfoIn);
64 void SetVacuumField(BDSFieldInfo* vacuumFieldInfoIn);
66
69 static G4String DetermineScalingKey(BDSMagnetType typeIn);
70
72 virtual void SetInputFaceNormal(const G4ThreeVector& input);
73 virtual void SetOutputFaceNormal(const G4ThreeVector& output);
75
77 virtual G4String Material() const;
78
80 virtual G4bool HasAField() const {return vacuumFieldInfo || outerFieldInfo;}
81
84
85protected:
87 BDSMagnet() = delete;
88
90 BDSMagnet& operator=(const BDSMagnet&) = delete;
91 BDSMagnet(BDSMagnet&) = delete;
93
97 virtual void Build();
98
101 virtual void BuildBeampipe();
102
104 virtual void BuildVacuumField();
105
109 virtual void BuildOuter();
110
112 virtual void BuildOuterField();
113
118 virtual void BuildContainerLogicalVolume();
119
122 virtual void PlaceComponents();
123
126
129
132
135
138
143
146
150
154 G4ThreeVector magnetOuterOffset;
155
158
162
164 G4bool isThin;
165};
166
167#endif
Abstract class that represents a component of an accelerator.
const G4String name
Const protected member variable that may not be changed by derived classes.
const G4String type
Const protected member variable that may not be changed by derived classes.
G4double angle
Protected member variable that can be modified by derived classes.
BDSBeamPipeInfo * beamPipeInfo
Optional beam pipe recipe that is written out to the survey if it exists.
Holder class for all information required to describe a beam pipe model.
A holder class for a piece of beam pipe geometry.
All info required to build complete field of any type.
BDSMagnetStrength * MagnetStrength() const
Accessor.
Holder struct of all information required to create the outer geometry of a magnet.
An object for both the returned magnet outer body but also a tight fitting container for the whole ma...
Efficient storage of magnet strengths.
Abstract base class that implements features common to all magnets.
Definition BDSMagnet.hh:44
virtual void SetOutputFaceNormal(const G4ThreeVector &output)
Update face normal and also to beam pipe and magnet outer.
Definition BDSMagnet.cc:122
G4Transform3D beamPipePlacementTransform
Definition BDSMagnet.hh:161
BDSFieldInfo * vacuumFieldInfo
Field information for vacuum field.
Definition BDSMagnet.hh:131
G4bool isThin
Boolean to store if the element is thin - will have no geometry constructed.
Definition BDSMagnet.hh:164
G4double horizontalWidth
For outer volume construction.
Definition BDSMagnet.hh:145
BDSMagnetType magnetType
Magnet type.
Definition BDSMagnet.hh:125
BDSMagnetOuterInfo * magnetOuterInfo
Model information for the outer volume construction.
Definition BDSMagnet.hh:128
virtual void SetFieldUsePlacementWorldTransform()
Override function as we have different field recipe objects.
Definition BDSMagnet.cc:363
BDSBeamPipe * beampipe
The constructed beampipe.
Definition BDSMagnet.hh:137
virtual void BuildBeampipe()
Definition BDSMagnet.cc:150
virtual void BuildVacuumField()
Construct the field for the vacuum and attach it.
Definition BDSMagnet.cc:168
G4bool placeBeamPipe
Definition BDSMagnet.hh:142
virtual void BuildContainerLogicalVolume()
Definition BDSMagnet.cc:281
BDSFieldInfo * outerFieldInfo
Field information for outer magnetic field (optional)
Definition BDSMagnet.hh:134
BDSMagnet()=delete
Private default constructor to force the use of the supplied one.
virtual void Build()
Definition BDSMagnet.cc:136
virtual G4bool HasAField() const
Override for a magnet - test on either field definition.
Definition BDSMagnet.hh:80
BDSMagnetOuter * outer
The assembled outer magnet geometry.
Definition BDSMagnet.hh:157
virtual G4String Material() const
Accessor to outer material if it exists.
Definition BDSMagnet.cc:128
virtual void BuildOuter()
Definition BDSMagnet.cc:193
static G4String DetermineScalingKey(BDSMagnetType typeIn)
Definition BDSMagnet.cc:90
G4ThreeVector magnetOuterOffset
Definition BDSMagnet.hh:154
void SetOuterField(BDSFieldInfo *outerFieldInfoIn)
@ { Delete existing field info and replace.
Definition BDSMagnet.cc:344
virtual void SetInputFaceNormal(const G4ThreeVector &input)
Update face normal and also to beam pipe and magnet outer.
Definition BDSMagnet.cc:116
BDSMagnet(BDSMagnet &)=delete
Assignment and copy constructor not implemented nor used.
virtual void BuildOuterField()
Construct the magnetic field for the outer magnet geometry.
Definition BDSMagnet.cc:230
G4double containerRadius
Definition BDSMagnet.hh:149
virtual void PlaceComponents()
Definition BDSMagnet.cc:307
BDSMagnet & operator=(const BDSMagnet &)=delete
Assignment and copy constructor not implemented nor used.