Belle II Software  release-08-01-10
trggdlDST.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # -----------------------------------------------------------------------------------
13 #
14 # GDL trigger DST Module
15 #
16 # usage : %> basf2 trggdlDST.py [input sroot file name]
17 #
18 # -----------------------------------------------------------------------------------
19 
20 import basf2 as b2
21 
22 import sys # get argv
23 argvs = sys.argv # get arg
24 argc = len(argvs) # of arg
25 if argc != 2:
26  sys.exit("trggdlDST.py> # of arg is strange. Exit.")
27 if argc == 2:
28  f_in_root = argvs[1]
29 
30 
31 b2.set_log_level(b2.LogLevel.INFO)
32 
33 main = b2.create_path()
34 
35 # input
36 if f_in_root[-6:] == ".sroot":
37  rootfiletype = "sroot"
38  input = b2.register_module('SeqRootInput')
39 if f_in_root[-5:] == ".root":
40  rootfiletype = "root"
41  input = b2.register_module('RootInput')
42 
43 input.param('inputFileName', f_in_root)
44 main.add_module(input)
45 
46 # Unpacker
47 trggdlUnpacker = b2.register_module("TRGGDLUnpacker")
48 main.add_module(trggdlUnpacker)
49 
50 # Fill DST
51 trggdldst = b2.register_module('TRGGDLDST')
52 main.add_module(trggdldst)
53 
54 output = b2.register_module('RootOutput')
55 output.param("outputFileName", "gdldst.root")
56 main.add_module(output, branchNames=["TRGGDLDST"])
57 
58 progress = b2.register_module('Progress')
59 main.add_module(progress)
60 
61 b2.process(main)
62 
63 print(b2.statistics)