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