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) 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 BDSMAGNETOUTERFACTORYBASE_H
20#define BDSMAGNETOUTERFACTORYBASE_H
21
22#include "BDSExtent.hh"
23#include "BDSFactoryBase.hh"
24#include "BDSMagnetOuter.hh"
25
26#include "globals.hh" // geant4 globals / types
27
28#include <set>
29#include <vector>
30
31class BDSBeamPipe;
34
35class G4Colour;
36class G4Material;
37class G4UserLimits;
38class G4VisAttributes;
39class G4VPhysicalVolume;
40class G4VSolid;
41
66{
67public:
69 virtual BDSMagnetOuter* CreateSectorBend(G4String name, // name
70 G4double length, // full length [mm]
71 const BDSBeamPipe* beamPipe, // beampipe
72 G4double containerLength, // full length to make AccComp container
73 const BDSMagnetOuterInfo* recipe // recipe for geometry
74 ) = 0;
75
77 virtual BDSMagnetOuter* CreateRectangularBend(G4String name, // name
78 G4double length, // full length [mm]
79 const BDSBeamPipe* beamPipe, // beampipe
80 G4double containerLength, // full length to make AccComp container
81 const BDSMagnetOuterInfo* recipe // recipe for geometry
82 ) = 0;
83
85 virtual BDSMagnetOuter* CreateQuadrupole(G4String name, // name
86 G4double length, // length
87 BDSBeamPipe* beamPipe, // beampipe
88 G4double containerLength, // full length to make AccComp container
89 const BDSMagnetOuterInfo* recipe // recipe for geometry
90 ) = 0;
91
92
94 virtual BDSMagnetOuter* CreateSextupole(G4String name, // name
95 G4double length, // length
96 BDSBeamPipe* beamPipe, // beampipe
97 G4double containerLength, // full length to make AccComp container
98 const BDSMagnetOuterInfo* recipe // recipe for geometry
99 ) = 0;
100
102 virtual BDSMagnetOuter* CreateOctupole(G4String name, // name
103 G4double length, // length
104 BDSBeamPipe* beamPipe, // beampipe
105 G4double containerLength, // full length to make AccComp container
106 const BDSMagnetOuterInfo* recipe // recipe for geometry
107 ) = 0;
108
110 virtual BDSMagnetOuter* CreateDecapole(G4String name, // name
111 G4double length, // length
112 BDSBeamPipe* beamPipe, // beampipe
113 G4double containerLength, // full length to make AccComp container
114 const BDSMagnetOuterInfo* recipe // recipe for geometry
115 ) = 0;
116
118 virtual BDSMagnetOuter* CreateSolenoid(G4String name, // name
119 G4double length, // length
120 BDSBeamPipe* beamPipe, // beampipe
121 G4double containerLength, // full length to make AccComp container
122 const BDSMagnetOuterInfo* recipe // recipe for geometry
123 ) = 0;
124
126 virtual BDSMagnetOuter* CreateMultipole(G4String name, // name
127 G4double length, // length
128 BDSBeamPipe* beamPipe, // beampipe
129 G4double containerLength, // full length to make AccComp container
130 const BDSMagnetOuterInfo* recipe // recipe for geometry
131 ) = 0;
132
134 virtual BDSMagnetOuter* CreateRfCavity(G4String name, // name
135 G4double length, // length
136 BDSBeamPipe* beamPipe, // beampipe
137 G4double containerLength, // full length to make AccComp container
138 const BDSMagnetOuterInfo* recipe // recipe for geometry
139 ) = 0;
140
142 virtual BDSMagnetOuter* CreateMuonSpoiler(G4String name, // name
143 G4double length, // length
144 BDSBeamPipe* beamPipe, // beampipe
145 G4double containerLength, // full length to make AccComp container
146 const BDSMagnetOuterInfo* recipe // recipe for geometry
147 ) = 0;
148
150 virtual BDSMagnetOuter* CreateKicker(G4String name, // name
151 G4double length, // length [mm]
152 const BDSBeamPipe* beamPipe, // beampipe
153 G4double containerLength, // full length to make AccComp container
154 const BDSMagnetOuterInfo* recipe, // geometry recipe
155 G4bool vertical // is it a vertical kicker?
156 ) = 0;
157
159 virtual void CleanUp();
160
162 void CleanUpBase();
163
166
167protected:
169
172 virtual void CreateLogicalVolumes(const G4String& name,
173 G4Colour* colour,
174 G4Material* outerMaterial);
175
177 virtual void SetUserLimits();
178
181 void BuildMagnetContainerSolidAngled(const G4String& name,
182 G4double magnetContainerLength,
183 G4double magnetContainerRadius,
184 G4bool flatFaces = false);
185
188 void BuildMagnetContainerSolidStraight(const G4String& name,
189 G4double magnetContainerLength,
190 G4double magnetContainerRadius);
191
192 void CreateMagnetContainerComponent();
193
195 void SetFaceNormals(BDSMagnetOuter* outer);
196
200
201 // Geometric pointers that will be used to pass around components
202 // within the factory (as different parts factorised so they can
203 // be overridden by the derived classes.
204 G4VSolid* poleSolid;
205 G4VSolid* yokeSolid;
206 G4VSolid* containerSolid;
207 G4VSolid* magnetContainerSolid;
208 G4LogicalVolume* poleLV;
209 G4LogicalVolume* yokeLV;
210 G4LogicalVolume* containerLV;
211 G4LogicalVolume* magnetContainerLV;
212 G4VPhysicalVolume* yokePV;
213 G4VisAttributes* outerVisAttributes;
214
215 BDSExtent magContExtent;
216 BDSGeometryComponent* magnetContainer;
217
218 G4ThreeVector inputFaceNormal;
219 G4ThreeVector outputFaceNormal;
220};
221
222#endif
A holder class for a piece of beam pipe geometry.
Definition: BDSBeamPipe.hh:45
Holder for +- extents in 3 dimensions.
Definition: BDSExtent.hh:39
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...