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 TGeoVolume* Si_cog[60000];
534 TGeoVolume* Si[60000];
536 TGeoTranslation* tr[60000];
537 TGeoRotation* ro[60000];
538 TGeoCombiTrans* mx[60000];
540 TGeoTranslation* nulltrans=
new TGeoTranslation(0.0,0.0,0.0);
541 TGeoRotation* nullrota=
new TGeoRotation();
542 nullrota->SetAngles(0.0,0.0,0.0);
543 TGeoRotation* fliprota=
new TGeoRotation();
544 fliprota->SetAngles(0.0,-90.0,0.0);
545 TGeoCombiTrans* donothing=
new TGeoCombiTrans(*nulltrans,*nullrota);
546 TGeoCombiTrans* swapaxes=
new TGeoCombiTrans(*nulltrans,*fliprota);
552 TGeoVolume* L0_A = gm->MakeTube(
"L0_A",med,0.0,1100.0,5000.0);
553 L0_A->SetVisibility(kFALSE);
554 top->AddNodeOverlap(L0_A,Si_count,donothing);
556 TGeoVolume* L1_IBL_A = gm->MakeTube(
"L1_IBL_A",med,20.0,40.0,700.0);
557 L1_IBL_A->SetVisibility(kFALSE);
558 L0_A->AddNodeOverlap(L1_IBL_A,Si_count,donothing);
560 TGeoVolume* L1_DBM_A = gm->MakeTube(
"L1_DBM_A",med,20.0,40.0,1000.0);
561 L1_DBM_A->SetVisibility(kFALSE);
562 L0_A->AddNodeOverlap(L1_DBM_A,Si_count,donothing);
564 TGeoVolume* L1_PIX_A = gm->MakeTube(
"L1_PIX_A",med,40.0,150.0,700.0);
565 L1_PIX_A->SetVisibility(kFALSE);
566 L0_A->AddNodeOverlap(L1_PIX_A,Si_count,donothing);
568 TGeoVolume* L1_SCTA_A = gm->MakeTube(
"L1_SCTA_A",med,250.0,550.0,3000.0);
569 L1_SCTA_A->SetVisibility(kFALSE);
570 L0_A->AddNodeOverlap(L1_SCTA_A,Si_count,donothing);
572 TGeoVolume* L1_SCTB_A = gm->MakeTube(
"L1_SCTB_A",med,250.0,550.0,3000.0);
573 L1_SCTB_A->SetVisibility(kFALSE);
574 L0_A->AddNodeOverlap(L1_SCTB_A,Si_count,donothing);
576 TGeoVolume* L1_SCTC_A = gm->MakeTube(
"L1_SCTC_A",med,250.0,550.0,3000.0);
577 L1_SCTC_A->SetVisibility(kFALSE);
578 L0_A->AddNodeOverlap(L1_SCTC_A,Si_count,donothing);
583 ATH_MSG_INFO(
"---------------------------------------------------");
590 ATH_MSG_INFO(
" - identifierHash: "<<module->identifyHash());
592 unsigned int npix(0);
593 unsigned int nsct(0);
598 npix =
module->detElementCollection(Trk::AlignModule::Pixel)->size();
599 nSi = npix; isPix =
true;
603 nsct =
module->detElementCollection(Trk::AlignModule::SCT)->size();
604 nSi = nsct; isSCT =
true;
607 if(!isPix && !isSCT)
ATH_MSG_INFO(
" UNKNOWN module found: "<<module->identify());
610 for(
unsigned int j=0;j<nSi;j++) {
612 if(isPix) element =
dynamic_cast<const SiDetectorElement*
>(
module->detElementCollection(Trk::AlignModule::Pixel)->at(j));
615 ATH_MSG_WARNING(
"Dynamic cast to SiDetectorElement from pixel or SCT module failed");
629 bec=m_pixHelper->barrel_ec(element_id);
630 layer=m_pixHelper->layer_disk(element_id);
631 ring=m_pixHelper->eta_module(element_id);
632 sector=m_pixHelper->phi_module(element_id);
637 bec=m_sctHelper->barrel_ec(element_id);
638 layer=m_sctHelper->layer_disk(element_id);
639 ring=m_sctHelper->eta_module(element_id);
640 sector=m_sctHelper->phi_module(element_id);
641 side=m_sctHelper->side(element_id);
644 if(!resok)
ATH_MSG_INFO(
" UNRESOLVED module found: "<<element_id);
646 if(resok && !(element->
isStereo())) {
649 xyz = element->transform().translation();
650 ea = element->transform().rotation().eulerAngles(2, 0, 2);
652 xyz = element->defTransform().translation();
653 ea = element->defTransform().rotation().eulerAngles(2, 0, 2);
656 ATH_MSG_INFO(
">>> Element ident,det,bec,layer,ring,sector,side: "<<element_id<<
", "<<det<<
", "<<bec<<
", "<<layer<<
", "<<ring<<
", "<<sector<<
", "<<side);
663 ATH_MSG_INFO(
">>> Euler angles: Phi="<<57.2957*ea[0]<<
" Theta="<<57.2957*ea[1]<<
" Psi="<<57.2957*ea[2]);
666 ATH_MSG_INFO(
"Adding a volume to the Silicon geometry:");
667 TString nname =
"Si_COG_";
668 TString mname =
"Si_MOD_";
671 std::string det_str = std::to_string(det);
672 std::string bec_str = std::to_string( bec);
673 std::string layer_str = std::to_string( layer);
674 std::string ring_str = std::to_string( ring);
675 std::string sector_str = std::to_string( sector);
676 const auto suffix = TString(det_str)+undsc+TString(bec_str)+undsc+TString(layer_str)+undsc+TString(ring_str)+undsc+TString(sector_str);
680 Si_cog[Si_count] = gm->MakeSphere(nname,med,0.0,element->
length(),0.0,180.0,0.0,360.0);
681 Si_cog[Si_count]->SetVisibility(kFALSE);
686 Si[Si_count] = gm->MakeBox(mname,med,0.5*element->
width(),0.5*element->
thickness(),0.5*element->
length());
688 tr[Si_count] =
new TGeoTranslation();
689 tr[Si_count]->SetTranslation(
xyz[0],
xyz[1],
xyz[2]);
690 ro[Si_count] =
new TGeoRotation();
691 ro[Si_count]->SetAngles(57.2957*ea[0],57.2957*ea[1],57.2957*ea[2]);
692 mx[Si_count] =
new TGeoCombiTrans(*tr[Si_count],*ro[Si_count]);
694 TGeoVolume* parrent_elem =
nullptr;
698 if(bec==0 && layer==0) parrent_elem = L1_IBL_A;
699 else if(abs(bec)==4) parrent_elem = L1_DBM_A;
700 else parrent_elem = L1_PIX_A;
706 parrent_elem = L1_SCTC_A;
709 parrent_elem = L1_SCTB_A;
712 parrent_elem = L1_SCTA_A;
724 top->AddNode(Si_cog[Si_count],0,mx[Si_count]);
727 Si_cog[Si_count]->AddNode(Si[Si_count],0,swapaxes);
735 ATH_MSG_INFO(
" - has "<<npix+nsct<<
" Silicon modules in total");
737 Amg::Transform3D localtoglobal = (
module->globalFrameToAlignFrame()).inverse();
738 ATH_MSG_DEBUG(
" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<
" "<<localtoglobal.rotation());
741 int npars = pars->size();
742 ATH_MSG_DEBUG(
" - number of active transform parameters: "<<npars);
743 for(
int j=0;j<npars;j++)
744 ATH_MSG_DEBUG(
" * par "<<j<<
": sigma = "<<(*pars)[j]->sigma());
751 gm->Export(
"Silicon.root",
"Silicon",
"v");