ATLAS Offline Software
MuonWallTool.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 //************************************************************
6 //
7 // Class MuonWallTool
8 // Class implementing geometry of the MuonWall
9 //
10 //************************************************************
11 
12 // class header
13 #include "MuonWallTool.h"
14 
15 //Athena headers
17 #include "GeoModelKernel/GeoMaterial.h"
19 
20 // Geant4 headers
21 #include "G4Box.hh"
22 #include "G4LogicalVolume.hh"
23 #include "G4Material.hh"
24 #include "G4PVPlacement.hh"
25 #include "G4ThreeVector.hh"
26 
27 // CLHEP headers
28 #include "CLHEP/Units/SystemOfUnits.h"
29 
30 // STL headers
31 #include <string>
32 #include <iostream>
33 
34 MuonWallTool::MuonWallTool(const std::string& type, const std::string& name, const IInterface* parent)
36 {
37 }
38 
40 
41  ATH_MSG_DEBUG( "Building Geometry back muon wall: "
42  << (m_backWall ? "true" : "false")
43  << " side muon wall: "
44  << (m_sideWall ? "true" : "false") );
45 
46  // MuonWall description :
47 
48  // Scintillator : 400*200*20, calculating half-size
49  const double zScintillator = m_zLength / 2.;
50  const double yScintillator = m_yLength / 2.;
51  const double xScintillator = m_xLength / 2.;
52  const double dzmuonwall = 750. * CLHEP::mm;
53  const double dymuonwall = 425. * CLHEP::mm;
54  const double dxmuonwall = xScintillator;
55 
56  G4Box *wall = new G4Box("MuonWall", dxmuonwall, dymuonwall, dzmuonwall);
57 
58  // Get the materials
59  StoredMaterialManager* materialManager = nullptr;
60  if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS"))) {
61  ATH_MSG_ERROR( "Could not find Material Manager MATERIALS" );
62  return;
63  }
64 
65  const GeoMaterial *geoAir = materialManager->getMaterial("tile::Air");
66  const GeoMaterial *geoScintillator = materialManager->getMaterial("tile::Scintillator");
67  Geo2G4MaterialFactory theMaterialFactory;
68  G4Material *airMaterial = theMaterialFactory.Build(geoAir);
69  G4Material *scintillatorMaterial = theMaterialFactory.Build(geoScintillator);
70 
71  G4LogicalVolume *wallV = new G4LogicalVolume(wall, airMaterial, "MuonWall");
72 
73  // ------- Create lead layers and place them inside the mother box --------
74  double zLayer, yLayer, xLayer = 0.;
75 
76  if (m_backWall) {
77 
78  const int nrOfLayers = 12;
79 
80  for (int j = 0; j < nrOfLayers; j++) {
81 
82  // Scintillator
83  G4Box *scintillatorLayer = new G4Box("ScintillatorLayer", xScintillator, yScintillator, zScintillator);
84 
85  G4LogicalVolume *scintillatorLayerV = new G4LogicalVolume(scintillatorLayer, scintillatorMaterial,
86  "MuScintillatorLayer");
87 
88  // scintillatorLayerV->GetLogicalVolume()->SetSensitiveDetector(muonwallSD);
89 
90  if (j < 6) {
91  yLayer = yScintillator + 25. * CLHEP::mm;
92  zLayer = -450. * CLHEP::mm + (2 * j + 1) * zScintillator;
93  } else {
94  yLayer = -yScintillator + 25. * CLHEP::mm;
95  zLayer = -450. * CLHEP::mm + (2 * (j - 6) + 1) * zScintillator;
96  }
97 
98  G4PVPlacement* scintillatorLayerVPhys __attribute__((unused)) =
99  new G4PVPlacement(0,
100  G4ThreeVector(xLayer,yLayer,zLayer),
101  scintillatorLayerV,
102  "MuScintillatorLayer",
103  wallV,
104  false,
105  j+1);
106  }
107  }
108 
109  if (m_sideWall) {
110 
111  // Scintillator : 500*100*20 instead of 400*200*20
112  const double yScintillator1 = yScintillator + 50. * CLHEP::mm;
113  const double zScintillator1 = zScintillator - 50. * CLHEP::mm;
114 
115  const int nScintLayers = 3;
116 
117  for (int j = 0; j < nScintLayers; j++) {
118 
119  G4Box* scintillatorLayer = new G4Box("SideScintiLayer", xScintillator, yScintillator1, zScintillator1);
120 
121  G4LogicalVolume* scintillatorLayerV = new G4LogicalVolume(scintillatorLayer, scintillatorMaterial,
122  "SideMuScintiLayer");
123 
124  yLayer = -175. * CLHEP::mm;
125  zLayer = -750. * CLHEP::mm + (2 * j + 1) * zScintillator1;
126 
127  G4PVPlacement* scintillatorLayerVPhys __attribute__((unused)) =
128  new G4PVPlacement(0,
129  G4ThreeVector(xLayer,yLayer,zLayer),
130  scintillatorLayerV,
131  "SideMuScintiLayer",
132  wallV,
133  false,
134  j+1);
135  }
136  }
137 
138  // FINAL STEP
139  m_envelope.theEnvelope = wallV;
140 }
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
MuonWallTool::m_yLength
Gaudi::Property< double > m_yLength
Definition: MuonWallTool.h:30
MuonWallTool::m_zLength
Gaudi::Property< double > m_zLength
Definition: MuonWallTool.h:29
MuonWallTool::BuildGeometry
virtual void BuildGeometry() override final
Override DetectorGeometryBase::BuildGeometry method.
Definition: MuonWallTool.cxx:39
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
MuonWallTool::m_xLength
Gaudi::Property< double > m_xLength
Definition: MuonWallTool.h:31
Geo2G4MaterialFactory.h
MuonWallTool::m_backWall
Gaudi::Property< bool > m_backWall
Definition: MuonWallTool.h:32
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
MuonWallTool::m_sideWall
Gaudi::Property< bool > m_sideWall
Definition: MuonWallTool.h:33
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
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
MuonWallTool::MuonWallTool
MuonWallTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuonWallTool.cxx:34
Geo2G4MaterialFactory
Definition: Geo2G4MaterialFactory.h:15
MuonWallTool.h
Geo2G4MaterialFactory::Build
G4Material * Build(const GeoMaterial *)
Definition: Geo2G4MaterialFactory.cxx:29