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