BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSCrystalFactory.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 BDSCRYSTALFACTORY_H
20#define BDSCRYSTALFACTORY_H
21
22#include "BDSCrystal.hh"
23#include "BDSCrystalInfo.hh"
24#include "BDSFactoryBase.hh"
25
26#include "globals.hh" // geant4 globals / types
27#include "G4RotationMatrix.hh"
28
29#include <set>
30
31class BDSExtent;
32class G4LogicalVolume;
33class G4Material;
34class G4PVPlacement;
35class G4UserLimits;
36class G4VSolid;
37
50{
51public:
53 virtual ~BDSCrystalFactory(){;}
54
56 BDSCrystal* CreateCrystal(const G4String& nameIn,
57 const BDSCrystalInfo* recipe);
58
59private:
62 void CleanUp();
63
65 void CommonConstruction(const G4String& nameIn,
66 const BDSCrystalInfo* recipe);
67
70 const BDSExtent& extent);
71
72 void SetVisAttributes();
73 void SetUserLimits(G4double length);
74
76 BDSCrystal* CreateCrystalBox(const G4String& nameIn,
77 const BDSCrystalInfo* recipe);
78
80 BDSCrystal* CreateCrystalCylinder(const G4String& nameIn,
81 const BDSCrystalInfo* recipe);
82
84 BDSCrystal* CreateCrystalTorus(const G4String& nameIn,
85 const BDSCrystalInfo* recipe);
86
89 void CalculateSolidAngles(G4double bendingAngle,
90 G4double& startAngle,
91 G4double& sweepAngle) const;
92
94 BDSExtent CalculateExtents(G4double bendingAngle,
95 G4double xBendingRadius,
96 G4double xThickness,
97 const BDSCrystalInfo* recipe) const;
98
99 const G4double maxStepFactor;
100 const G4int nPoints;
101
102 G4VSolid* crystalSolid;
103 G4LogicalVolume* crystalLV;
104 G4ThreeVector placementOffset;
105 G4RotationMatrix* placementRotation;
106};
107
108#endif
Abstract base class for crystal factory classes.
void CommonConstruction(const G4String &nameIn, const BDSCrystalInfo *recipe)
Common construction tasks.
const G4int nPoints
Number of points to split torus into.
void CalculateSolidAngles(G4double bendingAngle, G4double &startAngle, G4double &sweepAngle) const
const G4double maxStepFactor
Fraction of length for maximum step in user limits.
BDSCrystal * CreateCrystalBox(const G4String &nameIn, const BDSCrystalInfo *recipe)
Create box geometry for a crystal.
BDSCrystal * CreateCrystalCylinder(const G4String &nameIn, const BDSCrystalInfo *recipe)
Create cylinder geometry for a crystal.
BDSExtent CalculateExtents(G4double bendingAngle, G4double xBendingRadius, G4double xThickness, const BDSCrystalInfo *recipe) const
Produce an extent for a curved crystal.
BDSCrystal * CreateCrystalTorus(const G4String &nameIn, const BDSCrystalInfo *recipe)
Create torus geometry for a cyrstal.
BDSCrystal * CreateCrystal(const G4String &nameIn, const BDSCrystalInfo *recipe)
Main interface to create a crystal.
BDSCrystal * BuildCrystalObject(const BDSCrystalInfo *recipe, const BDSExtent &extent)
build beampipe and register logical volumes
void SetUserLimits(G4double length)
Set user limits.
void SetVisAttributes()
Set visual attributes.
Holder for all information required to create a crystal.
An object for both a crystal from a factory.
Definition: BDSCrystal.hh:40
Holder for +- extents in 3 dimensions.
Definition: BDSExtent.hh:39
Common temporary storage for all factories no matter what geometry.