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};
484 std::vector<TGeoVolume*> Si_cog(nElements);
485 std::vector<TGeoVolume*> Si(nElements);
487 std::vector<TGeoTranslation*> tr(nElements);
488 std::vector<TGeoRotation* > ro(nElements);
489 std::vector<TGeoCombiTrans*> mx(nElements);
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);
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);
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);
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);
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);
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);
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);
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);
534 ATH_MSG_INFO(
"---------------------------------------------------");
541 ATH_MSG_INFO(
" - identifierHash: "<<module->identifyHash());
543 unsigned int npix(0);
544 unsigned int nsct(0);
549 npix =
module->detElementCollection(Trk::AlignModule::Pixel)->size();
550 nSi = npix; isPix =
true;
554 nsct =
module->detElementCollection(Trk::AlignModule::SCT)->size();
555 nSi = nsct; isSCT =
true;
558 if(!isPix && !isSCT)
ATH_MSG_INFO(
" UNKNOWN module found: "<<module->identify());
561 for(
unsigned int j=0;j<nSi;j++) {
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");
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);
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);
595 if(!resok)
ATH_MSG_INFO(
" UNRESOLVED module found: "<<element_id);
597 if(resok && !(element->
isStereo())) {
600 xyz = element->transform().translation();
601 ea = element->transform().rotation().eulerAngles(2, 0, 2);
603 xyz = element->defTransform().translation();
604 ea = element->defTransform().rotation().eulerAngles(2, 0, 2);
607 ATH_MSG_INFO(
">>> Element ident,det,bec,layer,ring,sector,side: "<<element_id<<
", "<<det<<
", "<<bec<<
", "<<layer<<
", "<<ring<<
", "<<sector<<
", "<<side);
614 ATH_MSG_INFO(
">>> Euler angles: Phi="<<57.2957*ea[0]<<
" Theta="<<57.2957*ea[1]<<
" Psi="<<57.2957*ea[2]);
617 ATH_MSG_INFO(
"Adding a volume to the Silicon geometry:");
618 TString nname =
"Si_COG_";
619 TString mname =
"Si_MOD_";
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);
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);
637 Si[Si_count] = gm->MakeBox(mname,med,0.5*element->
width(),0.5*element->
thickness(),0.5*element->
length());
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]);
645 TGeoVolume* parrent_elem =
nullptr;
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;
657 parrent_elem = L1_SCTC_A;
660 parrent_elem = L1_SCTB_A;
663 parrent_elem = L1_SCTA_A;
675 top->AddNode(Si_cog[Si_count],0,mx[Si_count]);
678 Si_cog[Si_count]->AddNode(Si[Si_count],0,swapaxes);
686 ATH_MSG_INFO(
" - has "<<npix+nsct<<
" Silicon modules in total");
688 Amg::Transform3D localtoglobal = (
module->globalFrameToAlignFrame()).inverse();
689 ATH_MSG_DEBUG(
" - local to global : "<<std::setprecision(12)<<localtoglobal.translation()<<
" "<<localtoglobal.rotation());
692 int npars = pars->
size();
693 ATH_MSG_DEBUG(
" - number of active transform parameters: "<<npars);
694 for(
int j=0;j<npars;j++)
695 ATH_MSG_DEBUG(
" * par "<<j<<
": sigma = "<<(*pars)[j]->sigma());
702 gm->Export(
"Silicon.root",
"Silicon",
"v");