Belle II Software development
run_eclMuMuE_collector.py
1#!/usr/bin/env python3
2
3
10
11# Usage: basf2 run_eclMuMuE_collector.py
12# option: basf2 run_eclMuMuE_collector.py OutputFileName.root
13
14# Run just the collector part of the eclMuMuE calibration, which calibrates the single crystal
15# energy response using muon pairs.
16# Input file should be a muon pair skim (or MC) and include ECLDigits and tracks.
17# Also requires ECLCalDigits if code is being used to find expected deposited energies.
18# Output histograms are written to specified output file.
19# run_eclMuMuE_algorithm.py is then used to perform calibration using these histograms, or to simply copy
20# them to an output file.
21
22import sys
23import basf2 as b2
24
25
26main = b2.create_path()
27DR2 = '/ghi/fs01/belle2/bdata/users/karim/MC/DR2/release-00-09-02/mdst_calib/*.root'
28main.add_module('RootInput', inputFileNames=[DR2])
29
30narg = len(sys.argv)
31outputName = "eclMuMuECollectorOutput.root"
32if(narg >= 2):
33 outputName = sys.argv[1]
34main.add_module("HistoManager", histoFileName=outputName)
35
36# Genfit and track extrapolation
37gearbox = b2.register_module('Gearbox')
38main.add_module(gearbox)
39geometry = b2.register_module('Geometry')
40main.add_module(geometry)
41main.add_module("SetupGenfitExtrapolation")
42ext = b2.register_module('Ext')
43
44# extrapolate using muon hypothesis only
45pdgcodes = [13]
46ext.param('pdgCodes', pdgcodes)
47
48main.add_module(ext)
49
50eclMuMuE = b2.register_module('eclMuMuECollector')
51eclMuMuE.param('minPairMass', 9.0)
52eclMuMuE.param('minTrackLength', 30.)
53eclMuMuE.param('MaxNeighbourE', 0.010)
54eclMuMuE.param('thetaLabMinDeg', 17.)
55eclMuMuE.param('thetaLabMaxDeg', 150.)
56# Can fill histograms with MC eclCalDigits to calculate true deposited energy
57eclMuMuE.param('measureTrueEnergy', False)
58eclMuMuE.param('requireL1', True)
59main.add_module(eclMuMuE)
60
61main.add_module('Progress')
62
63b2.set_log_level(b2.LogLevel.INFO)
64
65# It is possible to force the job to use the specified global tag.
66# Default localdb is the subdirectory of current working directory, but can be overwritten
67b2.reset_database()
68b2.use_database_chain()
69b2.use_central_database("development")
70b2.use_local_database("localdb/database.txt")
71
72b2.process(main)
73
74print(b2.statistics)