19#ifndef BDSDETECTORCONSTRUCTION_H
20#define BDSDETECTORCONSTRUCTION_H
22#include "BDSExtent.hh"
23#include "BDSExtentGlobal.hh"
26#include "G4Transform3D.hh"
27#include "G4Version.hh"
28#include "G4VUserDetectorConstruction.hh"
38class G4VPhysicalVolume;
43 template<
typename T>
class FastList;
46 class SamplerPlacement;
60#if G4VERSION_NUMBER > 1009
104 const std::vector<BDSFieldQueryInfo*>&
FieldQueries()
const {
return fieldQueries;}
115 G4VPhysicalVolume* containerPV,
117 G4bool setRegions =
false,
118 G4bool registerInfo =
false,
119 G4bool useCLPlacementTransform =
false,
120 G4bool useIncrementalCopyNumbers =
false,
121 G4bool registerPlacementNamesForOutput =
false);
129 G4double* S =
nullptr,
131 const G4String& objectTypeForErrorMsg =
"placement");
137 G4double* S =
nullptr);
143 G4double* S =
nullptr);
148 G4double* S =
nullptr,
154 G4double* S =
nullptr);
169 G4bool BuildPlacementFieldsWorld()
const {
return buildPlacementFieldsWorld;}
199 const G4String& name,
202 const G4Transform3D& initialTransform = G4Transform3D(),
203 G4bool beamlineIsCircular =
false,
204 G4bool isPlacementBeamline =
false);
234#if G4VERSION_NUMBER > 1009
237 const std::list<std::string>& defaultBias,
238 const G4String& elementName);
249 std::vector<BDSBOptrMultiParticleChangeCrossSection*>
biasObjects;
250 std::map<G4String, BDSBOptrMultiParticleChangeCrossSection*> biasSetObjects;
280 G4bool buildPlacementFieldsWorld;
284 std::set<G4LogicalVolume*> worldVacuumLogicalVolumes;
285 G4LogicalVolume* worldLogicalVolume;
287 std::vector<BDSFieldQueryInfo*> fieldQueries;
290#ifdef BDSCHECKUSERLIMITS
291 void PrintUserLimitsSummary(
const G4VPhysicalVolume* world)
const;
292 void PrintUserLimitsPV(
const G4VPhysicalVolume* aPV, G4double globalMinEK)
const;
A holder class for all representations of the accelerator model created in BDSIM.
Multi-particle cross-section changer.
A class that holds the current integrated quantities along a beam line.
Simple struct to return a beamline plus associated beam lines.
A vector of BDSBeamlineElement instances - a beamline.
Factory for user specified accelerator components.
Class that constructs a Geant4 model of an accelerator.
G4bool circular
Whether or not we're building a circular machine.
void UpdateSamplerDiameterAndCountSamplers()
void SetDesignParticle(const BDSParticleDefinition *defIn)
Set the (initial) design particle definition.
BDSDetectorConstruction & operator=(const BDSDetectorConstruction &)=delete
assignment and copy constructor not implemented nor used
BDSBOptrMultiParticleChangeCrossSection * BuildCrossSectionBias(const std::list< std::string > &biasList, const std::list< std::string > &defaultBias, const G4String &elementName)
Function that creates physics biasing cross section.
void InitialiseRegions()
Create and set parameters for various G4Regions.
std::vector< BDSBOptrMultiParticleChangeCrossSection * > biasObjects
List of bias objects - for memory management.
BDSExtent CalculateExtentOfScorerMesh(const GMAD::ScorerMesh &sm) const
Calculate local extent of scorer mesh in 3D.
BDSAcceleratorModel * acceleratorModel
Accelerator model pointer.
static G4ThreeVector SideToLocalOffset(const GMAD::Placement &placement, const BDSBeamline *beamLine, const BDSExtent &placementExtent)
Attach component with extent2 to component with extent1 with placement.
G4bool verbose
Variable copied from global constants.
BDSBeamline * placementBL
static std::vector< BDSFieldQueryInfo * > PrepareFieldQueries(const BDSBeamline *mainBeamline)
Prepare field queries from parser information.
G4VPhysicalVolume * BuildWorld()
void VerboseSensitivity() const
Print out the sensitivity of every single volume so far constructed in the world.
void InitialiseApertures()
Create all aperture definitions from parser and store in BDSAcceleratorModel.
void CountPlacementFields()
Count number of fields required for placements.
G4bool canSampleAngledFaces
Whether the integrator set permits sampling elements with angled faces.
BDSExtent worldExtent
Record of the world extent.
std::set< G4LogicalVolume * > worldContentsLogicalVolumes
Cache of possibly loaded logical volumes from a world geometry file - used for biasing.
static BDSSamplerInfo * BuildSamplerInfo(const GMAD::Element *element)
G4bool BuildSamplerWorld() const
BDSExtent CalculateExtentOfSamplerPlacement(const GMAD::SamplerPlacement &sp) const
Calculate local extent of custom user sampler.
void ConstructScoringMeshes()
Construct scoring meshes.
BDSBeamlineSet BuildBeamline(const GMAD::FastList< GMAD::Element > &beamLine, const G4String &name, const BDSBeamlineIntegral &startingIntegral, BDSBeamlineIntegral *&integral, const G4Transform3D &initialTransform=G4Transform3D(), G4bool beamlineIsCircular=false, G4bool isPlacementBeamline=false)
BDSExtentGlobal CalculateExtentOfScorerMeshes(const BDSBeamline *bl) const
G4bool checkOverlaps
Variable copied from global constants.
G4int nSamplers
Count of number of samplers to be built.
void ComponentPlacement(G4VPhysicalVolume *worldPV)
Place beam line, tunnel beam line, end pieces and placements in world.
const std::vector< BDSFieldQueryInfo * > & FieldQueries() const
Access vector of query objects.
void BuildBeamlines()
Build the main beam line and then any other required beam lines.
const BDSParticleDefinition * designParticle
Particle definition all components are built w.r.t. Includes rigidity etc.
void BuildTunnel()
Build the tunnel around the already constructed flat beam line.
BDSExtent WorldExtent() const
Public access to the world extent.
virtual void ConstructSDandField()
Construct sensitive detectors and fields.
std::vector< BDSFieldObjects * > fields
All fields.
void PrintSensitiveDetectorsOfLV(const G4LogicalVolume *lv, G4int currentDepth) const
Recursive function to print out each sensitive detector name.
void PrepareExtraSamplerSDs()
static void PlaceBeamlineInWorld(BDSBeamline *beamline, G4VPhysicalVolume *containerPV, G4bool checkOverlaps=false, G4bool setRegions=false, G4bool registerInfo=false, G4bool useCLPlacementTransform=false, G4bool useIncrementalCopyNumbers=false, G4bool registerPlacementNamesForOutput=false)
virtual G4VPhysicalVolume * Construct()
static G4Transform3D CreatePlacementTransform(const GMAD::Placement &placement, const BDSBeamline *beamLine, G4double *S=nullptr, BDSExtent *placementExtent=nullptr, const G4String &objectTypeForErrorMsg="placement")
G4bool UnsuitableFirstElement(std::list< GMAD::Element >::const_iterator element)
BDSExtentGlobal CalculateExtentOfSamplerPlacements(const BDSBeamline *beamLine) const
Holder for +- extents in 3 dimensions with a rotation and translation.
Holder for +- extents in 3 dimensions.
A holder for all the Geant4 field related objects.
Holder class for all information required for a field query.
Wrapper for particle definition.
All info required to build a sampler but not place it.
List with Efficient Lookup.
Placement class for parser.
Query structure class for parser.
Sampler placement class for parser.
ScorerMesh class for parser.
Parser namespace for GMAD language. Combination of Geant4 and MAD.