Belle II Software  release-05-01-25
run_ee5x5_collector_mc.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # -----------------------------------------------------------
5 # BASF2 (Belle Analysis Framework 2)
6 # Copyright(C) 2018 Belle II Collaboration
7 #
8 # Author: The Belle II Collaboration
9 # Contributors: Christopher Hearty hearty@physics.ubc.ca
10 #
11 # This software is provided "as is" without any warranty.
12 # -----------------------------------------------------------
13 
14 # Usage: basf2 -i inputFile run_ee5x5_collector_mc.py
15 # option: basf2 -i inputFile run_ee5x5_collector_mc.py OutputFile.root
16 
17 # Run the collector part of the eclee5x5 calibration, which calibrates the single crystal
18 # energy response using Bhabha events.
19 
20 # This script sets parameters appropriate for mc. Use run_ee5x5_collector_data.py for data
21 
22 # Input file should be cdst file, including ECLDigits, ECLCalDigits, and clusters
23 # Output histograms are written to specified output file.
24 
25 # run_ee5x5_algorithm_XXX.py is then used to find payloads or output merged histograms.
26 
27 import os
28 import sys
29 import basf2 as b2
30 from ROOT import Belle2
31 
32 
33 main = b2.create_path()
34 DR2 = '/ghi/fs01/belle2/bdata/users/karim/MC/DR2/release-02-01-00/eegamma/cdst/eegamma_1.root'
35 main.add_module('RootInput', inputFileNames=[DR2])
36 
37 narg = len(sys.argv)
38 outputName = "ee5x5CollectorOutput_mc.root"
39 if(narg >= 2):
40  outputName = sys.argv[1]
41 main.add_module("HistoManager", histoFileName=outputName)
42 
43 eclee5x5 = b2.register_module('eclee5x5Collector')
44 eclee5x5.param('thetaLabMinDeg', 17.)
45 eclee5x5.param('thetaLabMaxDeg', 150.)
46 eclee5x5.param('minE0', 0.45)
47 eclee5x5.param('minE1', 0.40)
48 eclee5x5.param('maxdThetaSum', 2.)
49 eclee5x5.param('dPhiScale', 1.)
50 eclee5x5.param('maxTime', 10.)
51 # Can fill histograms with eclCalDigits to calculate deposited energy using MC
52 eclee5x5.param('useCalDigits', True)
53 eclee5x5.param('requireL1', False)
54 main.add_module(eclee5x5)
55 
56 main.add_module('Progress')
57 
58 b2.set_log_level(b2.LogLevel.INFO)
59 
60 # Force the job to use the global tag for offline calibration.
61 # Default localdb is the subdirectory of current working directory, but can be overwritten
62 b2.reset_database()
63 b2.use_database_chain()
64 b2.use_central_database("Calibration_Offline_Development")
65 b2.use_local_database("localdb/database.txt")
66 
67 b2.process(main)
68 
69 print(b2.statistics)