ATLAS Offline Software
Loading...
Searching...
No Matches
DeadMaterialTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//class header
6#include "DeadMaterialTool.h"
7
8//Athena headers
10#include "GeoModelKernel/GeoMaterial.h"
12
13// Geant4 headers
14#include "G4Box.hh"
15#include "G4LogicalVolume.hh"
16#include "G4Material.hh"
17#include "G4PVPlacement.hh"
18
19// CLHEP headers
20#include "CLHEP/Units/SystemOfUnits.h"
21
22DeadMaterialTool::DeadMaterialTool(const std::string& type, const std::string& name, const IInterface* parent)
23 : DetectorGeometryBase(type,name,parent)
24{
25}
26
28{
29 ATH_MSG_VERBOSE( name() << " DeadMaterialTool::BuildGeometry(): Starting" );
30
31 const double dzdeadmaterial = (m_zLength)/2. *CLHEP::mm;
32 const double dydeadmaterial = (m_yLength)/2. *CLHEP::mm;
33 const double dxdeadmaterial = (m_xLength)/2. *CLHEP::mm;
34
35 ATH_MSG_DEBUG ( "DeadMaterial geometry " << dzdeadmaterial << " " << dydeadmaterial << " " << dxdeadmaterial );
36
37 G4Box *wall = new G4Box("DeadMaterial",dxdeadmaterial,dydeadmaterial,dzdeadmaterial);
38
39 // Get the materials
40 StoredMaterialManager* materialManager = nullptr;
41 if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS")))
42 {
43 //FIXME should probably at least print an ERROR here...
44 return;
45 }
46 const GeoMaterial *geoAir = materialManager->getMaterial("tile::Air");
47 const GeoMaterial *geoIron = materialManager->getMaterial("std::Iron");
48 Geo2G4MaterialFactory theMaterialFactory;
49 G4Material *airMaterial=theMaterialFactory.Build(geoAir);
50 G4Material *ironMaterial=theMaterialFactory.Build(geoIron);
51
52 G4LogicalVolume *wallV = new G4LogicalVolume(wall,airMaterial,"DeadMaterial");
53
54 // ------- Create iron bar and place it inside the mother box --------
55 const double IronWidth = 5./2. *CLHEP::mm;
56 for (int j=0; j<2; j++)
57 {
58 // X Iron plates
59 G4Box *ironLayerX = new G4Box("IronLayerX",IronWidth,dydeadmaterial,dzdeadmaterial);
60 G4LogicalVolume *ironLayerXV = new G4LogicalVolume(ironLayerX,ironMaterial,"DMIronLayerX");
61
62 double xLayer=0.0, zLayer=0.0;
63 if(j==0) xLayer = -dxdeadmaterial+IronWidth;
64 if(j==1) xLayer = dxdeadmaterial-IronWidth;
65 G4PVPlacement *ironLayerXVPhys __attribute__((unused)) =
66 new G4PVPlacement (0,
67 G4ThreeVector(xLayer,0,0),
68 ironLayerXV,
69 "DMIronLayerX",
70 wallV,
71 false,
72 j+1);
73
74 // Z Iron plates
75 const double IronWidthX = 140./2. *CLHEP::mm;
76 G4Box *ironLayerZ = new G4Box("IronLayerZ",IronWidthX,dydeadmaterial,IronWidth);
77 G4LogicalVolume *ironLayerZV = new G4LogicalVolume(ironLayerZ,ironMaterial,"DMIronLayerZ");
78 if(j==0) zLayer = -dzdeadmaterial+IronWidth;
79 if(j==1) zLayer = dzdeadmaterial-IronWidth;
80 G4PVPlacement *ironLayerZVPhys __attribute__((unused)) =
81 new G4PVPlacement (0,
82 G4ThreeVector(0,0,zLayer),
83 ironLayerZV,
84 "DMIronLayerZ",
85 wallV,
86 false,
87 j+1);
88 }
89
90 // FINAL STEP
91 m_envelope.theEnvelope=wallV;
92 ATH_MSG_VERBOSE( name() << " DeadMaterialTool::BuildGeometry(): Finished" );
93}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
void unused(Args &&...)
Gaudi::Property< double > m_zLength
Gaudi::Property< double > m_xLength
Gaudi::Property< double > m_yLength
DeadMaterialTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual void BuildGeometry() override final
virtual methods being implemented here
DetectorGeometryBase(const std::string &type, const std::string &name, const IInterface *parent)
G4Material * Build(const GeoMaterial *)
This class holds one or more material managers and makes them storeable, under StoreGate.
virtual const GeoMaterial * getMaterial(const std::string &name)=0