12 #include "GeoModelKernel/GeoElement.h"
13 #include "GeoModelKernel/GeoMaterial.h"
14 #include "GeoModelKernel/GeoFullPhysVol.h"
15 #include "GeoModelKernel/GeoVFullPhysVol.h"
16 #include "GeoModelKernel/GeoPhysVol.h"
17 #include "GeoModelKernel/GeoVPhysVol.h"
18 #include "GeoModelKernel/GeoLogVol.h"
19 #include "GeoModelKernel/GeoBox.h"
20 #include "GeoModelKernel/GeoTubs.h"
21 #include "GeoModelKernel/GeoTube.h"
22 #include "GeoModelKernel/GeoNameTag.h"
23 #include "GeoModelKernel/GeoTransform.h"
24 #include "GeoModelKernel/GeoSerialDenominator.h"
25 #include "GeoModelKernel/GeoSerialIdentifier.h"
26 #include "GeoModelKernel/GeoSerialTransformer.h"
27 #include "GeoModelKernel/GeoAlignableTransform.h"
28 #include "GeoModelKernel/GeoIdentifierTag.h"
29 #include "GeoModelKernel/GeoDefinitions.h"
31 #include "GeoModelKernel/GeoShapeUnion.h"
32 #include "GeoModelKernel/GeoShapeShift.h"
33 #include "GeoGenericFunctions/Variable.h"
43 #include "GaudiKernel/MsgStream.h"
44 #include "GaudiKernel/Bootstrap.h"
45 #include "GaudiKernel/SystemOfUnits.h"
53 m_MWPCPhysical(nullptr)
67 if (m_MWPCPhysical)
return m_MWPCPhysical;
70 ISvcLocator *svcLocator = Gaudi::svcLocator();
75 m_msg = std::make_unique<MsgStream>(
msgSvc,
"MWPCConstruction");
77 throw std::runtime_error(
"MWPCConstruction: cannot initialze message service");
80 (*m_msg) << MSG::INFO <<
"MWPCConstruction - creating an MWPC with wire step " << m_wireStep <<
"mm ! " <<
endmsg;
85 if (svcLocator->service(
"DetectorStore",
detStore,
false )==StatusCode::FAILURE) {
86 throw std::runtime_error(
"Error in MWPCConstruction, cannot access DetectorStore");
91 if (geoModelSvc.retrieve().isFailure()) {
92 throw std::runtime_error (
"Cannot locate GeoModelSvc!!");
100 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS")))
return nullptr;
104 const GeoElement*
W=materialManager->
getElement(
"Wolfram");
110 const GeoElement* Ar=materialManager->
getElement(
"Argon");
111 const GeoElement* C=materialManager->
getElement(
"Carbon");
112 const GeoElement*
H=materialManager->
getElement(
"Hydrogen");
114 Isobutane->add(C,0.8266);
115 Isobutane->add(
H,0.1734);
119 ArIso->add(Isobutane,0.39);
129 const GeoMaterial *Air = materialManager->
getMaterial(
"std::Air");
130 if (!Air)
throw std::runtime_error(
"Error in MWPCConstruction, std::Air is not found.");
132 const GeoMaterial *Aluminium = materialManager->
getMaterial(
"std::Aluminium");
133 if (!Aluminium)
throw std::runtime_error(
"Error in MWPCConstruction, std::Aluminium is not found.");
135 const GeoMaterial *Mylar = materialManager->
getMaterial(
"std::Mylar");
136 if (!Mylar)
throw std::runtime_error(
"Error in MWPCConstruction, std::Mylar is not found.");
145 std::string LArVersion = geoModelSvc->LAr_VersionOverride();
147 std::string detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
148 std::string detectorNode = LArVersion.empty() ?
"ATLAS" :
"LAr";
162 (*m_msg) <<
" Create MWPC5 " <<
endmsg;
164 std::string baseName =
"LAr::TB";
165 std::string MWPCName = baseName +
"::MWPC";
172 GeoBox* MWPCShape =
new GeoBox(MWPCDxy, MWPCDxy, MWPCDz);
173 const GeoLogVol* MWPCLogical =
new GeoLogVol( MWPCName, MWPCShape, ArIso );
175 m_MWPCPhysical =
new GeoPhysVol(MWPCLogical);
181 GeoBox* MylarShape =
new GeoBox(MWPCDxy, MWPCDxy, MylarDz);
186 if (
side==0) MylarPos = MylarDz-MWPCDz;
187 else MylarPos = MWPCDz-MylarDz;
188 std::string MylarName = MWPCName +
"::Mylar";
189 GeoLogVol* MylarLogical =
new GeoLogVol( MylarName, MylarShape, Mylar );
190 GeoIntrusivePtr<GeoPhysVol> MylarPhysical =
new GeoPhysVol( MylarLogical );
191 m_MWPCPhysical->add(
new GeoIdentifierTag(
side ) );
193 m_MWPCPhysical->add( MylarPhysical );
201 const double AluDz = Aluz;
205 GeoBox* AluShape =
new GeoBox(MWPCDxy, MWPCDxy, AluDz);
210 case 0: { AluPos = -Alu_s-AluDz;
break; }
211 case 1: { AluPos = -Alu_f+AluDz;
break; }
212 case 2: { AluPos = Alu_f-AluDz;
break; }
213 case 3: { AluPos = Alu_s+AluDz;
break; }
214 default: {
throw std::runtime_error(
"MWPC5 - too many Al foils!");
break; }
217 std::string AluName = MWPCName +
"::AlFoil";
218 GeoLogVol* AluLogical =
new GeoLogVol( AluName, AluShape, Aluminium );
219 GeoIntrusivePtr<GeoPhysVol> AluPhysical =
new GeoPhysVol( AluLogical );
220 m_MWPCPhysical->add(
new GeoIdentifierTag(
pos ) );
222 m_MWPCPhysical->add( AluPhysical );
229 const double SenDz = Senz;
233 GeoBox* SenPlaneShape =
new GeoBox(MWPCDxy, MWPCDxy, SenDz);
235 std::string XPlaneName = MWPCName +
"::XPlane";
236 std::string YPlaneName = MWPCName +
"::YPlane";
237 GeoLogVol* XPlaneLogical =
new GeoLogVol( XPlaneName, SenPlaneShape, ArIso );
238 GeoLogVol* YPlaneLogical =
new GeoLogVol( YPlaneName, SenPlaneShape, ArIso );
239 GeoIntrusivePtr<GeoPhysVol> XPlanePhysical =
new GeoPhysVol( XPlaneLogical );
240 GeoIntrusivePtr<GeoPhysVol> YPlanePhysical =
new GeoPhysVol( YPlaneLogical );
241 m_MWPCPhysical->add(
new GeoIdentifierTag( 0 ) );
243 m_MWPCPhysical->add( XPlanePhysical );
244 m_MWPCPhysical->add(
new GeoIdentifierTag( 0 ) );
246 m_MWPCPhysical->add( YPlanePhysical );
252 GeoGenfun::Variable
Index;
253 int NDiv=
int ( 2*MWPCDxy / m_wireStep ) ;
254 GeoXF::TRANSFUNCTION TX = GeoXF::Pow(GeoTrf::TranslateX3D(1.0), -MWPCDxy + m_wireStep/2. + m_wireStep*
Index);
255 GeoXF::TRANSFUNCTION TY = GeoXF::Pow(GeoTrf::TranslateY3D(1.0), -MWPCDxy + m_wireStep/2. + m_wireStep*
Index);
256 GeoBox* XPlaneDiv =
new GeoBox(m_wireStep/2., MWPCDxy , SenDz);
257 GeoBox* YPlaneDiv =
new GeoBox(MWPCDxy , m_wireStep/2., SenDz);
258 std::string XDivName = MWPCName +
"::XDiv";
259 std::string YDivName = MWPCName +
"::YDiv";
260 GeoLogVol* XDivLogical =
new GeoLogVol( XDivName, XPlaneDiv, ArIso );
261 GeoLogVol* YDivLogical =
new GeoLogVol( YDivName, YPlaneDiv, ArIso );
262 GeoIntrusivePtr<GeoPhysVol> XDivPhysical =
new GeoPhysVol( XDivLogical );
263 GeoIntrusivePtr<GeoPhysVol> YDivPhysical =
new GeoPhysVol( YDivLogical );
265 GeoSerialIdentifier *sIX =
new GeoSerialIdentifier(0);
266 GeoSerialTransformer *sTSX =
new GeoSerialTransformer(XDivPhysical, &TX, NDiv );
267 GeoSerialIdentifier *sIY =
new GeoSerialIdentifier(0);
268 GeoSerialTransformer *sTSY =
new GeoSerialTransformer(YDivPhysical, &TY, NDiv );
269 XPlanePhysical->add(sIX);
270 XPlanePhysical->add(sTSX);
271 YPlanePhysical->add(sIY);
272 YPlanePhysical->add(sTSY);
276 const double WireLen = MWPCDxy;
278 std::string WireName = MWPCName +
"::Wire";
279 GeoLogVol* WireLogical =
new GeoLogVol(WireName, WireShape, Tungsten);
280 GeoIntrusivePtr<GeoPhysVol> WirePhysical =
new GeoPhysVol( WireLogical );
282 XDivPhysical->add(WirePhysical);
284 YDivPhysical->add(WirePhysical);
293 return m_MWPCPhysical;