BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSComponentFactoryUser.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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 BDSCOMPONENTFACTORYUSER_H
20#define BDSCOMPONENTFACTORYUSER_H
21
22#include "BDSFieldType.hh"
23#include "BDSMagnetStrength.hh"
24#include "BDSMagnetType.hh"
25#include "BDSIntegratorSetType.hh"
26
27#include "globals.hh"
28#include "G4ThreeVector.hh"
29#include "G4Transform3D.hh"
30
31#include "CLHEP/Units/PhysicalConstants.h"
32
33#include <map>
34
35class G4Colour;
36class G4Material;
37
38namespace GMAD
39{
40 struct Element;
41}
43class BDSBeamPipeInfo;
44class BDSCavityInfo;
46class BDSCrystalInfo;
47class BDSFieldInfo;
49class BDSMagnet;
52class BDSTiltOffset;
53
61{
62public:
65
67 void RegisterComponent(const G4String& componentTypeName,
68 BDSComponentConstructor* componentConstructor);
69
71 G4bool CanConstructComponentByName(const G4String& componentTypeName) const;
72
75 BDSAcceleratorComponent* ConstructComponent(const G4String& componentTypeName,
76 GMAD::Element const* elementIn,
77 GMAD::Element const* prevElementIn,
78 GMAD::Element const* nextElementIn,
79 G4double currentArcLength = 0);
80
81
83 void SetDesignParticle(const BDSParticleDefinition* designParticleIn);
84
85private:
87 std::map<G4String, BDSComponentConstructor*> userFunctions;
88
90 G4double brho;
91 G4double beta0;
92};
93#endif
Abstract class that represents a component of an accelerator.
Holder class for all information required to describe a beam pipe model.
Holder for all Geometrical information required to create an RF cavity.
Interface class the developer should derive to construct their element.
Factory for user specified accelerator components.
const BDSParticleDefinition * designParticle
Particle w.r.t. which elements are built.
G4bool CanConstructComponentByName(const G4String &componentTypeName) const
Check whether a component can be constructed - ie if the name exists.
void RegisterComponent(const G4String &componentTypeName, BDSComponentConstructor *componentConstructor)
Register a constructor instance by a given name.
G4double brho
Cache of nominal beam rigidity.
std::map< G4String, BDSComponentConstructor * > userFunctions
Map of user component name with constructors to build a component.
void SetDesignParticle(const BDSParticleDefinition *designParticleIn)
Update values for nominal rigidity and relativisitic beta of the beam particle.
G4double beta0
Cache of nominal relativistic beta for the beam particle.
BDSAcceleratorComponent * ConstructComponent(const G4String &componentTypeName, GMAD::Element const *elementIn, GMAD::Element const *prevElementIn, GMAD::Element const *nextElementIn, G4double currentArcLength=0)
Holder for all information required to create a crystal.
All info required to build complete field of any type.
Definition: BDSFieldInfo.hh:65
Which integrator to use for each type of magnet / field object.
Holder struct of all information required to create the outer geometry of a magnet.
Abstract base class that implements features common to all magnets.
Definition: BDSMagnet.hh:45
Wrapper for particle definition.
A holder for any placement offsets and rotations for a BDSAcceleratorComponent.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
Element class.
Definition: element.h:43