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");
66 GeoCOILCreator::GeoCOILCreator()
68 m_VisAttributes.clear();
69 m_VisAttributes.push_back(
new G4VisAttributes(
false));
73 GeoCOILCreator::~GeoCOILCreator()
75 for (G4VisAttributes* visAttr : m_VisAttributes)
delete visAttr;
76 m_VisAttributes.clear();
83 createGeometry(config, topVolume, type);
90 importObj.
construct(readConfiguration(content));
100 B2FATAL(
"No configuration for " << name <<
" found.");
102 createGeometry(*dbObj, topVolume, type);
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();
164 G4Material* matCryostat = Materials::get(strMatCryo);
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();
180 G4Material* matCav1 = Materials::get(strMatCav1);
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);
186 m_VisAttributes.push_back(
new G4VisAttributes(G4Colour(0., 1., 0.)));
187 Cav1LV->SetVisAttributes(m_VisAttributes.back());
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();
198 G4Material* matShield = Materials::get(strMatShield);
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);
204 m_VisAttributes.push_back(
new G4VisAttributes(G4Colour(1., 1., 0.)));
205 ShieldLV->SetVisAttributes(m_VisAttributes.back());
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();
216 G4Material* matCav2 = Materials::get(strMatCav2);
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);
222 m_VisAttributes.push_back(
new G4VisAttributes(G4Colour(1., 1., 1.)));
223 Cav2LV->SetVisAttributes(m_VisAttributes.back());
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();
234 G4Material* matCoil = Materials::get(strMatCoil);
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);
240 m_VisAttributes.push_back(
new G4VisAttributes(G4Colour(0., 1., 1.)));
241 CoilLV->SetVisAttributes(m_VisAttributes.back());
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.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.