void hexaround() { TGeoManager * geom = new TGeoManager("hexaround", ""); TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMedium *med = new TGeoMedium("MED",1,mat); TGeoVolume *top = gGeoManager->MakeBox("TOP",med,150,150,150); gGeoManager->SetTopVolume(top); TGeoPgon *pgon = new TGeoPgon("pgon", 0.,360.0,6,2); pgon->DefineSection(0,-70,0,100); pgon->DefineSection(1,70,0,50); TGeoPcon *pcon = new TGeoPcon("pcon", 0,360, 11); // we need a 2'nd degree function of the pcon radius with Z satisfying: // r(z) = a*z*z + b*z +c // r(0) = Rpgon_out(0) = 75./TMath::Cos(TMath::Pi()/6.) // r(70) = Rpgon_in(70) = 50.; // dr/dz(z=0) = -25./70. Double_t c = 75./TMath::Cos(TMath::Pi()/6.); Double_t b = -25./70.; Double_t a = (50.-c-b*70.)/(70.*70.); for (Int_t iz=0; iz<=10.; ++iz) { Double_t z = 7*iz; // Make last section of pcon slightly further in Z to avoid subtraction // artefact in visualization if (iz==10) z += 0.001; pcon->DefineSection(iz, z, a*z*z+b*z+c, 100.); } TGeoCompositeShape *hexa = new TGeoCompositeShape("hexa", "pgon-pcon"); TGeoVolume *vol = new TGeoVolume("hexaround",hexa, med); vol->SetLineColor(kRed); top->AddNode(vol,1); //top->Draw("ogl"); // Or you can replace the line above with the one below for raytracing top->Raytrace(); }