ATLAS Offline Software
MiddleBeamConstructionH62004.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 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/GeoSerialIdentifier.h"
21 #include "GeoModelKernel/GeoSerialTransformer.h"
22 #include "GeoModelKernel/GeoAlignableTransform.h"
23 #include "GeoModelKernel/GeoIdentifierTag.h"
24 #include "GeoModelKernel/GeoSerialDenominator.h"
25 #include "GeoModelKernel/GeoDefinitions.h"
26 #include "StoreGate/StoreGateSvc.h"
28 #include "GeoModelKernel/GeoShapeUnion.h"
29 #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_H62004MiddleBeamPhysical(nullptr),
49  m_detectorManager(nullptr)
50 {
51 }
52 
53 
55 = default;
56 
57 
58 
60 {
61 
62  if (m_H62004MiddleBeamPhysical) return m_H62004MiddleBeamPhysical;
63 
64  // Get access to the material manager:
65 
66  ISvcLocator *svcLocator = Gaudi::svcLocator();
67  IMessageSvc * msgSvc;
68  if (svcLocator->service("MessageSvc", msgSvc, true )==StatusCode::FAILURE) {
69  throw std::runtime_error("Error in MiddleBeamConstructionH62004, cannot access MessageSvc");
70  }
71 
72  MsgStream log(msgSvc, "LArGeo::MiddleBeamConstructionH62004");
73  log << MSG::INFO << "+ HELLO from LArGeo::MiddleBeamConstructionH62004 +" << endmsg;
74 
75 
77  if (svcLocator->service("DetectorStore", detStore, false )==StatusCode::FAILURE) {
78  throw std::runtime_error("Error in MiddleBeamConstructionH62004, cannot access DetectorStore");
79  }
80 
81  // Get the materials from the material manager:-----------------------------------------------------//
82  // //
83 
84  StoredMaterialManager* materialManager = nullptr;
85  if (StatusCode::SUCCESS != detStore->retrieve(materialManager, std::string("MATERIALS"))) return nullptr;
86 
87  const GeoMaterial *Air = materialManager->getMaterial("std::Air");
88  if (!Air) throw std::runtime_error("Error in MiddleBeamConstructionH62004, std::Air is not found.");
89 
90  //-------------------------------------------------------------------------------------------------//
91 
92 
93  DecodeVersionKey larVersion("LAr");
94 
95 
97  // Define geometry
99 
100 
101  // Here we creat the envelope for the Moveable FrontBeam Instrumentation. This code is repeated
102  // createEnvelope() method below. There should be a way to avoid this repitition.
103 
104  //------ The FrontBeam
105 
106  std::string baseName = "LAr::TBH62004";
107  std::string H62004MiddleBeamName = baseName + "::MiddleBeam";
108 
109  //
110  // Define dimension of Middle part & position of Front part
111  //
112  double bmtb_x = 12.0*Gaudi::Units::cm;
113  double bmtb_y = 12.0*Gaudi::Units::cm;
114  double bmtb_z = 25.0*Gaudi::Units::cm;
115  //double bmtb_pos = 10.0*Gaudi::Units::cm;
116  double bpco_pos[4] = {1.*Gaudi::Units::cm, 1.*Gaudi::Units::cm, 15.3*Gaudi::Units::cm, 15.3*Gaudi::Units::cm};
117  double bpco_shift[4] = {0.*Gaudi::Units::cm, 7.8*Gaudi::Units::cm, 0.*Gaudi::Units::cm, 7.5*Gaudi::Units::cm};
118  double bpc_old_z = (5.100/2)*Gaudi::Units::cm;
119 
120  GeoBox* H62004MiddleBeamShape = new GeoBox( bmtb_x, bmtb_y, bmtb_z );
121  const GeoLogVol* H62004MiddleBeamLogical = new GeoLogVol( H62004MiddleBeamName, H62004MiddleBeamShape, Air );
122 
123  m_H62004MiddleBeamPhysical = new GeoPhysVol(H62004MiddleBeamLogical);
124 
125 
126  //----- Now create BPC
127  log << MSG::INFO << " Create BPC 1&2 " << endmsg;
128 
129  BPCConstruction *BPC = new BPCConstruction(true);
130  PVLink BPCPhysical = BPC->GetEnvelope();
131  for(int i=0; i<4; ++i) {
132  m_H62004MiddleBeamPhysical->add( new GeoIdentifierTag((3+i/2)*10+i) );
133  switch(i) {
134  case 0: case 2: {
135  m_H62004MiddleBeamPhysical->add( new GeoTransform(GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, bpco_pos[i]+bpco_shift[i]+bpc_old_z-bmtb_z) ) );
136  m_H62004MiddleBeamPhysical->add(BPCPhysical);
137  break;}
138  case 1: case 3: {
139  m_H62004MiddleBeamPhysical->add( new GeoTransform(GeoTrf::RotateZ3D(90.*Gaudi::Units::deg) * GeoTrf::Translate3D( 0.*Gaudi::Units::cm, 0.*Gaudi::Units::cm, bpco_pos[i]+bpco_shift[i]+bpc_old_z-bmtb_z) ) );
140  m_H62004MiddleBeamPhysical->add(BPCPhysical);
141  break;}
142  }
143  }
144 
145  // End Middle FrontBeam detectors
146 
147 
148  return m_H62004MiddleBeamPhysical;
149 }
150 
151 
152 
MiddleBeamConstructionH62004.h
LArGeo::MiddleBeamConstructionH62004::MiddleBeamConstructionH62004
MiddleBeamConstructionH62004()
Definition: MiddleBeamConstructionH62004.cxx:47
LArGeo::MiddleBeamConstructionH62004::~MiddleBeamConstructionH62004
virtual ~MiddleBeamConstructionH62004()
deg
#define deg
Definition: SbPolyhedron.cxx:17
BPCConstruction.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
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
LArGeo::MiddleBeamConstructionH62004::GetEnvelope
virtual PVLink GetEnvelope()
Definition: MiddleBeamConstructionH62004.cxx:59
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
StoredMaterialManager.h
DecodeVersionKey.h
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.
StoreGateSvc.h
LArGeo::BPCConstruction::GetEnvelope
virtual PVLink GetEnvelope()
Definition: BPCConstruction.cxx:62
LArGeo::BPCConstruction
Definition: BPCConstruction.h:23