49 {
51
52 double eps = 0.000001;
53 double tol = 1.e-6;
54
56
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));
59
61 if (
m->nGasGaps() == 3)
65
67 log << MSG::VERBOSE <<
" RpcLayer: building an RPC layer with width = " <<
width <<
" length = " <<
length <<
" and thickness = " <<
thickness <<
endmsg;
68 }
69
71 const GeoMaterial *mrpcl = matManager.
getMaterial(
"std::Air");
72 GeoLogVol *lrpcl = new GeoLogVol("Rpclayer", srpcl, mrpcl);
73 PVLink prpcl = new GeoPhysVol(lrpcl);
74
76
77
78 double strpanThickness =
r->stripPanelThickness - tol;
79 double strpanCopperThickness =
r->stripPanelCopperSkinThickness;
80 if (
m->nGasGaps() == 3) {
81 strpanThickness = rpc3GapStrPanThickness - tol;
82 strpanCopperThickness = rpc3GapStrPanCopThickness;
83 }
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;
88 }
90 log << MSG::VERBOSE <<
" RpcLayer:: Building a strip panel:: w,l,t = " << strpanWidth <<
" " << strpanLength <<
" " << strpanThickness <<
endmsg;
91 }
92 GeoTrd *sstrpan = new GeoTrd(strpanThickness / 2., strpanThickness / 2., strpanWidth / 2., strpanWidth / 2., strpanLength / 2.);
93
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;
97
98 const auto *stripMaterial = matManager.
getMaterial(
"muo::RpcFoam");
99 if (
m->nGasGaps() == 3) {
100 stripMaterial = matManager.
getMaterial(
"muo::Forex");
101 }
102
103 GeoLogVol *lcustrpan =
new GeoLogVol(
"RPC_StripPanelCuSkin", scustrpan, matManager.
getMaterial(
"std::Copper"));
104 GeoLogVol *lfoamstrpan = new GeoLogVol("RPC_StripPanelFoam", sfoamstrpan, stripMaterial);
105
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));
110 GeoTransform *ty1;
111 GeoTransform *ty2;
112
113 if (
r->NstripPanels_in_s == 2) {
115 log << MSG::VERBOSE <<
" RpcLayer::NstripPanels_in_s == 2 " <<
endmsg;
116 }
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.));
121 prpcl->add(tx);
122 prpcl->add(ty1);
124 log << MSG::VERBOSE <<
"RpcLayer:: Locating the 1st phi strip panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
126 }
127 prpcl->add(pcustrpan11);
128 pcustrpan11->add(pfoamstrpan11);
129 prpcl->add(tx);
130 prpcl->add(ty2);
132 log << MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd phi strip panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
134 }
135 prpcl->add(pcustrpan12);
136 pcustrpan12->add(pfoamstrpan12);
137
138 }
else if (
r->NstripPanels_in_s == 1) {
140 log << MSG::VERBOSE <<
" RpcLayer::NstripPanels_in_s == 1 " <<
endmsg;
141 }
142 prpcl->add(tx);
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;
148 }
149 }
150
151 newpos += strpanThickness / 2.;
152 double bakelThickness =
r->bakeliteThickness;
153 double gThickness =
r->gasThickness;
154 double totAirThickness =
r->totalAirThickness;
155 if (
m->nGasGaps() == 3) {
156 bakelThickness = rpc3GapBakelThickness;
157 gThickness = rpc3GapGThickness;
158 totAirThickness = rpc3GapTotAirThickness;
159 }
160
161 double ggThickness = 2. * bakelThickness + gThickness + totAirThickness;
162 newpos += ggThickness / 2.;
163
164
166 double ggWidth =
width /
r->NGasGaps_in_s - eps;
167 double gasLength = ggLength - 2. *
r->bakeliteframesize;
168 double gasWidth = ggWidth - 2. *
r->bakeliteframesize;
169
170 if (
m->nGasGaps() == 3) {
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;
183 }
184 }
185
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;
190 }
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));
200
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.));
206 prpcl->add(tx);
207 prpcl->add(ty1);
209 log << MSG::VERBOSE <<
"RpcLayer:: put 1st gas gap centre at depth, s " << newpos <<
" " << -
width / 4. <<
endmsg;
210 }
211 prpcl->add(new GeoIdentifierTag(0));
212 prpcl->add(pbak1);
213 pbak1->add(new GeoIdentifierTag(1));
214 pbak1->add(pgas1);
215 prpcl->add(tx);
216 prpcl->add(ty2);
218 log << MSG::VERBOSE <<
"RpcLayer:: put 2nd gas gap centre at depth, s " << newpos <<
" " <<
width / 4. <<
endmsg;
219 }
220 prpcl->add(new GeoIdentifierTag(10));
221 prpcl->add(pbak2);
222 pbak2->add(new GeoIdentifierTag(1));
223 pbak2->add(pgas2);
224 }
else if (
r->NGasGaps_in_s == 1) {
225 prpcl->add(tx);
226 if (
m->nGasGaps() == 3) {
227 GeoTransform *ty =
new GeoTransform(GeoTrf::TranslateY3D(
m->y_translation));
228 GeoTransform *tz =
new GeoTransform(GeoTrf::TranslateZ3D(
m->z_translation));
229 prpcl->add(ty);
230 prpcl->add(tz);
231 }
232 prpcl->add(new GeoIdentifierTag(0));
233 prpcl->add(pbak1);
235 log << MSG::VERBOSE <<
"RpcLayer:: put a single gas gap at depth, s " << newpos <<
" 0 " <<
endmsg;
236 }
237 pbak1->add(new GeoIdentifierTag(1));
238 pbak1->add(pgas1);
239 }
240
241 newpos += ggThickness / 2.;
242
243
244 newpos += strpanThickness / 2.;
245
246 GeoPhysVol *pcustrpan21 = new GeoPhysVol(lcustrpan);
247 GeoPhysVol *pfoamstrpan21 = new GeoPhysVol(lfoamstrpan);
248 tx =
new GeoTransform(GeoTrf::TranslateX3D(newpos));
249
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.));
255 prpcl->add(tx);
256 prpcl->add(ty1);
258 log << MSG::VERBOSE <<
"RpcLayer:: Locating the 1st eta panel at x, y " << newpos <<
" " << -
width / 4. <<
" of width =" << strpanWidth
260 }
261 prpcl->add(pcustrpan21);
262 pcustrpan21->add(pfoamstrpan21);
263 prpcl->add(tx);
264 prpcl->add(ty2);
266 log << MSG::VERBOSE <<
"RpcLayer:: Locating the 2nd eta panel at x, y " << newpos <<
" " <<
width / 4. <<
" of width =" << strpanWidth
268 }
269 prpcl->add(pcustrpan22);
270 pcustrpan22->add(pfoamstrpan22);
271 }
else if (
r->NstripPanels_in_s == 1) {
272 prpcl->add(tx);
274 log << MSG::VERBOSE <<
"RpcLayer:: Locating a single eta panel at x, y " << newpos <<
" 0 " <<
endmsg;
275 }
276 prpcl->add(pcustrpan21);
277 pcustrpan21->add(pfoamstrpan21);
278 }
279
280
281 if (cutoutson && !vcutdef.empty()) {
282 PVLink tempPhys = nullptr;
283 Cutout *
cut =
nullptr;
284 GeoShape *cutoutShape = nullptr;
285 GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
286
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.);
291
292 PVLink volToCut{prpcl};
293 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
294 volToCut->apply(&cutAction);
295 tempPhys = cutAction.getPV();
296 prpcl = tempPhys;
297 }
298 }
299
300 return prpcl;
301 }
Technology * GetTechnology(const std::string &name)
virtual const GeoMaterial * getMaterial(const std::string &name)=0
IMessageSvc * getMessageSvc(bool quiet=false)
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
std::string buildString(int i, int ncha)