ATLAS Offline Software
LArCrateTool.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 "LArCrateTool.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 LArCrateTool::LArCrateTool(const std::string& type, const std::string& name, const IInterface* parent)
24 {
25 }
26 
28 {
29  ATH_MSG_VERBOSE( name() << " LArCrateTool::BuildGeometry(): Starting" );
30 
31  const double dzCrate = (m_zLength)/2.*CLHEP::mm ;
32  const double dyCrate = (m_yLength)/2.*CLHEP::mm ;
33  const double dxCrate = (m_xLength)/2.*CLHEP::mm ;
34 
35  G4Box *emptybox = new G4Box("Crate",dxCrate,dyCrate,dzCrate);
36 
37  // Get the materials
38  StoredMaterialManager* materialManager = nullptr;
39  if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS")))
40  {
41  //FIXME should probably at least print an ERROR here...
42  return;
43  }
44  const GeoMaterial *geoAir = materialManager->getMaterial("tile::Air");
45  const GeoMaterial *geoAluminium = materialManager->getMaterial("std::Aluinium");
46  const GeoMaterial *geoSiO2CondEpox = materialManager->getMaterial("tile::SiO2CondEpox");
47  Geo2G4MaterialFactory theMaterialFactory;
48  G4Material *airMaterial=theMaterialFactory.Build(geoAir);
49  G4Material *aluminiumMaterial=theMaterialFactory.Build(geoAluminium);
50  G4Material *SiO2CondEpoxMaterial=theMaterialFactory.Build(geoSiO2CondEpox);
51 
52  G4Material *crateMaterial = new G4Material("LArCrateMaterial", 0.2876*CLHEP::g/CLHEP::cm3,3);
53  crateMaterial->AddMaterial(aluminiumMaterial, 0.7744);
54  crateMaterial->AddMaterial(SiO2CondEpoxMaterial, 0.2216);
55  crateMaterial->AddMaterial(airMaterial, 0.0040);
56 
57  G4LogicalVolume *emptyboxV = new G4LogicalVolume(emptybox,crateMaterial,"LarCrate");
58  // creates wall of 5mm aluminum thickness
59  const double thicknessAlu = 5.*CLHEP::mm ;
60 
61  for(int j=0; j<2;j++)
62  {
63  double xLayers=0.0, yLayers=0.0, zLayers=0.0;
64 
65  // top and Bottom plates
66  G4Box *AluLayerTB = new G4Box("AluLayerTB",dxCrate,thicknessAlu/2.,dzCrate);
67  G4LogicalVolume *AluLayerVTB = new G4LogicalVolume(AluLayerTB,aluminiumMaterial,"AluLayerTB");
68  if(j==0) yLayers = dyCrate - thicknessAlu/2.;
69  if(j==1) yLayers = -dyCrate + thicknessAlu/2.;
70  G4PVPlacement *AluLayerVTBPhys __attribute__((unused)) =
71  new G4PVPlacement(0,
72  G4ThreeVector(0.,yLayers,0.),
73  AluLayerVTB,
74  "AluLayerTB" ,
75  emptyboxV,
76  false,
77  j+1);
78 
79  // Right and Left sides
80  G4Box *AluLayerRL = new G4Box("AluLayerRL",dxCrate,dyCrate-thicknessAlu,thicknessAlu/2.);
81  G4LogicalVolume *AluLayerVRL = new G4LogicalVolume(AluLayerRL,aluminiumMaterial,"AluLayerRL");
82  if(j==0) zLayers = dzCrate - thicknessAlu/2.;
83  if(j==1) zLayers = -dzCrate + thicknessAlu/2.;
84  G4PVPlacement *AluLayerVRLPhys __attribute__((unused)) =
85  new G4PVPlacement(0,
86  G4ThreeVector(0.,0.,zLayers),
87  AluLayerVRL,
88  "AluLayerRL" ,
89  emptyboxV,
90  false,
91  j+1);
92 
93  // Front and back sides
94  G4Box *AluLayerFB = new G4Box("AluLayerFB",thicknessAlu/2.,dyCrate-thicknessAlu,dzCrate-thicknessAlu);
95  G4LogicalVolume *AluLayerVFB = new G4LogicalVolume(AluLayerFB,aluminiumMaterial,"AluLayerFB");
96  if(j==0) xLayers = dxCrate - thicknessAlu/2.;
97  if(j==1) xLayers = -dxCrate + thicknessAlu/2.;
98  G4PVPlacement *AluLayerVFBPhys __attribute__((unused)) =
99  new G4PVPlacement(0,
100  G4ThreeVector(xLayers,0.,0.),
101  AluLayerVFB,
102  "AluLayerFB" ,
103  emptyboxV,
104  false,
105  j+1);
106  }
107  m_envelope.theEnvelope=emptyboxV;
108  ATH_MSG_VERBOSE( name() << " LArCrateTool::BuildGeometry(): Finished" );
109 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
python.SystemOfUnits.mm
float mm
Definition: SystemOfUnits.py:98
Envelope::theEnvelope
G4LogicalVolume * theEnvelope
Definition: IDetectorGeometryTool.h:20
LArCrateTool::m_xLength
Gaudi::Property< double > m_xLength
Definition: LArCrateTool.h:32
cm3
#define cm3
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
LArCrateTool::BuildGeometry
virtual void BuildGeometry() override final
virtual methods being implemented here
Definition: LArCrateTool.cxx:27
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Geo2G4MaterialFactory.h
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
LArCrateTool::m_zLength
Gaudi::Property< double > m_zLength
Definition: LArCrateTool.h:30
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LArCrateTool.h
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
StoredMaterialManager.h
DetectorGeometryBase::m_envelope
Envelope m_envelope
Definition: DetectorGeometryBase.h:70
unused
void unused(Args &&...)
Definition: VP1ExpertSettings.cxx:39
__attribute__
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
Definition: TileCalibDrawerBase.h:190
LArCrateTool::LArCrateTool
LArCrateTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArCrateTool.cxx:22
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
LArCrateTool::m_yLength
Gaudi::Property< double > m_yLength
Definition: LArCrateTool.h:31
Geo2G4MaterialFactory
Definition: Geo2G4MaterialFactory.h:15
Geo2G4MaterialFactory::Build
G4Material * Build(const GeoMaterial *)
Definition: Geo2G4MaterialFactory.cxx:29