{ TCanvas *c1 = new TCanvas("glcanvas","Geometry Shapes",200,10,700,500); // Define the geometry TGeoManager *geom = new TGeoManager("geom","Optics Demo"); TGeoMaterial *vacuum = new TGeoMaterial("vacuum",0,0,0); TGeoMaterial *Fe = new TGeoMaterial("Fe",55.84,26.7,7.87); TGeoMixture *glass = new TGeoMixture("Glass",2,0.6); glass->DefineElement(0,28.09,14,0.4674655); glass->DefineElement(1,16,8,0.5325345); glass->SetTransparency(30); TGeoMedium *Air = new TGeoMedium("Air",0,vacuum); TGeoMedium *Iron = new TGeoMedium("Iron",1,Fe); TGeoMedium *Glass = new TGeoMedium("Glass",2,glass); TGeoVolume *top = geom->MakeBox("top",Air,100,100,100); geom->SetTopVolume(top); geom->SetTopVisible(0); TGeoTranslation *t1= new TGeoTranslation("t1",0,0,-55); t1->RegisterYourself(); TGeoTranslation *t2= new TGeoTranslation("t2",0,0,55); t2->RegisterYourself(); TGeoVolume *s1 = geom->MakeSphere("S1",Glass,0,75,0,90,0,360); TGeoVolume *s2 = geom->MakeSphere("S2",Glass,0,75,90,180,0,360); TGeoCompositeShape *convex = new TGeoCompositeShape("convex","(S1:t1)*(S2:t2)"); TGeoVolume *lens1 = new TGeoVolume("LENS1",convex); top->AddNode(lens1,2,new TGeoTranslation(0,0,0)); TGeoVolume *m2 = geom->MakeBox("m2",Iron,75,75,5); top->AddNode(m2,3,new TGeoTranslation(0,0,-75)); geom->CloseGeometry(); geom->SetVisLevel(4); geom->SetNsegments(25); top->Draw(); c1->Update(); }