#include "TGeoManager.h" #include "TGeoVolume.h" #include "TGeoCompositeShape.h" #include "TGeoSphere.h" #include "TMath.h" void bug() { TGeoManager *gm; TGeoMaterial *mat; TGeoMedium *med; TGeoVolume *top; gm= new TGeoManager("world","the simplest geometry"); mat = new TGeoMaterial("Vacuum",0,0,0); med = new TGeoMedium("Vacuum",1,mat); top = gGeoManager->MakeBox("Top",med,40,40,40); gm->SetTopVolume(top); //gm->SetTopVisible(); Float_t lh=5; Float_t lR=1; Float_t rS=(lh*lh+lR*lR)/(2.*lh); Float_t thS=(360./(2.*TMath::Pi())) * TMath::ASin(lR/rS); TGeoSphere *s1=new TGeoSphere("s1",0,rS,0,thS,0,360); TGeoSphere *s2=new TGeoSphere("s2",0,rS,180-thS,180,0,360); TGeoCompositeShape *l1=new TGeoCompositeShape("l1","s1+s2"); TGeoVolume *comp0=new TGeoVolume("comp0",l1); comp0->SetLineColor(kMagenta); top->AddNode(comp0,1); gm->CloseGeometry(); top->Draw(); top->Raytrace(); }