Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:02:38

0001 #!/usr/bin/env python
0002 # draw sensor positions and orientations from table produced by `make_sensor_table.sh`
0003 
0004 import sys
0005 import ROOT as r
0006 
0007 root_file_name = sys.argv[1] if len(sys.argv)>1 else 'geo/sensor_table.root'
0008 print(f'Opening file {root_file_name}...')
0009 root_file = r.TFile(root_file_name, 'READ')
0010 tr = root_file.Get('table')
0011 
0012 cut = 'sector==0'
0013 
0014 def branch3D(name):
0015     return f'{name}_y:{name}_x:{name}_z'
0016 def cross(a,b):
0017     cx = f'{a}_y*{b}_z-{a}_z*{b}_y'
0018     cy = f'{a}_z*{b}_x-{a}_x*{b}_z'
0019     cz = f'{a}_x*{b}_y-{a}_y*{b}_x'
0020     return f'{cy}:{cx}:{cz}'
0021 
0022 canv = r.TCanvas()
0023 canv.Divide(2,2)
0024 canv.cd(1)
0025 tr.Draw(branch3D('pos'), cut)
0026 canv.cd(2)
0027 tr.Draw(branch3D('normX'), cut)
0028 canv.cd(3)
0029 tr.Draw(branch3D('normY'), cut)
0030 canv.cd(4)
0031 tr.Draw(cross('normX','normY'), cut) # normZ = normX x normY
0032 
0033 root_file.Close()
0034