DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
ConstructWorld.cc
Go to the documentation of this file.
1#include "DetectorConstruction_includes.hh" // common includes
2#include "VolumeBuilders.hh"
3using namespace CLHEP;
4namespace VB = DLG4::VolumeBuilders; // Geometry builder helpers.
5
6void DetectorConstruction::ConstructWorld() {
7 static bool firstcall = true;
8 if (!firstcall) {
9 // only run once
10 return;
11 }
12 firstcall = false;
13
14 // original version of this code snippet for comparisson:
15 // auto *zero_rot = new G4RotationMatrix();
16 // zero_rot->rotateY(0. * deg); // null rotation, probably redundant.
17 // auto zero_shift = G4ThreeVector(0, 0, 0); // no pointer, because geant copies them.
18 //
19 // G4double bounding_size = 3. * meter / 2.0;
20 // auto boxHall = new G4Box("worldbox", bounding_size, bounding_size, bounding_size);
21 // auto logiHall = new G4LogicalVolume(boxHall, _air, "logiHall");
22 // auto logiHallVis = new G4VisAttributes(G4Colour(0.8, 0.8, 0.8, 0.1));
23 // logiHall->SetVisAttributes(logiHallVis);
24 // logiHall->SetVisAttributes(G4VisAttributes::Invisible);
25 // G4VPhysicalVolume *physHall =
26 // new G4PVPlacement(0, zero_shift, logiHall, "world", NULL, false, 0);
27 // world_phys = physHall;
28
29 // now just becomes:
30 VB::SetGlobalDefaultUnit(CLHEP::mm);
31 world_phys = VB::CreateCenteredBoxBuilder("hallbox", 3000, 3000, 3000)
32 ->SetMaterial(_air)
33 ->SetColor(0.8, 0.8, 0.8, 0.1)
34 ->SetVisibility(false)
35 ->GetPlacement();
36}
BoxBuilder CreateCenteredBoxBuilder(const G4double unit, const G4String &name, const G4double x_full_size, const G4double y_full_size, const G4double z_full_size)
Create a Box solid.
void SetGlobalDefaultUnit(G4double unit)
Set the default unit for all VolumeBuilder methods.