BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSMagnetOuterFactoryBase.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 BDSMAGNETOUTERFACTORYBASE_H
19#define BDSMAGNETOUTERFACTORYBASE_H
20
21#include "BDSExtent.hh"
22#include "BDSFactoryBase.hh"
23#include "BDSMagnetOuter.hh"
24
25#include "globals.hh" // geant4 globals / types
26
27#include <set>
28#include <vector>
29
30class BDSBeamPipe;
33
34class G4Colour;
35class G4Material;
36class G4UserLimits;
37class G4VisAttributes;
38class G4VPhysicalVolume;
39class G4VSolid;
40
65{
66public:
68 virtual BDSMagnetOuter* CreateSectorBend(G4String name, // name
69 G4double length, // full length [mm]
70 const BDSBeamPipe* beamPipe, // beampipe
71 G4double containerLength, // full length to make AccComp container
72 const BDSMagnetOuterInfo* recipe // recipe for geometry
73 ) = 0;
74
76 virtual BDSMagnetOuter* CreateRectangularBend(G4String name, // name
77 G4double length, // full length [mm]
78 const BDSBeamPipe* beamPipe, // beampipe
79 G4double containerLength, // full length to make AccComp container
80 const BDSMagnetOuterInfo* recipe // recipe for geometry
81 ) = 0;
82
84 virtual BDSMagnetOuter* CreateQuadrupole(G4String name, // name
85 G4double length, // length
86 BDSBeamPipe* beamPipe, // beampipe
87 G4double containerLength, // full length to make AccComp container
88 const BDSMagnetOuterInfo* recipe // recipe for geometry
89 ) = 0;
90
91
93 virtual BDSMagnetOuter* CreateSextupole(G4String name, // name
94 G4double length, // length
95 BDSBeamPipe* beamPipe, // beampipe
96 G4double containerLength, // full length to make AccComp container
97 const BDSMagnetOuterInfo* recipe // recipe for geometry
98 ) = 0;
99
101 virtual BDSMagnetOuter* CreateOctupole(G4String name, // name
102 G4double length, // length
103 BDSBeamPipe* beamPipe, // beampipe
104 G4double containerLength, // full length to make AccComp container
105 const BDSMagnetOuterInfo* recipe // recipe for geometry
106 ) = 0;
107
109 virtual BDSMagnetOuter* CreateDecapole(G4String name, // name
110 G4double length, // length
111 BDSBeamPipe* beamPipe, // beampipe
112 G4double containerLength, // full length to make AccComp container
113 const BDSMagnetOuterInfo* recipe // recipe for geometry
114 ) = 0;
115
117 virtual BDSMagnetOuter* CreateSolenoid(G4String name, // name
118 G4double length, // length
119 BDSBeamPipe* beamPipe, // beampipe
120 G4double containerLength, // full length to make AccComp container
121 const BDSMagnetOuterInfo* recipe // recipe for geometry
122 ) = 0;
123
125 virtual BDSMagnetOuter* CreateMultipole(G4String name, // name
126 G4double length, // length
127 BDSBeamPipe* beamPipe, // beampipe
128 G4double containerLength, // full length to make AccComp container
129 const BDSMagnetOuterInfo* recipe // recipe for geometry
130 ) = 0;
131
133 virtual BDSMagnetOuter* CreateRfCavity(G4String name, // name
134 G4double length, // length
135 BDSBeamPipe* beamPipe, // beampipe
136 G4double containerLength, // full length to make AccComp container
137 const BDSMagnetOuterInfo* recipe // recipe for geometry
138 ) = 0;
139
141 virtual BDSMagnetOuter* CreateMuonSpoiler(G4String name, // name
142 G4double length, // length
143 BDSBeamPipe* beamPipe, // beampipe
144 G4double containerLength, // full length to make AccComp container
145 const BDSMagnetOuterInfo* recipe // recipe for geometry
146 ) = 0;
147
149 virtual BDSMagnetOuter* CreateKicker(G4String name, // name
150 G4double length, // length [mm]
151 const BDSBeamPipe* beamPipe, // beampipe
152 G4double containerLength, // full length to make AccComp container
153 const BDSMagnetOuterInfo* recipe, // geometry recipe
154 G4bool vertical // is it a vertical kicker?
155 ) = 0;
156
158 virtual void CleanUp();
159
161 void CleanUpBase();
162
165
166protected:
168
171 virtual void CreateLogicalVolumes(const G4String& name,
172 G4Colour* colour,
173 G4Material* outerMaterial);
174
176 virtual void SetUserLimits();
177
180 void BuildMagnetContainerSolidAngled(const G4String& name,
181 G4double magnetContainerLength,
182 G4double magnetContainerRadius,
183 G4bool flatFaces = false);
184
187 void BuildMagnetContainerSolidStraight(const G4String& name,
188 G4double magnetContainerLength,
189 G4double magnetContainerRadius);
190
191 void CreateMagnetContainerComponent();
192
194 void SetFaceNormals(BDSMagnetOuter* outer);
195
199
200 // Geometric pointers that will be used to pass around components
201 // within the factory (as different parts factorised so they can
202 // be overridden by the derived classes.
203 G4VSolid* poleSolid;
204 G4VSolid* yokeSolid;
205 G4VSolid* containerSolid;
206 G4VSolid* magnetContainerSolid;
207 G4LogicalVolume* poleLV;
208 G4LogicalVolume* yokeLV;
209 G4LogicalVolume* containerLV;
210 G4LogicalVolume* magnetContainerLV;
211 G4VPhysicalVolume* yokePV;
212 G4VisAttributes* outerVisAttributes;
213
214 BDSExtent magContExtent;
215 BDSGeometryComponent* magnetContainer;
216
217 G4ThreeVector inputFaceNormal;
218 G4ThreeVector outputFaceNormal;
219};
220
221#endif
A holder class for a piece of beam pipe geometry.
Holder for +- extents in 3 dimensions.
Definition BDSExtent.hh:38
Common temporary storage for all factories no matter what geometry.
A generic geometry component for a bdsim model.
Abstract base class for magnet outer volume factories.
virtual BDSMagnetOuter * CreateQuadrupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
quadrupole outer volume
virtual BDSMagnetOuter * CreateSolenoid(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
solenoid outer volume
virtual void CleanUp()
Empty containers for next use - factories are never deleted so can't rely on scope.
virtual void CreateLogicalVolumes(const G4String &name, G4Colour *colour, G4Material *outerMaterial)
void SetFaceNormals(BDSMagnetOuter *outer)
Copy face normals from members to an instance of outer.
virtual BDSMagnetOuter * CreateKicker(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe, G4bool vertical)=0
horizontal and vertical kicker outer volume
void CleanUpBase()
Non-virtual clean up that can be used in the constructor.
virtual BDSMagnetOuter * CreateRectangularBend(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
rectangular bend outer volume
virtual BDSMagnetOuter * CreateDecapole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
decapole outer volume
virtual BDSMagnetOuter * CreateSectorBend(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
sector bend outer volume
G4VSolid * poleSolid
Solid for an individual pole that will be placed multiple times.
virtual BDSMagnetOuter * CreateMuonSpoiler(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
muon spoiler outer volume
virtual ~BDSMagnetOuterFactoryBase()
Virtual base destructor.
virtual void SetUserLimits()
Attach default user limits to all logical volumes.
G4bool sensitiveOuter
Cache of global constants variable.
virtual BDSMagnetOuter * CreateMultipole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
general multipole outer volume - could be any 2N order multipole
G4VSolid * yokeSolid
Solid for outer part that connects all poles.
virtual BDSMagnetOuter * CreateOctupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
octupole outer volume
virtual BDSMagnetOuter * CreateRfCavity(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
RF cavity outer volume.
virtual BDSMagnetOuter * CreateSextupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)=0
sextupole outer volume
void BuildMagnetContainerSolidStraight(const G4String &name, G4double magnetContainerLength, G4double magnetContainerRadius)
void BuildMagnetContainerSolidAngled(const G4String &name, G4double magnetContainerLength, G4double magnetContainerRadius, G4bool flatFaces=false)
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...