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