BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSBeamPipeFactoryPoints.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 BDSBEAMPIPEFACTORYPOINTS_H
19#define BDSBEAMPIPEFACTORYPOINTS_H
20
21#include "BDSBeamPipeFactoryBase.hh"
22#include "BDSBeamPipe.hh"
23
24#include "globals.hh"
25#include "G4TwoVector.hh"
26
27#include <vector>
28
29class G4Material;
30
47{
48public:
51
53 virtual BDSBeamPipe* CreateBeamPipe(const G4String& nameIn,
54 G4double lengthIn,
55 G4double aper1In,
56 G4double aper2In,
57 G4double aper3In,
58 G4double aper4In,
59 G4Material* vacuumMaterialIn,
60 G4double beamPipeThicknessIn,
61 G4Material* beamPipeMaterialIn,
62 const G4String& pointsFileIn = "",
63 const G4String& pointsUnitIn = "");
64
66 virtual BDSBeamPipe* CreateBeamPipe(const G4String& nameIn,
67 G4double lengthIn,
68 const G4ThreeVector& inputFaceNormalIn,
69 const G4ThreeVector& outputFaceNormalIn,
70 G4double aper1In,
71 G4double aper2In,
72 G4double aper3In,
73 G4double aper4In,
74 G4Material* vacuumMaterialIn,
75 G4double beamPipeThicknessIn,
76 G4Material* beamPipeMaterialIn,
77 const G4String& pointsFileIn = "",
78 const G4String& pointsUnitIn = "");
79
80protected:
84 virtual void GeneratePoints(G4double aper1,
85 G4double aper2,
86 G4double aper3,
87 G4double aper4,
88 G4double beamPipeThickness,
89 G4int pointsPerTwoPi = 40) = 0;
90
96 virtual G4double CalculateIntersectionRadius(G4double aper1,
97 G4double aper2,
98 G4double aper3,
99 G4double aper4,
100 G4double beamPipeThickness) = 0;
101
103 virtual void CleanUp();
104
105 void AppendPoint(std::vector<G4TwoVector>& vec,
106 G4double x,
107 G4double y);
108
111 void AppendAngle(std::vector<G4TwoVector>& vec,
112 G4double startAngle,
113 G4double finishAngle,
114 G4double radius,
115 G4int nPoints = 10,
116 G4double xOffset = 0,
117 G4double yOffset = 0);
118
120 void AppendAngleEllipse(std::vector<G4TwoVector>& vec,
121 G4double startAngle,
122 G4double finishAngle,
123 G4double radiusA, // radius in horizontal
124 G4double radiusB, // radius in vertical
125 G4int nPoints = 10,
126 G4double xOffset = 0,
127 G4double yOffset = 0);
128
130 std::vector<G4TwoVector> vacuumEdge;
131
133 std::vector<G4TwoVector> beamPipeInnerEdge;
134
136 std::vector<G4TwoVector> beamPipeOuterEdge;
137
139 std::vector<G4TwoVector> containerEdge;
140
142 std::vector<G4TwoVector> containerSubtractionEdge;
143
145 G4double extentX;
146 G4double extentY;
148
150 G4String pointsFile;
151 G4String pointsUnit;
153
154private:
161
164
167
169 void CleanUpPoints();
170
174 void CreateSolids(const G4String& name,
175 G4double length,
176 G4bool buildLongForIntersection = false);
177
179 void CreateSolidsAngled(const G4String& name,
180 G4double length,
181 const G4ThreeVector& inputFace,
182 const G4ThreeVector& outputFace);
183
186 virtual BDSBeamPipe* CommonFinalConstruction(const G4String& nameIn,
187 G4Material* vacuumMaterialIn,
188 G4Material* beamPipeMaterialIn,
189 G4double lengthIn);
190};
191
192#endif
Abstract base class for beampipe factory classes.
Factory for beam pipes defined by a series of x,y points that are extruded.
G4VSolid * beamPipeInnerSolid
Solid for inner surface of beam pipe.
std::vector< G4TwoVector > containerSubtractionEdge
Vector of x,y coordinates for the container subtraction volume.
std::vector< G4TwoVector > beamPipeInnerEdge
Vector of x,y coordinates for beam pipe inner edge.
virtual void CleanUp()
Clear member vectors and run base class clean up to clear pointers between runs.
G4VSolid * beamPipeOuterSolid
Solid for outer surface of beam pipe.
virtual void GeneratePoints(G4double aper1, G4double aper2, G4double aper3, G4double aper4, G4double beamPipeThickness, G4int pointsPerTwoPi=40)=0
G4double extentY
Extents prepared by GeneratePoints function as only it knows the extents.
virtual G4double CalculateIntersectionRadius(G4double aper1, G4double aper2, G4double aper3, G4double aper4, G4double beamPipeThickness)=0
void CleanUpPoints()
Actual clean up here for this class only.
virtual BDSBeamPipe * CommonFinalConstruction(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn, G4double lengthIn)
G4double extentX
Extents prepared by GeneratePoints function as only it knows the extents.
std::vector< G4TwoVector > vacuumEdge
Vector of x,y coordinates for vacuum extruded solid edge.
virtual BDSBeamPipe * CreateBeamPipe(const G4String &nameIn, G4double lengthIn, G4double aper1In, G4double aper2In, G4double aper3In, G4double aper4In, G4Material *vacuumMaterialIn, G4double beamPipeThicknessIn, G4Material *beamPipeMaterialIn, const G4String &pointsFileIn="", const G4String &pointsUnitIn="")
Required overloaded method from BDSBeamPipeFactoryBase to build straight piece of beam pipe.
void CreateSolidsAngled(const G4String &name, G4double length, const G4ThreeVector &inputFace, const G4ThreeVector &outputFace)
Create angled solids. Uses CreateSolids() method.
void AppendAngle(std::vector< G4TwoVector > &vec, G4double startAngle, G4double finishAngle, G4double radius, G4int nPoints=10, G4double xOffset=0, G4double yOffset=0)
void CreateSolids(const G4String &name, G4double length, G4bool buildLongForIntersection=false)
G4String pointsFile
Temporary copy of input variables.
std::vector< G4TwoVector > containerEdge
Vector of x,y coordinates for the container volume.
std::vector< G4TwoVector > beamPipeOuterEdge
Vector of x,y coordinates for beam pipe outer edge.
G4String pointsUnit
Temporary copy of input variables.
void AppendAngleEllipse(std::vector< G4TwoVector > &vec, G4double startAngle, G4double finishAngle, G4double radiusA, G4double radiusB, G4int nPoints=10, G4double xOffset=0, G4double yOffset=0)
Generate 2-vector points (and append them) about an ellipse.
A holder class for a piece of beam pipe geometry.