Belle II Software  release-08-01-10
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 
19 import basf2 as b2
20 
21 import sys
22 
23 argvs = sys.argv # get arg
24 argc = len(argvs) # of arg
25 
26 if argc != 2:
27  sys.exit("trgtopUnpacker.py> # of arg is strange.\n 1.rootname\n Exit.")
28 
29 if argc == 2:
30  f_in_root = argvs[1]
31 
32 # set_log_level(LogLevel.ERROR)
33 b2.set_log_level(b2.LogLevel.INFO)
34 
35 b2.use_central_database("online")
36 
37 # input
38 if f_in_root[-6:] == ".sroot":
39  rootfiletype = "sroot"
40  input = b2.register_module('SeqRootInput')
41 if f_in_root[-5:] == ".root":
42  rootfiletype = "root"
43  input = b2.register_module('RootInput')
44 
45 input.param('inputFileName', f_in_root)
46 
47 # unpacker
48 unpacker = 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
55 output = b2.register_module('RootOutput')
56 
57 # Create main path
58 main = b2.create_path()
59 
60 # Add modules to main path
61 main.add_module(input)
62 main.add_module(unpacker)
63 
64 input.param("inputFileName", f_in_root)
65 output.param("outputFileName", "trgtop_test.root")
66 
67 main.add_module(output, branchNames=["TRGTOPUnpackerStores"])
68 
69 # if trgReadoutBoardSearch:
70 # process(main, max_event=100)
71 # el
72 b2.process(main)