Belle II Software development
analyze_svd_background.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12
13b2.set_log_level(b2.LogLevel.INFO)
14# Change this to point to actual locations on your system.
15input_dir = '/data/belle2/BG/Jun2014/bg_SVD/'
16output_dir = '/data/belle2/BG/Jun2014/bg_SVD/output/'
17
18components = []
19components.append(('Coulomb_HER', 100))
20components.append(('Coulomb_LER', 100))
21components.append(('RBB_HER', 100))
22components.append(('RBB_LER', 100))
23components.append(('Touschek_HER', 100))
24components.append(('Touschek_LER', 100))
25components.append(('twoPhoton', 200))
26
27files = [input_dir + s + '_' + str(t) + 'us.root' for (s, t) in components]
28
29svd_branches = ['MCParticles', 'MCParticlesToSVDSimHits',
30 'MCParticlesToSVDTrueHits', 'SVDSimHits', 'SVDTrueHits']
31
32input = b2.register_module('RootInput')
33input.param('inputFileNames', files)
34# input.param('branchNames', svd_branches)
35
36# Histogram manager immediately after master module
37histo = b2.register_module('HistoManager')
38# File to save histograms
39histo.param('histoFileName', output_dir + 'SVDBackgroundHisto.root')
40
41# Report progress of processing
42progress = b2.register_module('Progress')
43
44# Load parameters
45gearbox = b2.register_module('Gearbox')
46# Create geometry
47geometry = b2.register_module('Geometry')
48geometry.param('components', ['SVD'])
49
50# SVD digitizer
51svdDigi = b2.register_module('SVDDigitizer')
52svdDigi.param('ElectronicEffects', False)
53
54# SVD clusterizer
55# svdClust = register_module('SVDClusterizer')
56
57# SVD beam background
58svdBkg = b2.register_module('SVDBackground')
59svdBkg.param('componentNames', [s for (s, t) in components])
60svdBkg.param('componentTimes', [t for (s, t) in components])
61svdBkg.param('outputDirectory', output_dir)
62
63svdBkg.set_log_level(b2.LogLevel.DEBUG)
64svdBkg.set_debug_level(10)
65
66# output - do we want output?
67output = b2.register_module('RootOutput')
68output.param('outputFileName', output_dir + 'SVDBackgroundOutput.root')
69output.param('branchNames', ['SVDEnergyDepositionEvents', 'SVDNeutronFluxEvents'])
70
71# Create paths
72main = b2.create_path()
73
74# Add modules to paths
75main.add_module(input)
76main.add_module(histo)
77main.add_module(progress)
78main.add_module(gearbox)
79main.add_module(geometry)
80main.add_module(svdDigi)
81# main.add_module(svdClust)
82main.add_module(svdBkg)
83main.add_module(output)
84
85# Process events
86b2.process(main)
87
88# Print statistics
89print(b2.statistics)