ATLAS Offline Software
EndcapPresamplerConstruction.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GeoModelKernel/GeoElement.h"
7 #include "GeoModelKernel/GeoMaterial.h"
8 #include "GeoModelKernel/GeoFullPhysVol.h"
9 #include "GeoModelKernel/GeoPhysVol.h"
10 #include "GeoModelKernel/GeoVPhysVol.h"
11 #include "GeoModelKernel/GeoLogVol.h"
12 #include "GeoModelKernel/GeoTubs.h"
13 #include "GeoModelKernel/GeoNameTag.h"
14 #include "GeoModelKernel/GeoIdentifierTag.h"
15 #include "GeoModelKernel/GeoDefinitions.h"
17 #include "GeoModelKernel/GeoShapeUnion.h"
18 #include "GeoModelKernel/GeoShapeShift.h"
19 
20 #include "StoreGate/StoreGateSvc.h"
21 #include "GaudiKernel/MsgStream.h"
22 #include "GaudiKernel/Bootstrap.h"
23 #include "GaudiKernel/SystemOfUnits.h"
24 
25 // For the database:
26 
30 
32 
33 #include <string>
34 #include <cmath>
35 
36 
37 // EndcapPresamplerConstruction
38 // Insert the LAr Endcap Presampler into a pre-defined mother volume
39 // i.e. into the front cold wall of endcap cryostat (cyl.#14)
40 // 14-Jan-2002 Mikhail Leltchouk
41 
42 
43 
45  m_psPhysical(nullptr)
46 {
47  m_isModule = imb;
48 }
49 
51 
52 
53 GeoIntrusivePtr<GeoFullPhysVol> EndcapPresamplerConstruction::Envelope()
54 {
55  if (m_psPhysical) return m_psPhysical->clone();
56 
57 
58  ISvcLocator *svcLocator = Gaudi::svcLocator();
59  SmartIF<StoreGateSvc> detStore{svcLocator->service("DetectorStore")};
60  if (!detStore.isValid()) {
61  throw std::runtime_error("Error in EndcapCryostatConstruction, cannot access DetectorStore");
62  }
63 
64  StoredMaterialManager* materialManager = nullptr;
65  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
66 
67  const GeoMaterial *LAr = materialManager->getMaterial("std::LiquidArgon");
68  if (!LAr) {
69  throw std::runtime_error("Error in EndcapCryostatConstruction, std::LiquidArgon is not found.");
70  }
71 
72 
73  //===>
74  SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service("RDBAccessSvc")};
75  if (!pAccessSvc.isValid()) {
76  throw std::runtime_error ("Cannot locate RDBAccessSvc!!");
77  }
78 
79  SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
80  if (!geoModel.isValid()) {
81  throw std::runtime_error ("Cannot locate GeoModelSvc!!");
82  }
83 
84  std::string AtlasVersion = geoModel->atlasVersion();
85  std::string LArVersion = geoModel->LAr_VersionOverride();
86 
87  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
88  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
89 
90 
91 
92  IRDBRecordset_ptr presamplerPosition = pAccessSvc->getRecordsetPtr("PresamplerPosition",AtlasVersion, "ATLAS");
93 
94  //===>
95 
96 
98  // LAr Endcap Presampler GEOMETRY
100  double Rmin = 1231.74*Gaudi::Units::mm;
101  double Rmax = 1701.98*Gaudi::Units::mm;
102  double HalfZ = ((*presamplerPosition)[0]->getDouble("TCK")/2.)*Gaudi::Units::cm;
103 
104 
105  std::string name = "LAr::Endcap::Presampler::LiquidArgon";
106 
107  double phi_size = 360.*Gaudi::Units::deg;
108  double start_phi = 0.;
109 
110  if( m_isModule ){
111  phi_size = M_PI / 4;
112  start_phi = M_PI / 2 - M_PI / 8;
113  }
114 
115  GeoTubs* endcapPresamplerSolid = new GeoTubs(Rmin, Rmax, HalfZ, start_phi, phi_size);
116 
117  const GeoLogVol* endcapPresamplerLog = new GeoLogVol(name,endcapPresamplerSolid, LAr);
118  m_psPhysical = new GeoFullPhysVol(endcapPresamplerLog);
119 
120  return m_psPhysical;
121 }
122 
123 /* G3 code for comparison: cryogeo.age
124 
125  Fill CREE ! e. cold wall front flange
126  Section = 14 ! endcap element number
127  Material = 2 ! material type
128  Rmin = 22.1 ! minimal radius 23.2 > 22.1
129  Dr = 194.4 ! radial thickness 193.8 > 195.4 > 194.4cold
130  Zmin = 356.1 ! location in z (minimum) 357.0 > 356.1
131  Dz = 6.5 ! lenght in z 5.0 > 6.5
132 
133  FILL PSAM ! CEPS parameters - ABSOLUTE nominal positions
134  zpos = 362.4 ! nominal positions
135  Tck = 0.4 ! thinkness
136  rmin = 123.174 ! minimal radius
137  rmax = 170.198 ! maximum radius
138 * ---------------------------------------------------------------------
139 Block CEPS is the EC presampler
140  Material Liquid_Argon
141  Medium sensitive isvol=1
142  Attribute CEPS seen=1 colo=3
143  Shape TUBE Rmin=psam_rmin Rmax=psam_rmax dz=psam_Tck/2
144 
145 * eta limits are calculated based on geometry, taken into account Zshift:
146 
147  eta1=asinh((psam_zpos+CRYM_Zshift)/psam_rmax)
148  eta2=asinh((psam_zpos+CRYM_Zshift)/psam_rmin)
149  nbin=nint((eta2-eta1)/chit_Detaps)
150  deta=(eta2-eta1)/nbin
151  HITS CEPS comp=1:1: eta:deta:(eta1,eta2),
152  phi:chit_Dphi:(0,2*M_PI),
153  Eloss:0:(0,chit_Emax)
154 endblock
155 * ---------------------------------------------------------------------
156 */
LAr
Definition: LArVolumeBuilder.h:36
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
EndcapPresamplerConstruction::EndcapPresamplerConstruction
EndcapPresamplerConstruction(bool imb=false)
Definition: EndcapPresamplerConstruction.cxx:44
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
EndcapPresamplerConstruction::~EndcapPresamplerConstruction
virtual ~EndcapPresamplerConstruction()
Definition: EndcapPresamplerConstruction.cxx:50
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
EndcapPresamplerConstruction::m_psPhysical
GeoIntrusivePtr< GeoFullPhysVol > m_psPhysical
Definition: EndcapPresamplerConstruction.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
StoredMaterialManager.h
EndcapPresamplerConstruction::m_isModule
bool m_isModule
Definition: EndcapPresamplerConstruction.h:49
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
EndcapPresamplerConstruction.h
Declaration of EndcapPresamplerConstruction class.
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
EndcapPresamplerConstruction::Envelope
GeoIntrusivePtr< GeoFullPhysVol > Envelope()
Definition: EndcapPresamplerConstruction.cxx:53
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
Rmin
double Rmin
Definition: LArDetectorConstructionTBEC.cxx:56
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IGeoModelSvc.h
StoreGateSvc.h