void test() { Double_t mm = 0.1; Double_t cm = 1; // Mirror parameters const Double_t kMirrorT = 8*mm; // thickness const Double_t kMirrorRad = 425*mm; // radius const Int_t kMirrorN = 7; const Double_t kMirrorR[kMirrorN] = {1363*mm, 1363*mm, 1363*mm, 1363*mm, 1363*mm, 1363*mm, 1363*mm}; TGeoManager* manager = new TGeoManager("manager", "test"); // Make the world TGeoBBox* box1 = new TGeoBBox("box1", 200*cm, 200*cm, 200*cm); TGeoVolume *top = new TGeoVolume("top", box1); manager->SetTopVolume(top); // Mirror TGeoSphere* mirSph[kMirrorN]; TGeoPgon* cut; TGeoArb8* cut1[kMirrorN]; TGeoArb8* cut2[kMirrorN]; TGeoCompositeShape* mirSphCut[kMirrorN]; TGeoVolume* mirror[kMirrorN]; TGeoTranslation* tr[kMirrorN]; TGeoRotation* rt[kMirrorN]; // Cut of mirror for(Int_t i=0; iDefineSection(0, 0, 0, 0); cut->DefineSection(1, R_, 0, r*TMath::Sqrt(3)/2); } else { cut1[i] = new TGeoArb8(Form("cut1%d", i), R_/2.); for(Int_t j=0; j<4; j++) cut1[i]->SetVertex(j, 0, 0); cut1[i]->SetVertex(4, r*TMath::Cos(60*deg2rad), r*TMath::Sin(60*deg2rad)); cut1[i]->SetVertex(5, r*TMath::Cos(-8.6*deg2rad), r*TMath::Sin(-8.6*deg2rad)); cut1[i]->SetVertex(6, r*TMath::Cos(188.6*deg2rad), r*TMath::Sin(188.6*deg2rad)); cut1[i]->SetVertex(7, r*TMath::Cos(120*deg2rad), r*TMath::Sin(120*deg2rad)); cut2[i] = new TGeoArb8(Form("cut2%d", i), R_/2.); for(Int_t j=0; j<4; j++) cut2[i]->SetVertex(j, 0, 0); cut2[i]->SetVertex(4, r*TMath::Cos(340*deg2rad), r*TMath::Sin(340*deg2rad)); cut2[i]->SetVertex(5, 0, -1000*mm); cut2[i]->SetVertex(6, r*TMath::Cos(200*deg2rad), r*TMath::Sin(200*deg2rad)); cut2[i]->SetVertex(7, 0, 0); } // if tr[i] = new TGeoTranslation(Form("tr%d", i), 0, 0, R_/2.); tr[i]->RegisterYourself(); if(i==0){ rt[i] = 0; } else { rt[i] = new TGeoRotation(Form("rt%d", i), 60*i, 32, 0); rt[i]->RegisterYourself(); } // if mirSph[i] = new TGeoSphere(Form("mirSph%d", i), R, R_, 0, TMath::ASin(kMirrorRad/R)/deg2rad); if(i==0){ mirSphCut[i] = new TGeoCompositeShape(Form("cs%d", i), Form("mirSph%d*cut", i)); } else { if(i%2){ mirSphCut[i] = new TGeoCompositeShape(Form("cs%d", i), Form("mirSph%d*((cut1%d):tr%d)", i, i, i)); } else { mirSphCut[i] = new TGeoCompositeShape(Form("cs%d", i), Form("mirSph%d*((cut2%d ):tr%d)", i, i, i)); } // if } // if mirror[i] = new TGeoVolume(Form("mirror%d", i), mirSphCut[i]); top->AddNode(mirror[i], 1, rt[i]); } // i manager->CloseGeometry(); top->Draw(); }