Belle II Software development
runOverlay.py
1#!/usr/bin/env python3
2
3
10
11
21
22import sys
23import basf2 as b2
24import svd.overlay_utils as svdou
25import simulation as simu
26import glob
27
28tag = "unused"
29if len(sys.argv) == 2:
30 tag = sys.argv[1]
31
32'''
33# PREPARE YOUR INPUT FILES - ERROR printed at the end does not
34# affect output files
35# function provides output rootfile with SVDShaperDigits only
36
37# random TRG
38# 1. link the input raw data in /gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/
39# and select:
40# location="/gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/*.root"
41# and outputFileTag = ZS3
42# 2. then select:
43# location="/gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/*_ZS3.root"
44# and outputFileTag = overlay
45# and outputFileTag = overlayZS with same location
46
47filelist=glob.glob(location)
48# print(filelist)
49for inputfile in filelist:
50 main = b2.create_path()
51# svdou.prepare_svd_overlay(main, [inputfile],"ZS3")
52 svdou.prepare_svd_overlay(main, [inputfile],"overlay")
53# svdou.prepare_svd_overlay(main, [inputfile],"overlayZS5")
54'''
55
56# EXAMPLE OF OVERLAY
57main = b2.create_path()
58
59b2.set_random_seed(1)
60
61# set the exp/run event informations
62eventinfosetter = b2.register_module('EventInfoSetter')
63eventinfosetter.param('expList', [0])
64eventinfosetter.param('runList', [1])
65eventinfosetter.param('evtNumList', [10])
66main.add_module(eventinfosetter)
67
68# register HistoModules for DQM plots
69main.add_module("HistoManager", histoFileName="SVDDQMOutput_"+str(tag)+".root")
70
71# generate signal
72main.add_module('EvtGenInput')
73
74# add default simulation
75bkgDir = '/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root'
76bg = glob.glob(bkgDir)
77if len(bg) == 0:
78 b2.B2ERROR('No files found in ', bkgDir)
79 sys.exit()
80simu.add_simulation(main, bkgfiles=bg, usePXDDataReduction=False, forceSetPXDDataReduction=True)
81
82if str(tag) == "xTalk" or str(tag) == "cosmics" or str(tag) == "randomTrigger" or str(tag) == "randomTriggerZS5":
83 svdou.overlay_svd_data(main, str(tag))
84
85
86# add offline ZS for DQM
87main.add_module(
88 'SVDZeroSuppressionEmulator',
89 SNthreshold=5,
90 ShaperDigits='SVDShaperDigits',
91 ShaperDigitsIN='SVDShaperDigitsZS5',
92 FADCmode=True)
93main.add_module('SVDDQMExpressReco', offlineZSShaperDigits='SVDShaperDigitsZS5')
94
95main.add_module('Progress')
96
97b2.print_path(main)
98
99b2.process(main)
100
101print(b2.statistics)