72 throw std::runtime_error(
"Unable to retrieve TileTBID");
82 if(
status.isFailure() || storedLArECA == 0)
83 throw std::runtime_error(
"Failed to locate LAr Endcap A");
86 if(
status.isFailure() || storedLArECC == 0)
87 throw std::runtime_error(
"Failed to locate LAr Endcap C");
91 GeoFullPhysVol* pvLArECA = storedLArECA->
getPhysVol();
92 GeoFullPhysVol* pvLArECC = storedLArECC->
getPhysVol();
99 PVConstLink pvMbtsMother;
100 bool mbtsExists =
false;
102 GeoVolumeCursor cursor1(pvLArECA);
103 while(!cursor1.atEnd())
105 PVConstLink child = cursor1.getVolume();
106 if(child->getLogVol()->getName() ==
"MBTS_mother")
108 pvMbtsMother = child;
109 xfMbtsMother = cursor1.getTransform();
117 throw std::runtime_error(
"Unable to find MBTS volume");
134 GeoVolumeCursor cursor2(pvMbtsMother);
139 bool scin1Exists =
false;
140 bool scin2Exists =
false;
142 while(!cursor2.atEnd())
144 PVConstLink child = cursor2.getVolume();
145 std::string childName = child->getLogVol()->getName();
146 if(childName.find(
"MBTSAirEnv")!=std::string::npos) {
150 if(childName ==
"MBTS1")
154 int copyNo= cursor2.getId();
156 aTransforms1[copyNo] = xfLArECA * xfMbtsMother * cursor2.getTransform();
157 cTransforms1[copyNo] = xfLArECC * xfMbtsMother * cursor2.getTransform();
159 else if(childName ==
"MBTS2")
163 int copyNo= cursor2.getId();
165 aTransforms2[copyNo] = xfLArECA * xfMbtsMother * cursor2.getTransform();
166 cTransforms2[copyNo] = xfLArECC * xfMbtsMother * cursor2.getTransform();
172 GeoVolumeCursor cursor2a(pvMbtsMother);
173 while(!cursor2a.atEnd()) {
174 PVConstLink pvAirEnv = cursor2a.getVolume();
175 if(pvAirEnv->getLogVol()->getName().find(
"MBTSAirEnv")!=std::string::npos) {
176 int copyNo = cursor2a.getId();
179 GeoVolumeCursor cursor3(pvAirEnv);
180 bool aluEnvExists(
false);
181 while(!cursor3.atEnd()) {
182 if(cursor3.getVolume()->getLogVol()->getName().find(
"MBTSAluEnv")!=std::string::npos) {
189 throw std::runtime_error(
"Problems with MBTS geometry: Cannot find MBTSAluEnv!");
191 PVConstLink pvAluEnv = cursor3.getVolume();
194 GeoVolumeCursor cursor4(pvAluEnv);
195 bool airInAluExists(
false);
196 while(!cursor4.atEnd()) {
197 if(cursor4.getVolume()->getLogVol()->getName().find(
"MBTSAirInAlu")!=std::string::npos) {
198 airInAluExists =
true;
204 throw std::runtime_error(
"Problems with MBTS geometry: Cannot find MBTSAirInAlu!");
206 PVConstLink pvAirInAluEnv = cursor4.getVolume();
209 GeoVolumeCursor cursor5(pvAirInAluEnv);
210 while(!cursor5.atEnd()) {
211 PVConstLink child = cursor5.getVolume();
212 if(child->getLogVol()->getName()==
"MBTS1") {
215 aTransforms1[copyNo] = xfLArECA * xfMbtsMother * cursor2a.getTransform() * cursor3.getTransform() * cursor4.getTransform() * cursor5.getTransform();
216 cTransforms1[copyNo] = xfLArECC * xfMbtsMother * cursor2a.getTransform() * cursor3.getTransform() * cursor4.getTransform() * cursor5.getTransform();
218 if(child->getLogVol()->getName()==
"MBTS2") {
221 aTransforms2[copyNo] = xfLArECA * xfMbtsMother * cursor2a.getTransform() * cursor3.getTransform() * cursor4.getTransform() * cursor5.getTransform();
222 cTransforms2[copyNo] = xfLArECC * xfMbtsMother * cursor2a.getTransform() * cursor3.getTransform() * cursor4.getTransform() * cursor5.getTransform();
232 throw std::runtime_error(
"No MBTS1 in the geometry");
235 throw std::runtime_error(
"No MBTS2 in the geometry");
237 const GeoShape* shape1 = pvScin1->getLogVol()->getShape();
238 const GeoShape* shape2 = pvScin2->getLogVol()->getShape();
240 const GeoTrd* trd1 =
dynamic_cast<const GeoTrd*
>(shape1);
241 const GeoTrd* trd2 =
dynamic_cast<const GeoTrd*
>(shape2);
244 throw std::runtime_error(
"The shape of MBTS1 is not TRD");
247 throw std::runtime_error(
"The shape of MBTS2 is not TRD");
253 scinInfo1->
dx1 = trd1->getXHalfLength1();
254 scinInfo1->
dx2 = trd1->getXHalfLength2();
255 scinInfo1->
dy1 = trd1->getYHalfLength1();
256 scinInfo1->
dy2 = trd1->getYHalfLength2();
257 scinInfo1->
dz = trd1->getZHalfLength();
261 scinInfo2->
dx1 = trd2->getXHalfLength1();
262 scinInfo2->
dx2 = trd2->getXHalfLength2();
263 scinInfo2->
dy1 = trd2->getYHalfLength1();
264 scinInfo2->
dy2 = trd2->getYHalfLength2();
265 scinInfo2->
dz = trd2->getZHalfLength();