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