Belle II Software  release-08-01-10
collector_only.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 
13 import sys
14 from sys import argv
15 # logging.package("calibration").log_level = LogLevel.DEBUG
16 # logging.package("calibration").debug_level = 100
17 b2.set_log_level(b2.LogLevel.INFO)
18 
19 if len(argv) == 2:
20  data_dir = argv[1]
21 else:
22  print("Usage: basf2 collector_only.py <data directory>")
23  sys.exit(1)
24 
25 main = b2.create_path()
26 main.add_module("RootInput", inputFileNames=[data_dir + "/*.root"])
27 # HistoManager must be used right after RootInput
28 main.add_module('HistoManager', histoFileName="CollectorOutput.root", workDirName=".")
29 # Granularity can be 'run' or 'all'. If it's 'run' the collector objects are separated into different
30 # objects. If it's 'all' then a single object is used for all runs.
31 # main.add_module("CaTest", granularity="all")
32 main.add_module("CaTest", granularity="run")
33 # Notice that there is NO RootOutput module required anymore, although you could include it if you wanted
34 b2.process(main)
35 # The Collector Module memory can look weirdly high with default statistics printing. If you want to view the memory
36 # statistics of a collector use this command, Otherwise just do the normal print(statistics)
37 print(b2.statistics(b2.statistics.TOTAL))
38 print(b2.statistics)