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