Belle II Software development
trgtopUnpacker.py
1#!/usr/bin/env python
2
3
10
11# -----------------------------------------------------------------------------------
12#
13# TOP L1 trigger Unpacker module
14#
15# usage : %> basf2 trgtopUnpacker.py [input sroot file name]
16#
17# -----------------------------------------------------------------------------------
18
19import basf2 as b2
20
21import sys
22
23argvs = sys.argv # get arg
24argc = len(argvs) # of arg
25
26if argc != 2:
27 sys.exit("trgtopUnpacker.py> # of arg is strange.\n 1.rootname\n Exit.")
28
29if argc == 2:
30 f_in_root = argvs[1]
31
32# set_log_level(LogLevel.ERROR)
33b2.set_log_level(b2.LogLevel.INFO)
34
35b2.use_central_database("online")
36
37# input
38if f_in_root[-6:] == ".sroot":
39 rootfiletype = "sroot"
40 input = b2.register_module('SeqRootInput')
41if f_in_root[-5:] == ".root":
42 rootfiletype = "root"
43 input = b2.register_module('RootInput')
44
45input.param('inputFileName', f_in_root)
46
47# unpacker
48unpacker = b2.register_module('TRGTOPUnpacker')
49# No unpacking. Just print info of trigger readout board
50# included in the data.
51# trgReadoutBoardSearch = False
52# unpacker.param('trgReadoutBoardSearch', trgReadoutBoardSearch)
53
54# output
55output = b2.register_module('RootOutput')
56
57# Create main path
58main = b2.create_path()
59
60# Add modules to main path
61main.add_module(input)
62main.add_module(unpacker)
63
64input.param("inputFileName", f_in_root)
65output.param("outputFileName", "trgtop_test.root")
66
67main.add_module(output, branchNames=["TRGTOPUnpackerStores"])
68
69# if trgReadoutBoardSearch:
70# process(main, max_event=100)
71# el
72b2.process(main)