Belle II Software development
runClusterizer.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
28alg = 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 = '3sampleClusterizer_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_timeCalibration_test', 'klm_alignment_testing', 'online']
55else:
56 b2conditions.globaltags = ['svd_timeCalibration_test']
57
58# svd_timeCalibration_test CONTENT:
59# exp 0, run 0: no calibration applied: returned time from the database = raw time
60
61eventinfosetter = b2.register_module('EventInfoSetter')
62eventinfosetter.param('expList', [0])
63eventinfosetter.param('runList', [0])
64
65evtgeninput = b2.register_module('EvtGenInput')
66evtgeninput.logging.log_level = b2.LogLevel.INFO
67
68# main main
69main = b2.create_path()
70
71# read input rootfile
72# -> can be overwritten with the -i option
73if data:
74 main.add_module("RootInput", inputFileNames=files)
75else:
76 main.add_module(eventinfosetter)
77 main.add_module(evtgeninput)
78
79# nee to know SVD geometry to create histograms
80main.add_module('Gearbox')
81main.add_module('Geometry')
82
83# if using RAW data you need to unpack them
84if data and unpack:
85 add_unpackers(main, components=['SVD'])
86
87if not data:
88 main.add_module('FullSim')
89 add_simulation(main, bkgfiles=None, usePXDDataReduction=False, forceSetPXDDataReduction=True)
90# add_simulation(main, bkgfiles=bkg, usePXDDataReduction=False, forceSetPXDDataReduction=True)
91
92if not data:
93 fileout = 'SVD3SampleClusterizer_MCnoBKG_timeAlg'+str(alg)+'.root'
94
95add_svd_reconstruction(main)
96
97for m in main.modules():
98 if "SVDSimpleClusterizer" == m.name():
99 m.param("timeAlgorithm", alg)
100
101main.add_module('RootOutput', outputFileName=fileout, branchNames=['SVDClusters'])
102# Show progress
103main.add_module('Progress')
104
105b2.print_path(main)
106
107# Process events
108b2.process(main)
109
110print(b2.statistics)