Belle II Software development
EclHitDebug.py
1#!/usr/bin/env python3
2
3
10
11"""This steering file shows how to use 'ECLHitDebug'
12 module to dump ECL-related quantities in an ntuple.
13
14Input:
15 No file is required
16
17Output:
18 Root file named 'Output.root'
19
20Usage:
21 $ basf2 EclHitDebug.py
22"""
23
24import basf2 as b2
25from simulation import add_simulation
26from reconstruction import add_tracking_reconstruction
27from reconstruction import add_ecl_modules
28
29
30# Create path. Register necessary modules to this path.
31mainPath = b2.create_path()
32
33b2.set_log_level(b2.LogLevel.ERROR)
34
35# Register and add 'EventInfoSetter' module and settings
36eventInfoSetter = b2.register_module('EventInfoSetter')
37eventInfoSetter.param({'evtNumList': [3],
38 'runList': [1],
39 'expList': [0]}) # one event
40mainPath.add_module(eventInfoSetter)
41
42# Register and add 'EventInfoPrinter' module
43eventInfoPrinter = b2.register_module('EventInfoPrinter')
44mainPath.add_module(eventInfoPrinter)
45
46# Create geometry
47# Geometry parameter loader
48gearbox = b2.register_module('Gearbox')
49
50# Register 'Geometry' module
51geometry = b2.register_module('Geometry')
52
53# Register 'FullSim' module
54g4sim = b2.register_module('FullSim')
55
56# Random number for generation
57b2.set_random_seed(123456)
58
59# Register and add 'ParticleGun' generator module and settings
60particleGun = b2.register_module('ParticleGun')
61param_particleGun = {
62 'pdgCodes': [22, 111], # 22: photon, 111: pi0
63 'nTracks': 6,
64 'momentumGeneration': 'uniform',
65 'momentumParams': [1., 2.],
66 'thetaGeneration': 'uniform',
67 'thetaParams': [50., 130.],
68 'phiGeneration': 'uniform',
69 'phiParams': [0, 360.],
70 'vertexGeneration': 'uniform',
71 'xVertexParams': [0.0, 0.0],
72 'yVertexParams': [0.0, 0.0],
73 'zVertexParams': [0.0, 0.0],
74}
75particleGun.param(param_particleGun)
76mainPath.add_module(particleGun)
77
78# Register and add 'ECLDigitizer' module
79eclDigitizer = b2.register_module('ECLDigitizer')
80mainPath.add_module(eclDigitizer)
81
82# Register and add 'ECLHitDebug' module
83eclHitDebug = b2.register_module('ECLHitDebug')
84mainPath.add_module(eclHitDebug)
85
86# Register 'MCMatcherECLClusters' module
87mcMatcherECLClusters = b2.register_module('MCMatcherECLClusters')
88
89# Simulation
90add_simulation(mainPath)
91
92# Tracking reconstruction
93add_tracking_reconstruction(mainPath)
94
95# Add the ECL reconstruction modules to the path
96add_ecl_modules(mainPath)
97
98# Register and add 'RootOutput' module
99outputFile = b2.register_module('RootOutput')
100outputFile.param('outputFileName', 'Output.root')
101mainPath.add_module(outputFile)
102
103# Process the events and print call statistics
104mainPath.add_module('Progress')
105b2.process(mainPath)
106print(b2.statistics)