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