Belle II Software  release-08-01-10
CaveCreator Class Reference

The creator for the CAVE geometry. More...

#include <CaveCreator.h>

Inheritance diagram for CaveCreator:
Collaboration diagram for CaveCreator:

Public Member Functions

 CaveCreator ()
 Constructor.
 
virtual ~CaveCreator ()
 Destructor.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Creation of the detector geometry from Gearbox (XML). More...
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, GeometryTypes type)
 Function to create the geometry from the Database. More...
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov)
 Function to create the geometry database. More...
 

Protected Attributes

SensitiveDetectorm_sensitive
 SensitiveDetector cave.
 

Detailed Description

The creator for the CAVE geometry.

Definition at line 27 of file CaveCreator.h.

Member Function Documentation

◆ create()

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

Creation of the detector geometry from Gearbox (XML).

Parameters
[in]contentXML data directory.
[in]topVolumeGeant world volume.
[in]typeGeometry type.

Implements CreatorBase.

Definition at line 53 of file CaveCreator.cc.

54  {
55 
57 
58  G4double density;
59  G4double A;
60  G4int Z;
61 
62  G4String name, symbol;
63 
64  A = 1.01 * CLHEP::g / CLHEP::mole;
65  G4Element* elH = new G4Element(name = "Hydrogen", symbol = "H", Z = 1, A);
66 
67  A = 12.01 * CLHEP::g / CLHEP::mole;
68  G4Element* elC = new G4Element(name = "Carbon", symbol = "C", Z = 6, A);
69 
70  A = 16.00 * CLHEP::g / CLHEP::mole;
71  G4Element* elO = new G4Element(name = "Oxygen", symbol = "O", Z = 8, A);
72 
73  A = 22.99 * CLHEP::g / CLHEP::mole;
74  G4Element* elNa = new G4Element(name = "Natrium", symbol = "Na", Z = 11, A);
75 
76  A = 200.59 * CLHEP::g / CLHEP::mole;
77  G4Element* elHg = new G4Element(name = "Hg", symbol = "Hg", Z = 80, A);
78 
79  A = 26.98 * CLHEP::g / CLHEP::mole;
80  G4Element* elAl = new G4Element(name = "Aluminium", symbol = "Al", Z = 13, A);
81 
82  A = 28.09 * CLHEP::g / CLHEP::mole;
83  G4Element* elSi = new G4Element(name = "Silicon", symbol = "Si", Z = 14, A);
84 
85  A = 39.1 * CLHEP::g / CLHEP::mole;
86  G4Element* elK = new G4Element(name = "K", symbol = "K", Z = 19, A);
87 
88  A = 69.72 * CLHEP::g / CLHEP::mole;
89  G4Element* elCa = new G4Element(name = "Calzium", symbol = "Ca", Z = 31, A);
90 
91  A = 55.85 * CLHEP::g / CLHEP::mole;
92  G4Element* elFe = new G4Element(name = "Iron", symbol = "Fe", Z = 26, A);
93 
94  density = 2.03 * CLHEP::g / CLHEP::cm3;
95  G4Material* Concrete = new G4Material("Concrete", density, 10);
96  Concrete->AddElementByMassFraction(elH, 0.01);
97  Concrete->AddElementByMassFraction(elO, 0.529);
98  Concrete->AddElementByMassFraction(elNa, 0.016);
99  Concrete->AddElementByMassFraction(elHg, 0.002);
100  Concrete->AddElementByMassFraction(elAl, 0.034);
101  Concrete->AddElementByMassFraction(elSi, 0.337);
102  Concrete->AddElementByMassFraction(elK, 0.013);
103  Concrete->AddElementByMassFraction(elCa, 0.044);
104  Concrete->AddElementByMassFraction(elFe, 0.014);
105  Concrete->AddElementByMassFraction(elC, 0.001);
106 
107 
108  //lets get the stepsize parameter with a default value of 5 µm
109  double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
110 
111  //no get the array. Notice that the default framework unit is cm, so the
112  //values will be automatically converted
113  vector<double> bar = content.getArray("bar");
114  B2INFO("Contents of bar: ");
115  BOOST_FOREACH(double value, bar) {
116  B2INFO("value: " << value);
117  }
118  int detID = 0;
119  //Lets loop over all the Active nodes
120  BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
121 
122  //create cave volume
123  G4Box* s_CAVE = new G4Box("s_CAVE",
124  activeParams.getLength("px")*CLHEP::cm,
125  activeParams.getLength("py")*CLHEP::cm,
126  activeParams.getLength("pz")*CLHEP::cm);
127 
128  //G4LogicalVolume* l_CAVE = new G4LogicalVolume(s_CAVE, geometry::Materials::get("CAVE"), "l_CAVE", 0, m_sensitive);
129  G4LogicalVolume* l_CAVE = new G4LogicalVolume(s_CAVE, Concrete, "l_CAVE", 0, 0);
130 
131  //Lets limit the Geant4 stepsize inside the volume
132  l_CAVE->SetUserLimits(new G4UserLimits(stepSize));
133 
134  //position cave volume
135  G4ThreeVector CAVEpos = G4ThreeVector(
136  activeParams.getLength("x_cave") * CLHEP::cm,
137  activeParams.getLength("y_cave") * CLHEP::cm,
138  activeParams.getLength("z_cave") * CLHEP::cm
139  );
140 
141  G4RotationMatrix* rot_cave = new G4RotationMatrix();
142  rot_cave->rotateX(activeParams.getLength("AngleX"));
143  rot_cave->rotateY(activeParams.getLength("AngleY"));
144  rot_cave->rotateZ(activeParams.getLength("AngleZ"));
145  //geometry::setColor(*l_CAVE, "#006699");
146  //double angle = activeParams.getDouble("angle");
147  //double rx = activeParams.getDouble("rx");
148  //double ry = activeParams.getDouble("ry");
149  //double rz = activeParams.getDouble("rz");
150  //rot_cave->rotate(-angle, G4ThreeVector(rx, ry, rz));
151  new G4PVPlacement(rot_cave, CAVEpos, l_CAVE, "p_CAVE", &topVolume, false, detID);
152 
153  detID++;
154  }
155  }
SensitiveDetector * m_sensitive
SensitiveDetector cave.
Definition: CaveCreator.h:48
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.

