13 from optparse
import OptionParser
25 parser = OptionParser()
26 parser.add_option(
'-n',
'--nevents', dest=
'nevents', default=1000, help=
'Number of events to process')
27 parser.add_option(
'-f',
'--file', dest=
'filename', default=
'ARICHEvents.root')
28 parser.add_option(
'-r',
'--hepr', action=
"store_true", dest=
'hepr', default=
False, help=
'Visualisation with heprep')
29 parser.add_option(
'-o',
'--overlap', action=
"store_true", dest=
'overlap', default=
False, help=
'Run overlap checker')
30 parser.add_option(
'-b',
'--rootbatch', action=
"store_true", dest=
'rootbatch',
31 default=
False, help=
'Run analysis root script in batch mode')
32 parser.add_option(
'-m',
'--rootoff', action=
"store_true", dest=
'rootoff', default=
False, help=
'Do not run root script in the end')
34 (options, args) = parser.parse_args()
36 home = os.environ[
'BELLE2_LOCAL_DIR']
44 b2.set_log_level(b2.LogLevel.ERROR)
47 main = b2.create_path()
50 eventinfosetter = b2.register_module(
'EventInfoSetter')
51 if not (options.hepr):
52 if not (options.overlap):
53 eventinfosetter.param({
'evtNumList': [int(options.nevents)],
'runList': [1]})
55 eventinfosetter.param({
'evtNumList': [1],
'runList': [1]})
57 eventinfosetter.param({
'evtNumList': [1],
'runList': [1]})
58 main.add_module(eventinfosetter)
61 histo = b2.register_module(
'HistoManager')
62 histo.param(
'histoFileName',
'DQMhistograms.root')
63 main.add_module(histo)
66 gearbox = b2.register_module(
'Gearbox')
67 main.add_module(gearbox)
71 geometry = b2.register_module(
'Geometry')
72 geometry.param(
'components', [
75 main.add_module(geometry)
78 particlegun = b2.register_module(
'ParticleGun')
79 particlegun.param(
'pdgCodes', [211, -211, 321, -321])
80 particlegun.param(
'nTracks', 1)
82 particlegun.param(
'momentumGeneration',
'uniform')
83 particlegun.param(
'momentumParams', [0.5, 4])
85 particlegun.param(
'thetaGeneration',
'uniformCos')
86 particlegun.param(
'thetaParams', [17, 35])
87 particlegun.param(
'phiGeneration',
'uniform')
88 particlegun.param(
'phiParams', [0, 360])
89 particlegun.param(
'vertexGeneration',
'fixed')
90 particlegun.param(
'xVertexParams', [0])
91 particlegun.param(
'yVertexParams', [0])
92 particlegun.param(
'zVertexParams', [0])
93 particlegun.param(
'independentVertices',
False)
94 main.add_module(particlegun)
97 simulation = b2.register_module(
'FullSim')
100 print(
'Visualisation with HepRep')
101 simulation.param(
'EnableVisualization',
True)
102 simulation.param(
'UICommandsAtIdle', [
103 '/vis/open HepRepFile',
105 '/vis/scene/add/volume',
106 '/vis/sceneHandler/attach',
108 '/vis/scene/add/trajectories smooth',
109 '/vis/scene/add/hits'
112 main.add_module(simulation)
115 if (options.overlap):
116 print(
'Check for volume intersection/overlaps')
117 overlapchecker = b2.register_module(
'OverlapChecker')
118 main.add_module(overlapchecker)
121 arichDigi = b2.register_module(
'ARICHDigitizer')
122 main.add_module(arichDigi)
125 arichHits = b2.register_module(
'ARICHFillHits')
126 main.add_module(arichHits)
130 arichreco = b2.register_module(
'ARICHReconstructor')
132 arichreco.param(
'inputTrackType', 1)
134 arichreco.param(
'storePhotons', 1)
135 main.add_module(arichreco)
139 arichNtuple = b2.register_module(
'ARICHNtuple')
140 arichNtuple.param(
'outputFile', options.filename)
141 main.add_module(arichNtuple)
145 arichdqm = b2.register_module(
'ARICHDQM')
146 main.add_module(arichdqm)
160 progress = b2.register_module(
'Progress')
161 main.add_module(progress)
170 if (options.rootbatch):
171 com =
'root -l -b -q ' + options.filename +
' ' + home +
'/arich/utility/scripts/plotEfficiency.C'
173 com =
'root -l ' + options.filename +
' ' + home +
'/arich/utility/scripts/plotEfficiency.C'
175 if not (options.hepr):
176 if not (options.overlap):
177 if not (options.rootoff):
181 com =
'root -l -b -q ' +
'ARICHPerformance.root' +
' ' + home +
'/arich/utility/scripts/plotEfficiencyConvertTCanvasToHist.C'
182 if not (options.hepr):
183 if not (options.overlap):
184 if not (options.rootoff):