BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSDrift.cc
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#include "BDSAcceleratorComponent.hh"
20#include "BDSDrift.hh"
21#include "BDSBeamPipe.hh"
22#include "BDSBeamPipeFactory.hh"
23#include "BDSBeamPipeInfo.hh"
24
25#include "globals.hh" // geant4 globals / types
26#include "G4Material.hh"
27
28BDSDrift::BDSDrift(G4String nameIn,
29 G4double lengthIn,
30 BDSBeamPipeInfo* beamPipeInfoIn):
31 BDSAcceleratorComponent(nameIn, lengthIn, 0, "drift", beamPipeInfoIn)
32{;}
33
34BDSDrift::~BDSDrift()
35{;}
36
38{
40 BDSBeamPipe* pipe = factory->CreateBeamPipe(name,
43
44 RegisterDaughter(pipe);
45
46 // make the beam pipe container, this object's container
47 containerLogicalVolume = pipe->GetContainerLogicalVolume();
48 containerSolid = pipe->GetContainerSolid();
49
50 // register vacuum volume (for biasing)
52
53 // update extents
54 InheritExtents(pipe);
55
56 // update faces
59}
60
61G4String BDSDrift::Material() const
62{
63 auto bpMat = GetBeamPipeInfo()->beamPipeMaterial;
64 if (bpMat)
65 {return bpMat->GetName();}
66 else
67 {return BDSAcceleratorComponent::Material();} // none
68}
Abstract class that represents a component of an accelerator.
virtual G4String Material() const
Return the name of a material associated with the component - ie the primary material.
void SetAcceleratorVacuumLogicalVolume(G4LogicalVolume *accVacLVIn)
const G4String name
Const protected member variable that may not be changed by derived classes.
virtual void SetOutputFaceNormal(const G4ThreeVector &output)
Allow updating of face normals. Virtual so derived class may apply it to daughters.
BDSBeamPipeInfo * GetBeamPipeInfo() const
virtual void SetInputFaceNormal(const G4ThreeVector &input)
Allow updating of face normals. Virtual so derived class may apply it to daughters.
G4double chordLength
Protected member variable that can be modified by derived classes.
BDSBeamPipeInfo * beamPipeInfo
Optional beam pipe recipe that is written out to the survey if it exists.
The main interface for using the beam pipe factories.
static BDSBeamPipeFactory * Instance()
Singleton accessor.
Holder class for all information required to describe a beam pipe model.
G4Material * beamPipeMaterial
Public member for direct access.
A holder class for a piece of beam pipe geometry.
Definition: BDSBeamPipe.hh:45
G4LogicalVolume * GetVacuumLogicalVolume() const
Access the vacuum volume to set fields and limits.
Definition: BDSBeamPipe.hh:65
G4ThreeVector InputFaceNormal() const
Accessor.
Definition: BDSBeamPipe.hh:73
G4ThreeVector OutputFaceNormal() const
Accessor.
Definition: BDSBeamPipe.hh:74
BDSDrift()=delete
No default constructor.
virtual void Build()
Construct geometry.
Definition: BDSDrift.cc:37
virtual G4String Material() const
Override base class version and return beam pipe material if it exists.
Definition: BDSDrift.cc:61
G4LogicalVolume * GetContainerLogicalVolume() const
Accessor - see member for more info.
void InheritExtents(BDSGeometryComponent const *const anotherComponent)
Update the extents of this object with those of another object.
void RegisterDaughter(BDSGeometryComponent *anotherComponent)
G4VSolid * GetContainerSolid() const
Accessor - see member for more info.