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