Belle II Software development
run_eclCosmicE_collector.py
1#!/usr/bin/env python3
2
3
10
11# Usage: basf2 -i inputFile.root run_eclCosmicE_collector.py [outputFile.root globaltag]
12
13# Run just the collector part of the eclCosmicE calibration, which calibrates the single crystal
14# energy response using cosmic rays.
15# Input file should be cosmic data in root format, including ecl digits
16
17# Output histograms are written to specified output file.
18# run_eclCosmicE_algorithm.py is then used to perform calibration using these histograms, or to simply copy
19# them to an output file.
20
21import sys
22import basf2 as b2
23from rawdata import add_unpackers
24
25
26# input file
27main = b2.create_path()
28inputfile = '/ghi/fs01/belle2/bdata/Data/Raw/e0007/r01112/sub00/*.root'
29main.add_module('RootInput', inputFileNames=[inputfile])
30
31# output file
32outputName = "eclCosmicECollectorOutput.root"
33narg = len(sys.argv)
34if(narg >= 2):
35 outputName = sys.argv[1]
36main.add_module("HistoManager", histoFileName=outputName)
37
38main.add_module('Progress')
39
40# ECL unpackers
41add_unpackers(main, components='ECL')
42
43b2.set_log_level(b2.LogLevel.INFO)
44
45# CAF collector code
46eclCosmicE = b2.register_module('eclCosmicECollector', logLevel=b2.LogLevel.DEBUG, debugLevel=9)
47eclCosmicE.param('minCrysE', 0.01)
48eclCosmicE.param('mockupL1', False)
49eclCosmicE.param('trigThreshold', 0.1)
50main.add_module(eclCosmicE)
51
52# It is possible to force the job to use the specified global tag.
53# Default localdb is the subdirectory of current working directory
54centralGT = "data_reprocessing_prompt_bucket3b"
55if(narg >= 3):
56 centralGT = sys.argv[2]
57b2.reset_database()
58b2.use_database_chain()
59b2.use_central_database(centralGT)
60b2.use_local_database("localdb/database.txt")
61
62b2.process(main)
63
64print(b2.statistics)