BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSLinkDetectorConstruction.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
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 BDSLINKDETECTORCONSTRUCTION_H
20#define BDSLINKDETECTORCONSTRUCTION_H
21#include "BDSBeamline.hh"
22#include "BDSCollimatorJaw.hh"
23#include "BDSCollimatorTipJaw.hh"
24#include "BDSExtent.hh"
25
26#include "G4ThreeVector.hh"
27#include "G4Types.hh"
28#include "G4Version.hh"
29#include "G4VUserDetectorConstruction.hh"
30
31#include <string>
32
33class BDSBeamline;
37class BDSLinkRegistry;
39class G4Box;
40class G4ChannelingOptrMultiParticleChangeCrossSection;
41class G4VPhysicalVolume;
42
43#include "parser/element.h"
44#include "parser/elementtype.h"
45
52class BDSLinkDetectorConstruction: public G4VUserDetectorConstruction
53{
54public:
57
59 virtual G4VPhysicalVolume* Construct();
60
62 G4int AddLinkCollimatorJaw(const std::string& collimatorName,
63 const std::string& materialName,
64 G4double length,
65 G4double halfApertureLeft,
66 G4double halfApertureRight,
67 G4double rotation,
68 G4double xOffset,
69 G4double yOffset,
70 G4double jawTiltLeft = 0.0,
71 G4double jawTiltRight = 0.0,
72 G4bool buildLeftJaw = true,
73 G4bool buildRightJaw = true,
74 G4bool isACrystal = false,
75 G4double crystalAngle = 0,
76 G4bool sampleIn = false);
77
79 G4int AddLinkCollimatorTipJaw(const std::string& collimatorName,
80 const std::string& materialName,
81 const std::string& tipMaterialName,
82 G4double tipThickness,
83 G4double length,
84 G4double halfApertureLeft,
85 G4double halfApertureRight,
86 G4double rotation,
87 G4double xOffset,
88 G4double yOffset,
89 G4double jawTiltLeft = 0.0,
90 G4double jawTiltRight = 0.0,
91 G4bool buildLeftJaw = true,
92 G4bool buildRightJaw = true);
95
97 inline void SetDesignParticle(const BDSParticleDefinition* defIn) {designParticle = defIn;}
98 inline void SetPrimaryGeneratorAction(BDSLinkPrimaryGeneratorAction* pgIn) {primaryGeneratorAction = pgIn;}
99
100
102 inline BDSExtent WorldExtent() const {return worldExtent;}
103 inline BDSLinkRegistry* LinkRegistry() const {return linkRegistry;}
105
106 void BuildPhysicsBias();
107
108 inline const std::map<std::string, G4int>& NameToElementIndex() const {return nameToElementIndex;}
109 inline const std::map<int, int>& LinkIDToBeamlineIndex() const {return linkIDToBeamlineIndex;}
110 inline G4int NumberOfElements() const {return linkBeamline ? (G4int)linkBeamline->size() : 0;}
111 inline void SetSamplerWorldID(G4int samplerWorldIDIn) {samplerWorldID = samplerWorldIDIn;}
112 inline const BDSBeamline* LinkBeamline() const {return linkBeamline;}
113
114 private:
117 void UpdateWorldSolid();
118
120 G4int PlaceOneComponent(const BDSBeamlineElement* element, const G4String& originalName);
121
122 G4Box* worldSolid;
123 G4VPhysicalVolume* worldPV;
124 BDSExtent worldExtent;
125 BDSBeamline* linkBeamline;
126 BDSLinkRegistry* linkRegistry;
127 BDSLinkPrimaryGeneratorAction* primaryGeneratorAction;
128
131
132#if G4VERSION_NUMBER > 1039
133 G4ChannelingOptrMultiParticleChangeCrossSection* crystalBiasing;
134#endif
135
138
139 BDSBeamlineIntegral* integral;
140
141 std::map<std::string, G4int> nameToElementIndex;
142 std::map<G4int, G4int> linkIDToBeamlineIndex;
143};
144
145#endif
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
A class that holds the current integrated quantities along a beam line.
A vector of BDSBeamlineElement instances - a beamline.
BeamlineVector::size_type size() const
Get the number of elements.
Holder for +- extents in 3 dimensions.
Definition BDSExtent.hh:39
Construction of the geometry in the case of a link model.
G4int AddLinkCollimatorTipJaw(const std::string &collimatorName, const std::string &materialName, const std::string &tipMaterialName, G4double tipThickness, G4double length, G4double halfApertureLeft, G4double halfApertureRight, G4double rotation, G4double xOffset, G4double yOffset, G4double jawTiltLeft=0.0, G4double jawTiltRight=0.0, G4bool buildLeftJaw=true, G4bool buildRightJaw=true)
Interface to append a tip collimator jaw to the linking.
G4int AddLinkCollimatorJaw(const std::string &collimatorName, const std::string &materialName, G4double length, G4double halfApertureLeft, G4double halfApertureRight, G4double rotation, G4double xOffset, G4double yOffset, G4double jawTiltLeft=0.0, G4double jawTiltRight=0.0, G4bool buildLeftJaw=true, G4bool buildRightJaw=true, G4bool isACrystal=false, G4double crystalAngle=0, G4bool sampleIn=false)
Interface to append a collimator of jaw style to the linking.
G4int AddLinkElement(GMAD::Element el)
Interface to append an element.
G4int samplerWorldID
Cache of the index to which parallel world the sampler one is.
G4int PlaceOneComponent(const BDSBeamlineElement *element, const G4String &originalName)
Place a beam line element in the world.
const BDSParticleDefinition * designParticle
Particle definition all components are built w.r.t. Includes rigidity etc.
BDSLinkRegistry * LinkRegistry() const
Accessor.
BDSLinkDetectorConstruction()
Default constructor.
std::map< std::string, G4int > nameToElementIndex
Build up a copy here too.
std::map< G4int, G4int > linkIDToBeamlineIndex
Special linkID to linkBeamline index.
void SetDesignParticle(const BDSParticleDefinition *defIn)
Set the design particle definition.
Generates primary particle vertices using BDSBunch.
Registry / map of components for tracker linkage.
Wrapper for particle definition.
Element class.
Definition element.h:45