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) 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 BDSMAGNET_H
20#define BDSMAGNET_H
21
22#include "globals.hh"
23#include "BDSAcceleratorComponent.hh"
24#include "BDSFieldInfo.hh"
25#include "BDSMagnetType.hh"
26
27class BDSBeamPipe;
28class BDSBeamPipeInfo;
29class BDSMagnetOuter;
32
45{
46public:
50 const G4String& name,
51 G4double length,
54 BDSFieldInfo* vacuumFieldInfoIn,
55 G4double angle = 0,
56 BDSFieldInfo* outerFieldInfoIn = nullptr,
57 G4bool isThin = false);
58
59 virtual ~BDSMagnet();
60
61 inline const BDSMagnetStrength* MagnetStrength() const {return vacuumFieldInfo ? vacuumFieldInfo->MagnetStrength() : nullptr;}
62
64 void SetOuterField(BDSFieldInfo* outerFieldInfoIn);
65 void SetVacuumField(BDSFieldInfo* vacuumFieldInfoIn);
67
70 static G4String DetermineScalingKey(BDSMagnetType typeIn);
71
73 virtual void SetInputFaceNormal(const G4ThreeVector& input);
74 virtual void SetOutputFaceNormal(const G4ThreeVector& output);
76
78 virtual G4String Material() const;
79
81 virtual G4bool HasAField() const {return vacuumFieldInfo || outerFieldInfo;}
82
85
86protected:
88 BDSMagnet() = delete;
89
91 BDSMagnet& operator=(const BDSMagnet&) = delete;
92 BDSMagnet(BDSMagnet&) = delete;
94
98 virtual void Build();
99
102 virtual void BuildBeampipe();
103
105 virtual void BuildVacuumField();
106
110 virtual void BuildOuter();
111
113 virtual void BuildOuterField();
114
119 virtual void BuildContainerLogicalVolume();
120
123 virtual void PlaceComponents();
124
127
130
133
136
139
144
147
151
155 G4ThreeVector magnetOuterOffset;
156
159
163
165 G4bool isThin;
166};
167
168#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.
Definition: BDSBeamPipe.hh:45
All info required to build complete field of any type.
Definition: BDSFieldInfo.hh:66
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:45
virtual void SetOutputFaceNormal(const G4ThreeVector &output)
Update face normal and also to beam pipe and magnet outer.
Definition: BDSMagnet.cc:123
G4Transform3D beamPipePlacementTransform
Definition: BDSMagnet.hh:162
BDSFieldInfo * vacuumFieldInfo
Field information for vacuum field.
Definition: BDSMagnet.hh:132
G4bool isThin
Boolean to store if the element is thin - will have no geometry constructed.
Definition: BDSMagnet.hh:165
G4double horizontalWidth
For outer volume construction.
Definition: BDSMagnet.hh:146
BDSMagnetType magnetType
Magnet type.
Definition: BDSMagnet.hh:126
BDSMagnetOuterInfo * magnetOuterInfo
Model information for the outer volume construction.
Definition: BDSMagnet.hh:129
virtual void SetFieldUsePlacementWorldTransform()
Override function as we have different field recipe objects.
Definition: BDSMagnet.cc:359
BDSBeamPipe * beampipe
The constructed beampipe.
Definition: BDSMagnet.hh:138
virtual void BuildBeampipe()
Definition: BDSMagnet.cc:151
virtual void BuildVacuumField()
Construct the field for the vacuum and attach it.
Definition: BDSMagnet.cc:169
G4bool placeBeamPipe
Definition: BDSMagnet.hh:143
virtual void BuildContainerLogicalVolume()
Definition: BDSMagnet.cc:277
BDSFieldInfo * outerFieldInfo
Field information for outer magnetic field (optional)
Definition: BDSMagnet.hh:135
BDSMagnet()=delete
Private default constructor to force the use of the supplied one.
virtual void Build()
Definition: BDSMagnet.cc:137
virtual G4bool HasAField() const
Override for a magnet - test on either field definition.
Definition: BDSMagnet.hh:81
BDSMagnetOuter * outer
The assembled outer magnet geometry.
Definition: BDSMagnet.hh:158
virtual G4String Material() const
Accessor to outer material if it exists.
Definition: BDSMagnet.cc:129
virtual void BuildOuter()
Definition: BDSMagnet.cc:194
static G4String DetermineScalingKey(BDSMagnetType typeIn)
Definition: BDSMagnet.cc:91
G4ThreeVector magnetOuterOffset
Definition: BDSMagnet.hh:155
void SetOuterField(BDSFieldInfo *outerFieldInfoIn)
@ { Delete existing field info and replace.
Definition: BDSMagnet.cc:340
virtual void SetInputFaceNormal(const G4ThreeVector &input)
Update face normal and also to beam pipe and magnet outer.
Definition: BDSMagnet.cc:117
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:231
G4double containerRadius
Definition: BDSMagnet.hh:150
virtual void PlaceComponents()
Definition: BDSMagnet.cc:303
BDSMagnet & operator=(const BDSMagnet &)=delete
Assignment and copy constructor not implemented nor used.