108 {
109
110
111
112 ATH_MSG_VERBOSE(
" Building a MuonChamberLite for m_station " <<
m_station->GetName() <<
" at zi, fi " << zi <<
" " << fi + 1 <<
" is_mirrored " << is_mirrored
113 << " is assembly = " << isAssembly );
114
115 std::string stname(
m_station->GetName(), 0, 3);
116
117 double halfpitch =
m_station->mdtHalfPitch(mysql);
119
120 const MdtIdHelper *mdt_id =
manager->mdtIdHelper();
122
123 double extratop =
m_station->GetExtraTopThickness();
124 double extrabottom =
m_station->GetExtraBottomThickness();
125 double totthick =
thickness + extratop + extrabottom;
126
127
128 double amdbOrigine_along_length =
m_station->getAmdbOrigine_along_length();
129 double amdbOrigine_along_thickness =
m_station->getAmdbOrigine_along_thickness(mysql);
130
131
132
133
134 if (zi < 0 && !is_mirrored && stName[0] == 'B') {
136 amdbOrigine_along_length += halfpitch;
137 }
138 }
140 << amdbOrigine_along_length << " in the thickness direction = " << amdbOrigine_along_thickness);
141
142 if (isAssembly) {
143 ATH_MSG_DEBUG(
"Station " << stName <<
" at zi, fi " << zi <<
" " << fi + 1 <<
" will be described as Assembly" );
144
145 }
146
147
148
149
150
151
152 if (
stName.compare(0, 3,
"BOG") == 0 && (
manager->IncludeCutoutsBogFlag() ||
manager->IncludeCutoutsFlag())) {
153
154 ATH_MSG_VERBOSE(
"amdb org: length= " << amdbOrigine_along_length <<
" thickness= " << amdbOrigine_along_thickness );
155
156 std::string statType =
stName.substr(0, 3);
158 ATH_MSG_DEBUG(
"Station " << stName <<
" at zi, fi " << zi <<
" " << fi + 1 <<
" has components with cutouts " );
159 isAssembly = true;
160
161
162 bool foundCutouts = false;
163 for (
int j = 0; j <
m_station->GetNrOfComponents(); j++) {
164 StandardComponent *
c =
static_cast<StandardComponent *
>(
m_station->GetComponent(j));
165
166 if (!foundCutouts) {
167 for (
int ii = 0; ii <
m_station->GetNrOfCutouts(); ii++) {
169
170
171
172
173 if (std::abs(
cut->dx - 600.7) < 0.1) {
174 cut->dx =
cut->dx + 10. * Gaudi::Units::mm;
175 cut->widthXs =
cut->widthXs + 20. * Gaudi::Units::mm;
176 cut->widthXl =
cut->widthXl + 20. * Gaudi::Units::mm;
177 }
178 if (std::abs(
cut->dx + 600.7) < 0.1) {
179 cut->dx =
cut->dx - 10. * Gaudi::Units::mm;
180 cut->widthXs =
cut->widthXs + 20. * Gaudi::Units::mm;
181 cut->widthXl =
cut->widthXl + 20. * Gaudi::Units::mm;
182 }
183 if (std::abs(
cut->lengthY - 180.2) < 0.001) {
184 cut->lengthY =
cut->lengthY + (0.010) * Gaudi::Units::mm;
185 }
186 if (std::abs(
cut->dy - 1019.8) < 0.001) {
187 cut->dy = 1216.4185 -
cut->lengthY;
188 }
189
190 cut->setThickness(totthick * 1.01);
192 (
cut->ijob ==
c->index)) {
193
194 foundCutouts = true;
195 }
196 }
197 }
198 }
199 }
200 }
201
202
203
204 double ypos{0.}, zpos{0.}, xpos{0.}, irad{0.};
205 std::array<int, 2 > ndbz{0, 0};
206
207
208 int nDoubletR{0}, nRpc{0}, nTgc{0}, nCsc{0}, nMdt{0};
209 double previous_depth = 0.;
210
211 ATH_MSG_VERBOSE(
" Station Name = " << stName <<
" fi/zi " << fi <<
"/" << zi <<
" defining the n. of DoubletR to " );
212
213
214 for (
int j = 0; j <
m_station->GetNrOfComponents(); j++) {
215 StandardComponent *
d =
static_cast<StandardComponent *
>(
m_station->GetComponent(j));
216 std::string_view cn = std::string_view(
d->name).substr(0, 3);
217 if (cn == "RPC") {
218 nRpc++;
219 if (nRpc == 1)
220 nDoubletR++;
222
223 if (!(stname.compare(0, 2,
"BI") == 0) && nDoubletR == 1 && nRpc > 1 &&
depth * previous_depth < 0)
224 nDoubletR++;
225
226 previous_depth =
depth;
227 }
228 else if (cn == "CSC") {
229 nCsc++;
230 }
231 else if (cn == "TGC") {
232 nTgc++;
233 }
234 else if (cn == "MDT") {
235 nMdt++;
236 }
237 }
238 ATH_MSG_DEBUG(
"nDoubletR: " << nDoubletR<<
" nMdt/Rpc/Tgc/Csc " << nMdt <<
"/" << nRpc <<
"/" << nTgc <<
"/" << nCsc );
239
240
241
242 int numLB = -1;
243 double LBheight{0.}, LBwidth{0.};
244 std::array<double, 2> LBpos{-1, -1};
245 for (
int i = 0;
i <
m_station->GetNrOfComponents();
i++) {
246 StandardComponent *
c =
static_cast<StandardComponent *
>(
m_station->GetComponent(i));
247 std::string_view
cname = std::string_view(
c->name).substr(0, 2);
248 if (cname == "LB") {
250 numLB++;
251 LBpos[numLB] =
c->posy +
c->dy / 2.;
252 LBheight =
lb->height;
254 }
255 if (numLB > 0)
256 break;
257 }
258
259 for (
int i = 0;
i <
m_station->GetNrOfComponents();
i++) {
260 StandardComponent *
c =
static_cast<StandardComponent *
>(
m_station->GetComponent(i));
261 std::string_view
cname = std::string_view(
c->name).substr(0, 3);
262 if (cname == "CRO" || cname == "CMI" || cname == "CHV") {
263 CbmComponent *ccbm =
static_cast<CbmComponent *
>(
c);
264 ccbm->lb_height = LBheight;
265 ccbm->lb_width = LBwidth;
266 ccbm->hole_pos1 = LBpos[0];
267 ccbm->hole_pos2 = LBpos[1];
268 }
269 }
270
271
272 std::string CMIcomponentNumber = "";
273 for (
int j = 0; j <
m_station->GetNrOfComponents(); j++) {
274 StandardComponent *
d =
static_cast<StandardComponent *
>(
m_station->GetComponent(j));
275 std::string_view cn = std::string_view(
d->name).substr(0, 3);
276 if (cn == "CMI") {
277 CMIcomponentNumber = (
d->name).substr(3, 2);
278 break;
279 }
280 }
281
282 for (
int j = 0; j <
m_station->GetNrOfComponents(); j++) {
283 StandardComponent *
d =
static_cast<StandardComponent *
>(
m_station->GetComponent(j));
284 std::string_view cn = std::string_view(
d->name).substr(0, 2);
285 if (cn == "LB") {
286 LbiComponent *lbic =
static_cast<LbiComponent *
>(
d);
287 if (lbic) {
288 lbic->associated_CMIsubtype = CMIcomponentNumber;
289 } else
290 ATH_MSG_ERROR(
"MuonChamberLite :: cannot associate a CMI subtype to the LB component " );
291 }
292 }
293
294
295 MuonStation *mstat;
296 if (
stName.compare(0, 1,
"B") == 0) {
297 mstat =
new MuonStation(
stName.substr(0, 3),
width, totthick,
length,
longWidth, totthick,
length, zi, fi + 1,
298 (zi < 0 && !is_mirrored));
299 } else {
300 mstat =
new MuonStation(
stName.substr(0, 3),
width,
length, totthick,
longWidth,
length, totthick, zi, fi + 1,
301 (zi < 0 && !is_mirrored));
302 }
303
304 manager->addMuonStation(std::unique_ptr<MuonStation>(mstat));
306 << " at zi, fi " << zi << " " << fi + 1 << " is_mirrored " << is_mirrored);
307
308 GeoFullPhysVol *ptrd=(*m_mapFPV)[std::string(stName)+"_Station"+"_"+std::to_string(zi)+"_"+std::to_string(fi)];
309 mstat->setPhysVol(ptrd);
310
311 for (
int i = 0;
i <
m_station->GetNrOfComponents();
i++) {
312 StandardComponent *
c =
static_cast<StandardComponent *
>(
m_station->GetComponent(i));
313 ATH_MSG_VERBOSE(
" Component index " <<
c->index <<
" in loop for " << stName <<
" " << stationType <<
" at zi, fi " << zi <<
" " << fi + 1 <<
" cName "
314 <<
c->name <<
" thickness " <<
c->GetThickness(mysql) <<
" length " <<
c->dy <<
" w, lw " <<
c->dx1 <<
" " <<
c->dx2 );
315 ATH_MSG_VERBOSE(
" Component local (amdb) coords " <<
c->posx <<
" " <<
c->posy <<
" " <<
c->posz );
316
317 ypos = -
thickness / 2. +
c->posz +
c->GetThickness(mysql) / 2.;
318 zpos = 0.;
319 xpos = 0.;
320
321 ypos = -
thickness / 2. + (
c->posz + amdbOrigine_along_thickness) +
c->GetThickness(mysql) / 2.;
322 zpos = -
length / 2. + amdbOrigine_along_length +
c->posy +
c->dy / 2.;
324
325 const std::string &techname =
c->name;
326 std::string_view
type = std::string_view(techname).substr(0, 3);
327
328
329
330 GeoIntrusivePtr<GeoFullPhysVol> lvm{}, lvr{}, lvt{}, lvc{};
331
332
333
334
335 std::string statType =
stName.substr(0, 3);
336 double cthickness =
c->GetThickness(mysql);
337 int ncutouts = 0;
338 std::vector<Cutout *> vcutdef;
339 std::vector<std::unique_ptr<Cutout>> vcutdef_todel;
340 for (
int ii = 0; ii <
m_station->GetNrOfCutouts(); ii++) {
342 cut->setThickness(cthickness * 1.01);
343
345
346 double tempdx =
cut->dx;
347 double tempdy =
cut->dy;
348 double templengthY =
cut->lengthY;
351
352 if (
stName.compare(0, 3,
"BOG") == 0) {
353
354 cut->lengthY = templengthY + 31.;
355 }
356
359
360 if (std::abs(
cut->dead1) > 1. && techname ==
"MDT03")
361 cut->dy =
cut->dy + 15.0 *
cos(
cut->dead1 * Gaudi::Units::deg);
362
363
364
365 cut->lengthY = templengthY;
366
367
368 ncutouts++;
371
372
373 if (
stName.compare(0, 3,
"BMS") == 0) {
374 if (fi == 3) {
375 if (std::abs(zi) == 1) {
376 double margin = 1.0;
377
378 if (type == "RPC" || type == "DED") {
379 cut->widthXl += 2 * margin;
380 cut->widthXs += 2 * margin;
382 cut->lengthY += 2 * margin;
383
384 if (zi > 0)
386 }
387 }
388
389 if (zi == -1) {
390 if (type == "MDT")
392 }
393 }
394 }
395
396
397 if (
stName.compare(0, 3,
"BOS") == 0 && zi == -6 && type ==
"MDT") {
398 cut->dy =
c->dy -
cut->dy -
cut->lengthY - halfpitch;
400 if (techname == "MDT03")
403
404 }
405
406
407
408
409 if (type ==
"MDT" && (is_mirrored || zi < 0) &&
stName.compare(0, 1,
"B") == 0) {
410
411
412
413 Cutout *cutmirr = new Cutout(*cut);
414 cutmirr->dx = -cutmirr->dx;
415
416
417 vcutdef.push_back(cutmirr);
418 vcutdef_todel.emplace_back(cutmirr);
419 ATH_MSG_VERBOSE(
"adding for application mirrored cut \n" << *cutmirr );
420
421 } else if (type == "RPC" || type == "DED") {
422 Cutout *cutRpcType = new Cutout(*cut);
423
424 if (
stName.compare(0, 3,
"BMS") == 0 && zi == 4 && (
c->index == 20 ||
c->index == 21 ||
c->index == 24 ||
c->index == 25)) {
425 cutRpcType->dy = 1102.5;
426 }
427
428 if (
stName.compare(0, 3,
"BOS") == 0 && zi == 6 && type ==
"DED")
429 cutRpcType->dy = 706.;
430
431 cutRpcType->dy = cutRpcType->dy -
c->posy;
432 cutRpcType->dx = cutRpcType->dx -
c->posx;
433
434 if (type == "RPC") {
435 RpcComponent *
rp =
static_cast<RpcComponent *
>(
c);
436 if (
rp->iswap == -1) {
437 cutRpcType->dy =
c->dy - (cutRpcType->dy + cutRpcType->lengthY);
438 }
439 }
440
441 ATH_MSG_VERBOSE(
" Rpc or ded cutout redefined as follows \n" << *cutRpcType );
442 vcutdef.push_back(cutRpcType);
443 vcutdef_todel.emplace_back(cutRpcType);
444 } else if (type == "TGC") {
445
446
447
448 Cutout *tgccut = new Cutout(*cut);
449 tgccut->dy -=
c->posy;
450
452 vcutdef.push_back(tgccut);
453 vcutdef_todel.emplace_back(tgccut);
454 } else {
455 vcutdef.push_back(cut);
456 }
457 }
458 }
459
460 if (ncutouts > 0) {
461 ATH_MSG_DEBUG(
c->name <<
" of station " << stName <<
" at fi/zi " << fi + 1 <<
"/" << zi <<
" has " << ncutouts <<
" cutouts " );
462 }
463
464 GeoTrf::Transform3D htcomponent(GeoTrf::Transform3D::Identity());
465 GeoAlignableTransform *xfaligncomponent{nullptr};
466
467
468 if (type == "CRO") {
469 if (
stName.compare(0, 1,
"B") != 0 && is_mirrored)
470 mstat->setxAmdbCRO(-xpos);
471 else
472 mstat->setxAmdbCRO(xpos);
473 }
474
475 if (type == "MDT") {
476 MdtComponent *md=
static_cast<MdtComponent *
> (
c);
477 htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateZ3D(zpos) * GeoTrf::TranslateY3D(xpos);
478
479 if (zi < 0 && !is_mirrored && stName[0] == 'B') {
480
481 htcomponent = htcomponent * GeoTrf::RotateX3D(180. * Gaudi::Units::deg);
482 htcomponent = htcomponent * GeoTrf::TranslateZ3D(halfpitch);
483 }
484
485
486
487 if (zi < 0 &&
stName.compare(0, 3,
"BOG") == 0 && is_mirrored) {
488
489
490
491
492 htcomponent = GeoTrf::RotateX3D(180. * Gaudi::Units::deg) * htcomponent * GeoTrf::RotateX3D(180. * Gaudi::Units::deg);
493 }
494
495 std::string
key =std::string( stName) + techname;
496 xfaligncomponent = (*m_mapAXF)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)+
"_"+std::to_string(md->index)];
497
498
499
500 bool mdtCutoutFlag = ((stname == "BOS" && std::abs(zi) == 6) || stname == "BMG" || techname == "MDT14" || (stname == "BMS" && (std::abs(zi) == 1 && fi == 3)) ||
501 (stname == "EMS" && (std::abs(zi) == 1 || std::abs(zi) == 3)));
502 if (((
manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (
manager->IncludeCutoutsBogFlag() &&
stName.compare(0, 3,
"BOG") == 0)) && zi >= 0) {
504 }
else if (((
manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (
manager->IncludeCutoutsBogFlag() &&
stName.compare(0, 3,
"BOG")) == 0) && zi < 0) {
506 }
508 std::unique_ptr<Mdt>
r = std::make_unique<Mdt>(mysql, c, stName + techname);
509 if ((
manager->IncludeCutoutsFlag() && mdtCutoutFlag) || (
manager->IncludeCutoutsBogFlag() &&
stName.compare(0, 3,
"BOG") == 0)) {
510 if (!vcutdef.empty())
r->processCutouts(vcutdef);
511 }
513 }
514 lvm = (*m_mapFPV)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)+
"_"+std::to_string(md->index)];
515
516 } else if (type == "RPC") {
517
518 RpcComponent *
rp =
static_cast<RpcComponent *
>(
c);
519 int ndivy =
rp->ndivy;
520 int ndivz =
rp->ndivz;
521
522 if (ndivz != 1 || ndivy != 1) {
523 ATH_MSG_ERROR(
" RPC segmentation z,y " << ndivz <<
" " << ndivy );
524 }
525
526 double xpos =
c->posx;
527
528 if (is_mirrored)
529 xpos = -xpos;
530
531 ATH_MSG_VERBOSE(
" In station " << stName <<
" with " << nDoubletR <<
" doubletR,"
532 <<
" RPC " << (
c->name).substr(3, 2) <<
" has swap flag = " <<
rp->iswap <<
" ypos, zpos " << ypos <<
" " << zpos <<
" " );
533
534 htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateY3D(xpos) * GeoTrf::TranslateZ3D(zpos);
535 if (
rp->iswap == -1) {
536 htcomponent = htcomponent * GeoTrf::RotateY3D(180 * Gaudi::Units::deg);
537 }
538
539
540
541 bool rpcCutoutFlag = (stname == "BOS" && std::abs(zi) == 6) || (stname == "BMS" && (std::abs(zi) == 2 || std::abs(zi) == 4 || std::abs(zi) == 6)) ||
542 (stname == "BMS" && std::abs(zi) == 1 && fi == 3);
544 if (((
manager->IncludeCutoutsFlag() && rpcCutoutFlag) || (
manager->IncludeCutoutsBogFlag() &&
stName.compare(0, 3,
"BOG") == 0)) && zi >= 0) {
547 }
else if (((
manager->IncludeCutoutsFlag() && rpcCutoutFlag) || (
manager->IncludeCutoutsBogFlag() &&
stName.compare(0, 3,
"BOG") == 0)) && zi < 0) {
550 }
551 xfaligncomponent = (*m_mapAXF)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)+
"_"+std::to_string(
rp->index)];
552 lvr = (*m_mapFPV)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)+
"_"+std::to_string(
rp->index)];
553 } else if (type == "TGC") {
554 TgcComponent *tg =
static_cast<TgcComponent *
>(
m_station->GetComponent(i));
555 TgcComponent *tgInner =
static_cast<TgcComponent *
>(
m_station->GetComponent(0));
556 irad = tgInner->posy;
557 TgcComponent *tgOuter =
static_cast<TgcComponent *
>(
m_station->GetComponent(
m_station->GetNrOfComponents() - 1));
558 double orad = tgOuter->posy + tgOuter->dy;
559 double start = -(orad - irad) / 2. + (tg->posy - irad) + tg->dy / 2;
560 double xstart = -
thickness / 2. + tg->GetThickness(mysql) / 2.;
561 htcomponent = GeoTrf::TranslateX3D(xstart + tg->posz) * GeoTrf::TranslateZ3D(start);
562
563
564 std::string
key = std::string(stName) + techname;
565 if (
manager->IncludeCutoutsFlag()) {
567
568 if (zi >= 0) {
570 } else if (zi < 0) {
572 }
573 }
574 }
575
576 key += std::to_string(
int(10 *
c->dx1));
577 xfaligncomponent = (*m_mapAXF)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)];
578
579 lvt = (*m_mapFPV)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)];
580
581 } else if (type == "CSC") {
582 htcomponent = GeoTrf::TranslateX3D(ypos) * GeoTrf::TranslateZ3D(zpos);
583
584 std::string
key = std::string(stName) + techname;
585 if (
manager->IncludeCutoutsFlag() && zi >= 0) {
587 }
else if (
manager->IncludeCutoutsFlag() && zi < 0) {
589 }
590
591 xfaligncomponent = (*m_mapAXF)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)];
592 lvc=(*m_mapFPV)[
key+
"_"+std::to_string(zi)+
"_"+std::to_string(fi)];
593 } else {
594 if (type != "MDT" && type != "RPC" && type != "TGC" && type != "SUP" && type != "DED" && type != "SPA" && type != "CHV" && type != "CRO" && type != "CMI" &&
595 type != "LB0" && type != "LBI") {
597 }
598 }
599
600
601 if (lvm &&
manager->mdtIdHelper()) {
604 int ml = 1;
605 int tubel = 1;
607 if (ypos > 5.)
608 ml = 2;
609
610
611 const MdtIdHelper *mdt_id =
manager->mdtIdHelper();
612 std::unique_ptr<MdtReadoutElement>
det = std::make_unique<MdtReadoutElement>(lvm, stName, manager);
615 det->setHasCutouts(ncutouts > 0);
616 det->setNMdtInStation(nMdt);
617 Identifier
id = mdt_id->
channelID(stationType, stationEta, stationPhi, ml, tubel, tube);
618 det->setIdentifier(
id);
619 det->setMultilayer(ml);
620 det->setParentMuonStation(mstat);
622
623 if (ml == 1) {
624
625 mstat->setBlineFixedPointInAmdbLRS(
c->posx,
c->posy,
c->posz);
626 } else {
627 const Amg::Vector3D b0 = mstat->getBlineFixedPointInAmdbLRS();
628 if (
c->posy < b0.y())
629 mstat->setBlineFixedPointInAmdbLRS(b0.x(),
c->posy, b0.z());
630 }
631
632 int jobIndex =
c->index;
633
634 mstat->addMuonReadoutElementWithAlTransf(
det.get(), xfaligncomponent, jobIndex);
635 manager->addMdtReadoutElement(std::move(det));
636 }
637
638 if (lvc &&
manager->cscIdHelper()) {
639 CscComponent *cs =
static_cast<CscComponent *
>(
m_station->GetComponent(i));
642 int chamberLayer = 1;
643 if (ypos > 0.)
644 chamberLayer = 2;
645
646 std::unique_ptr<CscReadoutElement>
det = std::make_unique<CscReadoutElement>(lvc, stName, manager);
649
650 const CscIdHelper *csc_id =
manager->cscIdHelper();
651 det->setHasCutouts(ncutouts > 0);
652 Identifier
id = csc_id->
channelID(stationType, stationEta, stationPhi, chamberLayer, 1, 0, 1);
653 det->setIdentifier(
id);
654
655 det->setChamberLayer(chamberLayer);
656 det->setParentMuonStation(mstat);
657
658 int jobIndex =
c->index;
659
660 mstat->addMuonReadoutElementWithAlTransf(
det.get(), xfaligncomponent, jobIndex);
661
662
663
664
665 manager->addCscReadoutElement(std::move(det));
666 }
667
668 if (lvt &&
manager->tgcIdHelper()) {
669
670 ATH_MSG_DEBUG(
" Adding a TGC chamber to the tree zi,fi, is_mirrored " << zi <<
" " << fi + 1 <<
" " << is_mirrored );
671
672
673 TgcComponent *tg =
static_cast<TgcComponent *
>(
m_station->GetComponent(i));
674
675 ATH_MSG_VERBOSE(
"There's a TGC named " << techname <<
" of thickness " << tg->GetThickness(mysql) );
676
677 const TgcIdHelper *tgc_id =
manager->tgcIdHelper();
680 if (zi < 0)
684
685 std::unique_ptr<TgcReadoutElement>
det = std::make_unique<TgcReadoutElement>(lvt, stName, manager);
688 det->setHasCutouts(ncutouts > 0);
689 Identifier
id = tgc_id->
channelID(stationType, stationEta, stationPhi, 1,
false, 1);
690 det->setIdentifier(
id);
691 det->setParentMuonStation(mstat);
692
693 int jobIndex =
c->index;
694
695 mstat->addMuonReadoutElementWithAlTransf(
det.get(), xfaligncomponent, jobIndex);
696
697 manager->addTgcReadoutElement(std::move(det));
698 }
700 RpcComponent *
rp =
static_cast<RpcComponent *
>(
c);
701 int ndivy =
rp->ndivy;
702 int ndivz =
rp->ndivz;
703
704 if (ndivz != 1 || ndivy != 1) {
705 ATH_MSG_ERROR(
" RPC segmentation z,y " << ndivz <<
" " << ndivy );
706 }
707
708 double zpos = -
length / 2. +
c->posy +
c->dy / 2.;
709 double xpos =
c->posx;
710
711
712 if (is_mirrored)
713 xpos = -xpos;
714
715
716 const RpcIdHelper *rpc_id =
manager->rpcIdHelper();
720 int doubletZ = 1;
721
722 if (nRpc > 1 && nDoubletR == 2 && ypos > 0.)
725
726
727 if (stname.find("BI") != std::string::npos) {
728 if (stname.find("BIS") != std::string::npos) {
729
730 if (std::abs(stationEta)>= 7){
731 ATH_MSG_DEBUG(
"BIS78 station eta: "<<stationEta<<
" phi: "<<stationPhi<<
" dR: "<<doubletR<<
" dZ:"<< doubletZ <<
" rp: "<<
rp->posz);
732 }
733 if (std::abs(stationEta) >= 7 &&
rp->posz > 80)
734 doubletZ = 2;
735 else
736 doubletZ = 1;
737 } else {
738
739
740 if (stname.find("BIL") != std::string::npos && std::abs(stationEta) < 7 && std::abs(stationEta) != 2 && std::abs(stationEta) != 5) {
742 doubletZ = 2;
743 } else
744 doubletZ = 1;
745 }
746 } else {
747 if (zi <= 0 && !is_mirrored) {
748 if (zpos < -100 * Gaudi::Units::mm)
749 doubletZ = 2;
750 } else {
751 if (zpos > 100 * Gaudi::Units::mm)
752 doubletZ = 2;
753 }
754 }
755
756
757 if (std::abs(xpos) > 100. * Gaudi::Units::mm) {
758 if (ndbz[doubletR - 1] > 2) {
759 doubletZ = 3;
760 }
762 }
763
764 int dbphi = 1;
765
766
767
768
769
770 if (xpos > 400. * Gaudi::Units::mm)
771 dbphi = 2;
772
774
775 if (zi < 0 && is_mirrored && doubletZ == 3) {
777 if (doubletPhi > 2)
779 } else if (zi < 0 && is_mirrored && doubletZ == 2 && doubletR == 1 && stName == "BMS6") {
781 if (doubletPhi > 2)
783 }
784
786 int measuresPhi = 0;
788
789 int tag = doubletZ +
doubletR * 100 + dbphi * 1000;
793
794 } else {
798
799 }
800
801
802 std::unique_ptr<RpcReadoutElement>
det = std::make_unique<RpcReadoutElement>(lvr, stName, zi, fi + 1, is_mirrored, manager);
805 det->setHasCutouts(ncutouts > 0);
806 Identifier
id = rpc_id->
channelID(stationType, stationEta, stationPhi, doubletR, doubletZ, doubletPhi, gasGap, measuresPhi,
strip);
807 det->setIdentifier(
id);
808 det->setDoubletR(doubletR);
809 det->setDoubletZ(doubletZ);
810 det->setDoubletPhi(doubletPhi);
811 if (
stName.find(
"BI") != std::string::npos)
812 det->setNumberOfLayers(3);
813 det->setParentMuonStation(mstat);
814
815 int jobIndex =
c->index;
816
817 mstat->addMuonReadoutElementWithAlTransf(
det.get(), xfaligncomponent, jobIndex);
818
819
820
821 if (
stName.find(
"BI") != std::string::npos) {
822 std::map<std::string, float>::const_iterator yItr = rpcYTrans.find(techname);
823 if (yItr != rpcYTrans.end())
824 det->setYTranslation(yItr->second);
825 std::map<std::string, float>::const_iterator zItr = rpcZTrans.find(techname);
826 if (zItr != rpcZTrans.end())
827 det->setZTranslation(zItr->second);
828 }
829
833 manager->addRpcReadoutElement(std::move(det));
834
835 }
836
837 }
838 mstat->updateBlineFixedPointInAmdbLRS();
839
840 return ptrd;
841 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
Position GetStationPosition(const std::string &nameType, int fi, int zi) const
Technology * GetTechnology(const std::string &name)
int allocPosFindCutout(const std::string &statType, int fi, int zi) const
int allocPosFindSubtype(const std::string &statType, int fi, int zi) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
std::set< std::string > * m_keySet
void setMdtReadoutGeom(const MYSQL &mysql, MdtReadoutElement *re, const MdtComponent *cc, const Position &p)
void setCscReadoutGeom(const MYSQL &mysql, CscReadoutElement *re, const CscComponent *cc, const Position &p)
void setRpcReadoutGeom(const MYSQL &mysql, RpcReadoutElement *re, const RpcComponent *cc, const Position &p)
void setTgcReadoutGeom(const MYSQL &mysql, TgcReadoutElement *re, const TgcComponent *cc, const Position &p, const std::string &statname)
int stationNameIndex(const std::string &name) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
std::string depth
tag string for intendation
Eigen::Matrix< double, 3, 1 > Vector3D
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)
int stationPhiTGC(std::string_view stName, int fi, int zi_input)
Converts the AMDB phi index to the Identifier phi Index.
const std::string & stName(StIndex index)
convert StIndex into a string
constexpr uint8_t stationPhi
station Phi 1 to 8
constexpr uint8_t stationEta
1 to 3