BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSMagnetOuterFactoryPolesBase.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 BDSMAGNETOUTERFACTORYPOLESBASE_H
19#define BDSMAGNETOUTERFACTORYPOLESBASE_H
20
21#include "BDSMagnetOuter.hh"
22#include "BDSMagnetOuterFactoryBase.hh"
23
24#include "globals.hh" // geant4 globals / types
25#include "G4TwoVector.hh"
26
27#include <vector>
28
29class BDSBeamPipe;
31class G4Material;
32class G4VSolid;
33
49{
50public:
52 explicit BDSMagnetOuterFactoryPolesBase(G4double poleStopFactorIn);
54
56 virtual BDSMagnetOuter* CreateSectorBend(G4String name, // name
57 G4double length, // full length [mm]
58 const BDSBeamPipe* beamPipe, // beampipe
59 G4double containerLength, // full length to make AccComp container
60 const BDSMagnetOuterInfo* recipe); // recipe for geometry
61
63 virtual BDSMagnetOuter* CreateRectangularBend(G4String name, // name
64 G4double length, // full length [mm]
65 const BDSBeamPipe* beamPipe, // beampipe
66 G4double containerLength, // full length to make AccComp container
67 const BDSMagnetOuterInfo* recipe); // recipe for geometry
68
70 virtual BDSMagnetOuter* CreateQuadrupole(G4String name, // name
71 G4double length, // length [mm]
72 BDSBeamPipe* beamPipe, // beampipe
73 G4double containerLength, // full length to make AccComp container
74 const BDSMagnetOuterInfo* recipe); // geometry recipe
75
77 virtual BDSMagnetOuter* CreateSextupole(G4String name, // name
78 G4double length, // length [mm]
79 BDSBeamPipe* beamPipe, // beampipe
80 G4double containerLength, // full length to make AccComp container
81 const BDSMagnetOuterInfo* recipe); // geometry recipe
82
84 virtual BDSMagnetOuter* CreateOctupole(G4String name, // name
85 G4double length, // length [mm]
86 BDSBeamPipe* beamPipe, // beampipe
87 G4double containerLength, // full length to make AccComp container
88 const BDSMagnetOuterInfo* recipe); // geometry recipe
89
91 virtual BDSMagnetOuter* CreateDecapole(G4String name, // name
92 G4double length, // length
93 BDSBeamPipe* beamPipe, // beampipe
94 G4double containerLength, // full length to make AccComp container
95 const BDSMagnetOuterInfo* recipe); // geometry recipe
96
98 virtual BDSMagnetOuter* CreateSolenoid(G4String name, // name
99 G4double length, // length
100 BDSBeamPipe* beamPipe, // beampipe
101 G4double containerLength, // full length to make AccComp container
102 const BDSMagnetOuterInfo* recipe); // geometry recipe
103
105 virtual BDSMagnetOuter* CreateMultipole(G4String name, // name
106 G4double length, // length
107 BDSBeamPipe* beamPipe, // beampipe
108 G4double containerLength, // full length to make AccComp container
109 const BDSMagnetOuterInfo* recipe); // geometry recipe
110
112 virtual BDSMagnetOuter* CreateRfCavity(G4String name, // name
113 G4double length, // length
114 BDSBeamPipe* beamPipe, // beampipe
115 G4double containerLength, // full length to make AccComp container
116 const BDSMagnetOuterInfo* recipe); // geometry recipe
117
119 virtual BDSMagnetOuter* CreateMuonSpoiler(G4String name, // name
120 G4double length, // length
121 BDSBeamPipe* beamPipe, // beampipe
122 G4double containerLength, // full length to make AccComp container
123 const BDSMagnetOuterInfo* recipe); // geometry recipe
124
126 virtual BDSMagnetOuter* CreateKicker(G4String name, // name
127 G4double length, // length
128 const BDSBeamPipe* beamPipe, // beampipe
129 G4double containerLength, // full length to make AccComp container
130 const BDSMagnetOuterInfo* recipe, // geometry recipe
131 G4bool vertical); // is it a vertical kicker?
132
133protected:
134 // geometry parameters
137 const G4double poleFraction;
138
140 const G4double poleAngularFraction;
141
144 const G4double poleTipFraction;
145
148 const G4double poleAnnulusFraction;
149
153 const G4double bendHeightFraction;
154
158 const G4double poleStopFactor;
159
163 G4bool buildPole;
168 G4double segmentAngle;
169 G4double poleAngle;
170 G4ThreeVector poleTranslation;
171 G4double coilHeight;
173 G4double endPieceLength;
174 G4double endPieceInnerR;
175 G4double endPieceOuterR;
176
178 G4VSolid* coilLeftSolid;
179 G4VSolid* coilRightSolid;
181 G4LogicalVolume* coilLeftLV;
182 G4LogicalVolume* coilRightLV;
183 G4LogicalVolume* endPieceCoilLV;
184 G4LogicalVolume* endPieceContainerLV;
186
187 std::vector<G4TwoVector> leftPoints;
188 std::vector<G4TwoVector> rightPoints;
189 std::vector<G4TwoVector> endPiecePoints;
190
192 virtual void CleanUp();
193
195 void CleanUpPolesBase();
196
198 virtual BDSMagnetOuter* CommonConstructor(const G4String& name,
199 G4double length,
200 BDSBeamPipe* beamPipe,
201 G4int order,
202 G4double magnetContainerLength,
203 const BDSMagnetOuterInfo* recipe);
204
208 virtual void CalculatePoleAndYoke(G4double horizontalWidth,
209 BDSBeamPipe* beamPipe,
210 G4int order);
211
217 virtual void CreatePoleSolid(const G4String& name, // name
218 G4double length, // length [mm]
219 G4int order); // Nx2 poles
220
222 virtual void CreateCoilSolids(const G4String& name,
223 G4double length);
224
226 virtual void CreateCoilPoints();
227
231 virtual void CreateYokeAndContainerSolid(const G4String& name,
232 G4double length,
233 G4int order,
234 G4double magnetContainerLength,
235 G4double magnetContainerRadiusIn); // so as not to clash with member name
236
238 virtual void IntersectPoleWithYoke(const G4String& name,
239 G4double length,
240 G4int order);
241
242 virtual void CreateLogicalVolumes(const G4String& name,
243 G4Colour* colour,
244 G4Material* outerMaterial);
245
249 virtual void CreateLogicalVolumesCoil(const G4String& name);
250
253 virtual void CreateEndPiece(const G4String& name);
254
256 virtual void PlaceComponents(const G4String& name,
257 G4int order);
258
260 virtual void PlaceComponentsCoils(const G4String& name,
261 G4int order);
262
266 void TestCoilFractions(G4double& coilWidthFraction,
267 G4double& coilHeightFraction);
268
272 void DipoleCommonPreConstruction(const G4String& name,
273 G4double angleIn,
274 G4double angleOut,
275 G4double length,
276 G4double& horizontalWidth,
277 G4Material*& material,
278 G4double& vhRatio);
279
282 void DipoleCalculations(G4bool hStyle,
283 G4bool buildVertically,
284 const BDSBeamPipe* beamPipe,
285 G4double length,
286 G4double horizontalWidth,
287 G4double angleIn,
288 G4double angleOut,
289 G4double yokeThicknessFraction,
290 G4double vhRatio,
291 G4double coilWidthFraction,
292 G4double coilHeightFraction,
293 G4double& cShapeOuterEdge,
294 G4double& poleHalfGap,
295 G4double& poleWidth,
296 G4double& poleHeight,
297 G4double& yokeWidth,
298 G4double& yokeHalfHeight,
299 G4double& yokeThickness,
300 G4double& yokeOverHang,
301 G4double& coilWidth,
302 G4double& coilHeightIn, // to avoid shadowing member variable
303 G4double& coilToYokeGap,
304 G4double& coilToPoleGap,
305 G4double& sLength,
306 G4double& containerSLength,
307 G4double& intersectionRadius);
308
311 std::vector<G4ThreeVector> CalculateCoilDisplacements(G4double poleHalfWidthIn,
312 G4double poleHalfGapIn,
313 G4double coilWidthIn,
314 G4double coilHeightIn,
315 G4double cDY,
316 G4double& coilDY);
317
320 BDSMagnetOuter* CreateDipoleC(const G4String& name,
321 G4double length,
322 const BDSBeamPipe* beamPipe,
323 G4double containerLength,
324 const BDSMagnetOuterInfo* recipe,
325 G4bool buildVertically);
326
328 BDSMagnetOuter* CreateDipoleH(const G4String& name,
329 G4double length,
330 const BDSBeamPipe* beamPipe,
331 G4double containerLength,
332 const BDSMagnetOuterInfo* recipe,
333 G4bool buildVertically);
334
335 BDSMagnetOuter* DipoleCommonConstruction(const G4String& name,
336 G4double horizontalWidth,
337 G4bool buildEndPiece,
338 G4double coilWidth,
339 G4double length,
340 G4double containerLength,
341 G4double sLength,
342 G4double angleIn,
343 G4double angleOut,
344 G4Colour* colour,
345 G4Material* material,
346 std::vector<G4ThreeVector>& coilDisps,
347 G4bool buildVertically,
348 BDSExtent& ext,
349 G4double poleHalfWidth,
350 G4double poleHalfGap,
351 G4double cDY,
352 G4double coilDY,
353 G4double intersectionRadius);
354
356};
357
358#endif
A holder class for a piece of beam pipe geometry.
Holder for +- extents in 3 dimensions.
Definition BDSExtent.hh:38
Abstract base class for magnet outer volume factories.
Factory class for outer volume of magnets. Produces magnets with 2N-poles around the beampipe with a ...
void DipoleCommonPreConstruction(const G4String &name, G4double angleIn, G4double angleOut, G4double length, G4double &horizontalWidth, G4Material *&material, G4double &vhRatio)
virtual void CalculatePoleAndYoke(G4double horizontalWidth, BDSBeamPipe *beamPipe, G4int order)
BDSMagnetOuter * CreateDipoleH(const G4String &name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe, G4bool buildVertically)
Routine to construct an H shaped dipole magnet and can optionally be built vertically.
void CleanUpPolesBase()
Non-virtual clean up to be used in constructor.
G4double yokeFinishRadius
Finish radius of yoke geometry from magnet centre - less than horizontalWidth.
G4double segmentAngle
2PI / # of poles - angle per segment allocated for each pole.
virtual void CreateEndPiece(const G4String &name)
virtual void IntersectPoleWithYoke(const G4String &name, G4double length, G4int order)
Chop off the top of the pole to match the appropriate yoke geometry.
G4double endPieceOuterR
Outer radius for end piece container.
std::vector< G4ThreeVector > CalculateCoilDisplacements(G4double poleHalfWidthIn, G4double poleHalfGapIn, G4double coilWidthIn, G4double coilHeightIn, G4double cDY, G4double &coilDY)
virtual BDSMagnetOuter * CreateRectangularBend(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
rectangular bend outer volume
BDSMagnetOuter * CreateDipoleC(const G4String &name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe, G4bool buildVertically)
void DipoleCalculations(G4bool hStyle, G4bool buildVertically, const BDSBeamPipe *beamPipe, G4double length, G4double horizontalWidth, G4double angleIn, G4double angleOut, G4double yokeThicknessFraction, G4double vhRatio, G4double coilWidthFraction, G4double coilHeightFraction, G4double &cShapeOuterEdge, G4double &poleHalfGap, G4double &poleWidth, G4double &poleHeight, G4double &yokeWidth, G4double &yokeHalfHeight, G4double &yokeThickness, G4double &yokeOverHang, G4double &coilWidth, G4double &coilHeightIn, G4double &coilToYokeGap, G4double &coilToPoleGap, G4double &sLength, G4double &containerSLength, G4double &intersectionRadius)
virtual BDSMagnetOuter * CreateMuonSpoiler(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
muon spoiler outer volume
G4VSolid * coilLeftSolid
Left coil solid for one pole built upright along y axis.
virtual void CreateLogicalVolumes(const G4String &name, G4Colour *colour, G4Material *outerMaterial)
virtual BDSMagnetOuter * CreateDecapole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
decapole outer volume
BDSSimpleComponent * endPiece
Fully constructed end piece.
virtual void CreateCoilSolids(const G4String &name, G4double length)
Create the coil solids corresponding to the pole solid.
const G4double poleAngularFraction
Fraction of 2pi/Npoles that the pole will occupy - always < 1.
G4VSolid * poleIntersectionSolid
Solid used to chop off pole.
G4double poleSquareStartRadius
Radius from magnet centre that constant width section starts.
G4LogicalVolume * endPieceCoilLV
Logical volume for end piece single coil piece.
virtual BDSMagnetOuter * CreateSextupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
sextupole outer volume
virtual BDSMagnetOuter * CreateSectorBend(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
sector bend outer volume
G4double magnetContainerRadius
Radius of the container solid for the outer geometry.
G4double poleAngle
The angle allowed for the pole to occupy - less than segmentAngle.
virtual void CreatePoleSolid(const G4String &name, G4double length, G4int order)
virtual void PlaceComponents(const G4String &name, G4int order)
Place the poles and yoke in the container volume.
G4LogicalVolume * endPieceContainerLV
Logical volume for end piece container.
G4double coilCentreRadius
Radius from magnet centre that the centre of the coils exist at.
G4VSolid * endPieceContainerSolid
End piece container solid.
virtual void PlaceComponentsCoils(const G4String &name, G4int order)
If we're building coils, place two coils for each pole.
virtual void CleanUp()
Empty containers for next use - this class is never deleted so can't rely on scope.
std::vector< G4TwoVector > rightPoints
Vector of 2D points for right coil.
std::vector< G4TwoVector > endPiecePoints
Vector of 2D points for end piece looking from above down z.
void TestCoilFractions(G4double &coilWidthFraction, G4double &coilHeightFraction)
G4double poleFinishRadius
Finish radius of the pole from magnet centre.
BDSMagnetOuterFactoryBase * cylindrical
Default factory to fall back to.
virtual void CreateLogicalVolumesCoil(const G4String &name)
G4double endPieceInnerR
Inner radius for end piece container.
std::vector< G4TwoVector > leftPoints
Vector of 2D points for left coil.
G4double endPieceLength
Length of the coil end piece along what will be curvilinear S.
G4double poleStartRadius
Start radius of the pole from magnet centre.
virtual void CreateCoilPoints()
Create all the points that make up the extruded solid of the pole.
virtual BDSMagnetOuter * CreateSolenoid(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
solenoid outer volume
virtual void CreateYokeAndContainerSolid(const G4String &name, G4double length, G4int order, G4double magnetContainerLength, G4double magnetContainerRadiusIn)
G4LogicalVolume * coilRightLV
Logical volume for right coil.
virtual BDSMagnetOuter * CreateRfCavity(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
RF cavity outer volume.
G4bool buildPole
Whether or not to build poles (and therefore coils).
G4double yokeStartRadius
Start radius of yoke geometry from magnet cetnre.
G4double coilHeight
Height along y for coil for coil beside 1 upgright pole aligned with y axis.
virtual BDSMagnetOuter * CreateQuadrupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
quadrupole outer volume
virtual BDSMagnetOuter * CreateMultipole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
general multipole outer volume - could be any 2N order multipole
G4ThreeVector poleTranslation
Offste of pole for placement from magnet centre.
virtual BDSMagnetOuter * CreateOctupole(G4String name, G4double length, BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe)
octupole outer volume
virtual BDSMagnetOuter * CommonConstructor(const G4String &name, G4double length, BDSBeamPipe *beamPipe, G4int order, G4double magnetContainerLength, const BDSMagnetOuterInfo *recipe)
Common construction tasks to all methods - assemble yoke and poles in container.
G4double poleSquareWidth
Full width of pole in constant width section.
G4LogicalVolume * coilLeftLV
Logical volume for left coil.
virtual BDSMagnetOuter * CreateKicker(G4String name, G4double length, const BDSBeamPipe *beamPipe, G4double containerLength, const BDSMagnetOuterInfo *recipe, G4bool vertical)
horizontal and vertical kicker outer volume
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...
A BDSAcceleratorComponent wrapper for BDSGeometryComponent.