Project

General

Profile

GDML Ray Tracing Script

The script in numix-docdb 53 allows the user to trace a ray through a GDML geometry file. The script outputs the geometry element the ray starts in and outputs any subsequent changes. The script ends when the ray reaches the edge of the world.

The script takes 7 arguments. The first three are the coordinates for the starting position (doubles). The next three are the direction the ray will move (doubles). The last is the GDML file path (string).

At the time of the writing of this Wiki page, this was the most recent example in my history.

 root point_walk.C'(0,10,-600, 0,0,1, "numi.gdml")'

Note the single quotes around the arguments; this forces the arguments to be parsed correctly. The inputs indicate how the script will work. The ray starts at x=0, elevated by (y =) 10 cm, and starting at z = -6 m. The ray will move in the positive z direction, and the file is shown as the last argument.

Two typical outputs, when the ray crosses two boundaries, are:

 ----------------------------------------------------------
 fnbas[ 56]  at {       0,      10, 73787.2} in            LVMuMon_349 mom=LVMuMonAlcv_0_354
 current matrix: 
 matrix global_3 - tr=1  rot=1  refl=0  scl=0
   1.000000    0.000000    0.000000    Tx =   0.000000
   0.000000    0.998298    0.058317    Ty =   0.740625
   0.000000   -0.058317    0.998298    Tz = 73790.564745
 mother matrix: 
 matrix global_2 - tr=1  rot=1  refl=0  scl=0
   1.000000    0.000000    0.000000    Tx =   0.000000
   0.000000    0.998298    0.058317    Ty = -37.353282
   0.000000   -0.058317    0.998298    Tz = 73805.511701
 ----------------------------------------------------------
 fnbas[ 57]  at {       0,      10, 73792.9} in      LVMuMonAlcv_0_354 mom=TUNE_log_496
 current matrix: 
 matrix global_2 - tr=1  rot=1  refl=0  scl=0
   1.000000    0.000000    0.000000    Tx =   0.000000
   0.000000    0.998298    0.058317    Ty = -37.353282
   0.000000   -0.058317    0.998298    Tz = 73805.511701
 mother matrix: 
 matrix global_1 - tr=1  rot=0  refl=0  scl=0
   1.000000    0.000000    0.000000    Tx =   0.000000
   0.000000    1.000000    0.000000    Ty =   0.000000
   0.000000    0.000000    1.000000    Tz = 39241.925000

In the first line, the number in square brackets says are border crossing counters, the numbers in curly braces indicate the position the border crossing occurred, and 'GeoLabel_xxx mom=GeoLabel2_yyy' indicates what geometry component the ray is entering, and what this component's mother volume is. (It does not indicate what the ray is exiting.) In the above example, the ray is in "LVMuMon", then exits this and enters "LVMuMonAlcv_0".