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