9#include <structure/geometry/GeoCOILCreator.h>
10#include <structure/dbobjects/COILGeometryPar.h>
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
15#include <framework/gearbox/Unit.h>
16#include <framework/gearbox/GearDir.h>
17#include <framework/logging/Logger.h>
19#include <framework/database/DBObjPtr.h>
20#include <framework/database/DBImportObjPtr.h>
21#include <framework/database/IntervalOfValidity.h>
25#include <G4LogicalVolume.hh>
26#include <G4PVPlacement.hh>
28#include <G4Transform3D.hh>
29#include <G4VisAttributes.hh>
54 using namespace geometry;
61 geometry::CreatorFactory<GeoCOILCreator> GeoCOILFactory(
"COILCreator");
100 B2FATAL(
"No configuration for " << name <<
" found.");
112 parameters.setGlobalRotAngle(content.getAngle(
"Rotation") /
Unit::rad);
113 parameters.setGlobalOffsetZ(content.getLength(
"OffsetZ") /
Unit::mm);
116 parameters.setCryoMaterial(content.getString(
"Cryostat/Material",
"Air"));
117 parameters.setCryoRmin(content.getLength(
"Cryostat/Rmin") /
Unit::mm);
118 parameters.setCryoRmax(content.getLength(
"Cryostat/Rmax") /
Unit::mm);
119 parameters.setCryoLength(content.getLength(
"Cryostat/HalfLength") /
Unit::mm);
122 parameters.setCav1Material(content.getString(
"Cavity1/Material",
"Air"));
123 parameters.setCav1Rmin(content.getLength(
"Cavity1/Rmin") /
Unit::mm);
124 parameters.setCav1Rmax(content.getLength(
"Cavity1/Rmax") /
Unit::mm);
125 parameters.setCav1Length(content.getLength(
"Cavity1/HalfLength") /
Unit::mm);
128 parameters.setShieldMaterial(content.getString(
"RadShield/Material",
"Air"));
129 parameters.setShieldRmin(content.getLength(
"RadShield/Rmin") /
Unit::mm);
130 parameters.setShieldRmax(content.getLength(
"RadShield/Rmax") /
Unit::mm);
131 parameters.setShieldLength(content.getLength(
"RadShield/HalfLength") /
Unit::mm);
134 parameters.setCav2Material(content.getString(
"Cavity2/Material",
"Air"));
135 parameters.setCav2Rmin(content.getLength(
"Cavity2/Rmin") /
Unit::mm);
136 parameters.setCav2Rmax(content.getLength(
"Cavity2/Rmax") /
Unit::mm);
137 parameters.setCav2Length(content.getLength(
"Cavity2/HalfLength") /
Unit::mm);
140 parameters.setCoilMaterial(content.getString(
"Coil/Material",
"Air"));
141 parameters.setCoilRmin(content.getLength(
"Coil/Rmin") /
Unit::mm);
142 parameters.setCoilRmax(content.getLength(
"Coil/Rmax") /
Unit::mm);
143 parameters.setCoilLength(content.getLength(
"Coil/HalfLength") /
Unit::mm);
152 double GlobalRotAngle = parameters.getGlobalRotAngle();
153 double GlobalOffsetZ = parameters.getGlobalOffsetZ();
159 string strMatCryo = parameters.getCryoMaterial();
160 double CryoRmin = parameters.getCryoRmin();
161 double CryoRmax = parameters.getCryoRmax();
162 double CryoLength = parameters.getCryoLength();
166 new G4Tubs(
"Cryostat", CryoRmin, CryoRmax, CryoLength, 0.0, M_PI * 2.0);
167 G4LogicalVolume* CryoLV =
168 new G4LogicalVolume(CryoTube, matCryostat,
"LVCryo", 0, 0, 0);
169 new G4PVPlacement(G4TranslateZ3D(GlobalOffsetZ) * G4RotateZ3D(GlobalRotAngle),
170 CryoLV,
"PVCryo", &topVolume,
false, 0);
175 string strMatCav1 = parameters.getCav1Material();
176 double Cav1Rmin = parameters.getCav1Rmin();
177 double Cav1Rmax = parameters.getCav1Rmax();
178 double Cav1Length = parameters.getCav1Length();
183 new G4Tubs(
"Cavity1", Cav1Rmin, Cav1Rmax, Cav1Length, 0.0, M_PI * 2.0);
184 G4LogicalVolume* Cav1LV =
185 new G4LogicalVolume(Cav1Tube, matCav1,
"LVCav1", 0, 0, 0);
188 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), Cav1LV,
"PVCav1", CryoLV,
false, 0);
193 string strMatShield = parameters.getShieldMaterial();
194 double ShieldRmin = parameters.getShieldRmin();
195 double ShieldRmax = parameters.getShieldRmax();
196 double ShieldLength = parameters.getShieldLength();
201 new G4Tubs(
"RadShield", ShieldRmin, ShieldRmax, ShieldLength, 0.0, M_PI * 2.0);
202 G4LogicalVolume* ShieldLV =
203 new G4LogicalVolume(ShieldTube, matShield,
"LVShield", 0, 0, 0);
206 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), ShieldLV,
"PVShield", Cav1LV,
false, 0);
211 string strMatCav2 = parameters.getCav2Material();
212 double Cav2Rmin = parameters.getCav2Rmin();
213 double Cav2Rmax = parameters.getCav2Rmax();
214 double Cav2Length = parameters.getCav2Length();
219 new G4Tubs(
"Cavity2", Cav2Rmin, Cav2Rmax, Cav2Length, 0.0, M_PI * 2.0);
220 G4LogicalVolume* Cav2LV =
221 new G4LogicalVolume(Cav2Tube, matCav2,
"LVCav2", 0, 0, 0);
224 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), Cav2LV,
"PVCav2", ShieldLV,
false, 0);
229 string strMatCoil = parameters.getCoilMaterial();
230 double CoilRmin = parameters.getCoilRmin();
231 double CoilRmax = parameters.getCoilRmax();
232 double CoilLength = parameters.getCoilLength();
237 new G4Tubs(
"Coil", CoilRmin, CoilRmax, CoilLength, 0.0, M_PI * 2.0);
238 G4LogicalVolume* CoilLV =
239 new G4LogicalVolume(CoilTube, matCoil,
"LVCoil", 0, 0, 0);
242 new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), CoilLV,
"PVCoil", Cav2LV,
false, 0);
The Class for COIL geometry parameters.
bool import(const IntervalOfValidity &iov)
Import the object to database.
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Class for accessing objects in the database.
GearDir is the basic class used for accessing the parameter store.
A class that describes the interval of experiments/runs for which an object in the database is valid.
static const double mm
[millimeters]
static const double rad
Standard of [angle].
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
std::vector< G4VisAttributes * > m_VisAttributes
Vector of pointers to G4VisAttributes.
COILGeometryPar readConfiguration(const GearDir ¶m)
Creates a parameter object from the Gearbox XML parameters.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
GeoCOILCreator()
Constructor of the GeoCOILCreator class.
virtual ~GeoCOILCreator()
The destructor of the GeoCOILCreator class.
virtual void createGeometry(const COILGeometryPar ¶meters, G4LogicalVolume &topVolume, geometry::GeometryTypes)
Creates the ROOT Objects for the coil geometry.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the Geant4 objects for the structure geometry from Gearbox.
static G4Material * get(const std::string &name)
Find given material.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.