BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSCavityElement.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 "BDSBeamPipeInfo.hh"
21#include "BDSBeamPipeType.hh"
22#include "BDSCavity.hh"
23#include "BDSCavityElement.hh"
24#include "BDSCavityFactory.hh"
25#include "BDSCavityInfo.hh"
26#include "BDSExtent.hh"
27#include "BDSFieldBuilder.hh"
28#include "BDSFieldInfo.hh"
29
30#include "globals.hh" // geant4 globals / types
31#include "G4LogicalVolume.hh"
32
33
34BDSCavityElement::BDSCavityElement(const G4String& nameIn,
35 G4double chordLengthIn,
36 G4Material* vacuumMaterialIn,
37 const BDSFieldInfo* vacuumFieldInfoIn,
38 const BDSCavityInfo* cavityInfoIn):
39 BDSAcceleratorComponent(nameIn, chordLengthIn, 0,
40 "cavity_"+cavityInfoIn->cavityType.ToString()),
41 vacuumFieldInfo(vacuumFieldInfoIn),
42 cavityInfo(cavityInfoIn),
43 vacuumMaterial(vacuumMaterialIn)
44{
45 beamPipeInfo = new BDSBeamPipeInfo(BDSBeamPipeType::circular,
46 cavityInfo->irisRadius, 0, 0, 0,
47 vacuumMaterialIn,
48 cavityInfo->thickness,
49 cavityInfo->material);
50}
51
52BDSCavityElement::~BDSCavityElement()
53{
54 delete vacuumFieldInfo;
55 delete cavityInfo;
56}
57
59{;}
60
62{
67 RegisterDaughter(cavity);
68
69 // make the beam pipe container, this object's container
70 containerLogicalVolume = cavity->GetContainerLogicalVolume();
71 containerSolid = cavity->GetContainerSolid();
72
73 // register vacuum volume (for biasing)
75
76 // update extents
77 InheritExtents(cavity);
78
79 // field
80 BuildField();
81
84}
85
87{
90 true);
91}
Abstract class that represents a component of an accelerator.
void SetAcceleratorVacuumLogicalVolume(G4LogicalVolume *accVacLVIn)
const G4String name
Const protected member variable that may not be changed by derived classes.
virtual std::set< G4LogicalVolume * > GetAcceleratorVacuumLogicalVolumes() const
Access the 'vacuum' volume(s) in this component if any. Default is empty set.
virtual void AttachUserLimits() const
Doesn't change member variables, but may change their contents.
G4double chordLength
Protected member variable that can be modified by derived classes.
Holder class for all information required to describe a beam pipe model.
G4Material * vacuumMaterial
Cache of material to be used for vacuum - does not own it.
virtual void BuildContainerLogicalVolume() override
BDSCavityElement()=delete
Private constructor to force the use of the provided one.
const BDSCavityInfo * cavityInfo
Convenience shortcut to cavity information inside field information object.
const BDSFieldInfo * vacuumFieldInfo
Recipe for field.
virtual void Build() override
The full construction sequence that calls all methods in order.
virtual void BuildField()
Creates field objects - doesn't nothing by default and derived classes can override.
static BDSCavityFactory * Instance()
Singleton accessor.
BDSCavity * CreateCavity(const G4String &name, G4double totalChordLength, const BDSCavityInfo *info, G4Material *vacuumMaterial)
Main function to create a piece of cavity geometry.
Holder for all Geometrical information required to create an RF cavity.
A holder class for an RF cavity piece of geometry.
Definition: BDSCavity.hh:39
G4LogicalVolume * GetVacuumLogicalVolume() const
Access the vacuum volume to set fields and limits.
Definition: BDSCavity.hh:51
void RegisterFieldForConstruction(const BDSFieldInfo *info, G4LogicalVolume *logicalVolume, const G4bool propagateToDaughters=false, const BDSMagnetStrength *magnetStrengthForScaling=nullptr, const G4String &scalingKey="none")
static BDSFieldBuilder * Instance()
Singleton pattern accessor.
All info required to build complete field of any type.
Definition: BDSFieldInfo.hh:66
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.