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