Belle II Software  release-05-01-25
overlayUtils.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
17 
18 import sys
19 import os
20 from basf2 import *
21 import svd.overlay_utils as svdou
22 import simulation as simu
23 import glob
24 import basf2
25 
26 tag = "unused"
27 if len(sys.argv) == 2:
28  tag = sys.argv[1]
29 
30 '''
31 # PREPARE YOUR INPUT FILES - ERROR printed at the end does not
32 # affect output files
33 # function provides output rootfile with SVDShaperDigits only
34 
35 # random TRG
36 # 1. link the input raw data in /gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/
37 # and select:
38 # location="/gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/*.root"
39 # and outputFileTag = ZS3
40 # 2. then select:
41 # location="/gpfs/fs02/belle2/group/detector/SVD/overlayFiles/randomTRG/*_ZS3.root"
42 # and outputFileTag = overlay
43 # and outputFileTag = overlayZS with same location
44 
45 filelist=glob.glob(location)
46 # print(filelist)
47 for inputfile in filelist:
48  main = create_path()
49 # svdou.prepare_svd_overlay(main, [inputfile],"ZS3")
50  svdou.prepare_svd_overlay(main, [inputfile],"overlay")
51 # svdou.prepare_svd_overlay(main, [inputfile],"overlayZS5")
52 '''
53 
54 # EXAMPLE OF OVERLAY
55 main = create_path()
56 
57 set_random_seed(1)
58 
59 # set the exp/run event informations
60 eventinfosetter = register_module('EventInfoSetter')
61 eventinfosetter.param('expList', [0])
62 eventinfosetter.param('runList', [1])
63 eventinfosetter.param('evtNumList', [10])
64 main.add_module(eventinfosetter)
65 
66 # register HistoModules for DQM plots
67 main.add_module("HistoManager", histoFileName="SVDDQMOutput_"+str(tag)+".root")
68 
69 # generate signal
70 main.add_module('EvtGenInput')
71 
72 # add default simulation
73 bkgDir = '/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root'
74 bg = glob.glob(bkgDir)
75 if len(bg) == 0:
76  B2ERROR('No files found in ', bkgDir)
77  sys.exit()
78 simu.add_simulation(main, bkgfiles=bg, usePXDDataReduction=False, forceSetPXDDataReduction=True)
79 
80 if str(tag) == "xTalk" or str(tag) == "cosmics" or str(tag) == "randomTrigger" or str(tag) == "randomTriggerZS5":
81  svdou.overlay_svd_data(main, str(tag))
82 
83 
84 # add offline ZS for DQM
85 main.add_module(
86  'SVDZeroSuppressionEmulator',
87  SNthreshold=5,
88  ShaperDigits='SVDShaperDigits',
89  ShaperDigitsIN='SVDShaperDigitsZS5',
90  FADCmode=True)
91 main.add_module('SVDDQMExpressReco', offlineZSShaperDigits='SVDShaperDigitsZS5')
92 
93 main.add_module('Progress')
94 
95 print_path(main)
96 
97 process(main)
98 
99 print(statistics)
svd.overlay_utils
Definition: overlay_utils.py:1