31#include "B4DetectorConstruction.hh"
34#include "TG4GeometryManager.h"
36#include "G4Material.hh"
37#include "G4NistManager.hh"
39#include "G4AutoDelete.hh"
41#include "G4GlobalMagFieldMessenger.hh"
42#include "G4LogicalVolume.hh"
43#include "G4PVPlacement.hh"
44#include "G4PVReplica.hh"
46#include "G4GeometryManager.hh"
47#include "G4LogicalVolumeStore.hh"
48#include "G4PhysicalVolumeStore.hh"
49#include "G4SolidStore.hh"
52#include "G4VisAttributes.hh"
54#include "G4PhysicalConstants.hh"
55#include "G4SystemOfUnits.hh"
59G4ThreadLocal G4GlobalMagFieldMessenger*
91 G4NistManager* nistManager = G4NistManager::Instance();
92 nistManager->FindOrBuildMaterial(
"G4_Pb");
99 "liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
103 new G4Material(
"Galactic", z = 1., a = 1.01 * g / mole,
104 density = universe_mean_density, kStateGas, 2.73 * kelvin, 3.e-18 * pascal);
107 G4cout << *(G4Material::GetMaterialTable()) << G4endl;
115 G4int nofLayers = 10;
116 G4double absoThickness = 10. * mm;
117 G4double gapThickness = 5. * mm;
118 G4double calorSizeXY = 10. * cm;
120 G4double layerThickness = absoThickness + gapThickness;
121 G4double calorThickness = nofLayers * layerThickness;
122 G4double worldSizeXY = 1.2 * calorSizeXY;
123 G4double worldSizeZ = 1.2 * calorThickness;
126 G4Material* defaultMaterial = G4Material::GetMaterial(
"Galactic");
127 G4Material* absorberMaterial = G4Material::GetMaterial(
"G4_Pb");
128 G4Material* gapMaterial = G4Material::GetMaterial(
"liquidArgon");
130 if (!defaultMaterial || !absorberMaterial || !gapMaterial) {
131 G4ExceptionDescription msg;
132 msg <<
"Cannot retrieve materials already defined.";
133 G4Exception(
"B4DetectorConstruction::DefineVolumes()",
"MyCode0001",
134 FatalException, msg);
140 G4VSolid* worldS =
new G4Box(
"World",
141 worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2);
143 G4LogicalVolume* worldLV =
new G4LogicalVolume(worldS,
147 G4VPhysicalVolume* worldPV =
new G4PVPlacement(0,
159 G4VSolid* calorimeterS =
new G4Box(
"Calorimeter",
160 calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2);
162 G4LogicalVolume* calorLV =
new G4LogicalVolume(calorimeterS,
178 G4VSolid* layerS =
new G4Box(
"Layer",
179 calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2);
181 G4LogicalVolume* layerLV =
new G4LogicalVolume(layerS,
185 new G4PVReplica(
"LAYE",
195 G4VSolid* absorberS =
new G4Box(
"Abso",
196 calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2);
198 G4LogicalVolume* absorberLV =
new G4LogicalVolume(absorberS,
203 G4ThreeVector(0., 0., -gapThickness / 2),
214 G4VSolid* gapS =
new G4Box(
"Gap",
215 calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2);
217 G4LogicalVolume* gapLV =
new G4LogicalVolume(gapS,
221 fGapPV =
new G4PVPlacement(0,
222 G4ThreeVector(0., 0., absoThickness / 2),
233 G4cout <<
"\n------------------------------------------------------------"
234 <<
"\n---> The calorimeter is " << nofLayers <<
" layers of: [ "
235 << absoThickness / mm <<
"mm of " << absorberMaterial->GetName()
236 <<
" + " << gapThickness / mm <<
"mm of " << gapMaterial->GetName()
238 <<
"\n------------------------------------------------------------\n";
243 worldLV->SetVisAttributes(G4VisAttributes::GetInvisible());
245 G4VisAttributes* simpleBoxVisAtt =
246 new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
247 simpleBoxVisAtt->SetVisibility(
true);
248 calorLV->SetVisAttributes(simpleBoxVisAtt);
261 TG4GeometryManager::Instance()->ConstructSDandField();
G4VPhysicalVolume * fGapPV
G4VPhysicalVolume * fAbsorberPV
virtual ~B4DetectorConstruction()
static G4ThreadLocal G4GlobalMagFieldMessenger * fMagFieldMessenger
virtual void ConstructSDandField()
G4VPhysicalVolume * DefineVolumes()
virtual G4VPhysicalVolume * Construct()