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