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