19#include "BDSCurvilinearFactory.hh"
20#include "BDSExtent.hh"
21#include "BDSGlobalConstants.hh"
22#include "BDSSimpleComponent.hh"
23#include "BDSTiltOffset.hh"
24#include "BDSUtilities.hh"
27#include "G4CutTubs.hh"
28#include "G4LogicalVolume.hh"
29#include "G4ThreeVector.hh"
33#include "CLHEP/Units/SystemOfUnits.h"
37BDSCurvilinearFactory::BDSCurvilinearFactory():
41BDSCurvilinearFactory::~BDSCurvilinearFactory()
49 G4Tubs* solid =
new G4Tubs(name +
"_solid",
56 G4ThreeVector inputFaceNormal = G4ThreeVector(0, 0,-1);
57 G4ThreeVector outputFaceNormal = G4ThreeVector(0, 0, 1);
64 const G4double arcLength,
65 const G4double chordLength,
66 const G4double radius,
68 const G4ThreeVector& inputFaceNormal,
69 const G4ThreeVector& outputFaceNormal,
76 G4double radiusFromAngleLength = radius;
78 {radiusFromAngleLength = std::abs(chordLength / angle) * 0.8;}
79 G4double radiusLocal = std::min(radius, radiusFromAngleLength);
82 G4ThreeVector inputface = inputFaceNormal;
83 G4ThreeVector outputface = outputFaceNormal;
87 G4double tilt = tiltOffset->
GetTilt();
90 inputface = inputface.rotateZ(tilt);
91 outputface = outputface.rotateZ(tilt);
96 G4CutTubs* solid =
new G4CutTubs(name +
"_solid",
110 G4double chordLength,
115 std::pair<G4ThreeVector,G4ThreeVector> faces =
BDS::CalculateFaces(-0.5*angle, -0.5*angle);
116 G4ThreeVector inputFaceNormal = faces.first;
117 G4ThreeVector outputFaceNormal = faces.second;
119 return CreateCurvilinearVolume(name, arcLength, chordLength, radius, angle, inputFaceNormal, outputFaceNormal, tiltOffset);
124 G4double chordLength,
130 G4LogicalVolume* lv =
new G4LogicalVolume(solid,
144 BDSExtent(radius, radius, chordLength*0.5));
BDSSimpleComponent * CommonConstruction(const G4String &name, G4double arcLength, G4double chordLength, G4double radius, G4VSolid *solid, G4double angle)
BDSSimpleComponent * CreateCurvilinearVolume(const G4String &name, G4double chordLength, G4double radius)
Build a straight curvilinear volume.
const G4double lengthSafety
Cache of length safety from BDSGlobalConstants.
Holder for +- extents in 3 dimensions.
A class that holds global options and constants.
static BDSGlobalConstants * Instance()
Access method.
A BDSAcceleratorComponent wrapper for BDSGeometryComponent.
A holder for any placement offsets and rotations for a BDSAcceleratorComponent.
G4double GetTilt() const
Accessor.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
std::pair< G4ThreeVector, G4ThreeVector > CalculateFaces(G4double angleInIn, G4double angleOutIn)
Calculate input and output normal vector.