Belle II Software  release-05-01-25
run_eclGammaGammaE_collector.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_eclGammaGammaE_collector.py
15 # option: basf2 -i inputFile run_eclGammaGammaE_collector.py OutputFile.root
16 
17 # Run just the collector part of the eclGammaGammaE calibration, which calibrates the single crystal
18 # energy response using gamma gamma events.
19 # Input file should be a gamma gamma skim (or MC) and include ECLDigits, ECLCalDigits, ECLClusters,
20 # and tracks (to veto Bhabhas).
21 # Output histograms are written to specified output file. Default is eclGammaGammaECollectorOutput.root
22 # run_eclGammaGammaE_algorithm.py is then used to perform calibration using these histograms, or to simply copy
23 # them to an output file.
24 
25 import os
26 import sys
27 from basf2 import *
28 from ROOT import Belle2
29 
30 
31 main = create_path()
32 DR2 = '/ghi/fs01/belle2/bdata/users/karim/MC/DR2/release-01-00-00/gg/mdst/gg_0.root'
33 main.add_module('RootInput', inputFileNames=[DR2])
34 
35 narg = len(sys.argv)
36 outputName = "eclGammaGammaECollectorOutput.root"
37 if(narg >= 2):
38  outputName = sys.argv[1]
39 main.add_module("HistoManager", histoFileName=outputName)
40 
41 eclGammaGammaE = register_module('eclGammaGammaECollector')
42 eclGammaGammaE.param('thetaLabMinDeg', 0.)
43 eclGammaGammaE.param('thetaLabMaxDeg', 180.)
44 eclGammaGammaE.param('minPairMass', 9.)
45 eclGammaGammaE.param('mindPhi', 179.)
46 eclGammaGammaE.param('maxTime', 1.)
47 # Can fill histograms with MC eclCalDigits to calculate true deposited energy
48 eclGammaGammaE.param('measureTrueEnergy', False)
49 eclGammaGammaE.param('requireL1', True)
50 main.add_module(eclGammaGammaE)
51 
52 main.add_module('Progress')
53 
54 set_log_level(LogLevel.INFO)
55 
56 # It is possible to force the job to use the specified global tag.
57 # Default localdb is the subdirectory of current working directory, but can be overwritten
58 reset_database()
59 use_database_chain()
60 use_central_database("development")
61 use_local_database("localdb/database.txt")
62 
63 process(main)
64 
65 print(statistics)