512 const int ip_r7[6][2]={0,1, 2,3, 4,5, 6,7, 8,9, 10,11};
514 TGeoNode* st_node = NULL;
516 TGeoNode* sts = NULL;
517 gGeoManager->CdTop();
518 TGeoNode* cave = gGeoManager->GetCurrentNode();
519 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
520 TGeoNode* node = cave->GetDaughter(iNode);
521 TString name = node->GetName();
522 if ( name.Contains(
"GEMS_0") ) {
524 gGeoManager->CdDown(iNode);
529 cout <<
"-E- CbmBmnStsDigitize::ApplyAlignment: Cannot find top GEM node"
536 Int_t nStat0 = sts->GetNdaughters();
539 cout<<
"STATIONS : "<<nStat0<<endl;
541 Double_t xAlign[ 26 ]=
542 {3.33029,-2.67835,2.82585 ,-3.14615,
544 8.91918 ,2.92088, -3.09752,-9.09492, 8.91198 ,2.94528 ,-2.98182,-8.98402,
545 -40.718 , 40.916, 41.087, -40.6, 42.28, -39.431, -38.452, 43.252, 44.078, -37.598, -36.8112, 44.8227};
547 Double_t yAlign[ 26 ]=
548 {4.46297,5.07597, -1.48803,-0.910531,
550 7.84856,7.80306,7.92256,7.85506,-4.57154,-4.61864, -4.43934,-4.51954,
551 22.5211, 22.2759, 22.574, 22.6124, 22.8827, 22.516, 22.5385, 22.9377, 22.5828, 22.3481, 22.7875, 23.007};
553 Double_t zAlign3[9] =
554 {14.352475, 17.68975, 26.2729875,
555 42.19995,67.76995,115.569,137.8325,163.54,186.103};
557 Double_t zAlign23[26] =
558 {-0.406375,0.430925,0.274025,-0.298575,
560 0.540813, -1.06009, 0.653113, -0.915988, -0.719887, 0.761012, -0.386287, 1.12281,
561 0.08685,-0.08685, -0.07145,0.07145, -0.128, 0.128, 0.0115,-0.0115, -0.004,0.004, 0,0};
564 Int_t stn=0,SensCh=0;
566 for (Int_t iNode = 0; iNode < nStat0; iNode++) {
568 gGeoManager->CdDown(iNode);
569 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
570 TString statName = stationNode->GetName();
571 if ( ! statName.Contains(
"station") ) {
578 TGeoHMatrix *matr = gGeoManager->GetCurrentMatrix();
579 Double_t* statTrans = matr->GetTranslation();
581 cout<<
"statNr : "<<statNr <<
", "<<statTrans[2] <<
" zal: "<<zAlign3[statNr-1]<<endl;
582 statTrans[2] = zAlign3[statNr-1];
584 TGeoTranslation *t2 =
new TGeoTranslation(statTrans[0],statTrans[1],statTrans[2]);
586 r2 =
new TGeoRotation(
"rot",0,0,0);
587 TGeoCombiTrans *cc1 =
new TGeoCombiTrans(*t2,*r2);
589 TGeoHMatrix *matr0 =
new TGeoHMatrix(*cc1);
590 matr0->RegisterYourself();
596 sts->GetVolume()->AddNode((TGeoVolumeAssembly*)stationNode->GetVolume(),0,matr0);
599 st_node = (TGeoNode*) sts->GetVolume()->GetNodes()->Last();
602 Int_t moduleNr = 0, copy_no = 0;
605 for (Int_t iStatD = 0; iStatD < nModules; iStatD++) {
606 gGeoManager->CdDown(iStatD);
608 TGeoNode*
module = gGeoManager->GetCurrentNode();
609 if ( ! TString(module->GetName()).Contains(
"module") ) {
613 cout << iStatD <<
" " <<
module->GetName() << " stn: "<<statNr << endl;
618 Int_t nOfModSi=SensCh;
619 cout<<
"modSI: "<<nOfModSi<<
" "<<zAlign23[nOfModSi]<<endl;
621 TGeoHMatrix *matrMod = gGeoManager->GetCurrentMatrix();
622 Double_t* modTrans = matrMod->GetTranslation();
624 modTrans[0] = xAlign[nOfModSi];
625 modTrans[1] = yAlign[nOfModSi];
626 modTrans[2] = zAlign23[nOfModSi];
627 matrMod->SetTranslation(modTrans);
628 TGeoHMatrix *matr0Mod =
new TGeoHMatrix(*matrMod);
629 matr0Mod->RegisterYourself();
631 st_node->GetVolume()->AddNode((TGeoVolumeAssembly*)module->GetVolume(),copy_no,matr0Mod);
645 if (TString(module->GetName()).Contains(
"Senso")) {
647 if(iStatD==0) moduleNr=0;
648 if(iStatD>0) moduleNr=1;
652 TGeoHMatrix *matrMod = gGeoManager->GetCurrentMatrix();
653 Double_t* modTrans = matrMod->GetTranslation();
654 cout<<
" aaaa ^^^^^^^^^^^^^^^^^^^ : "<<statNr-1;
655 cout<<
"\n"<<moduleNr;
656 cout<<
"\n"<<ip_r7[ (statNr-1)-3 ][moduleNr]<<endl;
658 modTrans[0] = xAlign[ip_r7[(statNr-1)-3][moduleNr]+14];
659 modTrans[1] = yAlign[ip_r7[(statNr-1)-3][moduleNr]+14];
660 modTrans[2] = zAlign23[ip_r7[(statNr-1)-3][moduleNr]+14];
662 matrMod->SetTranslation(modTrans);
663 TGeoHMatrix *matr0Mod =
new TGeoHMatrix(*matrMod);
664 matr0Mod->RegisterYourself();
667 st_node->GetVolume()->AddNode((TGeoVolumeAssembly*)module->GetVolume(),copy_no,matr0Mod);
683 vector<TGeoNode*> removNodes;
685 for (Int_t iNode = 0; iNode < nStat0; iNode++) {
688 gGeoManager->CdDown(iNode);
689 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
690 cout<<
" st name del: "<< stationNode->GetName()<<
" iNode: "<<iNode<<endl;
691 removNodes.push_back(stationNode);
695 for (
size_t o=0; o<removNodes.size(); o++)
696 sts->GetVolume()->RemoveNode(removNodes[o]);
700 for (Int_t iNode = 0; iNode <nStat0; iNode++) {
703 gGeoManager->CdDown(iNode);
704 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
706 TString statName = stationNode->GetName();
707 if ( ! statName.Contains(
"station") ) {
713 for (Int_t iStatD = 0; iStatD < nMod; iStatD++) {
714 gGeoManager->CdDown(0);
716 TGeoNode*
module = gGeoManager->GetCurrentNode();
718 stationNode->GetVolume()->RemoveNode(module);
723 for (Int_t iStatD = 0; iStatD <currNodes; iStatD++) {
724 gGeoManager->CdDown(0);
725 TString mName = gGeoManager->GetCurrentNode()->GetName();
726 if(!mName.Contains(
"module")) {
730 TGeoNode* moduleS = gGeoManager->GetCurrentNode();
732 stationNode->GetVolume()->RemoveNode(moduleS);
742 for (Int_t iNode = 0; iNode < sts->GetNdaughters(); iNode++) {
746 gGeoManager->CdDown(iNode);
747 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
748 cout<<
" Check-in STATION: "<< stationNode->GetName()<<
" zpos : "<<gGeoManager->GetCurrentMatrix()->GetTranslation()[2]<<endl;
749 for (Int_t iModule = 0; iModule < stationNode->GetNdaughters() ; iModule++) {
750 gGeoManager->CdDown(iModule);
751 TGeoNode* moduleNode = gGeoManager->GetCurrentNode();
754 TString gName = moduleNode->GetName();
755 if(gName.Contains(
"frame")) {
756 stationNode->GetVolume()->RemoveNode(moduleNode);
763 cout<<
" Check-in st name : "<< stationNode->GetName()<<
" mod name : "<<moduleNode->GetName()<<endl;
764 Double_t* sensTrans = gGeoManager->GetCurrentMatrix()->GetTranslation();
765 cout<<
"trans mod: "<<sensTrans[0]<<
" "<<sensTrans[1]<<
" "<<sensTrans[2]<< endl;
766 for (Int_t iModule2 = 0; iModule2 < moduleNode->GetNdaughters() ; iModule2++) {
767 gGeoManager->CdDown(iModule2);
768 TGeoNode* moduleNode2 = gGeoManager->GetCurrentNode();
770 TString hName = moduleNode2->GetName();
771 if(hName.Contains(
"frame")) {
772 moduleNode->GetVolume()->RemoveNode(moduleNode2);
778 cout<<
" Check-in st name : "<< stationNode->GetName()<<
" hot name : "<<moduleNode2->GetName()<<endl;
779 sensTrans = gGeoManager->GetCurrentMatrix()->GetTranslation();
780 cout<<
"trans hot: "<<sensTrans[0]<<
" "<<sensTrans[1]<<
" "<<sensTrans[2]<< endl;