ATLAS Offline Software
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 
22 DeadMaterialTool::DeadMaterialTool(const std::string& type, const std::string& name, const IInterface* 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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.SystemOfUnits.mm
float mm
Definition: SystemOfUnits.py:98
DeadMaterialTool::m_yLength
Gaudi::Property< double > m_yLength
Definition: DeadMaterialTool.h:31
Envelope::theEnvelope
G4LogicalVolume * theEnvelope
Definition: IDetectorGeometryTool.h:20
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Geo2G4MaterialFactory.h
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DeadMaterialTool.h
DeadMaterialTool::DeadMaterialTool
DeadMaterialTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: DeadMaterialTool.cxx:22
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
DeadMaterialTool::BuildGeometry
virtual void BuildGeometry() override final
virtual methods being implemented here
Definition: DeadMaterialTool.cxx:27
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
StoredMaterialManager.h
DetectorGeometryBase::m_envelope
Envelope m_envelope
Definition: DetectorGeometryBase.h:70
DeadMaterialTool::m_xLength
Gaudi::Property< double > m_xLength
Definition: DeadMaterialTool.h:32
unused
void unused(Args &&...)
Definition: VP1ExpertSettings.cxx:39
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
DetectorGeometryBase
Definition: DetectorGeometryBase.h:26
StoredMaterialManager::getMaterial
virtual const GeoMaterial * getMaterial(const std::string &name)=0
StoredMaterialManager
This class holds one or more material managers and makes them storeable, under StoreGate.
Definition: StoredMaterialManager.h:28
DeadMaterialTool::m_zLength
Gaudi::Property< double > m_zLength
Definition: DeadMaterialTool.h:30
Geo2G4MaterialFactory
Definition: Geo2G4MaterialFactory.h:15
Geo2G4MaterialFactory::Build
G4Material * Build(const GeoMaterial *)
Definition: Geo2G4MaterialFactory.cxx:29