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 );
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 );
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 );
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 );
252 GeoGenfun::Variable
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);