526 ATH_MSG_INFO(
"---------------------------------------------------");
528 TGeoManager* gm=
new TGeoManager(
"Silicon",
"Silicon");
529 TGeoMaterial* mat=
new TGeoMaterial(
"Vacuum",0,0,0);
530 TGeoMedium* med=
new TGeoMedium(
"Vacuum",1,mat);
531 TGeoVolume*
top = gm->MakeBox(
"Silicon",med,2000.,2000.,10000.);
532 gm->SetTopVolume(
top);
533 static constexpr std::size_t nElements{60'000};
535 std::vector<TGeoVolume*> Si_cog(nElements);
536 std::vector<TGeoVolume*> Si(nElements);
538 std::vector<TGeoTranslation*> tr(nElements);
539 std::vector<TGeoRotation* > ro(nElements);
540 std::vector<TGeoCombiTrans*> mx(nElements);
542 TGeoTranslation* nulltrans=
new TGeoTranslation(0.0,0.0,0.0);
543 TGeoRotation* nullrota=
new TGeoRotation();
544 nullrota->SetAngles(0.0,0.0,0.0);
545 TGeoRotation* fliprota=
new TGeoRotation();
546 fliprota->SetAngles(0.0,-90.0,0.0);
547 TGeoCombiTrans* donothing=
new TGeoCombiTrans(*nulltrans,*nullrota);
548 TGeoCombiTrans* swapaxes=
new TGeoCombiTrans(*nulltrans,*fliprota);
554 TGeoVolume* L0_A = gm->MakeTube(
"L0_A",med,0.0,1100.0,5000.0);
555 L0_A->SetVisibility(kFALSE);
556 top->AddNodeOverlap(L0_A,Si_count,donothing);
558 TGeoVolume* L1_IBL_A = gm->MakeTube(
"L1_IBL_A",med,20.0,40.0,700.0);
559 L1_IBL_A->SetVisibility(kFALSE);
560 L0_A->AddNodeOverlap(L1_IBL_A,Si_count,donothing);
562 TGeoVolume* L1_DBM_A = gm->MakeTube(
"L1_DBM_A",med,20.0,40.0,1000.0);
563 L1_DBM_A->SetVisibility(kFALSE);
564 L0_A->AddNodeOverlap(L1_DBM_A,Si_count,donothing);
566 TGeoVolume* L1_PIX_A = gm->MakeTube(
"L1_PIX_A",med,40.0,150.0,700.0);
567 L1_PIX_A->SetVisibility(kFALSE);
568 L0_A->AddNodeOverlap(L1_PIX_A,Si_count,donothing);
570 TGeoVolume* L1_SCTA_A = gm->MakeTube(
"L1_SCTA_A",med,250.0,550.0,3000.0);
571 L1_SCTA_A->SetVisibility(kFALSE);
572 L0_A->AddNodeOverlap(L1_SCTA_A,Si_count,donothing);
574 TGeoVolume* L1_SCTB_A = gm->MakeTube(
"L1_SCTB_A",med,250.0,550.0,3000.0);
575 L1_SCTB_A->SetVisibility(kFALSE);
576 L0_A->AddNodeOverlap(L1_SCTB_A,Si_count,donothing);
578 TGeoVolume* L1_SCTC_A = gm->MakeTube(
"L1_SCTC_A",med,250.0,550.0,3000.0);
579 L1_SCTC_A->SetVisibility(kFALSE);
580 L0_A->AddNodeOverlap(L1_SCTC_A,Si_count,donothing);
585 ATH_MSG_INFO(
"---------------------------------------------------");
592 ATH_MSG_INFO(
" - identifierHash: "<<module->identifyHash());
594 unsigned int npix(0);
595 unsigned int nsct(0);
600 npix =
module->detElementCollection(Trk::AlignModule::Pixel)->size();
601 nSi = npix; isPix =
true;
605 nsct =
module->detElementCollection(Trk::AlignModule::SCT)->size();
606 nSi = nsct; isSCT =
true;
609 if(!isPix && !isSCT)
ATH_MSG_INFO(
" UNKNOWN module found: "<<module->identify());
612 for(
unsigned int j=0;j<nSi;j++) {
614 if(isPix) element =
dynamic_cast<const SiDetectorElement*
>(
module->detElementCollection(Trk::AlignModule::Pixel)->at(j));
617 ATH_MSG_WARNING(
"Dynamic cast to SiDetectorElement from pixel or SCT module failed");
631 bec=m_pixHelper->barrel_ec(element_id);
632 layer=m_pixHelper->layer_disk(element_id);
633 ring=m_pixHelper->eta_module(element_id);
634 sector=m_pixHelper->phi_module(element_id);
639 bec=m_sctHelper->barrel_ec(element_id);
640 layer=m_sctHelper->layer_disk(element_id);
641 ring=m_sctHelper->eta_module(element_id);
642 sector=m_sctHelper->phi_module(element_id);
643 side=m_sctHelper->side(element_id);
646 if(!resok)
ATH_MSG_INFO(
" UNRESOLVED module found: "<<element_id);
648 if(resok && !(element->
isStereo())) {
651 xyz = element->transform().translation();
652 ea = element->transform().rotation().eulerAngles(2, 0, 2);
654 xyz = element->defTransform().translation();
655 ea = element->defTransform().rotation().eulerAngles(2, 0, 2);
658 ATH_MSG_INFO(
">>> Element ident,det,bec,layer,ring,sector,side: "<<element_id<<
", "<<det<<
", "<<bec<<
", "<<layer<<
", "<<ring<<
", "<<sector<<
", "<<side);
665 ATH_MSG_INFO(
">>> Euler angles: Phi="<<57.2957*ea[0]<<
" Theta="<<57.2957*ea[1]<<
" Psi="<<57.2957*ea[2]);
668 ATH_MSG_INFO(
"Adding a volume to the Silicon geometry:");
669 TString nname =
"Si_COG_";
670 TString mname =
"Si_MOD_";
673 std::string det_str = std::to_string(det);
674 std::string bec_str = std::to_string( bec);
675 std::string layer_str = std::to_string( layer);
676 std::string ring_str = std::to_string( ring);
677 std::string sector_str = std::to_string( sector);
678 const auto suffix = TString(det_str)+undsc+TString(bec_str)+undsc+TString(layer_str)+undsc+TString(ring_str)+undsc+TString(sector_str);
682 Si_cog[Si_count] = gm->MakeSphere(nname,med,0.0,element->
length(),0.0,180.0,0.0,360.0);
683 Si_cog[Si_count]->SetVisibility(kFALSE);
688 Si[Si_count] = gm->MakeBox(mname,med,0.5*element->
width(),0.5*element->
thickness(),0.5*element->
length());
690 tr[Si_count] =
new TGeoTranslation();
691 tr[Si_count]->SetTranslation(
xyz[0],
xyz[1],
xyz[2]);
692 ro[Si_count] =
new TGeoRotation();
693 ro[Si_count]->SetAngles(57.2957*ea[0],57.2957*ea[1],57.2957*ea[2]);
694 mx[Si_count] =
new TGeoCombiTrans(*tr[Si_count],*ro[Si_count]);
696 TGeoVolume* parrent_elem =
nullptr;
700 if(bec==0 && layer==0) parrent_elem = L1_IBL_A;
701 else if(abs(bec)==4) parrent_elem = L1_DBM_A;
702 else parrent_elem = L1_PIX_A;
708 parrent_elem = L1_SCTC_A;
711 parrent_elem = L1_SCTB_A;
714 parrent_elem = L1_SCTA_A;
726 top->AddNode(Si_cog[Si_count],0,mx[Si_count]);
729 Si_cog[Si_count]->AddNode(Si[Si_count],0,swapaxes);
737 ATH_MSG_INFO(
" - has "<<npix+nsct<<
" Silicon modules in total");
739 Amg::Transform3D localtoglobal = (
module->globalFrameToAlignFrame()).inverse();
740 ATH_MSG_DEBUG(
" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<
" "<<localtoglobal.rotation());
743 int npars = pars->size();
744 ATH_MSG_DEBUG(
" - number of active transform parameters: "<<npars);
745 for(
int j=0;j<npars;j++)
746 ATH_MSG_DEBUG(
" * par "<<j<<
": sigma = "<<(*pars)[j]->sigma());
753 gm->Export(
"Silicon.root",
"Silicon",
"v");