52 double eps = 0.000001;
55 const RPC *
r =
dynamic_cast<const RPC*
>(mysql.GetTechnology(
name));
57 if (
m->
nGasGaps() == 3 &&
r->NstripPanels_in_s != 1)
58 throw std::runtime_error(Form(
"File: %s, Line: %d\nRpcLayer::build() - NstripPanels_in_s = %d for BI RPC, not possible", __FILE__, __LINE__,
r->NstripPanels_in_s));
71 const GeoMaterial *mrpcl = matManager.
getMaterial(
"std::Air");
72 GeoLogVol *lrpcl =
new GeoLogVol(
"Rpclayer", srpcl, mrpcl);
73 PVLink prpcl =
new GeoPhysVol(lrpcl);
78 double strpanThickness =
r->stripPanelThickness - tol;
79 double strpanCopperThickness =
r->stripPanelCopperSkinThickness;
81 strpanThickness = rpc3GapStrPanThickness - tol;
82 strpanCopperThickness = rpc3GapStrPanCopThickness;
84 double strpanLength =
length /
r->NstripPanels_in_z;
85 double strpanWidth =
width /
r->NstripPanels_in_s - eps;
87 log <<
MSG::VERBOSE <<
" RpcLayer:: Building a strip panel:: div_s, div_z = " <<
r->NstripPanels_in_s <<
" " <<
r->NstripPanels_in_z <<
endmsg;
90 log <<
MSG::VERBOSE <<
" RpcLayer:: Building a strip panel:: w,l,t = " << strpanWidth <<
" " << strpanLength <<
" " << strpanThickness <<
endmsg;
92 GeoTrd *sstrpan =
new GeoTrd(strpanThickness / 2., strpanThickness / 2., strpanWidth / 2., strpanWidth / 2., strpanLength / 2.);
94 GeoTrd *sfoamstrpan =
new GeoTrd(strpanThickness / 2. - strpanCopperThickness, strpanThickness / 2. - strpanCopperThickness, strpanWidth / 2. - strpanCopperThickness,
95 strpanWidth / 2. - strpanCopperThickness, strpanLength / 2. - strpanCopperThickness);
96 const GeoShape *scustrpan = sstrpan;
98 const auto *stripMaterial = matManager.
getMaterial(
"muo::RpcFoam");
100 stripMaterial = matManager.
getMaterial(
"muo::Forex");
103 GeoLogVol *lcustrpan =
new GeoLogVol(
"RPC_StripPanelCuSkin", scustrpan, matManager.
getMaterial(
"std::Copper"));
104 GeoLogVol *lfoamstrpan =
new GeoLogVol(
"RPC_StripPanelFoam", sfoamstrpan, stripMaterial);
106 newpos += strpanThickness / 2. + tol / 2.;
107 GeoPhysVol *pcustrpan11 =
new GeoPhysVol(lcustrpan);
108 GeoPhysVol *pfoamstrpan11 =
new GeoPhysVol(lfoamstrpan);
109 GeoTransform *
tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
113 if (
r->NstripPanels_in_s == 2) {
117 GeoPhysVol *pcustrpan12 =
new GeoPhysVol(lcustrpan);
118 GeoPhysVol *pfoamstrpan12 =
new GeoPhysVol(lfoamstrpan);
119 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
120 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
124 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 1st phi strip panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
127 prpcl->add(pcustrpan11);
128 pcustrpan11->add(pfoamstrpan11);
132 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd phi strip panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
135 prpcl->add(pcustrpan12);
136 pcustrpan12->add(pfoamstrpan12);
138 }
else if (
r->NstripPanels_in_s == 1) {
143 prpcl->add(pcustrpan11);
144 pcustrpan11->add(pfoamstrpan11);
146 log <<
MSG::VERBOSE <<
" RpcLayer:: Locating a single phi strip panel at x, y " << newpos <<
" 0 "
147 <<
" of width = " << strpanWidth <<
" in a box of width = " <<
width <<
endmsg;
151 newpos += strpanThickness / 2.;
152 double bakelThickness =
r->bakeliteThickness;
153 double gThickness =
r->gasThickness;
154 double totAirThickness =
r->totalAirThickness;
156 bakelThickness = rpc3GapBakelThickness;
157 gThickness = rpc3GapGThickness;
158 totAirThickness = rpc3GapTotAirThickness;
161 double ggThickness = 2. * bakelThickness + gThickness + totAirThickness;
162 newpos += ggThickness / 2.;
166 double ggWidth =
width /
r->NGasGaps_in_s - eps;
167 double gasLength = ggLength - 2. *
r->bakeliteframesize;
168 double gasWidth = ggWidth - 2. *
r->bakeliteframesize;
171 if (
name ==
"RPC26") {
172 gasLength = ggLength - 93.25;
173 gasWidth = ggWidth - 109.52;
174 }
else if (
name ==
"RPC27") {
175 gasLength = ggLength - 93.12;
176 gasWidth = ggWidth - 109.52;
177 }
else if (
name ==
"RPC28") {
178 gasLength = ggLength - 93.04;
179 gasWidth = ggWidth - 109.52;
180 }
else if (
name ==
"RPC29") {
181 gasLength = ggLength - 93.04;
182 gasWidth = ggWidth - 109.2;
187 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gasgap:: " <<
r->NGasGaps_in_s <<
" in s direction" <<
endmsg;
188 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gasgap:: w,l,t " << ggWidth <<
" " << ggLength <<
" " << ggThickness <<
endmsg;
189 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gas:: w,l,t " << gasWidth <<
" " << gasLength <<
" " << gThickness <<
endmsg;
191 GeoTrd *sgg =
new GeoTrd(ggThickness / 2., ggThickness / 2., ggWidth / 2., ggWidth / 2., ggLength / 2.);
192 GeoTrd *sgas =
new GeoTrd(gThickness / 2., gThickness / 2., gasWidth / 2., gasWidth / 2., gasLength / 2.);
193 const GeoShape *sbak = sgg;
196 GeoLogVol *lgas =
new GeoLogVol(
"gazGap", sgas, matManager.
getMaterial(
"muo::RPCgas"));
197 GeoPhysVol *pbak1 =
new GeoPhysVol(lbak);
198 GeoPhysVol *pgas1 =
new GeoPhysVol(lgas);
199 tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
201 if (
r->NGasGaps_in_s == 2) {
202 GeoPhysVol *pbak2 =
new GeoPhysVol(lbak);
203 GeoPhysVol *pgas2 =
new GeoPhysVol(lgas);
204 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
205 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
211 prpcl->add(
new GeoIdentifierTag(0));
213 pbak1->add(
new GeoIdentifierTag(1));
220 prpcl->add(
new GeoIdentifierTag(10));
222 pbak2->add(
new GeoIdentifierTag(1));
224 }
else if (
r->NGasGaps_in_s == 1) {
227 GeoTransform *ty =
new GeoTransform(GeoTrf::TranslateY3D(
m->
y_translation));
228 GeoTransform *tz =
new GeoTransform(GeoTrf::TranslateZ3D(
m->
z_translation));
232 prpcl->add(
new GeoIdentifierTag(0));
237 pbak1->add(
new GeoIdentifierTag(1));
241 newpos += ggThickness / 2.;
244 newpos += strpanThickness / 2.;
246 GeoPhysVol *pcustrpan21 =
new GeoPhysVol(lcustrpan);
247 GeoPhysVol *pfoamstrpan21 =
new GeoPhysVol(lfoamstrpan);
248 tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
250 if (
r->NstripPanels_in_s == 2) {
251 GeoPhysVol *pcustrpan22 =
new GeoPhysVol(lcustrpan);
252 GeoPhysVol *pfoamstrpan22 =
new GeoPhysVol(lfoamstrpan);
253 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
254 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
258 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 1st eta panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
261 prpcl->add(pcustrpan21);
262 pcustrpan21->add(pfoamstrpan21);
266 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd eta panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
269 prpcl->add(pcustrpan22);
270 pcustrpan22->add(pfoamstrpan22);
271 }
else if (
r->NstripPanels_in_s == 1) {
274 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating a single eta panel at x, y " << newpos <<
" 0 " <<
endmsg;
276 prpcl->add(pcustrpan21);
277 pcustrpan21->add(pfoamstrpan21);
281 if (cutoutson && !vcutdef.empty()) {
282 PVLink tempPhys =
nullptr;
283 Cutout *
cut =
nullptr;
284 GeoShape *cutoutShape =
nullptr;
287 for (
unsigned i = 0;
i < vcutdef.size();
i++) {
289 cutoutShape =
new GeoTrd(
thickness / 2. + 1.,
thickness / 2. + 1.,
cut->widthXs / 2. + 0.5,
cut->widthXl / 2. + 0.5,
cut->lengthY / 2. + tol);
290 cutTrans = GeoTrf::Translate3D(0.0,
cut->dx, -
length / 2 +
cut->dy +
cut->lengthY / 2.);
292 PVLink volToCut{prpcl};
293 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
294 volToCut->apply(&cutAction);
295 tempPhys = cutAction.getPV();