Belle II Software  release-05-02-19
Run_study_phase1.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 import os
4 import sys
5 import datetime
6 from basf2 import *
7 from subprocess import call
8 
9 d = datetime.datetime.today()
10 print((d.strftime('job start: %Y-%m-%d %H:%M:%S\n')))
11 
12 # parse input
13 location = ""
14 
15 # input file path
16 inputs = str(sys.argv[1]) + "/" + str(sys.argv[2]) + "_" + str(sys.argv[3]) + "*.root"
17 print(inputs)
18 # output file path
19 outfile = str(sys.argv[4]) + "/" + str(sys.argv[2]) + "_" + str(sys.argv[3]) + ".root"
20 print(outfile)
21 
22 # Set the global log level
23 set_log_level(LogLevel.WARNING)
24 seed = str(sys.argv[5])
25 print('seed: ', seed)
26 set_random_seed(int(seed))
27 
28 ethres = str(sys.argv[6])
29 print('thres: ', ethres)
30 erange = str(sys.argv[7])
31 print('range: ', erange)
32 sampletime = str(sys.argv[8])
33 print('sample time: ', sampletime)
34 
35 # Input
36 simpleinput = register_module('RootInput')
37 simpleinput.param('inputFileNames', inputs)
38 
39 # Output
40 histo = register_module("HistoManager") # Histogram Manager
41 histo.param('histoFileName', outfile)
42 
43 # suppress info messages during processing:
44 # set_log_level(LogLevel.WARNING)
45 
46 # Gearbox
47 gearbox = register_module('Gearbox')
48 gearbox.param('fileName', '/geometry/Beast2_phase1.xml')
49 
50 detector = register_module('QcsmonitorStudy')
51 detector.param('Ethres', double(ethres))
52 detector.param('Erange', double(erange))
53 detector.param('SampleTime', double(sampletime))
54 
55 # Show progress of processing
56 progress = register_module('Progress')
57 
58 # Register necessary modules
59 main = create_path()
60 main.add_module(simpleinput)
61 main.add_module(gearbox)
62 main.add_module(detector)
63 main.add_module(histo)
64 main.add_module(progress)
65 
66 process(main)
67 
68 print('Event Statistics:')
69 print(statistics)
70 
71 d = datetime.datetime.today()
72 print(d.strftime('job finish: %Y-%m-%d %H:%M:%S\n'))
display.CDCDisplayRun.create_path
def create_path(self)
Definition: display.py:143