Belle II Software development
runOccupancy.py
1#!/usr/bin/env python3
2
3
10
11
18
19import glob
20
21import basf2 as b2
22from basf2 import conditions as b2conditions
23from rawdata import add_unpackers
24from simulation import add_simulation
25
26data = True
27run = 5751
28
29# RAW
30files = ['/group/belle2/dataprod/Data/Raw/e0010/r0'+str(run)+'/sub00/physics.0010.0'+str(run)+'.HLT*.root']
31# 5751 (1% media)
32# 5900
33
34# old-format cDST
35# files=["/group/belle2/dataprod/Data/release-04-00-02/DB00000523/Unofficial/e0010/4S/r04295/skim/hlt_hadron/cdst/sub00/cdst.physics.0010.04295.HLT1*.root","/group/belle2/dataprod/Data/release-04-00-02/DB00000523/Unofficial/e0010/4S/r04295/skim/hlt_bhabha/cdst/sub00/cdst.physics.0010.04295.HLT1.*.root","/group/belle2/dataprod/Data/release-04-00-02/DB00000523/Unofficial/e0010/4S/r04295/skim/hlt_mumu_2trk/cdst/sub00/cdst.physics.0010.04295.HLT1.*.root"]
36
37bkg = glob.glob('/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root')
38# needed for some temporary issues with BKLMDisplacement payload
39if data:
40 b2conditions.override_globaltags()
41 b2conditions.globaltags = ['klm_alignment_testing', 'online']
42
43eventinfosetter = b2.register_module('EventInfoSetter')
44eventinfosetter.param('expList', [1003])
45eventinfosetter.param('runList', [1])
46
47evtgeninput = b2.register_module('EvtGenInput')
48evtgeninput.logging.log_level = b2.LogLevel.INFO
49
50
51# main main
52main = b2.create_path()
53
54
55# read input rootfile
56# -> can be overwritten with the -i option
57if data:
58 main.add_module("RootInput", inputFileNames=files)
59else:
60 main.add_module(eventinfosetter)
61 main.add_module(evtgeninput)
62
63# nee to know SVD geometry to create histograms
64main.add_module('Gearbox')
65main.add_module('Geometry')
66
67# if using RAW data you need to unpack them
68if data:
69 add_unpackers(main, components=['SVD'])
70
71if not data:
72 main.add_module('FullSim')
73 add_simulation(main, bkgfiles=bkg)
74
75# add offline ZS
76main.add_module(
77 'SVDZeroSuppressionEmulator',
78 SNthreshold=5,
79 ShaperDigits='SVDShaperDigits',
80 ShaperDigitsIN='SVDShaperDigitsZS5',
81 FADCmode=True)
82
83main.add_module(
84 'SVDOccupancyAnalysis',
85 outputFileName='SVDOccupancyAnalysis_exp10run'+str(run)+'.root',
86 ShaperDigitsName='SVDShaperDigitsZS5',
87 skipHLTRejectedEvents=True)
88
89# == Show progress
90main.add_module('Progress')
91
92b2.print_path(main)
93
94# Process events
95b2.process(main)
96
97print(b2.statistics)