12from optparse
import OptionParser
24parser = OptionParser()
25parser.add_option(
'-n',
'--nevents', dest=
'nevents', default=1000, help=
'Number of events to process')
26parser.add_option(
'-f',
'--file', dest=
'filename', default=
'ARICHEvents.root')
27parser.add_option(
'-r',
'--hepr', action=
"store_true", dest=
'hepr', default=
False, help=
'Visualisation with heprep')
28parser.add_option(
'-o',
'--overlap', action=
"store_true", dest=
'overlap', default=
False, help=
'Run overlap checker')
29parser.add_option(
'-b',
'--rootbatch', action=
"store_true", dest=
'rootbatch',
30 default=
False, help=
'Run analysis root script in batch mode')
31parser.add_option(
'-m',
'--rootoff', action=
"store_true", dest=
'rootoff', default=
False, help=
'Do not run root script in the end')
33(options, args) = parser.parse_args()
35home = os.environ[
'BELLE2_LOCAL_DIR']
43b2.set_log_level(b2.LogLevel.ERROR)
46main = b2.create_path()
49eventinfosetter = b2.register_module(
'EventInfoSetter')
51 if not (options.overlap):
52 eventinfosetter.param({
'evtNumList': [int(options.nevents)],
'runList': [1]})
54 eventinfosetter.param({
'evtNumList': [1],
'runList': [1]})
56 eventinfosetter.param({
'evtNumList': [1],
'runList': [1]})
57main.add_module(eventinfosetter)
60histo = b2.register_module(
'HistoManager')
61histo.param(
'histoFileName',
'DQMhistograms.root')
65main.add_module(
'Gearbox')
69geometry = b2.register_module(
'Geometry')
70geometry.param(
'components', [
73main.add_module(geometry)
76particlegun = b2.register_module(
'ParticleGun')
77particlegun.param(
'pdgCodes', [211, -211, 321, -321])
78particlegun.param(
'nTracks', 1)
80particlegun.param(
'momentumGeneration',
'uniform')
81particlegun.param(
'momentumParams', [0.5, 4])
83particlegun.param(
'thetaGeneration',
'uniformCos')
84particlegun.param(
'thetaParams', [17, 35])
85particlegun.param(
'phiGeneration',
'uniform')
86particlegun.param(
'phiParams', [0, 360])
87particlegun.param(
'vertexGeneration',
'fixed')
88particlegun.param(
'xVertexParams', [0])
89particlegun.param(
'yVertexParams', [0])
90particlegun.param(
'zVertexParams', [0])
91particlegun.param(
'independentVertices',
False)
92main.add_module(particlegun)
95simulation = b2.register_module(
'FullSim')
98 print(
'Visualisation with HepRep')
99 simulation.param(
'EnableVisualization',
True)
100 simulation.param(
'UICommandsAtIdle', [
101 '/vis/open HepRepFile',
103 '/vis/scene/add/volume',
104 '/vis/sceneHandler/attach',
106 '/vis/scene/add/trajectories smooth',
107 '/vis/scene/add/hits'
110main.add_module(simulation)
114 print(
'Check for volume intersection/overlaps')
115 overlapchecker = b2.register_module(
'OverlapChecker')
116 main.add_module(overlapchecker)
119arichDigi = b2.register_module(
'ARICHDigitizer')
120main.add_module(arichDigi)
123arichHits = b2.register_module(
'ARICHFillHits')
124main.add_module(arichHits)
128arichreco = b2.register_module(
'ARICHReconstructor')
130arichreco.param(
'inputTrackType', 1)
132arichreco.param(
'storePhotons', 1)
133main.add_module(arichreco)
137arichNtuple = b2.register_module(
'ARICHNtuple')
138arichNtuple.param(
'outputFile', options.filename)
139main.add_module(arichNtuple)
143arichdqm = b2.register_module(
'ARICHDQM')
144main.add_module(arichdqm)
158main.add_module(
'Progress')
167if (options.rootbatch):
168 com =
'root -l -b -q ' + options.filename +
' ' + home +
'/arich/utility/scripts/plotEfficiency.C'
170 com =
'root -l ' + options.filename +
' ' + home +
'/arich/utility/scripts/plotEfficiency.C'
172if not (options.hepr
or options.overlap
or options.rootoff):
176com =
'root -l -b -q ' +
'ARICHPerformance.root' +
' ' + home +
'/arich/utility/scripts/plotEfficiencyConvertTCanvasToHist.C'
177if not (options.hepr
or options.overlap
or options.rootoff):