Belle II Software development
runCoGTimeError.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12from rawdata import add_unpackers
13from simulation import add_simulation
14from tracking import add_tracking_reconstruction
15
16from basf2 import conditions as b2conditions
17
18# data = True
19data = False
20
21if data:
22 b2conditions.override_globaltags()
23 b2conditions.globaltags = ['klm_alignment_testing', 'online']
24
25numEvents = 10
26
27b2.set_random_seed(1)
28files = [' /group/belle2/dataprod/Data/Raw/e0010/r04925/sub00/beam.0010.04925.HLT*.root']
29
30# old cDST
31# 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"]
32
33
34eventinfosetter = b2.register_module('EventInfoSetter')
35eventinfosetter.param('expList', [0])
36eventinfosetter.param('runList', [1])
37eventinfosetter.param('evtNumList', [numEvents])
38
39eventinfoprinter = b2.register_module('EventInfoPrinter')
40
41evtgeninput = b2.register_module('EvtGenInput')
42evtgeninput.logging.log_level = b2.LogLevel.INFO
43
44
45# Create paths
46main = b2.create_path()
47
48
49# read input rootfile
50if data:
51 main.add_module("RootInput", inputFileNames=files)
52
53else:
54 main.add_module(eventinfosetter)
55 main.add_module(eventinfoprinter)
56 main.add_module(evtgeninput)
57
58main.add_module('Gearbox')
59main.add_module('Geometry')
60
61if data:
62 add_unpackers(main, components=['SVD', 'CDC'])
63else:
64 main.add_module('FullSim')
65 add_simulation(main)
66
67add_tracking_reconstruction(main, components=['SVD', 'CDC'])
68
69# Select Strips form Tracks
70fil = b2.register_module('SVDShaperDigitsFromTracks')
71fil.param('outputINArrayName', 'SVDShaperDigitsFromTracks')
72main.add_module(fil)
73
74fitter = b2.register_module('SVDCoGTimeEstimator')
75fitter.set_name('post_SVDCoGTimeEstimator')
76fitter.param('ShaperDigits', 'SVDShaperDigitsFromTracks')
77fitter.param('RecoDigits', 'SVDRecoDigitsFromTracks')
78main.add_module(fitter)
79
80clusterizer = b2.register_module('SVDSimpleClusterizer')
81clusterizer.set_name('post_SVDSimpleClusterizer')
82clusterizer.param('RecoDigits', 'SVDRecoDigitsFromTracks')
83clusterizer.param('Clusters', 'SVDClustersFromTracks')
84clusterizer.param('useDB', True)
85main.add_module(clusterizer)
86
87input_branches = [
88 'EventT0',
89 'SVDShaperDigits',
90 'SVDShaperDigitsFromTracks',
91 'SVDRecoDigits',
92 'SVDRecoDigitsFromTracks',
93 'SVDClusters',
94 'SVDClustersFromTracks',
95]
96
97if data:
98 input_branches.append('SVDEventInfo')
99else:
100 input_branches.append('SVDEventInfoSim')
101
102if data:
103 main.add_module("RootOutput", branchNames=input_branches, outputFileName="RootOutput_CoGerror_FromTracks_DATA.root")
104else:
105 main.add_module("RootOutput", branchNames=input_branches, outputFileName="RootOutput_CoGerror_FromTracks.root")
106
107b2.print_path(main)
108
109# Process events
110b2.process(main)
111
112print(b2.statistics)