Belle II Software  release-05-01-25
run_eclMuMuE_collector.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # -----------------------------------------------------------
5 # BASF2 (Belle Analysis Framework 2)
6 # Copyright(C) 2017 Belle II Collaboration
7 #
8 # Author: The Belle II Collaboration
9 # Contributors: Christopher Hearty
10 #
11 # This software is provided "as is" without any warranty.
12 # -----------------------------------------------------------
13 
14 # Usage: basf2 run_eclMuMuE_collector.py
15 # option: basf2 run_eclMuMuE_collector.py OutputFileName.root
16 
17 # Run just the collector part of the eclMuMuE calibration, which calibrates the single crystal
18 # energy response using muon pairs.
19 # Input file should be a muon pair skim (or MC) and include ECLDigits and tracks.
20 # Also requires ECLCalDigits if code is being used to find expected deposited energies.
21 # Output histograms are written to specified output file.
22 # run_eclMuMuE_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-00-09-02/mdst_calib/*.root'
33 main.add_module('RootInput', inputFileNames=[DR2])
34 
35 narg = len(sys.argv)
36 outputName = "eclMuMuECollectorOutput.root"
37 if(narg >= 2):
38  outputName = sys.argv[1]
39 main.add_module("HistoManager", histoFileName=outputName)
40 
41 # Genfit and track extrapolation
42 gearbox = register_module('Gearbox')
43 main.add_module(gearbox)
44 geometry = register_module('Geometry')
45 main.add_module(geometry)
46 main.add_module("SetupGenfitExtrapolation")
47 ext = register_module('Ext')
48 
49 # extrapolate using muon hypothesis only
50 pdgcodes = [13]
51 ext.param('pdgCodes', pdgcodes)
52 
53 main.add_module(ext)
54 
55 eclMuMuE = register_module('eclMuMuECollector')
56 eclMuMuE.param('minPairMass', 9.0)
57 eclMuMuE.param('minTrackLength', 30.)
58 eclMuMuE.param('MaxNeighbourE', 0.010)
59 eclMuMuE.param('thetaLabMinDeg', 17.)
60 eclMuMuE.param('thetaLabMaxDeg', 150.)
61 # Can fill histograms with MC eclCalDigits to calculate true deposited energy
62 eclMuMuE.param('measureTrueEnergy', False)
63 eclMuMuE.param('requireL1', True)
64 main.add_module(eclMuMuE)
65 
66 main.add_module('Progress')
67 
68 set_log_level(LogLevel.INFO)
69 
70 # It is possible to force the job to use the specified global tag.
71 # Default localdb is the subdirectory of current working directory, but can be overwritten
72 reset_database()
73 use_database_chain()
74 use_central_database("development")
75 use_local_database("localdb/database.txt")
76 
77 process(main)
78 
79 print(statistics)