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