Hello all,
I am a newbie to ROOT. I have been working on a code I found online for the construction of a photodetector design. The code is found below.
My question is about the “addnode” parts. In this configuration each box of alimunium has a side of 0.2 mm in y and z axis. However to create 5 boxes aligned vertically , commands such as " D->AddNode(comp,1,new TGeoTranslation(0.,.4,0.));" are used. And 0.4 mm increases are used for each node. Given that the sides are 0.2 mm, shouldn’t the distance between the nodes be 0.2 mm and the corresponding code "D->AddNode(comp,1,newTGeoTranslation(0.,.2,0.)); with 0.2 mm increases for each node? Thanks in advance.
_ROOT Version:
From tags/v6-24-06@v6-24-06 |
| With Apple clang version 13.0.0 (clang-1300.0.29.3)
#include “TGeoManager.h”
#include iostream>
#include cmath>
using namespace std;
void pet()
{
// gStyle->SetCanvasPreferGL(true);
gSystem->Load(“libGeom”);
TGeoManager *geom = new TGeoManager(“world”, “Simple geometry”);
//— define some materials
TGeoMaterial *matPb = new TGeoMaterial(“Pb”, 207.2, 82, 11.34);
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 *Pb = new TGeoMedium(“Pb”,3, matPb);
TGeoMedium *Si = new TGeoMedium(“Si”,4, matSi);
//— make mixture lead glass
TGeoElementTable *table = gGeoManager->GetElementTable();
TGeoElement *el1 = table->GetElement(8);
TGeoElement *el2 = table->GetElement(14);
TGeoElement *el3 = table->GetElement(22);
TGeoElement *el4 = table->GetElement(33);
TGeoElement *el5 = table->GetElement(82);
TGeoMixture *glass = new TGeoMixture(“glass”,5,6.22);
glass->AddElement(el1,0.1564);
glass->AddElement(el2,0.0809);
glass->AddElement(el3,0.0081);
glass->AddElement(el4,0.0027);
glass->AddElement(el5,0.7519);
printf(“___________________________________________________________\n”); printf(“Lead glass:\n”);
glass->Print();
TGeoMedium *mglass = new TGeoMedium(“glass”,5, glass);
//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,1.5,0.2,0.2);
TGeoVolume *box2 = geom->MakeBox(“box2”, Vacuum, 1.5,0.15,0.15);
TGeoVolume *box3 = geom->MakeBox(“box3”, mglass, 1.5,0.15,0.15);
// SiPm Silicon
TGeoVolume *box4 = geom->MakeBox(“box4”, Si, 0.05,0.15,0.15);
TGeoTranslation *t1 = new TGeoTranslation(“t1”, 1.55,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.,.4,0.));
D->AddNode(comp,2,new TGeoTranslation(0.,.8,0.));
D->AddNode(comp,3,new TGeoTranslation(0.,1.2,0.));
D->AddNode(comp,4,new TGeoTranslation(0.,1.6,0.));
double z;
for ( int i=1; i<=4; i=1+i )
{
z= (0.4*i);
D->AddNode(comp,i,new TGeoTranslation(0.,0.,z));
D->AddNode(comp,i+3,new TGeoTranslation(0.,.4,z));
D->AddNode(comp,i+4,new TGeoTranslation(0.,.8,z));
D->AddNode(comp,i+5,new TGeoTranslation(0.,1.2,z));
D->AddNode(comp,i+6,new TGeoTranslation(0.,1.6,z));
} //duplicate matrix
top->AddNode(D,1,new TGeoTranslation(41.5,-0.8,-0.8));
TGeoRotation *r1 = new TGeoRotation(“r1”,180,0,0);
TGeoCombiTrans *c1 = new TGeoCombiTrans(-41.5,0.8,-0.8,r1);
top->AddNode(D,2,c1);
// close geometry
geom->CloseGeometry();
gGeoManager->GetMasterVolume()->Draw();
comp->SetLineColor(kBlue);
}