8 #include "GeoModelKernel/GeoCutVolAction.h"
9 #include "GeoModelKernel/GeoDefinitions.h"
10 #include "GeoModelKernel/GeoIdentifierTag.h"
11 #include "GeoModelKernel/GeoLogVol.h"
12 #include "GeoModelKernel/GeoMaterial.h"
13 #include "GeoModelKernel/GeoNameTag.h"
14 #include "GeoModelKernel/GeoPhysVol.h"
15 #include "GeoModelKernel/GeoShapeSubtraction.h"
16 #include "GeoModelKernel/GeoTransform.h"
17 #include "GeoModelKernel/GeoTrd.h"
29 constexpr
double const rpc3GapLayerThickness = 11.8;
30 constexpr
double const rpc3GapStrPanThickness = 3.5;
31 constexpr
double const rpc3GapStrPanCopThickness = 0.3;
32 constexpr
double const rpc3GapBakelThickness = 1.2;
33 constexpr
double const rpc3GapGThickness = 1.0;
34 constexpr
double const rpc3GapTotAirThickness = 0.52;
43 std::vector<Cutout *> vcutdef;
45 return build(matManager, mysql, cutoutson, vcutdef);
51 const std::vector<Cutout *>& vcutdef) {
54 double eps = 0.000001;
59 if (
m->
nGasGaps() == 3 &&
r->NstripPanels_in_s != 1)
60 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));
73 const GeoMaterial *mrpcl = matManager.
getMaterial(
"std::Air");
74 GeoLogVol *lrpcl =
new GeoLogVol(
"Rpclayer", srpcl, mrpcl);
75 GeoPhysVol *prpcl =
new GeoPhysVol(lrpcl);
80 double strpanThickness =
r->stripPanelThickness - tol;
81 double strpanCopperThickness =
r->stripPanelCopperSkinThickness;
83 strpanThickness = rpc3GapStrPanThickness - tol;
84 strpanCopperThickness = rpc3GapStrPanCopThickness;
86 double strpanLength =
length /
r->NstripPanels_in_z;
87 double strpanWidth =
width /
r->NstripPanels_in_s - eps;
89 log <<
MSG::VERBOSE <<
" RpcLayer:: Building a strip panel:: div_s, div_z = " <<
r->NstripPanels_in_s <<
" " <<
r->NstripPanels_in_z <<
endmsg;
92 log <<
MSG::VERBOSE <<
" RpcLayer:: Building a strip panel:: w,l,t = " << strpanWidth <<
" " << strpanLength <<
" " << strpanThickness <<
endmsg;
94 GeoTrd *sstrpan =
new GeoTrd(strpanThickness / 2., strpanThickness / 2., strpanWidth / 2., strpanWidth / 2., strpanLength / 2.);
96 GeoTrd *sfoamstrpan =
new GeoTrd(strpanThickness / 2. - strpanCopperThickness, strpanThickness / 2. - strpanCopperThickness, strpanWidth / 2. - strpanCopperThickness,
97 strpanWidth / 2. - strpanCopperThickness, strpanLength / 2. - strpanCopperThickness);
98 const GeoShape *scustrpan = sstrpan;
100 const auto *stripMaterial = matManager.
getMaterial(
"muo::RpcFoam");
102 stripMaterial = matManager.
getMaterial(
"muo::Forex");
105 GeoLogVol *lcustrpan =
new GeoLogVol(
"RPC_StripPanelCuSkin", scustrpan, matManager.
getMaterial(
"std::Copper"));
106 GeoLogVol *lfoamstrpan =
new GeoLogVol(
"RPC_StripPanelFoam", sfoamstrpan, stripMaterial);
108 newpos += strpanThickness / 2. + tol / 2.;
109 GeoPhysVol *pcustrpan11 =
new GeoPhysVol(lcustrpan);
110 GeoPhysVol *pfoamstrpan11 =
new GeoPhysVol(lfoamstrpan);
111 GeoTransform *
tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
115 if (
r->NstripPanels_in_s == 2) {
119 GeoPhysVol *pcustrpan12 =
new GeoPhysVol(lcustrpan);
120 GeoPhysVol *pfoamstrpan12 =
new GeoPhysVol(lfoamstrpan);
121 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
122 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
126 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 1st phi strip panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
129 prpcl->add(pcustrpan11);
130 pcustrpan11->add(pfoamstrpan11);
134 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd phi strip panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
137 prpcl->add(pcustrpan12);
138 pcustrpan12->add(pfoamstrpan12);
140 }
else if (
r->NstripPanels_in_s == 1) {
145 prpcl->add(pcustrpan11);
146 pcustrpan11->add(pfoamstrpan11);
148 log <<
MSG::VERBOSE <<
" RpcLayer:: Locating a single phi strip panel at x, y " << newpos <<
" 0 "
149 <<
" of width = " << strpanWidth <<
" in a box of width = " <<
width <<
endmsg;
153 newpos += strpanThickness / 2.;
154 double bakelThickness =
r->bakeliteThickness;
155 double gThickness =
r->gasThickness;
156 double totAirThickness =
r->totalAirThickness;
158 bakelThickness = rpc3GapBakelThickness;
159 gThickness = rpc3GapGThickness;
160 totAirThickness = rpc3GapTotAirThickness;
163 double ggThickness = 2. * bakelThickness + gThickness + totAirThickness;
164 newpos += ggThickness / 2.;
168 double ggWidth =
width /
r->NGasGaps_in_s - eps;
169 double gasLength = ggLength - 2. *
r->bakeliteframesize;
170 double gasWidth = ggWidth - 2. *
r->bakeliteframesize;
173 if (
name ==
"RPC26") {
174 gasLength = ggLength - 93.25;
175 gasWidth = ggWidth - 109.52;
176 }
else if (
name ==
"RPC27") {
177 gasLength = ggLength - 93.12;
178 gasWidth = ggWidth - 109.52;
179 }
else if (
name ==
"RPC28") {
180 gasLength = ggLength - 93.04;
181 gasWidth = ggWidth - 109.52;
182 }
else if (
name ==
"RPC29") {
183 gasLength = ggLength - 93.04;
184 gasWidth = ggWidth - 109.2;
189 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gasgap:: " <<
r->NGasGaps_in_s <<
" in s direction" <<
endmsg;
190 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gasgap:: w,l,t " << ggWidth <<
" " << ggLength <<
" " << ggThickness <<
endmsg;
191 log <<
MSG::VERBOSE <<
"RpcLayer:: Building the gas:: w,l,t " << gasWidth <<
" " << gasLength <<
" " << gThickness <<
endmsg;
193 GeoTrd *sgg =
new GeoTrd(ggThickness / 2., ggThickness / 2., ggWidth / 2., ggWidth / 2., ggLength / 2.);
194 GeoTrd *sgas =
new GeoTrd(gThickness / 2., gThickness / 2., gasWidth / 2., gasWidth / 2., gasLength / 2.);
195 const GeoShape *sbak = sgg;
198 GeoLogVol *lgas =
new GeoLogVol(
"gazGap", sgas, matManager.
getMaterial(
"muo::RPCgas"));
199 GeoPhysVol *pbak1 =
new GeoPhysVol(lbak);
200 GeoPhysVol *pgas1 =
new GeoPhysVol(lgas);
201 tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
203 if (
r->NGasGaps_in_s == 2) {
204 GeoPhysVol *pbak2 =
new GeoPhysVol(lbak);
205 GeoPhysVol *pgas2 =
new GeoPhysVol(lgas);
206 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
207 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
213 prpcl->add(
new GeoIdentifierTag(0));
215 pbak1->add(
new GeoIdentifierTag(1));
222 prpcl->add(
new GeoIdentifierTag(10));
224 pbak2->add(
new GeoIdentifierTag(1));
226 }
else if (
r->NGasGaps_in_s == 1) {
229 GeoTransform *ty =
new GeoTransform(GeoTrf::TranslateY3D(
m->
y_translation));
230 GeoTransform *tz =
new GeoTransform(GeoTrf::TranslateZ3D(
m->
z_translation));
234 prpcl->add(
new GeoIdentifierTag(0));
239 pbak1->add(
new GeoIdentifierTag(1));
243 newpos += ggThickness / 2.;
246 newpos += strpanThickness / 2.;
248 GeoPhysVol *pcustrpan21 =
new GeoPhysVol(lcustrpan);
249 GeoPhysVol *pfoamstrpan21 =
new GeoPhysVol(lfoamstrpan);
250 tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
252 if (
r->NstripPanels_in_s == 2) {
253 GeoPhysVol *pcustrpan22 =
new GeoPhysVol(lcustrpan);
254 GeoPhysVol *pfoamstrpan22 =
new GeoPhysVol(lfoamstrpan);
255 ty1 =
new GeoTransform(GeoTrf::TranslateY3D(-
width / 4.));
256 ty2 =
new GeoTransform(GeoTrf::TranslateY3D(
width / 4.));
260 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 1st eta panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
263 prpcl->add(pcustrpan21);
264 pcustrpan21->add(pfoamstrpan21);
268 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd eta panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
271 prpcl->add(pcustrpan22);
272 pcustrpan22->add(pfoamstrpan22);
273 }
else if (
r->NstripPanels_in_s == 1) {
276 log <<
MSG::VERBOSE <<
"RpcLayer:: Locating a single eta panel at x, y " << newpos <<
" 0 " <<
endmsg;
278 prpcl->add(pcustrpan21);
279 pcustrpan21->add(pfoamstrpan21);
283 if (cutoutson && !vcutdef.empty()) {
284 GeoPhysVol *tempPhys =
nullptr;
286 GeoShape *cutoutShape =
nullptr;
289 for (
unsigned i = 0;
i < vcutdef.size();
i++) {
291 cutoutShape =
new GeoTrd(
thickness / 2. + 1.,
thickness / 2. + 1.,
cut->widthXs / 2. + 0.5,
cut->widthXl / 2. + 0.5,
cut->lengthY / 2. + tol);
292 cutTrans = GeoTrf::Translate3D(0.0,
cut->dx, -
length / 2 +
cut->dy +
cut->lengthY / 2.);
294 GeoIntrusivePtr<GeoVPhysVol> volToCut{prpcl};
295 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
296 volToCut->apply(&cutAction);
297 tempPhys = cutAction.getPV();
307 log << MSG::INFO <<
" Rpc Layer " <<
name +
"Layer"