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