ATLAS Offline Software
ExcluderConstruction.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ExcluderConstruction
6 
7 // Feb-2006 JPA;
8 //
9 
10 #include "ExcluderConstruction.h"
11 
12 
13 #include "GeoModelKernel/GeoElement.h"
14 #include "GeoModelKernel/GeoMaterial.h"
15 #include "GeoModelKernel/GeoFullPhysVol.h"
16 #include "GeoModelKernel/GeoPhysVol.h"
17 #include "GeoModelKernel/GeoVPhysVol.h"
18 #include "GeoModelKernel/GeoVFullPhysVol.h"
19 #include "GeoModelKernel/GeoLogVol.h"
20 #include "GeoModelKernel/GeoTubs.h"
21 #include "GeoModelKernel/GeoBox.h"
22 #include "GeoModelKernel/GeoNameTag.h"
23 #include "GeoModelKernel/GeoTransform.h"
24 #include "GeoModelKernel/GeoAlignableTransform.h"
25 #include "GeoModelKernel/GeoIdentifierTag.h"
26 #include "GeoModelKernel/GeoDefinitions.h"
27 #include "GeoModelKernel/Units.h"
28 #include "StoreGate/StoreGateSvc.h"
30 #include "GeoModelKernel/GeoShapeUnion.h"
31 #include "GeoModelKernel/GeoShapeShift.h"
32 
33 // For the database:
34 
38 
40 
41 #include "GaudiKernel/MsgStream.h"
42 #include "GaudiKernel/Bootstrap.h"
43 #include "GaudiKernel/SystemOfUnits.h"
44 
45 #include <string>
46 #include <cmath>
47 
49 = default;
50 
52 
53 //GeoIntrusivePtr<GeoVFullPhysVol> LArGeo::ExcluderConstruction::GetEnvelope()
54 GeoIntrusivePtr<GeoPhysVol> LArGeo::ExcluderConstruction::GetEnvelope()
55 {
56 
57  // Need to do the equivalent for excluder here: <<<================
58  // if (cryoMotherPhysical) return cryoMotherPhysical;
59 
60  // Detector Store
61  ISvcLocator *svcLocator = Gaudi::svcLocator();
63  if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
64  throw std::runtime_error("Error in ExcluderConstruction, cannot access DetectorStore");
65  }
66 
67  // Material Manager
68 
69  // Need to add Rohacell here! <<<===============
70 
71  StoredMaterialManager* materialManager = nullptr;
72  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
73 
74 
75  // (use Air for the moment....) <<<================
76  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
77  if (!Air) {
78  throw std::runtime_error("Error in ExcluderConstruction, std::Air is not found.");
79  }
80 
81  // Define Rohacell Foam.
82  // Rohacell foam has density: 0.11g/cm3
83  std::string name;
84  double density;
85  const GeoElement* C=materialManager->getElement("Carbon");
86  const GeoElement* H=materialManager->getElement("Hydrogen");
87  const GeoElement* O=materialManager->getElement("Oxygen");
88  const GeoElement* N=materialManager->getElement("Nitrogen");
89  GeoMaterial* Rohacell = new GeoMaterial(name="Rohacell", density=0.11*GeoModelKernelUnits::g/Gaudi::Units::cm3);
90  Rohacell->add(C,0.6465);
91  Rohacell->add(H,0.07836);
92  Rohacell->add(O,0.19137);
93  Rohacell->add(N,0.08377);
94  Rohacell->lock();
95 
96  ServiceHandle<IGeoDbTagSvc> geoDbTagSvc ("GeoDbTagSvc", "WallsConstruction");
97  if (geoDbTagSvc.retrieve().isFailure()) {
98  throw std::runtime_error ("Cannot locate GeoDbTagSvc!!");
99  }
100 
101  std::string AtlasVersion = geoDbTagSvc->atlasVersion();
102  std::string LArVersion = geoDbTagSvc->LAr_VersionOverride();
103 
104  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
105  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
106 
107  //--------
108  // Now build the actual Excluder.
109 
110  // It is a Union out of a GeoBox and a GeoTubs.
111  // Box Dimensions:
112  double xbox = 300.0 *Gaudi::Units::mm;
113  double ybox = 160.0 *Gaudi::Units::mm;
114  double zbox = 300.7 *Gaudi::Units::mm;
115  //
116  // Tubs Dimensions:
117  double ztubs = 300.0 *Gaudi::Units::mm;
118  double phitubs= 76.2 *Gaudi::Units::deg;
119  double delphi = 27.6 *Gaudi::Units::deg;
120  double rcold = 1249.5 *Gaudi::Units::mm;
121  double rmin = 1220.0 *Gaudi::Units::mm;
122 
123  // The radius of the cryostat cold wall is: 1250 Gaudi::Units::mm
124  // Before we make the union, we have to shift the box in y (that actually along the beam axis)
125  // and there, positive y goes from the cryostat centre towards the beam window.
126 
127  std::string ExcluderName = "LAr::H6::Cryostat::Excluder";
128 
129  GeoBox* rohaBox = new GeoBox(xbox, ybox, zbox); // The rectangular part of the excluder
130  const GeoShapeShift & rohaBoxShift = (*rohaBox << GeoTrf::TranslateY3D(1062.85*Gaudi::Units::mm) );
131  GeoTubs* rohaTubs = new GeoTubs(rmin, rcold, ztubs, phitubs, delphi); // The round part of the excluder
132 
133  // Combine the two parts to make one excluder of the correct shape:
134  const GeoShapeUnion* Excluder = new GeoShapeUnion(&rohaBoxShift, rohaTubs);
135 
136  const GeoLogVol* LogExcluder = new GeoLogVol(ExcluderName, Excluder, Rohacell); // <<<==== air should be rohacell !!!
137  GeoIntrusivePtr<GeoPhysVol> PhysExcluder = new GeoPhysVol(LogExcluder);
138  PhysExcluder->add( new GeoNameTag(ExcluderName) );
139 
140  return PhysExcluder;
141 
142 }
LArGeo::ExcluderConstruction::ExcluderConstruction
ExcluderConstruction()
ExcluderConstruction.h
StoredMaterialManager::getElement
virtual const GeoElement * getElement(const std::string &name)=0
cm3
#define cm3
deg
#define deg
Definition: SbPolyhedron.cxx:17
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LArGeo::ExcluderConstruction::~ExcluderConstruction
virtual ~ExcluderConstruction()
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
H
#define H(x, y, z)
Definition: MD5.cxx:114
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
LArGeo::ExcluderConstruction::GetEnvelope
virtual GeoIntrusivePtr< GeoPhysVol > GetEnvelope()
Definition: ExcluderConstruction.cxx:54
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
StoredMaterialManager.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
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
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
StoreGateSvc.h
IGeoDbTagSvc.h
ServiceHandle< IGeoDbTagSvc >