void hexaround2() { 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(-70) = Rpgon_out(0) = 100./TMath::Cos(TMath::Pi()/6.) // r(70) = Rpgon_in(70) = 50.; // dr/dz(z=-70) = -50./140. Double_t b = 5./14.*(1-2./TMath::Cos(TMath::Pi()/6.)); Double_t a = (b+5./14)/140; Double_t c = 50.-70.*(70*a+b); for (Int_t iz=0; iz<=10.; ++iz) { Double_t z = -70+14*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); gGeoManager->SetNsegments(80); top->Draw("ogl"); // Or you can replace the line above with the one below for raytracing //top->Raytrace(); }