Belle II Software development
DQMCorrelations.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12
13import svd
14import pxd
15
16import argparse
17parser = argparse.ArgumentParser(description="PXD+SVD+VXD DQM correlations for Belle II + TB, show all possible histos")
18parser.add_argument(
19 '--magnet-off',
20 dest='magnet_off',
21 action='store_const',
22 const=True,
23 default=False,
24 help='Turn off magnetic field')
25
26parser.add_argument('--skip-pxd-svd', dest='SkipPXDSVD', action='store_const', const=True, default=False,
27 help='Add also PXD and SVD DQM, default = True')
28parser.add_argument('--data-output', dest='DataOutput', action='store_const', const=True, default=False,
29 help='Save data to output file, default = False')
30parser.add_argument('--correlation-granulation', dest='CorrelationGranulation', action='store', default=1.0, type=float,
31 help='Set granulation of histogram plots, default is 1 degree, min = 0.02 degree, max = 1 degree')
32parser.add_argument('--cut-correlation-sig-pxd', dest='CutCorrelationSigPXD', action='store', default=0, type=int,
33 help='Cut threshold of PXD signal for accepting to correlations, default = 0 ADU')
34parser.add_argument('--cut-correlation-sig-u-svd', dest='CutCorrelationSigUSVD', action='store', default=0, type=int,
35 help='Cut threshold of SVD signal for accepting to correlations in u, default = 0 ADU')
36parser.add_argument('--cut-correlation-sig-v-svd', dest='CutCorrelationSigVSVD', action='store', default=0, type=int,
37 help='Cut threshold of SVD signal for accepting to correlations in v, default = 0 ADU')
38parser.add_argument('--cut-correlation-time-svd', dest='CutCorrelationTimeSVD', action='store', default=70, type=int,
39 help='Cut threshold of SVD time window for accepting to correlations, default = 70 ns')
40
41parser.add_argument('--use-digits', dest='UseDigits', action='store', default=0, type=int,
42 help='flag <0,1> for using digits only, no cluster information will be required, default = 0')
43parser.add_argument('--reduce-1d-correl-histos', dest='Reduce1DCorrelHistos', action='store', default=0, type=int,
44 help='flag <0,1> for removing of 1D correlation plots from output, default = 0')
45parser.add_argument('--reduce-2d-correl-histos', dest='Reduce2DCorrelHistos', action='store', default=0, type=int,
46 help='flag <0,1> for removing of 2D correlation plots from output, default = 0')
47parser.add_argument('--only-23-layers-histos', dest='Only23LayersHistos', action='store', default=0, type=int,
48 help='flag <0,1> for to keep only correlation plots between layer 2 and 3 (between PXD and SVD), default = 0')
49parser.add_argument('--save-other-histos', dest='SaveOtherHistos', action='store', default=1, type=int,
50 help='flag <0,1> for creation of correlation plots for non-neighboar layers, default = 0')
51parser.add_argument('--unpacking', dest='unpacking', action='store_const', const=True,
52 default=False, help='Add PXD and SVD unpacking modules to the path')
53parser.add_argument('--input-file', dest='input_file', action='store', default=None, type=str,
54 help='Name of input file')
55parser.add_argument('--filename-histos', dest='histo_file_name', action='store',
56 default='VXD_DQM_Histograms.root', type=str,
57 help='Name of output file with histograms in dqm option is used')
58parser.add_argument('--SkipDQM', dest='SkipDQM', action='store_const', const=True, default=False, help='Produce DQM plots')
59parser.add_argument('--SkipDQMExpressReco', dest='SkipDQMExpressReco', action='store_const', const=True, default=False,
60 help='Skip production of ExpressReco DQM plots')
61
62
63args = parser.parse_args()
64
65print("Final setting of arguments: ")
66print(" SkipPXDSVD: ", args.SkipPXDSVD)
67print(" DataOutput: ", args.DataOutput)
68print(" CorrelationGranulation: ", args.CorrelationGranulation)
69print(" CutCorrelationSigPXD: ", args.CutCorrelationSigPXD)
70print(" CutCorrelationSigUSVD: ", args.CutCorrelationSigUSVD)
71print(" CutCorrelationSigVSVD: ", args.CutCorrelationSigVSVD)
72print(" CutCorrelationTimeSVD: ", args.CutCorrelationTimeSVD)
73print(" UseDigits: ", args.UseDigits)
74print(" Reduce1DCorrelHistos: ", args.Reduce1DCorrelHistos)
75print(" Reduce2DCorrelHistos: ", args.Reduce2DCorrelHistos)
76print(" Only23LayersHistos: ", args.Only23LayersHistos)
77print(" SaveOtherHistos: ", args.SaveOtherHistos)
78print(" unpacking: ", args.unpacking)
79print(" input_file: ", args.input_file)
80print(" histo_file_name: ", args.histo_file_name)
81print(" SkipDQM: ", args.SkipDQM)
82print(" SkipDQMExpressReco: ", args.SkipDQMExpressReco)
83
84
85param_vxddqm = {'CutCorrelationSigPXD': args.CutCorrelationSigPXD,
86 'CutCorrelationSigUSVD': args.CutCorrelationSigUSVD,
87 'CutCorrelationSigVSVD': args.CutCorrelationSigVSVD,
88 'CutCorrelationTimeSVD': args.CutCorrelationTimeSVD,
89 'UseDigits': args.UseDigits
90 }
91
92# Now let's create a path to simulate our events. We need a bit of statistics but
93# that's not too bad since we only simulate single muons
94main = b2.create_path()
95main.add_module("EventInfoSetter", evtNumList=[1000])
96main.add_module("Gearbox")
97# we only need the vxd for this
98if (args.magnet_off is True):
99 main.add_module("Geometry", components=['BeamPipe', 'PXD', 'SVD'])
100else:
101 main.add_module("Geometry", components=['MagneticFieldConstant4LimitedRSVD',
102 'BeamPipe', 'PXD', 'SVD'])
103
104
105main.add_module("EvtGenInput")
106main.add_module("FullSim")
111
112if (args.SkipDQM is False):
113 histomanager = b2.register_module('HistoManager', histoFileName=args.histo_file_name)
114 main.add_module(histomanager)
115 if (args.SkipPXDSVD is False):
116 if (args.SkipDQMExpressReco is False):
117 pxddqmExpReco = b2.register_module('PXDDQMExpressReco')
118 svddqmExpReco = b2.register_module('SVDDQMExpressReco')
119 main.add_module(pxddqmExpReco)
120 main.add_module(svddqmExpReco)
121
122 if (args.SkipDQMExpressReco is False):
123 vxddqmExpReco = b2.register_module('VXDDQMExpressReco')
124 vxddqmExpReco.param(param_vxddqm)
125 main.add_module(vxddqmExpReco)
126
127if (args.DataOutput is True):
128 main.add_module('RootOutput')
129
130
131main.add_module("Progress")
132
133b2.process(main)
134print(b2.statistics)
def add_pxd_simulation(path, digitsName=None, activatePixelMasks=True, activateGainCorrection=True)
Definition: __init__.py:147
def add_pxd_reconstruction(path, clusterName=None, digitsName=None, usePXDClusterShapes=False, spacePointsName='PXDSpacePoints')
Definition: __init__.py:105
def add_svd_simulation(path, useConfigFromDB=False, daqMode=2, relativeShift=9)
Definition: __init__.py:244
def add_svd_reconstruction(path, isROIsimulation=False, createRecoDigits=False, applyMasking=False)
Definition: __init__.py:14