Belle II Software development
GeoCOILCreator Class Reference

The GeoCoilCreator class. More...

#include <GeoCOILCreator.h>

Inheritance diagram for GeoCOILCreator:
CreatorBase

Public Member Functions

 GeoCOILCreator ()
 Constructor of the GeoCOILCreator class.
 
virtual ~GeoCOILCreator ()
 The destructor of the GeoCOILCreator class.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Creates the Geant4 objects for the structure geometry from Gearbox.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 Create the configuration objects and save them in the Database.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Create the geometry from the Database.
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 

Private Member Functions

COILGeometryPar readConfiguration (const GearDir &param)
 Creates a parameter object from the Gearbox XML parameters.
 
virtual void createGeometry (const COILGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes)
 Creates the ROOT Objects for the coil geometry.
 

Private Attributes

std::vector< G4VisAttributes * > m_VisAttributes
 Vector of pointers to G4VisAttributes.
 

Detailed Description

The GeoCoilCreator class.

The creator for the the Belle II coil.

Definition at line 38 of file GeoCOILCreator.h.

Constructor & Destructor Documentation

◆ GeoCOILCreator()

Constructor of the GeoCOILCreator class.

Definition at line 66 of file GeoCOILCreator.cc.

67 {
68 m_VisAttributes.clear();
69 m_VisAttributes.push_back(new G4VisAttributes(false)); // for "invisible"
70 }
std::vector< G4VisAttributes * > m_VisAttributes
Vector of pointers to G4VisAttributes.

◆ ~GeoCOILCreator()

~GeoCOILCreator ( )
virtual

The destructor of the GeoCOILCreator class.

Definition at line 73 of file GeoCOILCreator.cc.

74 {
75 for (G4VisAttributes* visAttr : m_VisAttributes) delete visAttr;
76 m_VisAttributes.clear();
77 }

Member Function Documentation

◆ create()

void create ( const GearDir content,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
overridevirtual

Creates the Geant4 objects for the structure geometry from Gearbox.

This is the 'old' way of building the geometry from Gearbox (xml files). Expected to be deprecated in the future.

Parameters
contentA reference to the content part of the parameter description, which should to be used to create the ROOT objects.
topVolumeGeant4 logical top volume.
typeGeometry type.

Implements CreatorBase.

Definition at line 80 of file GeoCOILCreator.cc.

81 {
82 COILGeometryPar config = readConfiguration(content);
83 createGeometry(config, topVolume, type);
84 }
COILGeometryPar readConfiguration(const GearDir &param)
Creates a parameter object from the Gearbox XML parameters.
virtual void createGeometry(const COILGeometryPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes)
Creates the ROOT Objects for the coil geometry.

◆ createFromDB()

void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
overridevirtual

Create the geometry from the Database.

Reimplemented from CreatorBase.

Definition at line 95 of file GeoCOILCreator.cc.

96 {
97 DBObjPtr<COILGeometryPar> dbObj;
98 if (!dbObj) {
99 // Check that we found the object and if not report the problem
100 B2FATAL("No configuration for " << name << " found.");
101 }
102 createGeometry(*dbObj, topVolume, type);
103 }

◆ createGeometry()

void createGeometry ( const COILGeometryPar parameters,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes   
)
privatevirtual

Creates the ROOT Objects for the coil geometry.

Parameters
parametersA database object containing the geometry information
topVolumeA Geant4 volume where to place the item

Definition at line 149 of file GeoCOILCreator.cc.

150 {
151 // Global parameters
152 double GlobalRotAngle = parameters.getGlobalRotAngle();
153 double GlobalOffsetZ = parameters.getGlobalOffsetZ();
154
155
156 // Cryostat
158
159 string strMatCryo = parameters.getCryoMaterial();
160 double CryoRmin = parameters.getCryoRmin();
161 double CryoRmax = parameters.getCryoRmax();
162 double CryoLength = parameters.getCryoLength();
163
164 G4Material* matCryostat = Materials::get(strMatCryo);
165 G4Tubs* CryoTube =
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);
171
172
173 // Cavity #1
175 string strMatCav1 = parameters.getCav1Material();
176 double Cav1Rmin = parameters.getCav1Rmin();
177 double Cav1Rmax = parameters.getCav1Rmax();
178 double Cav1Length = parameters.getCav1Length();
179
180 G4Material* matCav1 = Materials::get(strMatCav1);
181
182 G4Tubs* Cav1Tube =
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);
189
190
191 // Rad Shield
193 string strMatShield = parameters.getShieldMaterial();
194 double ShieldRmin = parameters.getShieldRmin();
195 double ShieldRmax = parameters.getShieldRmax();
196 double ShieldLength = parameters.getShieldLength();
197
198 G4Material* matShield = Materials::get(strMatShield);
199
200 G4Tubs* ShieldTube =
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);
207
208
209 // Cavity #2
211 string strMatCav2 = parameters.getCav2Material();
212 double Cav2Rmin = parameters.getCav2Rmin();
213 double Cav2Rmax = parameters.getCav2Rmax();
214 double Cav2Length = parameters.getCav2Length();
215
216 G4Material* matCav2 = Materials::get(strMatCav2);
217
218 G4Tubs* Cav2Tube =
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);
225
226
227 // Coil
229 string strMatCoil = parameters.getCoilMaterial();
230 double CoilRmin = parameters.getCoilRmin();
231 double CoilRmax = parameters.getCoilRmax();
232 double CoilLength = parameters.getCoilLength();
233
234 G4Material* matCoil = Materials::get(strMatCoil);
235
236 G4Tubs* CoilTube =
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);
243
244 }
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63

◆ createPayloads()

void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
overridevirtual

Create the configuration objects and save them in the Database.

If more than one object is needed adjust accordingly

Reimplemented from CreatorBase.

Definition at line 87 of file GeoCOILCreator.cc.

88 {
89 DBImportObjPtr<COILGeometryPar> importObj;
90 importObj.construct(readConfiguration(content));
91 importObj.import(iov);
92 }

◆ readConfiguration()

COILGeometryPar readConfiguration ( const GearDir param)
private

Creates a parameter object from the Gearbox XML parameters.

If more than one object is created these could be assigned to members or you could return a tuple.

Parameters
paramA reference to the content part of the parameter description, which should to be used to create the ROOT objects.

Definition at line 107 of file GeoCOILCreator.cc.

108 {
109 COILGeometryPar parameters;
110
111 // Global parameters
112 parameters.setGlobalRotAngle(content.getAngle("Rotation") / Unit::rad);
113 parameters.setGlobalOffsetZ(content.getLength("OffsetZ") / Unit::mm);
114
115 // Cryostat
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);
120
121 //Cavity #1
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);
126
127 // Radiation Shield
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);
132
133 // Cavity #2
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);
138
139 // Coil
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);
144
145 return parameters;
146 }
static const double mm
[millimeters]
Definition: Unit.h:70
static const double rad
Standard of [angle].
Definition: Unit.h:50

Member Data Documentation

◆ m_VisAttributes

std::vector<G4VisAttributes*> m_VisAttributes
private

Vector of pointers to G4VisAttributes.

Definition at line 86 of file GeoCOILCreator.h.


The documentation for this class was generated from the following files: