BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSParallelWorldSampler.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 BDSPARALLELWORLDSAMPER_H
19#define BDSPARALLELWORLDSAMPER_H
20
21#include "BDSBeamPipeType.hh"
22#include "BDSSamplerType.hh"
23
24#include "globals.hh"
25#include "G4String.hh"
26#include "G4VUserParallelWorld.hh"
27
28#include <map>
29#include <vector>
30
31class G4VisAttributes;
32class G4VPhysicalVolume;
34class BDSSampler;
35class BDSSamplerPlane;
36namespace GMAD
37{
38 class SamplerPlacement;
39}
40
47class BDSParallelWorldSampler: public G4VUserParallelWorld
48{
49public:
51 explicit BDSParallelWorldSampler(const G4String& name);
53
56 virtual void Construct();
57
60 G4LogicalVolume* WorldLV() const {return samplerWorldLV;}
62
64 void Place(const BDSBeamlineElement* element,
65 G4double samplerRadius);
66
67private:
69 void ErrorNonPositive(G4double value,
70 const G4String& variableName,
71 const G4String& objectName) const;
72
74 BDSSampler* BuildSampler(const GMAD::SamplerPlacement& samplerPlacement,
76 G4double& radius) const;
77
80 void AdjustTransform(G4Transform3D& trans,
81 BDSSamplerType st) const;
82
84 std::vector<G4VPhysicalVolume*> placements;
85
86 G4String suffix;
87 G4VisAttributes* samplerWorldVis;
89 std::map<int, BDSSamplerPlane*> samplerInstances;
90 G4LogicalVolume* samplerWorldLV;
91};
92
93#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:35
Sampler placement class for parser.
Parser namespace for GMAD language. Combination of Geant4 and MAD.