Belle II Software  release-08-01-10
TrgEcl.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # -------------------------------------------------------------------------------------------------------
13 # TSim-ecl example code.
14 # -------------------------------------------------------------------------------------------------------
15 # In order to test Tsim-ecl code, you need a root file which has ECLHit table.(after Gsim)
16 # ex)
17 # commend > basf2 TrgEcl.py [Name of Gsim root file] [Name of output root file]
18 # -------------------------------------------------------------------------------------------------------
19 
20 import basf2 as b2
21 from L1trigger import add_trigger_simulation
22 
23 import sys # get argv
24 argvs = sys.argv # get arg
25 argc = len(argvs) # of arg
26 if argc != 3:
27  sys.exit("ztsim02.py> # of arg is strange. Exit.")
28 if argc == 3:
29  f_in_root = argvs[1]
30  f_out_root = argvs[2]
31 # print
32 # print 'f_in_root = %s' % f_in_root
33 # print 'f_out_root = %s\n' % f_out_root
34 
35 
36 
37 b2.set_log_level(b2.LogLevel.ERROR)
38 # set_log_level(LogLevel.INFO)
39 # set_log_level(LogLevel.DEBUG)
40 # use_local_database('./trg_ecl/database.txt')
41 
42 gearbox = b2.register_module('Gearbox')
43 
44 # input
45 rootinput1 = b2.register_module('RootInput')
46 rootinput1.param('inputFileName', f_in_root)
47 
48 
49 # output
50 rootoutput = b2.register_module('RootOutput')
51 rootoutput.param('outputFileName', f_out_root)
52 
53 # import random
54 progress = b2.register_module('Progress')
55 
56 
57 # Create paths
58 main = b2.create_path()
59 
60 main.add_module(rootinput1)
61 
62 main.add_module(progress)
63 main.add_module(gearbox)
64 
65 add_trigger_simulation(main, component=["ECL"])
66 
67 
68 main.add_module(rootoutput, branchNames=["TRGECLTrgs", "TRGECLHits", "TRGECLClusters"])
69 
70 
71 # main
72 b2.process(main)
73 
76 print(b2.statistics)
77 # ===<END>