Belle II Software development
runMaxStrip.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 = False # True
27unpack = True
28run = 5900 # 3239 #5751
29fileout = 'SVDMaxStripTTree_exp10run'+str(run)+'.root'
30
31# RAW
32files = ['/group/belle2/dataprod/Data/Raw/e0010/r0'+str(run)+'/sub00/physics.0010.0'+str(run)+'.HLT*.root']
33# 5751
34# 5900
35# RAW CT skims
36# files = ['/gpfs/fs02/belle2/group/detector/SVD/']
37# run = 3239
38
39# old-format cDST
40# 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"]
41
42bkg = glob.glob('/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root')
43
44# needed for some temporary issues with BKLMDisplacement payload
45if data:
46 b2conditions.override_globaltags()
47 b2conditions.globaltags = ['klm_alignment_testing', 'online']
48
49eventinfosetter = b2.register_module('EventInfoSetter')
50eventinfosetter.param('expList', [1003])
51eventinfosetter.param('runList', [1])
52
53evtgeninput = b2.register_module('EvtGenInput')
54evtgeninput.logging.log_level = b2.LogLevel.INFO
55
56
57# main main
58main = b2.create_path()
59
60
61# read input rootfile
62# -> can be overwritten with the -i option
63if data:
64 main.add_module("RootInput", inputFileNames=files)
65else:
66 main.add_module(eventinfosetter)
67 main.add_module(evtgeninput)
68
69# nee to know SVD geometry to create histograms
70main.add_module('Gearbox')
71main.add_module('Geometry')
72
73# if using RAW data you need to unpack them
74if data and unpack:
75 add_unpackers(main, components=['SVD'])
76
77if not data:
78 main.add_module('FullSim')
79 add_simulation(main, bkgfiles=bkg)
80
81if not data:
82 fileout = 'SVDMaxStripTTree_MC.root'
83
84main.add_module(
85 'SVDMaxStripTTree',
86 outputFileName=fileout,
87 ShaperDigits='SVDShaperDigits',
88 skipHLTRejectedEvents=True)
89
90# Show progress
91main.add_module('Progress')
92
93b2.print_path(main)
94
95# Process events
96b2.process(main)
97
98print(b2.statistics)