Skip to content
Snippets Groups Projects

SiEIC geometry

Merged David Blyth requested to merge sieic_geo into master
11 files
+ 1138
703
Compare changes
  • Side-by-side
  • Inline
Files
11
+ 81
0
#!/usr/bin/env python2
import argparse
from array import array
def run(args):
import ROOT, DDG4
kernel = DDG4.Kernel()
kernel.loadGeometry('file:' + args.compact_path)
dd = kernel.detectorDescription()
manager = dd.manager()
manager.CheckOverlaps(0.01)
manager.PrintOverlaps()
manager.SetVisDensity()
manager.SetVisLevel(2)
top_vol = manager.GetTopVolume()
top_vol.Draw('ogl')
viewer = ROOT.gPad.GetViewer3D()
viewer.SetCurrentCamera(ROOT.TGLViewer.kCameraOrthoZOY)
overlay = viewer.GetCameraOverlay()
overlay.SetOrthographicMode(ROOT.TGLCameraOverlay.kAxis)
overlay.SetShowOrthographic(True)
clip_set = viewer.GetClipSet()
clip_type = ROOT.TGLClip.kClipPlane
clip_set.SetClipType(clip_type)
clip_state = array('d')
clip_state.extend([1,0,0,0,0,0])
clip_set.SetClipState(clip_type, clip_state)
viewer.ToggleOrthoRotate()
if args.interactive:
ROOT.gApplication.Run()
else:
save_picture(viewer, args.output_prefix + '.png')
camera = viewer.CurrentCamera()
camera.RotateRad(-0.25, -0.4)
save_picture(viewer, args.output_prefix + '_angled.png')
overlay.SetShowOrthographic(False)
save_picture(viewer, args.output_prefix + '_angledNoOverlay.png')
def save_picture(viewer, filename):
viewer.SavePictureUsingFBO(filename, 1920, 1080)
print("Saved file: " + filename)
def define_args(parser):
parser.add_argument(
'compact_path',
metavar='CompactPath',
help='file with compact XML detector description'
)
parser.add_argument(
'-o', '--outputprefix',
dest='output_prefix',
default='sieic_vis',
help='output file prefix'
)
parser.add_argument(
'-i', '--interactive',
action='store_true',
dest='interactive',
help='run an interactive session. Must quit ROOT application from the menu.'
)
# parser.add_argument(
# '-i', '--input',
# dest='input_file',
# default=None,
# help='truth-level input path'
# )
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='sieic_vis')
define_args(parser)
args = parser.parse_args()
print(args)
run(args)
Loading