Belle II Software  release-06-02-00
ECLClusterFWD.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 <header>
14 <output>ECLClusterOutputFWD.root</output>
15 <contact>Elisa Manoni, elisa.manoni@pg.infn.it</contact>
16 </header>
17 """
18 
19 import os
20 import glob
21 import basf2 as b2
22 from simulation import add_simulation
23 from reconstruction import add_reconstruction
24 
25 # Create paths
26 main = b2.create_path()
27 
28 # Event setting and info
29 eventinfosetter = b2.register_module('EventInfoSetter')
30 eventinfosetter.param({'evtNumList': [1000], 'runList': [1]})
31 main.add_module(eventinfosetter)
32 
33 # Fixed random seed
34 b2.set_random_seed(123456)
35 
36 # single particle generator settings
37 pGun = b2.register_module('ParticleGun')
38 param_pGun = {
39  'pdgCodes': [22],
40  'nTracks': 1,
41  'momentumGeneration': 'fixed',
42  'momentumParams': [0.1],
43  'thetaGeneration': 'uniform',
44  'thetaParams': [17., 31.],
45  'phiGeneration': 'uniform',
46  'phiParams': [0, 360],
47  'vertexGeneration': 'uniform',
48  'xVertexParams': [0.0, 0.0],
49  'yVertexParams': [0.0, 0.0],
50  'zVertexParams': [0.0, 0.0],
51 }
52 
53 pGun.param(param_pGun)
54 main.add_module(pGun)
55 
56 # bg = None
57 if 'BELLE2_BACKGROUND_DIR' in os.environ:
58  bg = glob.glob(os.environ['BELLE2_BACKGROUND_DIR'] + '/*.root')
59 else:
60  print('Warning: variable BELLE2_BACKGROUND_DIR is not set')
61 b2.B2INFO('Using background samples from ' + os.environ['BELLE2_BACKGROUND_DIR'])
62 
63 add_simulation(main, bkgfiles=bg)
64 add_reconstruction(main)
65 
66 # eclDataAnalysis module
67 ecldataanalysis = b2.register_module('ECLDataAnalysis')
68 ecldataanalysis.param('rootFileName', '../ECLClusterOutputFWD.root')
69 ecldataanalysis.param('doTracking', 1)
70 ecldataanalysis.param('doDigits', 1)
71 main.add_module(ecldataanalysis)
72 
73 b2.process(main)
74 # print(statistics)