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