{ gSystem->Load("libGeom.so"); if (gGeoManager) delete gGeoManager; gROOT->GetListOfCanvases()->Delete(); //materials and media defs TGeoManager *geometry = new TGeoManager("ID viewer","ID"); TGeoMaterial *vac_mat = new TGeoMaterial("Vacuum",0,0,0); TGeoMaterial *si_mat = new TGeoMaterial("Silicon",geometry->GetElementTable()->FindElement("silicon"),2.3); si_mat->SetTransparency(20); //translucent silicon //si_mat->SetTransparency(0); //opaque silicon TGeoMedium *vac = new TGeoMedium("Vacuum",1,vac_mat); TGeoMedium *si = new TGeoMedium("Silicon",1,si_mat); TGeoVolume *id_box = geometry->MakeBox("TopBox",vac,600,600,3000); geometry->SetTopVolume(id_box); TGeoVolume *origin = geometry->MakeSphere("origin",si,0,1); TGeoVolume *con = geometry->MakeBox("box",vac,20,20,20); TGeoVolume *t1 = geometry->MakeBox("test1",si,5,10,15); TGeoVolume *t2 = geometry->MakeBox("test2",si,5,10,15); TGeoPhysicalNode *n1 , *n2 , ; TGeoTranslation *trans = new TGeoTranslation(0,0,0); TGeoTranslation *corr = new TGeoTranslation(0,0,0); TGeoRotation *rot = new TGeoRotation(); TGeoRotation *crot = new TGeoRotation(); trans->SetTranslation(0,15,15); rot->SetAngles(0,45,45); //Set the alignment vals here: corr->SetTranslation(1,2,3); crot->SetAngles(1,5,10); TGeoCombiTrans *combi = new TGeoCombiTrans(*trans,*rot); TGeoCombiTrans *cor_combi = new TGeoCombiTrans(*corr,*crot); origin->SetLineColor(kWhite); t2->SetLineColor(kRed); t1->SetLineColor(kGreen); con->AddNode(t1,1,gGeoIdentity); con->AddNode(t2,2,gGeoIdentity); id_box->AddNode(con,1,combi); id_box->AddNode(origin,2,gGeoIdentity); gGeoManager->CloseGeometry(); id_box->Draw(); //TGeoPhysicalNode *n = new TGeoPhysicalNode() TGeoPhysicalNode *n1 = gGeoManager->MakePhysicalNode("/TopBox_1/box_1/test1_1"); TGeoPhysicalNode *n2 = gGeoManager->MakePhysicalNode("/TopBox_1/box_1/test2_2"); n2->Align(cor_combi); gPad->Modified(); cout << "Align the node n2 using: " << endl ; cout << "corr->SetTranslation(dx,dy,dz); _or/and_" <SetAngles(dalpha,dbeta,dgamma);" <SetRotation(*crot); cor_combi->SetTranslation(*corr);"<Modified()" << endl; }