ATLAS Offline Software
MuonWallTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 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  m_zLength(0.),
37  m_yLength(0.),
38  m_xLength(0.),
39  m_backWall(true),
40  m_sideWall(false)
41 {
42  ATH_MSG_DEBUG( "MuonWallTool constructor for " << name );
43  declareProperty("ZLength", m_zLength, "");
44  declareProperty("YLength", m_yLength, "");
45  declareProperty("XLength", m_xLength, "");
46  declareProperty("backWall", m_backWall, "");
47  declareProperty("sideWall", m_sideWall, "");
48 }
49 
51 {
52 }
53 
55 
56  ATH_MSG_DEBUG( "Building Geometry back muon wall: "
57  << (m_backWall ? "true" : "false")
58  << " side muon wall: "
59  << (m_sideWall ? "true" : "false") );
60 
61  // MuonWall description :
62 
63  // Scintillator : 400*200*20, calculating half-size
64  const double zScintillator = m_zLength / 2.;
65  const double yScintillator = m_yLength / 2.;
66  const double xScintillator = m_xLength / 2.;
67  const double dzmuonwall = 750. * CLHEP::mm;
68  const double dymuonwall = 425. * CLHEP::mm;
69  const double dxmuonwall = xScintillator;
70 
71  G4Box *wall = new G4Box("MuonWall", dxmuonwall, dymuonwall, dzmuonwall);
72 
73  // Get the materials
74  StoredMaterialManager* materialManager = nullptr;
75  if (StatusCode::SUCCESS != detStore()->retrieve(materialManager, std::string("MATERIALS"))) {
76  ATH_MSG_ERROR( "Could not find Material Manager MATERIALS" );
77  return;
78  }
79 
80  const GeoMaterial *geoAir = materialManager->getMaterial("tile::Air");
81  const GeoMaterial *geoScintillator = materialManager->getMaterial("tile::Scintillator");
82  Geo2G4MaterialFactory theMaterialFactory;
83  G4Material *airMaterial = theMaterialFactory.Build(geoAir);
84  G4Material *scintillatorMaterial = theMaterialFactory.Build(geoScintillator);
85 
86  G4LogicalVolume *wallV = new G4LogicalVolume(wall, airMaterial, "MuonWall");
87 
88  // ------- Create lead layers and place them inside the mother box --------
89  double zLayer, yLayer, xLayer = 0.;
90 
91  if (m_backWall) {
92 
93  const int nrOfLayers = 12;
94 
95  for (int j = 0; j < nrOfLayers; j++) {
96 
97  // Scintillator
98  G4Box *scintillatorLayer = new G4Box("ScintillatorLayer", xScintillator, yScintillator, zScintillator);
99 
100  G4LogicalVolume *scintillatorLayerV = new G4LogicalVolume(scintillatorLayer, scintillatorMaterial,
101  "MuScintillatorLayer");
102 
103  // scintillatorLayerV->GetLogicalVolume()->SetSensitiveDetector(muonwallSD);
104 
105  if (j < 6) {
106  yLayer = yScintillator + 25. * CLHEP::mm;
107  zLayer = -450. * CLHEP::mm + (2 * j + 1) * zScintillator;
108  } else {
109  yLayer = -yScintillator + 25. * CLHEP::mm;
110  zLayer = -450. * CLHEP::mm + (2 * (j - 6) + 1) * zScintillator;
111  }
112 
113  G4PVPlacement* scintillatorLayerVPhys __attribute__((unused)) =
114  new G4PVPlacement(0,
115  G4ThreeVector(xLayer,yLayer,zLayer),
116  scintillatorLayerV,
117  "MuScintillatorLayer",
118  wallV,
119  false,
120  j+1);
121  }
122  }
123 
124  if (m_sideWall) {
125 
126  // Scintillator : 500*100*20 instead of 400*200*20
127  const double yScintillator1 = yScintillator + 50. * CLHEP::mm;
128  const double zScintillator1 = zScintillator - 50. * CLHEP::mm;
129 
130  const int nScintLayers = 3;
131 
132  for (int j = 0; j < nScintLayers; j++) {
133 
134  G4Box* scintillatorLayer = new G4Box("SideScintiLayer", xScintillator, yScintillator1, zScintillator1);
135 
136  G4LogicalVolume* scintillatorLayerV = new G4LogicalVolume(scintillatorLayer, scintillatorMaterial,
137  "SideMuScintiLayer");
138 
139  yLayer = -175. * CLHEP::mm;
140  zLayer = -750. * CLHEP::mm + (2 * j + 1) * zScintillator1;
141 
142  G4PVPlacement* scintillatorLayerVPhys __attribute__((unused)) =
143  new G4PVPlacement(0,
144  G4ThreeVector(xLayer,yLayer,zLayer),
145  scintillatorLayerV,
146  "SideMuScintiLayer",
147  wallV,
148  false,
149  j+1);
150  }
151  }
152 
153  // FINAL STEP
154  m_envelope.theEnvelope = wallV;
155 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonWallTool::m_zLength
double m_zLength
Definition: MuonWallTool.h:29
Envelope::theEnvelope
G4LogicalVolume * theEnvelope
Definition: IDetectorGeometryTool.h:20
MuonWallTool::BuildGeometry
virtual void BuildGeometry() override final
Override DetectorGeometryBase::BuildGeometry method.
Definition: MuonWallTool.cxx:54
MuonWallTool::m_xLength
double m_xLength
Definition: MuonWallTool.h:31
MuonWallTool::~MuonWallTool
~MuonWallTool()
Definition: MuonWallTool.cxx:50
MuonWallTool::m_sideWall
bool m_sideWall
Definition: MuonWallTool.h:33
MuonWallTool::m_backWall
bool m_backWall
Definition: MuonWallTool.h:32
Geo2G4MaterialFactory.h
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
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
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
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
MuonWallTool::m_yLength
double m_yLength
Definition: MuonWallTool.h:30