ATLAS Offline Software
FrontBeamConstructionH62002.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_H62002FrontBeamPhysical(nullptr)
49 {
50 }
51 
52 
54 = default;
55 
56 
57 
59 {
60 
61  if (m_H62002FrontBeamPhysical) return m_H62002FrontBeamPhysical;
62 
63  // Get access to the material manager:
64 
65  ISvcLocator *svcLocator = Gaudi::svcLocator();
66  IMessageSvc * msgSvc;
67  if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
68  throw std::runtime_error("Error in FrontBeamConstructionH62002, cannot access MessageSvc");
69  }
70 
71  MsgStream log(msgSvc, "LArGeo::FrontBeamConstructionH62002");
72  log << MSG::INFO;
73  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
74  log << "+ +" << std::endl;
75  log << "+ HELLO from LArGeo::FrontBeamConstructionH62002 +" << std::endl;
76  log << "+ +" << std::endl;
77  log << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
78 
79 
81  if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
82  throw std::runtime_error("Error in FrontBeamConstructionH62002, cannot access DetectorStore");
83  }
84 
85  ServiceHandle<IGeoDbTagSvc> geoDbTagSvc ("GeoDbTagSvc", "WallsConstruction");
86  if (geoDbTagSvc.retrieve().isFailure()) {
87  throw std::runtime_error ("Cannot locate GeoDbTagSvc!!");
88  }
89 
90  // Get the materials from the material manager:-----------------------------------------------------//
91  // //
92 
93  StoredMaterialManager* materialManager = nullptr;
94  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
95 
96 
97  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
98  if (!Air) throw std::runtime_error("Error in FrontBeamConstructionH62002, std::Air is not found.");
99 
100  const GeoMaterial *Aluminium = materialManager->getMaterial("std::Aluminium");
101  if (!Aluminium) throw std::runtime_error("Error in FrontBeamConstructionH62002, std::Aluminium is not found.");
102 
103  // Is this ok for the Scintillator?
104  // I don't really know for sure what kind of a scintillator we have.
105  // Lots of Scintillators are PMMA (Plexiglas), which has a composition of C5 H8 O2 and density 1.18 g/cm3
106  // The Tile uses a composition of C H (density 1.032)
107  // The old FrontBeam testbeam code uses a composition of C9 H10 (density 1.032)
108  // ... because it's easiest at the moment and not all that different from the fractional
109  // composition of the old tb code, take the Tile material (polysterene)...
110  const GeoMaterial *Scint = materialManager->getMaterial("std::Polystyrene");
111  if (!Scint) throw std::runtime_error("Error in FrontBeamConstructionH62002, std::Polystyrene is not found.");
112 
113  const GeoMaterial *Mylar = materialManager->getMaterial("std::Mylar");
114  if (!Mylar) throw std::runtime_error("Error in FrontBeamConstructionH62002, std::Mylar is not found.");
115 
116 
117  // //
118  //-------------------------------------------------------------------------------------------------//
119 
120  std::string AtlasVersion = geoDbTagSvc->atlasVersion();
121  std::string LArVersion = geoDbTagSvc->LAr_VersionOverride();
122 
123  std::string detectorKey = LArVersion.empty() ? AtlasVersion : LArVersion;
124  std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
125 
127  // Define geometry
129 
130 
131  // Here we creat the envelope for the Moveable FrontBeam Instrumentation. This code is repeated
132  // createEnvelope() method below. There should be a way to avoid this repitition.
133 
134  //------ The FrontBeam
135 
136  std::string baseName = "LAr::TBH62002";
137  std::string H62002FrontBeamName = baseName + "::FrontBeam";
138 
139  const double H62002FrontBeamXY = 2000.*Gaudi::Units::mm;
140  const double H62002FrontBeamZ = 350.*Gaudi::Units::mm;
141 
142 
143  GeoBox* H62002FrontBeamShape = new GeoBox( H62002FrontBeamXY, H62002FrontBeamXY, H62002FrontBeamZ );
144  const GeoLogVol* H62002FrontBeamLogical = new GeoLogVol( H62002FrontBeamName, H62002FrontBeamShape, Air );
145 
146  m_H62002FrontBeamPhysical = new GeoPhysVol(H62002FrontBeamLogical);
147  //m_H62002FrontBeamPhysical->add( new GeoNameTag("LArTBFrontBeamPos") );
148 
149 
150 
151 
152 
153  //------ W1,W2,B1 Scintillators
154  // In the old stand-alone code, all three were round with a radius of 5cm
155  // and 7.5mm thickness.
156  // Logbooks in the control-room say that their xyz sizes are:
157  // B1 : 30 x 30 x 10 Gaudi::Units::mm
158  // W1,2 : 150 x 150 x 10 Gaudi::Units::mm
159  // They are certainly not round, so stick with the logbook values
160  // The beam sees the instrumentation in the following order:
161  // W1, W2, B1, MWPC5
162 
163  log << "Create Front Scintillators ..." << std::endl;
164 
165  const double Wxy= 75.0*Gaudi::Units::mm;
166  const double Wz = 5.0*Gaudi::Units::mm;
167  const double Bxy= 15.0*Gaudi::Units::mm;
168  const double Bz = 5.0*Gaudi::Units::mm;
169 
170  std::vector<double> v_ScintXY;
171  std::vector<double> v_ScintZ;
172  v_ScintXY.push_back(Wxy);
173  v_ScintXY.push_back(Wxy);
174  v_ScintXY.push_back(Bxy);
175  v_ScintZ.push_back(170.*Gaudi::Units::mm);
176  v_ScintZ.push_back(200.*Gaudi::Units::mm);
177  v_ScintZ.push_back(340.*Gaudi::Units::mm);
178 
179  // Create one Scintillator and place it twice along z:
180 
181  GeoBox* ScintShapeW = new GeoBox(Wxy, Wxy, Wz);
182  GeoBox* ScintShapeB = new GeoBox(Bxy, Bxy, Bz);
183  std::string ScintName = baseName + "::Scintillator";
184  GeoLogVol* WScintLogical = new GeoLogVol( ScintName, ScintShapeW, Scint );
185  GeoLogVol* BScintLogical = new GeoLogVol( ScintName, ScintShapeB, Scint );
186  GeoIntrusivePtr<GeoPhysVol> WScintPhysical = new GeoPhysVol( WScintLogical );
187  GeoIntrusivePtr<GeoPhysVol> BScintPhysical = new GeoPhysVol( BScintLogical );
188  //WScintPhysical->add( new GeoNameTag(ScintName) );
189  //BScintPhysical->add( new GeoNameTag(ScintName) );
190  for ( unsigned int i = 0; i < v_ScintZ.size(); i++ ) {
191  m_H62002FrontBeamPhysical->add( new GeoIdentifierTag(i) );
192  m_H62002FrontBeamPhysical->add( new GeoTransform( GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (v_ScintZ[ i ]-H62002FrontBeamZ) ) ) ) ; m_H62002FrontBeamPhysical->add( new GeoNameTag(ScintName) );
193 
194  switch(i) {
195  case 0: case 1: { m_H62002FrontBeamPhysical->add( WScintPhysical ); break; }
196  case 2: { m_H62002FrontBeamPhysical->add( BScintPhysical ); break; }
197  default: { throw std::runtime_error("H62002FrontBeam wants too many Scintillators!!"); break; }
198  }
199  }
200 
201  //----- Done with Scintillators
202 
203 
204 
205 
206  //------ Get MWPC number 5 from LArGeoH6Cryostats
207  const double MwpcPos = 605.*Gaudi::Units::mm;
208  double WireStep = 2.*Gaudi::Units::mm;
209  MWPCConstruction mwpcXConstruction (WireStep);
210  PVLink mwpcEnvelope = mwpcXConstruction.GetEnvelope();
211  m_H62002FrontBeamPhysical->add(new GeoIdentifierTag(5));
212  m_H62002FrontBeamPhysical->add( new GeoTransform(GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (MwpcPos-H62002FrontBeamZ) ) ) );
213  m_H62002FrontBeamPhysical->add(mwpcEnvelope);
214  //------ Done with creating an MWPC from LArGeoH6Cryostats
215 
216 
217 
218 
219  // End Moveable FrontBeam detectors
220 
221 
222  return m_H62002FrontBeamPhysical;
223 }
224 
225 
226 
FrontBeamConstructionH62002.h
LArGeo::MWPCConstruction
Definition: MWPCConstruction.h:24
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
LArGeo::FrontBeamConstructionH62002::~FrontBeamConstructionH62002
virtual ~FrontBeamConstructionH62002()
LArGeo::FrontBeamConstructionH62002::GetEnvelope
virtual PVLink GetEnvelope()
Definition: FrontBeamConstructionH62002.cxx:58
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
StoredMaterialManager.h
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
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
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
MWPCConstruction.h
StoreGateSvc.h
IGeoDbTagSvc.h
LArGeo::FrontBeamConstructionH62002::FrontBeamConstructionH62002
FrontBeamConstructionH62002()
Definition: FrontBeamConstructionH62002.cxx:47
ServiceHandle< IGeoDbTagSvc >