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