Belle II Software development
QAMHistMaker.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12import argparse
13import glob
14
15b2.reset_database()
16b2.use_database_chain()
17b2.use_central_database("GT_gen_data_003.04_gcr2017-08", b2.LogLevel.WARNING)
18
19
20def ana(exp=1, run=3118, magneticField=True, prefix='', dest='.'):
21
22 # Seach dst files.
23 # files = glob.glob(prefix + '/output_cosmic.{0:0>4}.{1:0>5}'.format(exp, run) + '*.root')
24 files = glob.glob(prefix + f'/e{exp:0>4}/cosmics/r{run:0>5}/all/dst/sub00/dst.cosmic.{exp:0>4}.{run:0>5}' + '*.root')
25 # files = glob.glob(prefix + 'dst.cosmic.{0:0>4}.{1:0>5}'.format(exp, run) + '*.root')
26 # files = glob.glob(prefix + '/dst_run{0}'.format(run) + '.root')
27
28 # create path
29 main = b2.create_path()
30 # Input (ROOT file).
31 main.add_module('RootInput',
32 inputFileNames=files)
33
34 gearbox = b2.register_module('Gearbox',
35 fileName="/geometry/GCR_Summer2017.xml",
36 override=[
37 ("/Global/length", "8.", "m"),
38 ("/Global/width", "8.", "m"),
39 ("/Global/height", "8.", "m"),
40 ])
41 main.add_module(gearbox)
42 # main.add_module('Geometry')
43 main.add_module('Geometry',
44 excludedComponents=['EKLM'])
45
46 output = "/".join([dest, f'qam.{exp:0>4}.{run:0>5}.root'])
47 main.add_module('CDCCosmicAnalysis',
48 noBFit=not magneticField,
49 Output=output,
50 treeName='treeTrk',
51 phi0InRad=False,
52 qam=True)
53
54 main.add_module('Progress')
55 # process events and print call statistics
56 b2.process(main)
57 print(b2.statistics)
58
59
60if __name__ == "__main__":
61
62 parser = argparse.ArgumentParser()
63
64 parser.add_argument('exp', help='Experimental number')
65 parser.add_argument('run', help='Run number')
66 args = parser.parse_args()
67 ana(exp=args.exp, run=args.run, magneticField=True,
68 # prefix='/ghi/fs01/belle2/bdata/users/karim/data/GCR1/build-2017-08-21',
69 # prefix='/home/belle/muchida/basf2/release/cdc/examples/performance/output',
70 prefix='/hsm/belle2/bdata/Data/release-00-09-01/DB00000266/GCR1/prod00000001',
71 # prefix='/ghi/fs01/belle2/bdata/users/karim/MC/GCR1/release-00-09-02',
72 # prefix='/ghi/fs01/belle2/bdata/users/karim/MC/GCR1/prerelease-00-09-02',
73 # prefix='/ghi/fs01/belle2/bdata/users/karim/data/GCR1/release-00-09-00_new/',
74 # dest='/ghi/fs01/belle2/bdata/group/detector/CDC/qam/GCR1/test'
75 dest='.' # Store current directory.
76 )
Definition: ana.py:1