Belle II Software development
runUVTimeDifference.py
1#!/usr/bin/env python3
2
3
10
11
18
19import glob
20import sys
21
22import basf2 as b2
23from basf2 import conditions as b2conditions
24from rawdata import add_unpackers
25from simulation import add_simulation
26from svd import add_svd_reconstruction
27
28MCrun = int(sys.argv[1])
29data = False # True
30unpack = True
31if not data:
32 unpack = False
33
34# only relevant for data:
35run = 5900 # 3239 #5751
36fileout = 'hitTimeSelection_exp10run'+str(run)+'.root'
37
38# RAW
39files = ['/group/belle2/dataprod/Data/Raw/e0010/r0'+str(run)+'/sub00/physics.0010.0'+str(run)+'.HLT*.root']
40# 5751
41# 5900
42# RAW CT skims
43# files = ['/gpfs/fs02/belle2/group/detector/SVD/']
44# run = 3239
45
46# old-format cDST
47# 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"]
48
49bkg = glob.glob('/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root')
50
51# needed for some temporary issues with BKLMDisplacement payload
52if data:
53 b2conditions.override_globaltags()
54 b2conditions.globaltags = ['svd_svdHitTimeSelection_test', 'klm_alignment_testing', 'online']
55else:
56 b2conditions.globaltags = ['svd_svdHitTimeSelection_test']
57
58# svd_svd_svdHitTimeSelection_test CONTENT:
59# exp 0, run 0 maxTimeDiff = 100
60# exp 0, run 1 maxTimeDiff = 10
61# exp 0, run 2 maxTimeDiff = 15
62# exp 0, run 3 maxTimeDiff = 20
63# exp 0, run 4 maxTimeDiff = 25
64# exp 0, run 5 maxTimeDiff = 30
65# exp 0, run 6 maxTimeDiff = 35
66# exp 0, run 7 maxTimeDiff = 40
67# exp 0, run 8 maxTimeDiff = 45
68# exp 0, run 9 maxTimeDiff = 50
69
70eventinfosetter = b2.register_module('EventInfoSetter')
71eventinfosetter.param('expList', [0])
72eventinfosetter.param('runList', [MCrun])
73
74evtgeninput = b2.register_module('EvtGenInput')
75evtgeninput.logging.log_level = b2.LogLevel.INFO
76
77# main main
78main = b2.create_path()
79
80# read input rootfile
81# -> can be overwritten with the -i option
82if data:
83 main.add_module("RootInput", inputFileNames=files)
84else:
85 main.add_module(eventinfosetter)
86 main.add_module(evtgeninput)
87
88# nee to know SVD geometry to create histograms
89main.add_module('Gearbox')
90main.add_module('Geometry')
91
92# if using RAW data you need to unpack them
93if data and unpack:
94 add_unpackers(main, components=['SVD'])
95
96if not data:
97 main.add_module('FullSim')
98 add_simulation(main, bkgfiles=None, usePXDDataReduction=False, forceSetPXDDataReduction=True)
99# add_simulation(main, bkgfiles=bkg, usePXDDataReduction=False, forceSetPXDDataReduction=True)
100
101if not data:
102 fileout = 'SVDHitTimeSelection_MCnoBKG_run'+str(MCrun)+'.root'
103
104add_svd_reconstruction(main)
105
106main.add_module('RootOutput', outputFileName=fileout, branchNames=['SVDSpacePoints'])
107# Show progress
108main.add_module('Progress')
109
110b2.print_path(main)
111
112# Process events
113b2.process(main)
114
115print(b2.statistics)