Belle II Software  release-08-01-10
trggrl_unpacker_dqm.py
1 #!/usr/bin/env python
2 
3 
10 
11 # -----------------------------------------------------------------------------------
12 #
13 # CDCT3D trigger Unpacker module
14 #
15 # usage : %> basf2 TrgCdcT3dUnpacker.py [input sroot file name]
16 #
17 # -----------------------------------------------------------------------------------
18 
19 import basf2 as b2
20 import os
21 from optparse import OptionParser
22 from reconstruction import add_cosmics_reconstruction
23 home = os.environ['BELLE2_LOCAL_DIR']
24 
25 parser = OptionParser()
26 parser.add_option(
27  '-f',
28  '--file',
29  dest='filename',
30  default='hsm/belle2/bdata/Data/Raw/e0007/r01640/sub00/cosmic.0007.01640.HLT1.f00000.root')
31 parser.add_option('-o', '--output', dest='output', default='trggrl_unpacker.root')
32 parser.add_option('-t', '--tracking', dest='tracking', default=0)
33 parser.add_option('-g', '--gdl', dest='gdl', default=0)
34 (options, args) = parser.parse_args()
35 
36 runID = str(options.run)
37 
38 b2.set_log_level(b2.LogLevel.ERROR)
39 
40 main = b2.create_path()
41 
42 # input
43 input = b2.register_module('RootInput')
44 input.param('inputFileName', options.filename)
45 
46 main.add_module(input)
47 
48 histo = b2.register_module('HistoManager')
49 histo.param('histoFileName', "dqm.root") # File to save histograms
50 main.add_module(histo)
51 
52 unpacker = b2.register_module('TRGGRLUnpacker')
53 main.add_module(unpacker)
54 
55 trggrldqm = b2.register_module('TRGGRLDQM')
56 main.add_module(trggrldqm)
57 
58 
59 if int(options.tracking):
60  cdcunpacker = b2.register_module('CDCUnpacker')
61  cdcunpacker.param('xmlMapFileName', "cdc/data/ch_map.dat")
62  cdcunpacker.param('enablePrintOut', False)
63  main.add_module(cdcunpacker)
64  add_cosmics_reconstruction(main, 'CDC', False)
65 
66 
67 if int(options.gdl):
68  trggdlUnpacker = b2.register_module("TRGGDLUnpacker")
69  main.add_module(trggdlUnpacker)
70  trggdlsummary = b2.register_module('TRGGDLSummary')
71  main.add_module(trggdlsummary)
72 
73 output = b2.register_module('RootOutput')
74 output.param("outputFileName", options.output)
75 main.add_module(output, branchNames=["TRGGRLUnpackerStore"])
76 
77 # Process all events
78 b2.process(main)