Hello, I am a newbie to ROOT programming. I am using ROOT
version : v6-24-06@v6-24-06 . I am trying to use the following code, but end up getting the errors:
error: use of undeclared identifier ‘Vacuum’
*TGeoVolume top = geom->MakeBox(“TOP”,Vacuum, 110, 110, 110);
-
^*
ROOT_prompt_36:1:36: error: use of undeclared identifier ‘Vacuum’
*TGeoVolume D = geom->MakeBox(“D”, Vacuum, 100, 100, 100);
-
^*
ROOT_prompt_39:1:42: error: use of undeclared identifier ‘Vacuum’
*TGeoVolume box2 = geom->MakeBox(“box2”, Vacuum, 1.5,0.15,0.15);
-
^*
ROOT_prompt_44:1:42: error: use of undeclared identifier ‘cs’
*TGeoVolume comp = new TGeoVolume(“COMP”,cs);comp->SetLineColor(5);
^
The code I am trying to use is below. Any help would be greatly appreciated.
#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
Double_t worldx = 110.;
Double_t worldy = 110.;
Double_t worldz = 110.;
TGeoVolume *top = geom->MakeBox(“TOP”,Vacuum, 110, 110, 110);
top->SetLineColor(kMagenta);
geom->SetTopVolume(top);
top->SetVisibility(kFalse)
// make detector
TGeoVolume *D = geom->MakeBox(“D”, Vacuum, 100, 100, 100);
D->SetVisibility(kFalse)
// 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);