BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSParallelWorldSampler.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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 BDSPARALLELWORLDSAMPER_H
20#define BDSPARALLELWORLDSAMPER_H
21
22#include "BDSBeamPipeType.hh"
23#include "BDSSamplerType.hh"
24
25#include "globals.hh"
26#include "G4String.hh"
27#include "G4VUserParallelWorld.hh"
28
29#include <map>
30#include <vector>
31
32class G4VisAttributes;
33class G4VPhysicalVolume;
35class BDSSampler;
36class BDSSamplerPlane;
37namespace GMAD
38{
39 class SamplerPlacement;
40}
41
48class BDSParallelWorldSampler: public G4VUserParallelWorld
49{
50public:
52 explicit BDSParallelWorldSampler(const G4String& name);
54
57 virtual void Construct();
58
61 G4LogicalVolume* WorldLV() const {return samplerWorldLV;}
63
65 void Place(const BDSBeamlineElement* element,
66 G4double samplerRadius);
67
68private:
70 void ErrorNonPositive(G4double value,
71 const G4String& variableName,
72 const G4String& objectName) const;
73
75 BDSSampler* BuildSampler(const GMAD::SamplerPlacement& samplerPlacement,
77 G4double& radius) const;
78
81 void AdjustTransform(G4Transform3D& trans,
82 BDSSamplerType st) const;
83
85 std::vector<G4VPhysicalVolume*> placements;
86
87 G4String suffix;
88 G4VisAttributes* samplerWorldVis;
90 std::map<int, BDSSamplerPlane*> samplerInstances;
91 G4LogicalVolume* samplerWorldLV;
92};
93
94#endif
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
A parallel world for sampler planes.
BDSParallelWorldSampler()=delete
No default constructor.
G4LogicalVolume * WorldLV() const
Accessor.
BDSSamplerPlane * generalPlane
General single sampler we use for plane samplers.
void AdjustTransform(G4Transform3D &trans, BDSSamplerType st) const
void ErrorNonPositive(G4double value, const G4String &variableName, const G4String &objectName) const
Utility function to reduce code.
void Place(const BDSBeamlineElement *element, G4double samplerRadius)
Place a sampler from a single element.
std::vector< G4VPhysicalVolume * > placements
Cache of the placements to clean up at the end.
BDSSamplerPlane * GeneralPlane() const
Accessor.
G4String suffix
Just the input part of the world name.
BDSSampler * BuildSampler(const GMAD::SamplerPlacement &samplerPlacement, BDSSamplerType st, G4double &radius) const
Construct the geometry for a sampler. Update 'radius' by reference if applicable.
G4VisAttributes * samplerWorldVis
Visualisation attributes for the sampler world.
Rectangular sampler with fixed thickness but variable x,y.
Base class and registry of sampler instances.
Definition: BDSSampler.hh:36
Sampler placement class for parser.
Parser namespace for GMAD language. Combination of Geant4 and MAD.