473 {
474
475 ATH_MSG_INFO(
"---------------------------------------------------");
477 TGeoManager* gm=new TGeoManager("Silicon","Silicon");
478 TGeoMaterial*
mat=
new TGeoMaterial(
"Vacuum",0,0,0);
479 TGeoMedium* med=new TGeoMedium("Vacuum",1,mat);
480 TGeoVolume*
top = gm->MakeBox(
"Silicon",med,2000.,2000.,10000.);
481 gm->SetTopVolume(top);
482 static constexpr std::size_t nElements{60'000};
483
484 std::vector<TGeoVolume*> Si_cog(nElements);
485 std::vector<TGeoVolume*> Si(nElements);
486 int Si_count=0;
487 std::vector<TGeoTranslation*> tr(nElements);
488 std::vector<TGeoRotation* > ro(nElements);
489 std::vector<TGeoCombiTrans*>
mx(nElements);
490
491 TGeoTranslation* nulltrans=new TGeoTranslation(0.0,0.0,0.0);
492 TGeoRotation* nullrota=new TGeoRotation();
493 nullrota->SetAngles(0.0,0.0,0.0);
494 TGeoRotation* fliprota=new TGeoRotation();
495 fliprota->SetAngles(0.0,-90.0,0.0);
496 TGeoCombiTrans* donothing=new TGeoCombiTrans(*nulltrans,*nullrota);
497 TGeoCombiTrans* swapaxes=new TGeoCombiTrans(*nulltrans,*fliprota);
498
501
502
503 TGeoVolume* L0_A = gm->MakeTube("L0_A",med,0.0,1100.0,5000.0);
504 L0_A->SetVisibility(kFALSE);
505 top->AddNodeOverlap(L0_A,Si_count,donothing);
506 Si_count++;
507 TGeoVolume* L1_IBL_A = gm->MakeTube("L1_IBL_A",med,20.0,40.0,700.0);
508 L1_IBL_A->SetVisibility(kFALSE);
509 L0_A->AddNodeOverlap(L1_IBL_A,Si_count,donothing);
510 Si_count++;
511 TGeoVolume* L1_DBM_A = gm->MakeTube("L1_DBM_A",med,20.0,40.0,1000.0);
512 L1_DBM_A->SetVisibility(kFALSE);
513 L0_A->AddNodeOverlap(L1_DBM_A,Si_count,donothing);
514 Si_count++;
515 TGeoVolume* L1_PIX_A = gm->MakeTube("L1_PIX_A",med,40.0,150.0,700.0);
516 L1_PIX_A->SetVisibility(kFALSE);
517 L0_A->AddNodeOverlap(L1_PIX_A,Si_count,donothing);
518 Si_count++;
519 TGeoVolume* L1_SCTA_A = gm->MakeTube("L1_SCTA_A",med,250.0,550.0,3000.0);
520 L1_SCTA_A->SetVisibility(kFALSE);
521 L0_A->AddNodeOverlap(L1_SCTA_A,Si_count,donothing);
522 Si_count++;
523 TGeoVolume* L1_SCTB_A = gm->MakeTube("L1_SCTB_A",med,250.0,550.0,3000.0);
524 L1_SCTB_A->SetVisibility(kFALSE);
525 L0_A->AddNodeOverlap(L1_SCTB_A,Si_count,donothing);
526 Si_count++;
527 TGeoVolume* L1_SCTC_A = gm->MakeTube("L1_SCTC_A",med,250.0,550.0,3000.0);
528 L1_SCTC_A->SetVisibility(kFALSE);
529 L0_A->AddNodeOverlap(L1_SCTC_A,Si_count,donothing);
530 Si_count++;
531
532
533
534 ATH_MSG_INFO(
"---------------------------------------------------");
542
543 unsigned int npix(0);
544 unsigned int nsct(0);
545 unsigned int nSi(0);
547 bool isSCT(false);
549 npix = module->detElementCollection(Trk::AlignModule::Pixel)->size();
550 nSi = npix;
isPix =
true;
552 }
554 nsct = module->detElementCollection(Trk::AlignModule::SCT)->size();
555 nSi = nsct; isSCT = true;
557 }
559
560
561 for(
unsigned int j=0;
j<nSi;
j++) {
562 const SiDetectorElement * element=nullptr;
563 if(isPix) element = dynamic_cast<const SiDetectorElement*>(module->detElementCollection(Trk::AlignModule::Pixel)->at(j));
566 ATH_MSG_WARNING(
"Dynamic cast to SiDetectorElement from pixel or SCT module failed");
567 return;
568 }
569 const Identifier element_id = element->identify();
573 int ring;
574 int sector;
576
577 bool resok=false;
579 det=1;
580 bec=m_pixHelper->barrel_ec(element_id);
581 layer=m_pixHelper->layer_disk(element_id);
582 ring=m_pixHelper->eta_module(element_id);
583 sector=m_pixHelper->phi_module(element_id);
584 side=0;
585 resok=true;
587 det=2;
588 bec=m_sctHelper->barrel_ec(element_id);
589 layer=m_sctHelper->layer_disk(element_id);
590 ring=m_sctHelper->eta_module(element_id);
591 sector=m_sctHelper->phi_module(element_id);
592 side=m_sctHelper->side(element_id);
593 resok=true;
594 }
595 if(!resok)
ATH_MSG_INFO(
" UNRESOLVED module found: "<<element_id);
596
597 if(resok && !(element->isStereo())) {
598
599 if( m_actualGeom ) {
600 xyz = element->transform().translation();
601 ea = element->transform().rotation().eulerAngles(2, 0, 2);
602 } else {
603 xyz = element->defTransform().translation();
604 ea = element->defTransform().rotation().eulerAngles(2, 0, 2);
605 }
606
607 ATH_MSG_INFO(
">>> Element ident,det,bec,layer,ring,sector,side: "<<element_id<<
", "<<det<<
", "<<bec<<
", "<<layer<<
", "<<ring<<
", "<<sector<<
", "<<side);
608 ATH_MSG_INFO(
">>> Element length/width/thickness: "<<element->length()<<
", "<<element->width()<<
", "<<element->thickness());
609 if(element->isSCT() && element->isEndcap())
610 ATH_MSG_INFO(
">>> SCT Endcap wedge, min/max "<<element->minWidth()<<
" / "<<element->maxWidth());
611 ATH_MSG_INFO(
">>> Center position: "<<element->center());
614 ATH_MSG_INFO(
">>> Euler angles: Phi="<<57.2957*ea[0]<<
" Theta="<<57.2957*ea[1]<<
" Psi="<<57.2957*ea[2]);
615
616
617 ATH_MSG_INFO(
"Adding a volume to the Silicon geometry:");
618 TString nname = "Si_COG_";
619 TString mname = "Si_MOD_";
620 TString undsc = "_";
621
622 std::string det_str = std::to_string(det);
623 std::string bec_str = std::to_string( bec);
624 std::string layer_str = std::to_string( layer);
625 std::string ring_str = std::to_string( ring);
626 std::string sector_str = std::to_string( sector);
627 const auto suffix = TString(det_str)+undsc+TString(bec_str)+undsc+TString(layer_str)+undsc+TString(ring_str)+undsc+TString(sector_str);
630
631 Si_cog[Si_count] = gm->MakeSphere(nname,med,0.0,element->length(),0.0,180.0,0.0,360.0);
632 Si_cog[Si_count]->SetVisibility(kFALSE);
633
634 if(element->isSCT() && element->isEndcap()) {
635 Si[Si_count] = gm->MakeTrd1(mname,med,0.5*element->minWidth(),0.5*element->maxWidth(),0.5*element->thickness(),0.5*element->length());
636 } else {
637 Si[Si_count] = gm->MakeBox(mname,med,0.5*element->width(),0.5*element->thickness(),0.5*element->length());
638 }
639 tr[Si_count] = new TGeoTranslation();
640 tr[Si_count]->SetTranslation(
xyz[0],
xyz[1],
xyz[2]);
641 ro[Si_count] = new TGeoRotation();
642 ro[Si_count]->SetAngles(57.2957*ea[0],57.2957*ea[1],57.2957*ea[2]);
643 mx[Si_count] =
new TGeoCombiTrans(*tr[Si_count],*ro[Si_count]);
644
645 TGeoVolume* parrent_elem = nullptr;
646 switch(det)
647 {
648 case 1:
649 if(bec==0 && layer==0) parrent_elem = L1_IBL_A;
650 else if(abs(bec)==4) parrent_elem = L1_DBM_A;
651 else parrent_elem = L1_PIX_A;
652 break;
653 case 2:
654 switch(bec)
655 {
656 case -2:
657 parrent_elem = L1_SCTC_A;
658 break;
659 case 0:
660 parrent_elem = L1_SCTB_A;
661 break;
662 case 2:
663 parrent_elem = L1_SCTA_A;
664 break;
665 default:
666 break;
667 }
668 break;
669 default:
670 break;
671 }
672 if(parrent_elem) {
673
674
675 top->AddNode(Si_cog[Si_count],0,mx[Si_count]);
676
677
678 Si_cog[Si_count]->AddNode(Si[Si_count],0,swapaxes);
679 Si_count++;
680 }
681 }
682 }
683
684
685 if(npix && nsct)
686 ATH_MSG_INFO(
" - has "<<npix+nsct<<
" Silicon modules in total");
687
688 Amg::Transform3D localtoglobal = (
module->globalFrameToAlignFrame()).inverse();
689 ATH_MSG_DEBUG(
" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<
" "<<localtoglobal.rotation());
690
692 int npars = pars->
size();
693 ATH_MSG_DEBUG(
" - number of active transform parameters: "<<npars);
694 for(
int j=0;
j<npars;
j++)
696
697 }
698
699
700
701 gm->CloseGeometry();
702 gm->Export("Silicon.root","Silicon","v");
703
704 }
#define ATH_MSG_WARNING(x,...)
Eigen::Matrix< double, 3, 1 > Vector3D
@ top
Decay of a top quark (including through W).
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)