12 from optparse
import OptionParser
24 parser = OptionParser()
25 parser.add_option(
'-n',
'--nevents', dest=
'nevents', default=1000, help=
'Number of events to process')
26 parser.add_option(
'-f',
'--file', dest=
'filename', default=
'ARICHEvents.root')
27 parser.add_option(
'-r',
'--hepr', action=
"store_true", dest=
'hepr', default=
False, help=
'Visualisation with heprep')
28 parser.add_option(
'-o',
'--overlap', action=
"store_true", dest=
'overlap', default=
False, help=
'Run overlap checker')
29 parser.add_option(
'-b',
'--rootbatch', action=
"store_true", dest=
'rootbatch',
30 default=
False, help=
'Run analysis root script in batch mode')
31 parser.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()
35 home = os.environ[
'BELLE2_LOCAL_DIR']
43 b2.set_log_level(b2.LogLevel.ERROR)
46 main = b2.create_path()
49 eventinfosetter = b2.register_module(
'EventInfoSetter')
50 if not (options.hepr):
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]})
57 main.add_module(eventinfosetter)
60 histo = b2.register_module(
'HistoManager')
61 histo.param(
'histoFileName',
'DQMhistograms.root')
62 main.add_module(histo)
65 main.add_module(
'Gearbox')
69 geometry = b2.register_module(
'Geometry')
70 geometry.param(
'components', [
73 main.add_module(geometry)
76 particlegun = b2.register_module(
'ParticleGun')
77 particlegun.param(
'pdgCodes', [211, -211, 321, -321])
78 particlegun.param(
'nTracks', 1)
80 particlegun.param(
'momentumGeneration',
'uniform')
81 particlegun.param(
'momentumParams', [0.5, 4])
83 particlegun.param(
'thetaGeneration',
'uniformCos')
84 particlegun.param(
'thetaParams', [17, 35])
85 particlegun.param(
'phiGeneration',
'uniform')
86 particlegun.param(
'phiParams', [0, 360])
87 particlegun.param(
'vertexGeneration',
'fixed')
88 particlegun.param(
'xVertexParams', [0])
89 particlegun.param(
'yVertexParams', [0])
90 particlegun.param(
'zVertexParams', [0])
91 particlegun.param(
'independentVertices',
False)
92 main.add_module(particlegun)
95 simulation = 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'
110 main.add_module(simulation)
113 if (options.overlap):
114 print(
'Check for volume intersection/overlaps')
115 overlapchecker = b2.register_module(
'OverlapChecker')
116 main.add_module(overlapchecker)
119 arichDigi = b2.register_module(
'ARICHDigitizer')
120 main.add_module(arichDigi)
123 arichHits = b2.register_module(
'ARICHFillHits')
124 main.add_module(arichHits)
128 arichreco = b2.register_module(
'ARICHReconstructor')
130 arichreco.param(
'inputTrackType', 1)
132 arichreco.param(
'storePhotons', 1)
133 main.add_module(arichreco)
137 arichNtuple = b2.register_module(
'ARICHNtuple')
138 arichNtuple.param(
'outputFile', options.filename)
139 main.add_module(arichNtuple)
143 arichdqm = b2.register_module(
'ARICHDQM')
144 main.add_module(arichdqm)
158 main.add_module(
'Progress')
167 if (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'
172 if not (options.hepr
or options.overlap
or options.rootoff):
176 com =
'root -l -b -q ' +
'ARICHPerformance.root' +
' ' + home +
'/arich/utility/scripts/plotEfficiencyConvertTCanvasToHist.C'
177 if not (options.hepr
or options.overlap
or options.rootoff):