BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSElement.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
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 BDSELEMENT_H
20#define BDSELEMENT_H
21
22#include "BDSAcceleratorComponent.hh"
23#include "BDSGeometryExternal.hh"
24
25#include "globals.hh"
26
27#include <set>
28#include <vector>
29
39{
40public:
41 BDSElement() = delete;
42 BDSElement(const G4String& name,
43 G4double arcLength,
44 G4double horizontalWidthIn,
45 const G4String& geometry,
46 G4double angle = 0,
47 std::vector<G4String>* namedVacuumVolumesIn = nullptr,
48 G4bool autoColourGeometryIn = true,
49 G4bool markAsCollimatorIn = false,
50 G4bool stripOuterVolume = false);
51 virtual ~BDSElement(){;}
52
54 BDSElement& operator=(const BDSElement&) = delete;
57
58 // This is a little convoluted because ultimately we can't change the
59 // behaviour of the base class destructor, which will always be called
60 // even if overridden. So if we want a BDSGeometryComponent that's uniquely
61 // managed by the geometry factory (ie we don't own here) we have to forward
62 // things on for the same access but no deletion.
64 virtual std::set<G4VPhysicalVolume*> GetAllPhysicalVolumes() const;
65 virtual std::set<G4RotationMatrix*> GetAllRotationMatrices() const;
66 virtual std::set<G4VisAttributes*> GetAllVisAttributes() const;
67 virtual std::set<G4UserLimits*> GetAllUserLimits() const;
68 virtual std::set<BDSGeometryComponent*> GetAllDaughters() const;
69 virtual std::set<G4VSolid*> GetAllSolids() const;
70 virtual std::set<G4LogicalVolume*> GetAllLogicalVolumes() const;
71 virtual std::map<G4LogicalVolume*, BDSSDType> GetAllSensitiveVolumes() const;
72 virtual std::set<G4LogicalVolume*> GetAllBiasingVolumes() const;
73 virtual void ExcludeLogicalVolumeFromBiasing(G4LogicalVolume* lv);
74 virtual void AttachSensitiveDetectors();
76
77protected:
80 virtual void Build();
81
83 virtual void BuildContainerLogicalVolume();
84
85private:
86 G4double horizontalWidth;
87 G4String geometryFileName;
88 std::vector<G4String> namedVacuumVolumes;
89 G4bool autoColourGeometry;
90 G4bool markAsCollimator;
91 G4bool stripOuterVolume;
92
95};
96
97#endif
Abstract class that represents a component of an accelerator.
const G4double arcLength
Const protected member variable that may not be changed by derived classes.
const G4String name
Const protected member variable that may not be changed by derived classes.
G4double angle
Protected member variable that can be modified by derived classes.
A class for a generic piece of external geometry.
Definition: BDSElement.hh:39
virtual std::set< BDSGeometryComponent * > GetAllDaughters() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:165
virtual std::set< G4VSolid * > GetAllSolids() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:170
virtual void ExcludeLogicalVolumeFromBiasing(G4LogicalVolume *lv)
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:190
BDSElement & operator=(const BDSElement &)=delete
Assignment and copy constructor not implemented nor used.
BDSGeometryExternal * geometry
Cache of the constructed geometry. Used to forward onto various BDSGeometryComponent functions.
Definition: BDSElement.hh:94
BDSElement(BDSElement &)=delete
Assignment and copy constructor not implemented nor used.
virtual std::set< G4LogicalVolume * > GetAllBiasingVolumes() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:180
virtual void Build()
Definition: BDSElement.cc:58
virtual void BuildContainerLogicalVolume()
This does the full construction. Loads the external geometry and field if there is one.
Definition: BDSElement.cc:66
virtual std::set< G4UserLimits * > GetAllUserLimits() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:160
virtual void AttachSensitiveDetectors()
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:196
virtual std::map< G4LogicalVolume *, BDSSDType > GetAllSensitiveVolumes() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:185
virtual std::set< G4LogicalVolume * > GetAllLogicalVolumes() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:175
virtual std::set< G4VisAttributes * > GetAllVisAttributes() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:155
virtual std::set< G4RotationMatrix * > GetAllRotationMatrices() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:150
virtual std::set< G4VPhysicalVolume * > GetAllPhysicalVolumes() const
Overloads of functions in BDSGeometryComponent.
Definition: BDSElement.cc:145
A loaded piece of externally provided geometry.