Hello all,
I am a newbie to ROOT. I am currently working on a code I discovered online. My aim is to construct a Positron Emitting Tomography Ring. By employing the code below, I managed to create two opposite photodetectors with an angle 180 degrees. However, I want to create an entire ring composed of many photodetectors such as in the following image.
Considering that creating opposite detectors many times is not utile, how can I create such a ring in one step? Any help would be greatly appreciated. Currently I was able to create the following opposite photodetectors:
_ROOT Version:
From tags/v6-24-06@v6-24-06 |
| With Apple clang version 13.0.0 (clang-1300.0.29.3)
The code:
#include “TGeoManager.h”
#include iostream>
#include cmath>
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
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);
}