Newer
Older
Markus Frank
committed
# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $
#==========================================================================
# AIDA Detector description implementation for LCD
#--------------------------------------------------------------------------
# Copyright (C) Organisation européenne pour la Recherche nucléaire (CERN)
# All rights reserved.
#
# For the licensing terms see $DD4hepINSTALL/LICENSE.
# For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
#
#==========================================================================
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys, optparse
parser = optparse.OptionParser()
parser.description = "TGeo Geometry checking."
parser.add_option("-c", "--compact", dest="compact", default=None,
help="Define LCCDD style compact xml input",
metavar="<FILE>")
parser.add_option("-f","--full",
dest="full", default=False,
help="Full geometry checking",
metavar="<boolean>")
parser.add_option("-n", "--ntracks",
dest="num_tracks", default=1000000,
help="Number of tracks [requires 'full']",
metavar="<integer>")
parser.add_option("-x", "--vx",
dest="vx", default=0.0,
help="X-position of track origine vertex [requires 'full']",
metavar="<double>")
parser.add_option("-y", "--vy",
dest="vy", default=0.0,
help="Y-position of track origine vertex [requires 'full']",
metavar="<double>")
parser.add_option("-z", "--vz",
dest="vz", default=0.0,
help="Z-position of track origine vertex [requires 'full']",
metavar="<double>")
parser.add_option("-o", "--option", dest="option", default='ob',
help="Geometry checking option default:ob",
metavar="<string>")
(opts, args) = parser.parse_args()
if opts.compact is None:
print " ",parser.format_help()
sys.exit(1)
try:
import DD4hep
except ImportError,X:
print 'DD4hep python interface not accessible:',X
DD4hep.setPrintLevel(DD4hep.OutputLevel.ERROR)
print '+++%s\n+++ Loading compact geometry:%s\n+++%s'%(120*'=',opts.compact,120*'=')
lcdd = DD4hep.Geo.LCDD.getInstance()
lcdd.fromXML(opts.compact)
print '+++%s\n+++ Checking geometry:%s full-check:%s\n+++%s'%(120*'=',opts.compact,opts.full,120*'=')
if opts.full:
print '+++ # tracks:%d vertex:(%7.3f, %7.3f, %7.3f) [cm]'%(opts.num_tracks,opts.vx,opts.vy,opts.vz,)
lcdd.manager().CheckGeometryFull(opts.num_tracks,opts.vx,opts.vy,opts.vz,opts.option)
else:
lcdd.manager().CheckGeometry()