How to build a simple Setup
In this example a new Setup is created.
This Setup contains a mandatory mother Volume, and another Volume with a Surface inside
// Create a position vector at (0,0,0)
EVector pos(3,0);
// Create a unitary vector along z (0,0,1)
EVector axis1(3,0); axis1[2]=1;
// Create a unitary vector along x (1,0,0)
EVector axis2(3,0); axis2[0]=1;
// Size of the volume
double sx = 100*mm;
double sy = 100*mm;
double sz = 1000*mm;
// Create a Setup called "main"
Setup* setup = new Setup();
setup->set_name("main");
// Create a mother volume and set it to the Setup
Volume* mother = new Box(pos,axis1,axis2,sx*2,sy*2,sz*2);
setup->set_mother(mother);
// Create a volume of type Box, called "TPC" and put it inside "mother"
Volume* vol = new Box(pos,axis1,axis2,sx,sy,sz);
setup->add_volume("mother", "TPC", vol);
// Create a surface of type Rectangle, called "surf_1" and put it inside "TPC"
Surface* surf = new Rectangle(pos,axis1,axis2,sx,sy);
setup->add_surface("TPC", "surf_1", surf);