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