17from optparse
import OptionParser
22b2.set_log_level(b2.LogLevel.INFO)
24outroot =
'arichbtest.root'
26parser = OptionParser()
27parser.add_option(
'-r',
'--run', dest=
'runno', default=
'068',
29parser.add_option(
'-p',
'--path', dest=
'path',
30 default=
'/afs/f9.ijs.si/data/belle/data/beamtests/2011/run',
33parser.add_option(
'-y',
'--year', dest=
'year', default=
'2011',
34 help=
'beam test year')
36parser.add_option(
'-t',
'--track-mask', dest=
'mask', default=
'0x5',
37 help=
'track mask 4 bits')
39parser.add_option(
'-m',
'--avgagel', dest=
'avgagel', default=
'0',
40 help=
'average thc calculation based on the mean agel')
47 help=
'Output filename',
51parser.add_option(
'-n',
'--neve', dest=
'neve', default=20000,
52 help=
'Number of events to process')
54(options, args) = parser.parse_args()
56fname = options.path +
'/run' + options.runno +
'.dat'
58if not os.path.isfile(fname):
59 print(
'File does not exist:')
62 print(
'Appending .gz...')
63if not os.path.isfile(fname):
64 print(
'File does not exist:')
68if options.output == outroot:
69 outroot =
'run_' + options.runno +
'.root'
71 outroot = options.output
73mask = int(options.mask, 16)
74runno = int(options.runno)
76print(
'TrackMask:' + options.mask)
79averageagel = int(options.avgagel)
81eventinfosetter = b2.register_module(
'EventInfoSetter')
82eventinfosetter.param(
'evtNumList', [int(options.neve)])
83eventinfosetter.param(
'runList', [int(options.runno)])
84eventinfosetter.param(
'expList', [1])
87paramloader = b2.register_module(
'Gearbox')
89xmlgeometry =
'file://%s/arich/modules/arichBtest/data/%s/arichBtest%s.xml' \
90 % (os.getcwd(), options.year, options.year)
91paramloader.param(
'fileName', xmlgeometry)
93paramloader.param(
'fileName', xmlgeometry)
106geobuilder = b2.register_module(
'Geometry')
107geobuilder.param(
'components', [
'ARICHBtest'])
109btest = b2.register_module(
'arichBtest')
110btest.param(
'mwpcTrackMask', [mask])
112btest.param(
'runList', [fname])
113btest.param(
'outputFileName', outroot)
115if options.year ==
'2013':
117print(
'Beam momentum ' + str(momentum))
118btest.param(
'beamMomentum', momentum)
121g4sim = b2.register_module(
'FullSim')
124g4sim.param(
'RegisterOptics', 1)
128g4sim.param(
'PhotonFraction', 0.3)
130g4sim.param(
'EnableVisualization',
True)
134g4sim.param(
'UICommandsAtIdle', [
'/vis/open VRML2FILE',
'/vis/drawVolume',
135 '/vis/scene/add/axes 0 0 0 100 mm'])
138geosaver = b2.register_module(
'ExportGeometry')
139geosaver.param(
'Filename',
'Belle2Geo.root')
141arichrec = b2.register_module(
'ARICHReconstructor')
142arichrec.param(
'inputTrackType', 1)
143arichrec.param(
'beamtest', 3)
144arichrec.param(
'trackPositionResolution', 0.0)
145arichrec.param(
'trackAngleResolution', 0.0)
147profile = b2.register_module(
'Profile')
148profile.param(
'outputFileName',
'profileusage.ps')
150main = b2.create_path()
151main.add_module(eventinfosetter)
152main.add_module(paramloader)
154main.add_module(geobuilder)
155main.add_module(btest)
156main.add_module(arichrec)
158main.add_module(geosaver)
163print(
'Event Statistics:')