Belle II Software  release-05-01-25
EclRefactoring.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
13 
14 import os
15 from basf2 import *
16 from simulation import add_simulation
17 from reconstruction import *
18 
19 import sys
20 import glob
21 
22 # user input
23 withbg = 0 # add beam background yes/no
24 bgfolder = '' # folder that holds beam background
25 seed = 10000 # seed for random numbers
26 mdstfile = 'eclrefactoring.root' # output file
27 
28 # set log level
29 set_log_level(LogLevel.INFO)
30 
31 # fix random seed
32 set_random_seed(seed)
33 
34 # create main path
35 main = create_path()
36 
37 # add event infosetter
38 eventinfosetter = register_module('EventInfoSetter')
39 main.add_module(eventinfosetter)
40 
41 # add generator
42 evtgeninput = register_module('EvtGenInput')
43 main.add_module(evtgeninput)
44 
45 # add default full simulation and digitization
46 if (withbg == 1):
47  bg = glob.glob(bgfolder + '/*.root')
48  add_simulation(main, bkgfiles=bg)
49 else:
50  add_simulation(main)
51 
52 # add reconstruction
53 add_reconstruction(main)
54 
55 # --------------------------------------------------
56 # --------------------------------------------------
57 
58 # add output file with all of the available ECL information
59 add_mdst_output(
60  main,
61  mc=True,
62  filename=mdstfile,
63  additionalBranches=[
64  'ECLDigits',
65  'ECLCalDigits',
66  'ECLConnectedRegions',
67  'ECLShowers',
68  'ECLLocalMaximums'])
69 
70 # Show progress of processing
71 progress = register_module('ProgressBar')
72 main.add_module(progress)
73 
74 process(main)
75 print(statistics)