Belle II Software development
trggrl_unpacker.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
19import basf2 as b2
20import os
21from optparse import OptionParser
22from reconstruction import add_cosmics_reconstruction
23home = os.environ['BELLE2_LOCAL_DIR']
24
25parser = OptionParser()
26parser.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')
31parser.add_option('-o', '--output', dest='output', default='trggrl_unpacker.root')
32parser.add_option('-t', '--tracking', dest='tracking', default=0)
33parser.add_option('-g', '--gdl', dest='gdl', default=0)
34(options, args) = parser.parse_args()
35
36runID = str(options.run)
37
38b2.set_log_level(b2.LogLevel.ERROR)
39
40main = b2.create_path()
41
42# input
43input = b2.register_module('RootInput')
44input.param('inputFileName', options.filename)
45
46main.add_module(input)
47
48
49unpacker = b2.register_module('TRGGRLUnpacker')
50main.add_module(unpacker)
51
52
53if int(options.tracking):
54 cdcunpacker = b2.register_module('CDCUnpacker')
55 cdcunpacker.param('xmlMapFileName', "cdc/data/ch_map.dat")
56 cdcunpacker.param('enablePrintOut', False)
57 main.add_module(cdcunpacker)
58 add_cosmics_reconstruction(main, 'CDC', False)
59
60
61if int(options.gdl):
62 trggdlUnpacker = b2.register_module("TRGGDLUnpacker")
63 main.add_module(trggdlUnpacker)
64 trggdlsummary = b2.register_module('TRGGDLSummary')
65 main.add_module(trggdlsummary)
66
67output = b2.register_module('RootOutput')
68output.param("outputFileName", options.output)
69main.add_module(output, branchNames=["TRGGRLUnpackerStore"])
70
71# Process all events
72b2.process(main)