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