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