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) 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 BDSCRYSTALFACTORY_H
19#define BDSCRYSTALFACTORY_H
20
21#include "BDSCrystal.hh"
22#include "BDSCrystalInfo.hh"
23#include "BDSFactoryBase.hh"
24
25#include "globals.hh" // geant4 globals / types
26#include "G4RotationMatrix.hh"
27
28#include <set>
29
30class BDSExtent;
31class G4LogicalVolume;
32class G4Material;
33class G4PVPlacement;
34class G4UserLimits;
35class G4VSolid;
36
49{
50public:
52 virtual ~BDSCrystalFactory(){;}
53
55 BDSCrystal* CreateCrystal(const G4String& nameIn,
56 const BDSCrystalInfo* recipe);
57
58private:
61 void CleanUp();
62
64 void CommonConstruction(const G4String& nameIn,
65 const BDSCrystalInfo* recipe);
66
69 const BDSExtent& extent);
70
71 void SetVisAttributes();
72 void SetUserLimits(G4double length);
73
75 BDSCrystal* CreateCrystalBox(const G4String& nameIn,
76 const BDSCrystalInfo* recipe);
77
79 BDSCrystal* CreateCrystalCylinder(const G4String& nameIn,
80 const BDSCrystalInfo* recipe);
81
83 BDSCrystal* CreateCrystalTorus(const G4String& nameIn,
84 const BDSCrystalInfo* recipe);
85
88 void CalculateSolidAngles(G4double bendingAngle,
89 G4double& startAngle,
90 G4double& sweepAngle) const;
91
93 BDSExtent CalculateExtents(G4double bendingAngle,
94 G4double xBendingRadius,
95 G4double xThickness,
96 const BDSCrystalInfo* recipe) const;
97
98 const G4double maxStepFactor;
99 const G4int nPoints;
100
101 G4VSolid* crystalSolid;
102 G4LogicalVolume* crystalLV;
103 G4ThreeVector placementOffset;
104 G4RotationMatrix* placementRotation;
105};
106
107#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:39
Holder for +- extents in 3 dimensions.
Definition BDSExtent.hh:38
Common temporary storage for all factories no matter what geometry.