void hexa1() { gSystem->Load("libGeom"); TGeoManager *geom = new TGeoManager("geom", "irregular hexagone"); TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMedium *med = new TGeoMedium("MED",1,mat); TGeoVolume *top = geom->MakeBox("TOP",med,50,50,50); gGeoManager->SetTopVolume(top); TGeoXtru *xtru = new TGeoXtru(2); // 2 = nb. of Z planes Double_t x[6] = {30,20,-15,-25,-5,10}; Double_t y[6] = {0,-25,-35,0,20,15}; xtru->DefinePolygon(6,x,y); Double_t zsection = 20.; Double_t shiftx = 0.; Double_t shifty = 0.; Double_t scale = 1.; xtru->DefineSection(0,-zsection, shiftx, shifty, scale); xtru->DefineSection(1, zsection, shiftx, shifty, scale); TGeoVolume *vol = new TGeoVolume("HEXA", xtru,med); vol->SetLineColor(kRed); top->AddNode(vol,1); geom->CloseGeometry(); top->Draw("ogl"); }