BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSCurvilinearBuilder.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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#include "BDSBeamlineElement.hh"
20#include "BDSUtilities.hh"
21
22#include "globals.hh"
23
24class BDSBeamline;
27
38{
39public:
42
45 const G4bool circular);
46
49
50private:
52 BDSCurvilinearBuilder& operator=(const BDSCurvilinearBuilder&) = delete;
53
57 G4double CurvilinearRadius(const BDSBeamlineElement* el) const;
58
65 BDSBeamlineElement* CreateCurvilinearElement(const G4String& elementName,
66 BDSBeamline::const_iterator startElement,
67 BDSBeamline::const_iterator finishElement,
68 G4int index,
69 G4double crRadius);
70
73 BDSBeamline::const_iterator startElement,
74 BDSBeamline::const_iterator finishElement,
75 G4int index);
76
77
82
93 G4int& numberOfUniqueComponents,
94 const G4int beamlineIndex,
95 G4double crRadius);
96
102 const BDSBeamlineElement*& previous,
103 const BDSBeamlineElement*& next) const;
104
108
112 G4int& numberOfUniqueComponents);
113
116 G4int& numberOfUniqueComponents,
117 G4double suggestedRadius);
118
123 BDSBeamline::const_iterator nextElement,
125 const G4int beamlineIndex);
126
128 inline G4bool Angled(BDSBeamlineElement const* const element) const;
129
131 inline G4bool TooShort(BDSBeamlineElement const* const element) const;
132
135 G4double defaultBridgeLength;
137 G4double radiusTolerance;
139
142};
143
144inline G4bool BDSCurvilinearBuilder::Angled(BDSBeamlineElement const* const element) const
145{return BDS::IsFinite(element->GetAngle());}
Abstract class that represents a component of an accelerator.
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
G4double GetAngle() const
Accessor.
A vector of BDSBeamlineElement instances - a beamline.
Definition: BDSBeamline.hh:61
BeamlineVector::const_iterator const_iterator
Iterator mechanics.
Definition: BDSBeamline.hh:164
Factory for simple parallel geometry for curvilinear coordinates.
BDSBeamlineElement * CreateElementFromComponent(BDSSimpleComponent *component, BDSBeamline::const_iterator startElement, BDSBeamline::const_iterator finishElement, G4int index)
Create the BDSBeamlineElement by wrapping a BDSSimpleComponent.
BDSBeamlineElement * CreateBridgeSection(BDSAcceleratorComponent *defaultBridge, BDSBeamline::const_iterator element, BDSBeamline::const_iterator nextElement, BDSBeamline::const_iterator end, G4int &numberOfUniqueComponents, const G4int beamlineIndex, G4double crRadius)
BDSAcceleratorComponent * CreateStraightBridgeComponent(G4double width, G4int &numberOfUniqueComponents)
BDSBeamlineElement * CreateBridgeElementFromComponent(BDSAcceleratorComponent *component, BDSBeamline::const_iterator element, BDSBeamline::const_iterator nextElement, BDSBeamline::const_iterator end, const G4int beamlineIndex)
G4double curvilinearRadius
Radius for curvilinear geometry.
G4double paddingLength
Length that was used for padding on the beam line we're building with respesct to.
void PreviousAndNext(BDSBeamline::const_iterator it, BDSBeamline::const_iterator startIt, BDSBeamline::const_iterator endIt, const BDSBeamlineElement *&previous, const BDSBeamlineElement *&next) const
G4double CurvilinearRadius(const BDSBeamlineElement *el) const
G4bool TooShort(BDSBeamlineElement const *const element) const
Whether an element is too short for its own curvilinear volume.
BDSBeamline * BuildCurvilinearBeamLine1To1(BDSBeamline const *const beamline, const G4bool circular)
Build a beam line of curvilinear geometry based on another beam line.
BDSAcceleratorComponent * CreateAngledBridgeComponent(BDSBeamline::const_iterator element, G4int &numberOfUniqueComponents, G4double suggestedRadius)
Create a unique accelerator component for an element with angled faces.
G4bool Angled(BDSBeamlineElement const *const element) const
Simple interrogation function to determine if an element has a finite angle or not.
BDSBeamline * BuildCurvilinearBridgeBeamLine(BDSBeamline const *const beamline)
Build bridging volumes to join the curvilinear ones.
BDSCurvilinearFactory * factory
Factory to build curvilinear geometry.
BDSBeamlineElement * CreateBonusSectionStart(BDSBeamline const *const beamline)
Create a small section to extend a linear beam line.
BDSAcceleratorComponent * CreateDefaultBridgeComponent()
G4double bonusChordLength
Length of any possible bonus section added to beginning and end.
BDSBeamlineElement * CreateBonusSectionEnd(BDSBeamline const *const beamline)
Create a small section to extend a linear beam line.
BDSBeamlineElement * CreateCurvilinearElement(const G4String &elementName, BDSBeamline::const_iterator startElement, BDSBeamline::const_iterator finishElement, G4int index, G4double crRadius)
Factory to create curvilinear geometry for parallel world.
A BDSAcceleratorComponent wrapper for BDSGeometryComponent.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())