Belle II Software development
DQMVXD_BelleII.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12from simulation import add_simulation
13from reconstruction import add_reconstruction
14
15import PXDROIUnpackerModule
16
17
18import argparse
19parser = argparse.ArgumentParser(
20 description=("VXD DQM Belle II for Run 0 (Phase 2, Exp=1), Run 1 (Phase 3 Early, Exp=2) "
21 "and Run 2 (Phase 3 regular, Exp=3), show all possible histos")
22 )
23parser.add_argument(
24 '--experiment-type',
25 dest='ExperimentType',
26 action='store',
27 default=2,
28 type=int,
29 help='Set which experiment you want: 1 (Run 0, Phase 2), 2 (Run 1, Phase 3 Early) or 3 (Run 2, Phase 3 regular), default = 2')
30
31args = parser.parse_args()
32
33print("Final setting of arguments: ")
34print(" ExperimentType: ", args.ExperimentType)
35
36# background (collision) files
37# bg = glob.glob('./BG/*.root')
38bg = None
39
40# number of events to generate, can be overridden with -n
41num_events = 100
42# output filename, can be overridden with -o
43output_filename = "RootOutput.root"
44if (args.ExperimentType == 1):
45 output_filename = "RootOutput_Phase2.root"
46if (args.ExperimentType == 2):
47 output_filename = "RootOutput_Phase3Early.root"
48if (args.ExperimentType == 3):
49 output_filename = "RootOutput_Phase3.root"
50
51# create path
52main = b2.create_path()
53
54if (args.ExperimentType == 1):
55 # the experiment number for Run 0 (phase2) MC has to be 1002,
56 # otherwise the wrong payloads (for VXDTF2 the SectorMap) are loaded
57 main.add_module("EventInfoSetter", expList=1002, runList=1, evtNumList=num_events)
58if (args.ExperimentType == 2):
59 # the experiment number for Run 1 (early phase3) MC has to be 1003,
60 # otherwise the wrong payloads for this faze are loaded
61 main.add_module("EventInfoSetter", expList=1003, runList=1, evtNumList=num_events)
62if (args.ExperimentType == 3):
63 # the experiment number for Run 2 (regular phase3) MC has no need to set, it is default
64 main.add_module("EventInfoSetter", evtNumList=num_events)
65
66# in case you need to fix seed of random numbers
67# set_random_seed('d33fa68eab781f3dcb069fb23425885fcd92d3432e6433a14894e5d7bba34272')
68
69# generate BBbar events
70main.add_module('EvtGenInput')
71
72# detector and L1 trigger simulation
73add_simulation(main, bkgfiles=bg)
74
75
76# PXD digitization module
77# main.add_module('PXDDigitizer')
78# Convert digits to raw pxd data
79PXDPACKER = b2.register_module('PXDPacker')
80# ============================================================================
81# [[dhhc1, dhh1, dhh2, dhh3, dhh4, dhh5] [ ... ]]
82# -1 is disable port
83PXDPACKER.param('dhe_to_dhc', [
84 [0, 2, 4, 34, 36, 38],
85 [1, 6, 8, 40, 42, 44],
86 [2, 10, 12, 46, 48, 50],
87 [3, 14, 16, 52, 54, 56],
88 [4, 3, 5, 35, 37, 39],
89 [5, 7, 9, 41, 43, 45],
90 [6, 11, 13, 47, 49, 51],
91 [7, 15, 17, 53, 55, 57],
92])
93main.add_module(PXDPACKER)
94# Convert digits from raw pxd data
95main.add_module('PXDUnpacker')
96'''Unpack ROIs from ONSEN output'''
98'''Unpack ROIs from HLT Payload (depends if there are in the sroot file)'''
99# main.add_module(PXDROIUnpackerModule.PXDPayloadROIUnpackerModule())
100
101# reconstruction
102add_reconstruction(main)
103
104# histomanager: use DqmHistoManager for in-line monitoring, or HistoManager for offline training
105# main.add_module('DqmHistoManager', Port=7777)
106Histos_filename = "Histos_DQMVXD.root"
107if (args.ExperimentType == 1):
108 Histos_filename = "Histos_DQMVXD_Phase2.root"
109if (args.ExperimentType == 2):
110 Histos_filename = "Histos_DQMVXD_Phase3Early.root"
111if (args.ExperimentType == 3):
112 Histos_filename = "Histos_DQMVXD_Phase3.root"
113main.add_module('HistoManager', histoFileName=Histos_filename)
114
115main.add_module('PXDDAQDQM', histogramDirectoryName='PXDDAQ')
116main.add_module('PXDDQMClusters', histogramDirectoryName='PXDCls')
117main.add_module('PXDDQMCorr', histogramDirectoryName='PXDCor')
118main.add_module('PXDDQMEfficiency', histogramDirectoryName='PXDEff')
119# main.add_module('PXDHardwareClusterDQM', histogramDirectoryName='PXDHCl')
120main.add_module('PXDRawDQMChips', histogramDirectoryName='PXDRCh')
121main.add_module('PXDRawDQMCorr', histogramDirectoryName='PXDRCo')
122main.add_module('PXDRawDQM', histogramDirectoryName='PXDRaw')
123main.add_module('PXDROIDQM', histogramDirectoryName='PXDROI')
124
125pxddqmExpReco = b2.register_module('PXDDQMExpressReco')
126svddqmExpReco = b2.register_module('SVDDQMExpressReco')
127vxddqmExpReco = b2.register_module('VXDDQMExpressReco')
128
129main.add_module(pxddqmExpReco)
130main.add_module(svddqmExpReco)
131main.add_module(vxddqmExpReco)
132
133# DQM of tracking
134trackDQM = main.add_module('TrackDQM')
135# In case to see more details:
136# trackDQM = main.add_module('TrackDQM', debugLevel=250)
137# trackDQM.logging.log_level = LogLevel.DEBUG
138
139# Finally add output, if you need
140# main.add_module("RootOutput", outputFileName=output_filename)
141
142# process events and print call statistics
143b2.process(main, calculateStatistics=True)
144print(b2.statistics)