Belle II Software development
collector_only.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12
13import sys
14from sys import argv
15# logging.package("calibration").log_level = LogLevel.DEBUG
16# logging.package("calibration").debug_level = 100
17b2.set_log_level(b2.LogLevel.INFO)
18
19if len(argv) == 2:
20 data_dir = argv[1]
21else:
22 print("Usage: basf2 collector_only.py <data directory>")
23 sys.exit(1)
24
25main = b2.create_path()
26main.add_module("RootInput", inputFileNames=[data_dir + "/*.root"])
27# HistoManager must be used right after RootInput
28main.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")
32main.add_module("CaTest", granularity="run")
33# Notice that there is NO RootOutput module required anymore, although you could include it if you wanted
34b2.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)
37print(b2.statistics(b2.statistics.TOTAL))
38print(b2.statistics)