#include #include #include using namespace std; void photodetector () { // gStyle->SetCanvasPreferGL(true); gSystem->Load("libGeom"); TGeoManager *geom = new TGeoManager("world", "Simple geometry"); //— define some materials TGeoMaterial *matVacuum = new TGeoMaterial("Vacuum", 0,0,0); TGeoMaterial *matAl = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMaterial *matSi = new TGeoMaterial("Si", 28.0855,14,2.3290); //— define some media TGeoMedium *Vacuum = new TGeoMedium("Vacuum", 1, matVacuum); TGeoMedium *Al = new TGeoMedium("Al",2, matAl); TGeoMedium *Si = new TGeoMedium("Si",4, matSi); //— make mixture lead glass TGeoElementTable *table = gGeoManager->GetElementTable(); TGeoElement *el1 = table->GetElement(8); TGeoElement *el2 = table->GetElement(48); TGeoElement *el3 = table->GetElement(74); TGeoMixture *cadmiumt = new TGeoMixture("cadmiumt",5,7.9); cadmiumt->AddElement(el1,0.177); cadmiumt->AddElement(el2,0.313); cadmiumt->AddElement(el3,0.510); printf("___________________________________________________________\n"); printf("Cadmium tungstate:\n"); cadmiumt->Print(); TGeoMedium *mcadmiumt = new TGeoMedium("cadmiumt",5, cadmiumt); //define the top container volume TGeoVolume *top = geom->MakeBox("TOP",Vacuum, 110, 110, 110); top->SetLineColor(kMagenta); geom->SetTopVolume(top); top->SetVisibility(false); // make detector TGeoVolume *D = geom->MakeBox("D", Vacuum, 100, 100, 100); D->SetVisibility(false); // make boxes TGeoVolume *box1 = geom->MakeBox("box1",Al,4.5,0.6,0.6); TGeoVolume *box2 = geom->MakeBox("box2", Vacuum, 4.5,0.45,0.45); TGeoVolume *box3 = geom->MakeBox("box3", mcadmiumt, 4.5,0.45,0.45); // SiPm Silicon TGeoVolume *box4 = geom->MakeBox("box4", Si, 0.2,0.45,0.45); TGeoTranslation *t1 = new TGeoTranslation("t1", 4.7,0,0); t1->RegisterYourself(); //composition TGeoCompositeShape *cs = new TGeoCompositeShape("cs","((box1-box2)+box3)+box4:t1"); TGeoVolume *comp = new TGeoVolume("COMP", cs); comp->SetLineColor(5); D->AddNode(comp, 1); // create matrix D->AddNode(comp,1,new TGeoTranslation(0.,1.2,0.)); D->AddNode(comp,2,new TGeoTranslation(0.,2.4,0.)); D->AddNode(comp,3,new TGeoTranslation(0.,3.6,0.)); D->AddNode(comp,4,new TGeoTranslation(0.,4.8,0.)); D->AddNode(comp,5,new TGeoTranslation(0.,6.0,0.)); D->AddNode(comp,5,new TGeoTranslation(0.,7.2,0.)); double z; for ( int i=1; i<=6; i=1+i ) { z= (1.2*i); D->AddNode(comp,i,new TGeoTranslation(0.,0.,z)); D->AddNode(comp,i+3,new TGeoTranslation(0.,1.2,z)); D->AddNode(comp,i+4,new TGeoTranslation(0.,2.4,z)); D->AddNode(comp,i+5,new TGeoTranslation(0.,3.6,z)); D->AddNode(comp,i+6,new TGeoTranslation(0.,4.8,z)); D->AddNode(comp,i+7,new TGeoTranslation(0.,6.0,z)); D->AddNode(comp,i+8,new TGeoTranslation(0.,7.2,z)); } //duplicate matrix // make container ring auto ring = geom->MakeTube("ring", Vacuum, 35, 49, 8); // divide ring in sectors that will hold each detector auto sector = ring->Divide("Sector", 2 /*phi division*/, 20 /* number of slices*/, 0 /*start phi*/, 0 /*delta phi, 0 means fill the full disc with divisions*/); // see https://root.cern.ch/doc/master/classTGeoVolume.html#abc4f9494937df4582e67c94eef01ae63 for options // Place detector in each sector sector->AddNode(D, 1, new TGeoTranslation(41.5,-3.6,-3.6)); // Make sure the sector actually fits the detector top->AddNode(ring, 1); //top->AddNode(D,1,new TGeoTranslation(41.5,-3.6,-3.6)); //TGeoRotation *r1 = new TGeoRotation("r1",180,0,0 ); //TGeoCombiTrans *c1 = new TGeoCombiTrans(-41.5,3.6,-3.6,r1); //top->AddNode(D,2,c1); // close geometry geom->CloseGeometry(); gGeoManager->GetMasterVolume()->Draw(); comp->SetLineColor(kBlue); }