ATLAS Offline Software
TableConstructionH62002.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "GeoModelKernel/GeoElement.h"
9 #include "GeoModelKernel/GeoMaterial.h"
10 #include "GeoModelKernel/GeoFullPhysVol.h"
11 #include "GeoModelKernel/GeoVFullPhysVol.h"
12 #include "GeoModelKernel/GeoPhysVol.h"
13 #include "GeoModelKernel/GeoVPhysVol.h"
14 #include "GeoModelKernel/GeoLogVol.h"
15 #include "GeoModelKernel/GeoBox.h"
16 #include "GeoModelKernel/GeoTubs.h"
17 #include "GeoModelKernel/GeoTube.h"
18 #include "GeoModelKernel/GeoNameTag.h"
19 #include "GeoModelKernel/GeoTransform.h"
20 #include "GeoModelKernel/GeoSerialDenominator.h"
21 #include "GeoModelKernel/GeoSerialIdentifier.h"
22 #include "GeoModelKernel/GeoSerialTransformer.h"
23 #include "GeoModelKernel/GeoAlignableTransform.h"
24 #include "GeoModelKernel/GeoIdentifierTag.h"
25 #include "GeoModelKernel/GeoDefinitions.h"
26 #include "StoreGate/StoreGateSvc.h"
28 #include "GeoModelKernel/GeoShapeUnion.h"
29 #include "GeoModelKernel/GeoShapeShift.h"
30 #include "GeoGenericFunctions/Variable.h"
31 
32 // For the database:
36 
38 
39 #include "GaudiKernel/MsgStream.h"
40 #include "GaudiKernel/Bootstrap.h"
41 #include "GaudiKernel/SystemOfUnits.h"
42 
43 #include <string>
44 #include <cmath>
45 #include <iostream>
46 
48  : m_H62002TablePhysical(nullptr)
49 {
50 }
51 
52 
54 = default;
55 
56 
57 
59 {
60 
61  if (m_H62002TablePhysical) return m_H62002TablePhysical;
62 
63 
64  ISvcLocator *svcLocator = Gaudi::svcLocator();
65  IMessageSvc * msgSvc;
66  if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
67  throw std::runtime_error("Error in TableConstructionH62002, cannot access MessageSvc");
68  }
69 
70  MsgStream log(msgSvc, "LArGeo::TableConstructionH62002");
71  log << MSG::INFO;
72  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
73  log << "+ +" << std::endl;
74  log << "+ HELLO from LArGeo::TableConstructionH62002 +" << std::endl;
75  log << "+ +" << std::endl;
76  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
77 
78 
80  if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
81  throw std::runtime_error("Error in TableConstructionH62002, cannot access DetectorStore");
82  }
83 
84  ServiceHandle<IGeoDbTagSvc> geoDbTagSvc ("GeoDbTagSvc", "WallsConstruction");
85  if (geoDbTagSvc.retrieve().isFailure()) {
86  throw std::runtime_error ("Cannot locate GeoDbTagSvc!!");
87  }
88 
89  // Get the materials from the material manager:-----------------------------------------------------//
90  // //
91  StoredMaterialManager* materialManager = nullptr;
92  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
93 
94  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
95  if (!Air) throw std::runtime_error("Error in TableConstructionH62002, std::Air is not found.");
96 
97  const GeoMaterial *Aluminium = materialManager->getMaterial("std::Aluminium");
98  if (!Aluminium) throw std::runtime_error("Error in TableConstructionH62002, std::Aluminium is not found.");
99 
100  // Is this ok for the Scintillator?
101  // I don't really know for sure what kind of a scintillator we have.
102  // Lots of Scintillators are PMMA (Plexiglas), which has a composition of C5 H8 O2 and density 1.18 g/cm3
103  // The Tile uses a composition of C H (density 1.032)
104  // The old testbeam code uses a composition of C9 H10 (density 1.032)
105  // ... because it's easiest at the moment and not all that different from the fractional
106  // composition of the old tb code, take the Tile material (polysterene)...
107  const GeoMaterial *Scint = materialManager->getMaterial("std::Polystyrene");
108  if (!Scint) throw std::runtime_error("Error in TableConstructionH62002, std::Polystyrene is not found.");
109 
110  const GeoMaterial *Mylar = materialManager->getMaterial("std::Mylar");
111  if (!Mylar) throw std::runtime_error("Error in TableConstructionH62002, std::Mylar is not found.");
112 
113 
114  // //
115  //-------------------------------------------------------------------------------------------------//
116 
117  std::string AtlasVersion = geoDbTagSvc->atlasVersion();
118  std::string LArVersion = geoDbTagSvc->LAr_VersionOverride();
119 
120  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
121  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
122 
123 
125  // Define geometry
127 
128 
129  // Here we creat the envelope for the Moveable Table Instrumentation. This code is repeated
130  // createEnvelope() method below. There should be a way to avoid this repitition.
131 
132  //------ The Table
133 
134  std::string baseName = "LAr::TBH62002";
135  std::string H62002TableName = baseName + "::Table";
136 
137  const double H62002TableXY = 150.*Gaudi::Units::mm;
138  const double H62002TableZ = 1200.*Gaudi::Units::mm;
139 
140 
141  GeoBox* H62002TableShape = new GeoBox( H62002TableXY, H62002TableXY, H62002TableZ );
142  const GeoLogVol* H62002TableLogical = new GeoLogVol( H62002TableName, H62002TableShape, Air );
143 
144  m_H62002TablePhysical = new GeoPhysVol(H62002TableLogical);
145  //m_H62002TablePhysical->add( new GeoNameTag("LArTBTablePos") );
146 
147 
148 
149 
150 
151  //------ F1/F2Scintillators
152  log << "Create F1/F2 Scintillators ..." << std::endl;
153 
154  // Universal size:
155  const double Fx = 10.0*Gaudi::Units::mm;
156  const double Fy = 10.0*Gaudi::Units::mm;
157  const double Fz = 10.0*Gaudi::Units::mm;
158 
159  std::vector<double> v_ScintZ;
160  v_ScintZ.push_back(2195.*Gaudi::Units::mm); // <-- = btas_pos
161  v_ScintZ.push_back(2320.*Gaudi::Units::mm);
162  const double ScintDx = Fx;
163  const double ScintDy = Fy;
164  const double ScintDz = Fz;
165 
166  // Create one Scintillator and place it twice along z:
167 
168  GeoBox* ScintShape = new GeoBox(ScintDx, ScintDy, ScintDz); // A generic Box Scintillator
169  std::string ScintName = baseName + "::Scintillator";
170  GeoLogVol* ScintLogical = new GeoLogVol( ScintName, ScintShape, Scint );
171  GeoIntrusivePtr<GeoPhysVol> ScintPhysical = new GeoPhysVol( ScintLogical );
172  for ( unsigned int i = 0; i < v_ScintZ.size(); i++ ) {
173  m_H62002TablePhysical->add( new GeoIdentifierTag(i) );
174  m_H62002TablePhysical->add( new GeoTransform( GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (v_ScintZ[ i ]-H62002TableZ) ) ) );
175  log << MSG::INFO << " Position the F Scintillator at: " << v_ScintZ[ i ] << endmsg ;
176  m_H62002TablePhysical->add( ScintPhysical );
177  }
178 
179  //----- Done with F1/F2 Scintillators
180 
181 
182 
183 
184 
185 
186  //------ Get the MWPCs from LArGeoH6Cryostats
187  const int MwpcNumber = 3;
188  std::vector<double> v_MwpcPos;
189  v_MwpcPos.push_back(105.*Gaudi::Units::mm);
190  v_MwpcPos.push_back(825.*Gaudi::Units::mm);
191  v_MwpcPos.push_back(1815.*Gaudi::Units::mm);
192  double WireStep = 1.*Gaudi::Units::mm;
193  MWPCConstruction mwpcXConstruction (WireStep);
194  PVLink mwpcEnvelope = mwpcXConstruction.GetEnvelope();
195  for ( int imwpc = 0; imwpc<MwpcNumber ; imwpc++)
196  {
197  m_H62002TablePhysical->add(new GeoIdentifierTag(imwpc+2));
198  m_H62002TablePhysical->add( new GeoTransform(GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (v_MwpcPos[imwpc]-H62002TableZ) ) ) );
199  m_H62002TablePhysical->add(mwpcEnvelope);
200  }
201  //------ Done with creating an MWPC from LArGeoH6Cryostats
202 
203 
204 
205  // End Moveable Table detectors
206 
207 
208  return m_H62002TablePhysical;
209 }
210 
211 
212 
LArGeo::MWPCConstruction
Definition: MWPCConstruction.h:24
LArGeo::Fx
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:16
LArGeo::MWPCConstruction::GetEnvelope
virtual PVLink GetEnvelope()
Definition: MWPCConstruction.cxx:64
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
StoredMaterialManager.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
LArGeo::Fy
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:25
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
LArGeo::TableConstructionH62002::TableConstructionH62002
TableConstructionH62002()
Definition: TableConstructionH62002.cxx:47
LArGeo::TableConstructionH62002::~TableConstructionH62002
virtual ~TableConstructionH62002()
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
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
LArGeo::TableConstructionH62002::GetEnvelope
virtual PVLink GetEnvelope()
Definition: TableConstructionH62002.cxx:58
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
MWPCConstruction.h
StoreGateSvc.h
IGeoDbTagSvc.h
TableConstructionH62002.h
ServiceHandle< IGeoDbTagSvc >