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) 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 BDSLINKDETECTORCONSTRUCTION_H
19#define BDSLINKDETECTORCONSTRUCTION_H
20#include "BDSBeamline.hh"
21#include "BDSExtent.hh"
22
23#include "G4ThreeVector.hh"
24#include "G4Types.hh"
25#include "G4Version.hh"
26#include "G4VUserDetectorConstruction.hh"
27
28#include <map>
29#include <string>
30
34class BDSLinkRegistry;
36class G4Box;
37class G4ChannelingOptrMultiParticleChangeCrossSection;
38class G4VPhysicalVolume;
39
40#include "parser/element.h"
41#include "parser/elementtype.h"
42
49class BDSLinkDetectorConstruction: public G4VUserDetectorConstruction
50{
51public:
54
56 virtual G4VPhysicalVolume* Construct();
57
59 G4int AddLinkCollimatorJaw(const std::string& collimatorName,
60 const std::string& materialName,
61 G4double length,
62 G4double halfApertureLeft,
63 G4double halfApertureRight,
64 G4double rotation,
65 G4double xOffset,
66 G4double yOffset,
67 G4double jawTiltLeft = 0.0,
68 G4double jawTiltRight = 0.0,
69 G4bool buildLeftJaw = true,
70 G4bool buildRightJaw = true,
71 G4bool isACrystal = false,
72 G4double crystalAngle = 0,
73 G4bool sampleIn = false);
74
76 G4int AddLinkCollimatorTipJaw(const std::string& collimatorName,
77 const std::string& materialName,
78 const std::string& tipMaterialName,
79 G4double tipThickness,
80 G4double length,
81 G4double halfApertureLeft,
82 G4double halfApertureRight,
83 G4double rotation,
84 G4double xOffset,
85 G4double yOffset,
86 G4double jawTiltLeft = 0.0,
87 G4double jawTiltRight = 0.0,
88 G4bool buildLeftJaw = true,
89 G4bool buildRightJaw = true);
92
94 inline void SetDesignParticle(const BDSParticleDefinition* defIn) {designParticle = defIn;}
95 inline void SetPrimaryGeneratorAction(BDSLinkPrimaryGeneratorAction* pgIn) {primaryGeneratorAction = pgIn;}
96
97
99 inline BDSExtent WorldExtent() const {return worldExtent;}
100 inline BDSLinkRegistry* LinkRegistry() const {return linkRegistry;}
102
103 void BuildPhysicsBias();
104
105 inline const std::map<std::string, G4int>& NameToElementIndex() const {return nameToElementIndex;}
106 inline const std::map<int, int>& LinkIDToBeamlineIndex() const {return linkIDToBeamlineIndex;}
107 inline G4int NumberOfElements() const {return linkBeamline ? (G4int)linkBeamline->size() : 0;}
108 inline void SetSamplerWorldID(G4int samplerWorldIDIn) {samplerWorldID = samplerWorldIDIn;}
109 inline const BDSBeamline* LinkBeamline() const {return linkBeamline;}
110
111 private:
114 void UpdateWorldSolid();
115
117 G4int PlaceOneComponent(const BDSBeamlineElement* element, const G4String& originalName);
118
119 G4Box* worldSolid;
120 G4VPhysicalVolume* worldPV;
121 BDSExtent worldExtent;
122 BDSBeamline* linkBeamline;
123 BDSLinkRegistry* linkRegistry;
124 BDSLinkPrimaryGeneratorAction* primaryGeneratorAction;
125
128
129#if G4VERSION_NUMBER > 1039
130 G4ChannelingOptrMultiParticleChangeCrossSection* crystalBiasing;
131#endif
132
135
136 BDSBeamlineIntegral* integral;
137
138 std::map<std::string, G4int> nameToElementIndex;
139 std::map<G4int, G4int> linkIDToBeamlineIndex;
140};
141
142#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:38
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.
BDSExtent WorldExtent() const
Accessor.
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:47