Belle II Software development
cosmicsExtrapolationReconstruction.py
1#!/usr/bin/env python3
2
3
10
11"""
12<header>
13 <contact>software-tracking@belle2.org</contact>
14 <input>CosmicsSimNoBkg.root</input>
15 <output>CosmicsExtrapolation.root</output>
16 <description>Validation of cosmic track extrapolation.</description>
17</header>
18"""
19
20import basf2
21from reconstruction import add_cosmics_reconstruction
22
23ACTIVE = True
24
25
26def run():
27 """
28 Run the cosmics reconstruction and extrapolation.
29 """
30 basf2.set_random_seed(12345)
31
32 main = basf2.create_path()
33
34 # Input.
35 main.add_module('RootInput', inputFileName='../CosmicsSimNoBkg.root')
36
37 # Extrapolation. Tracks are not merged (otherwise, many backward-extrapolated
38 # tracks are removed).
39 main.add_module('Gearbox')
40 main.add_module('Geometry')
41 add_cosmics_reconstruction(main, merge_tracks=False)
42
43 # Output.
44 output = basf2.register_module('RootOutput')
45 output.param('outputFileName', '../CosmicsExtrapolation.root')
46 output.param('branchNames', ['ExtHits', 'KLMHit2ds',
47 'MCParticles', 'Tracks', 'TrackFitResults'])
48 main.add_module(output)
49
50 main.add_module('Progress')
51
52 # Process the path.
53 basf2.process(main, max_event=1000)
54
55 print(basf2.statistics)
56
57
58if __name__ == '__main__':
59 if ACTIVE:
60 run()
61 else:
62 print("This validation deactivated and thus basf2 is not executed.\n"
63 "If you want to run this validation, please set the 'ACTIVE' flag above to 'True'.\n"
64 "Exiting.")