◆ createFromDB()

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

Function to create the geometry from the Database.

Parameters
namename of the component in the database, could be used to disambiguate multiple components created with the same creator
topVolumeTop volume in which the geometry has to be placed
typeType of geometry to be build

Reimplemented in GeoVXDServiceCreator, GeoHeavyMetalShieldCreator, GeoTOPCreator, GeoSVDCreator, GeoSTRCreator, GeoServiceMaterialCreator, GeoCOILCreator, GeoPXDCreator, GeoKLMCreator, GeoEKLMCreator, GeoBKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, GeoBeamPipeCreator, MyDBCreator, GeoECLCreator, GeoCDCCreatorReducedCDC, GeoCDCCreator, BeamabortCreator, GeoARICHCreator, and GeoMagneticField.

Definition at line 17 of file CreatorBase.cc.

◆ createPayloads()

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

Function to create the geometry database.

This function should be implemented to convert Gearbox parameters to one ore more database payloads

Parameters
contentGearDir pointing to the parameters which should be used for construction
iovinterval of validity to use when generating payloads

Reimplemented in GeoVXDServiceCreator, GeoHeavyMetalShieldCreator, GeoTOPCreator, GeoSVDCreator, GeoSTRCreator, GeoServiceMaterialCreator, GeoCOILCreator, GeoPXDCreator, GeoKLMCreator, GeoEKLMCreator, GeoBKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, GeoBeamPipeCreator, MyDBCreator, GeoMagneticField, GeoECLCreator, GeoCDCCreatorReducedCDC, GeoCDCCreator, BeamabortCreator, and GeoARICHCreator.

Definition at line 24 of file CreatorBase.cc.


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