ATLAS Offline Software
FrontBeamConstructionH62004.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "GeoModelKernel/GeoElement.h"
10 #include "GeoModelKernel/GeoMaterial.h"
11 #include "GeoModelKernel/GeoFullPhysVol.h"
12 #include "GeoModelKernel/GeoVFullPhysVol.h"
13 #include "GeoModelKernel/GeoPhysVol.h"
14 #include "GeoModelKernel/GeoVPhysVol.h"
15 #include "GeoModelKernel/GeoLogVol.h"
16 #include "GeoModelKernel/GeoBox.h"
17 #include "GeoModelKernel/GeoTubs.h"
18 #include "GeoModelKernel/GeoTube.h"
19 #include "GeoModelKernel/GeoNameTag.h"
20 #include "GeoModelKernel/GeoTransform.h"
21 #include "GeoModelKernel/GeoSerialDenominator.h"
22 #include "GeoModelKernel/GeoSerialIdentifier.h"
23 #include "GeoModelKernel/GeoSerialTransformer.h"
24 #include "GeoModelKernel/GeoAlignableTransform.h"
25 #include "GeoModelKernel/GeoIdentifierTag.h"
26 #include "GeoModelKernel/GeoDefinitions.h"
27 #include "StoreGate/StoreGateSvc.h"
29 #include "GeoModelKernel/GeoShapeUnion.h"
30 #include "GeoModelKernel/GeoShapeShift.h"
31 
32 #include "GeoGenericFunctions/Variable.h"
33 
34 // For the database:
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_H62004FrontBeamPhysical(nullptr),
49  m_detectorManager(nullptr)
50 {
51 }
52 
53 
55 = default;
56 
57 
58 
60 {
61 
62  if (m_H62004FrontBeamPhysical) return m_H62004FrontBeamPhysical;
63 
64  // Get access to the material manager:
65 
66  StatusCode sc;
67  ISvcLocator *svcLocator = Gaudi::svcLocator();
68  IMessageSvc * msgSvc;
69  sc=svcLocator->service("MessageSvc", msgSvc, true );
70  if (sc==StatusCode::FAILURE) {
71  throw std::runtime_error("Error in FrontBeamConstructionH62004, cannot access MessageSvc");
72  }
73 
74  MsgStream log(msgSvc, "LArGeo::FrontBeamConstructionH62004");
75  log << MSG::INFO << "+ HELLO from LArGeo::FrontBeamConstructionH62004 +" << endmsg;
76 
77 
79  sc=svcLocator->service("DetectorStore", detStore, false );
80  if (sc==StatusCode::FAILURE) {
81  throw std::runtime_error("Error in FrontBeamConstructionH62004, cannot access DetectorStore");
82  }
83 
84 
85 
86  // Get the materials from the material manager:-----------------------------------------------------//
87  // //
88 
89  StoredMaterialManager* materialManager = nullptr;
90  sc=detStore->retrieve(materialManager, std::string("MATERIALS"));
91  if (StatusCode::SUCCESS != sc) return nullptr;
92 
93  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
94  if (!Air) throw std::runtime_error("Error in FrontBeamConstructionH62004, std::Air is not found.");
95 
96  // Is this ok for the Scintillator?
97  // I don't really know for sure what kind of a scintillator we have.
98  // Lots of Scintillators are PMMA (Plexiglas), which has a composition of C5 H8 O2 and density 1.18 g/cm3
99  // The Tile uses a composition of C H (density 1.032)
100  // The old FrontBeam testbeam code uses a composition of C9 H10 (density 1.032)
101  // ... because it's easiest at the moment and not all that different from the fractional
102  // composition of the old tb code, take the Tile material (polysterene)...
103  const GeoMaterial *Scint = materialManager->getMaterial("std::Polystyrene");
104  if (!Scint) throw std::runtime_error("Error in FrontBeamConstructionH62004, std::Polystyrene is not found.");
105 
106  //-------------------------------------------------------------------------------------------------//
108  // Define geometry
110 
111 
112  // Here we creat the envelope for the Moveable FrontBeam Instrumentation. This code is repeated
113  // createEnvelope() method below. There should be a way to avoid this repitition.
114 
115  //------ The FrontBeam
116 
117  std::string baseName = "LAr::TBH62004";
118  std::string H62004FrontBeamName = baseName + "::FrontBeam";
119 
120  //
121  // Define dimension of Front part & position of Front part
122  //
123  // DB ?
124  const double bard_x = 20.0*Gaudi::Units::cm;
125  const double bard_y = 20.0*Gaudi::Units::cm;
126  //const double bard_z = 35.0*Gaudi::Units::cm;
127  const double bard_z = 100.0*Gaudi::Units::cm;
128  const double fbpc_z[2] = {60.4*Gaudi::Units::cm,112.7*Gaudi::Units::cm};
129  // Position in exp_hall
130  //const double z_bard=-2160.0*Gaudi::Units::cm+80.1*Gaudi::Units::cm+16.*Gaudi::Units::cm+bard_z;
131  //const double z_bardm=-2160.0*Gaudi::Units::cm+1362.3*Gaudi::Units::cm;
132 
133 
134 
135  GeoBox* H62004FrontBeamShape = new GeoBox( bard_x, bard_y, bard_z );
136  const GeoLogVol* H62004FrontBeamLogical = new GeoLogVol( H62004FrontBeamName, H62004FrontBeamShape, Air );
137 
138  m_H62004FrontBeamPhysical = new GeoPhysVol(H62004FrontBeamLogical);
139  //m_H62004FrontBeamPhysical->add( new GeoNameTag("LArTBFrontBeamPos") );
140 
141  //------ W1,W2,B1 Scintillators
142  // In the old stand-alone code, all three were round with a radius of 5cm
143  // and 7.5mm thickness.
144  // Logbooks in the control-room say that their xyz sizes are:
145  // B1 : 30 x 30 x 10 Gaudi::Units::mm
146  // W1,2 : 150 x 150 x 10 Gaudi::Units::mm
147  // They are certainly not round, so stick with the logbook values
148  // The beam sees the instrumentation in the following order:
149  // W1, W2, B1, MWPC5
150 
151  log << MSG::INFO << "Create Front Scintillators ..." << endmsg;
152 
153  const double Wxy= 75.0*Gaudi::Units::mm;
154  const double Wz = 5.0*Gaudi::Units::mm;
155  const double Bxy= 15.0*Gaudi::Units::mm;
156  const double Bz = 5.0*Gaudi::Units::mm;
157 
158  std::vector<double> v_ScintXY;
159  std::vector<double> v_ScintZ;
160  v_ScintXY.push_back(Wxy);
161  v_ScintXY.push_back(Wxy);
162  v_ScintXY.push_back(Bxy);
163  v_ScintZ.push_back(10.*Gaudi::Units::mm);
164  v_ScintZ.push_back(40.*Gaudi::Units::mm);
165  v_ScintZ.push_back(180.*Gaudi::Units::mm);
166 
167  // Create one Scintillator and place it twice along z:
168 
169  GeoBox* ScintShapeW = new GeoBox(Wxy, Wxy, Wz);
170  GeoBox* ScintShapeB = new GeoBox(Bxy, Bxy, Bz);
171  std::string ScintName = H62004FrontBeamName + "::Scintillator";
172  GeoLogVol* WScintLogical = new GeoLogVol( ScintName, ScintShapeW, Scint );
173  GeoLogVol* BScintLogical = new GeoLogVol( ScintName, ScintShapeB, Scint );
174  GeoIntrusivePtr<GeoPhysVol> WScintPhysical = new GeoPhysVol( WScintLogical );
175  GeoIntrusivePtr<GeoPhysVol> BScintPhysical = new GeoPhysVol( BScintLogical );
176  //WScintPhysical->add( new GeoNameTag(ScintName) );
177  //BScintPhysical->add( new GeoNameTag(ScintName) );
178  for ( unsigned int i = 0; i < v_ScintZ.size(); i++ ) {
179  m_H62004FrontBeamPhysical->add( new GeoIdentifierTag(i+1) );
180  m_H62004FrontBeamPhysical->add( new GeoTransform( GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (v_ScintZ[ i ]-bard_z) ) ) ) ; m_H62004FrontBeamPhysical->add( new GeoNameTag(ScintName) );
181 
182  switch(i) {
183  case 0: case 1: { m_H62004FrontBeamPhysical->add( WScintPhysical ); break; }
184  case 2: { m_H62004FrontBeamPhysical->add( BScintPhysical ); break; }
185  default: { throw std::runtime_error("H62004FrontBeam wants too many Scintillators!!"); break; }
186  }
187  }
188 
189  //----- Done with Scintillators
190 
191 
192 
193  //------ Now create MWPC5
194  log << MSG::INFO << " Create MWPC5 " << endmsg;
195 
197  PVLink MwpcPhysical = MWPC5.GetEnvelope();
198 
199  const double MwpcPos = 445.*Gaudi::Units::mm;
200 
201  m_H62004FrontBeamPhysical->add( new GeoIdentifierTag(5) );
202  m_H62004FrontBeamPhysical->add( new GeoTransform(GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (MwpcPos-bard_z) ) ) );
203  m_H62004FrontBeamPhysical->add( MwpcPhysical );
204 
205  //----- Done with the MWPC
206 
207  //----- Now create BPC
208  log << MSG::INFO << " Create BPC 1&2 " << endmsg;
209 
210  BPCConstruction BPC (false);
211  PVLink BPCPhysical = BPC.GetEnvelope();
212  for(int i=1; i<3; ++i) {
213  m_H62004FrontBeamPhysical->add( new GeoIdentifierTag(i) );
214  m_H62004FrontBeamPhysical->add( new GeoTransform(GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, (MwpcPos-bard_z) + fbpc_z[i-1]) ) );
215  m_H62004FrontBeamPhysical->add(BPCPhysical);
216  }
217 
218  // End Moveable FrontBeam detectors
219 
220 
221  return m_H62004FrontBeamPhysical;
222 }
223 
224 
225 
LArGeo::FrontBeamConstructionH62004::GetEnvelope
virtual PVLink GetEnvelope()
Definition: FrontBeamConstructionH62004.cxx:59
LArGeo::MWPCConstruction
Definition: MWPCConstruction.h:24
BPCConstruction.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LArGeo::MWPCConstruction::GetEnvelope
virtual PVLink GetEnvelope()
Definition: MWPCConstruction.cxx:64
FrontBeamConstructionH62004.h
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
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
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
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
LArGeo::FrontBeamConstructionH62004::~FrontBeamConstructionH62004
virtual ~FrontBeamConstructionH62004()
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
MWPCConstruction.h
StoreGateSvc.h
LArGeo::BPCConstruction::GetEnvelope
virtual PVLink GetEnvelope()
Definition: BPCConstruction.cxx:62
LArGeo::FrontBeamConstructionH62004::FrontBeamConstructionH62004
FrontBeamConstructionH62004()
Definition: FrontBeamConstructionH62004.cxx:47
LArGeo::BPCConstruction
Definition: BPCConstruction.h:23