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) 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#include "BDSAcceleratorComponent.hh"
19#include "BDSDrift.hh"
20#include "BDSBeamPipe.hh"
21#include "BDSBeamPipeFactory.hh"
22#include "BDSBeamPipeInfo.hh"
23
24#include "globals.hh" // geant4 globals / types
25#include "G4Material.hh"
26
27BDSDrift::BDSDrift(G4String nameIn,
28 G4double lengthIn,
29 BDSBeamPipeInfo* beamPipeInfoIn):
30 BDSAcceleratorComponent(nameIn, lengthIn, 0, "drift", beamPipeInfoIn)
31{;}
32
33BDSDrift::~BDSDrift()
34{;}
35
37{
39 BDSBeamPipe* pipe = factory->CreateBeamPipe(name,
42
43 RegisterDaughter(pipe);
44
45 // make the beam pipe container, this object's container
46 containerLogicalVolume = pipe->GetContainerLogicalVolume();
47 containerSolid = pipe->GetContainerSolid();
48
49 // register vacuum volume (for biasing)
51
52 // update extents
53 InheritExtents(pipe);
54
55 // update faces
58}
59
60G4String BDSDrift::Material() const
61{
62 auto bpMat = GetBeamPipeInfo()->beamPipeMaterial;
63 if (bpMat)
64 {return bpMat->GetName();}
65 else
66 {return BDSAcceleratorComponent::Material();} // none
67}
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.
G4LogicalVolume * GetVacuumLogicalVolume() const
Access the vacuum volume to set fields and limits.
G4ThreeVector InputFaceNormal() const
Accessor.
G4ThreeVector OutputFaceNormal() const
Accessor.
BDSDrift()=delete
No default constructor.
virtual void Build()
Construct geometry.
Definition BDSDrift.cc:36
virtual G4String Material() const
Override base class version and return beam pipe material if it exists.
Definition BDSDrift.cc:60
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.