17 from optparse
import OptionParser
21 b2.set_log_level(b2.LogLevel.INFO)
23 outroot =
'arichbtest.root'
25 parser = OptionParser()
26 parser.add_option(
'-r',
'--run', dest=
'runno', default=
'068',
29 parser.add_option(
'-y',
'--year', dest=
'year', default=
'2013',
30 help=
'beam test year')
32 parser.add_option(
'-m',
'--avgagel', dest=
'avgagel', default=
'0',
33 help=
'average thc calculation based on the mean agel')
40 help=
'Output filename',
44 parser.add_option(
'-n',
'--neve', dest=
'neve', default=20000,
45 help=
'Number of events to process')
47 (options, args) = parser.parse_args()
49 if options.output == outroot:
50 outroot =
'run_' + options.runno +
'.root'
52 outroot = options.output
54 runno = int(options.runno)
57 averageagel = int(options.avgagel)
59 eventinfosetter = b2.register_module(
'EventInfoSetter')
60 eventinfosetter.param(
'evtNumList', [int(options.neve)])
61 eventinfosetter.param(
'runList', [int(options.runno)])
62 eventinfosetter.param(
'expList', [1])
65 paramloader = b2.register_module(
'Gearbox')
67 xmlgeometry =
'file://%s/arich/modules/arichBtest/data/%s/arichBtest%s.xml' \
68 % (os.getcwd(), options.year, options.year)
69 paramloader.param(
'fileName', xmlgeometry)
71 paramloader.param(
'fileName', xmlgeometry)
87 geobuilder = b2.register_module(
'Geometry')
88 geobuilder.param(
'components', [
'ARICHBtest'])
91 particlegun = b2.register_module(
'ParticleGun')
93 b2.set_random_seed(1097)
95 particlegun.param(
'pdgCodes', [-211, 211])
97 particlegun.param(
'nTracks', 1)
102 particlegun.param(
'momentumGeneration',
'uniform')
103 particlegun.param(
'momentumParams', [3.5, 3.51])
106 particlegun.param(
'thetaGeneration',
'uniformCos')
107 particlegun.param(
'thetaParams', [0, 0.2])
108 particlegun.param(
'phiGeneration',
'uniform')
109 particlegun.param(
'phiParams', [0, 360])
111 particlegun.param(
'vertexGeneration',
'uniform')
112 particlegun.param(
'xVertexParams', [-2.5, 2.5])
113 particlegun.param(
'yVertexParams', [18, 22])
114 particlegun.param(
'zVertexParams', [-100, -101])
116 b2.print_params(particlegun)
119 g4sim = b2.register_module(
'FullSim')
124 g4sim.param(
'RegisterOptics', 1)
128 g4sim.param(
'PhotonFraction', 0.3)
130 arichDIGI = b2.register_module(
'ARICHDigitizer')
132 arichrec = b2.register_module(
'ARICHReconstructor')
133 arichrec.param(
'inputTrackType', 1)
136 arichrec.param(
'beamtest', 2)
141 arichrec.param(
'outfileName', outroot)
144 geosaver = b2.register_module(
'ExportGeometry')
145 geosaver.param(
'Filename',
'BeamtestGeo.root')
147 main = b2.create_path()
148 main.add_module(eventinfosetter)
149 main.add_module(paramloader)
150 main.add_module(geobuilder)
151 main.add_module(particlegun)
152 main.add_module(g4sim)
153 main.add_module(arichDIGI)
154 main.add_module(arichrec)
159 print(
'Event Statistics:')