Belle II Software development
run_eclMuMuE.py
1#!/usr/bin/env python3
2
3
10
11# Usage: basf2 run_eclMuMuE.py
12# Energy calibration of (part of) the ecl using muon pairs.
13# Runs within the CAF framework.
14# Calls both collector and algorithm stages of the calibration;
15# run_eclMuMuE_collector.py and run_eclMuMuE_algorithm.py run the two stages as separate jobs for
16# debugging purposes.
17# Input file should be e+e- --> mu+mu- including ecl digits and track extrapolation.
18# Production version (but not this version) should call required reconstruction modules.
19# Primary output is a histogram of calibration constant vs cellID0;
20# output file RootOutput.root contains many additional diagnostic histograms.
21
22import basf2 as b2
23from ROOT import Belle2 # noqa: make the Belle2 namespace available
24from ROOT.Belle2 import eclMuMuEAlgorithm
25from caf.framework import Calibration, CAF
26
27# Specify the input
28import glob
29inputFileNames = glob.glob('/nfs/dust/belle2/user/ferber/data/kkmc_mumu/kkmc-mumu-1485213008/*.root')
30print(inputFileNames)
31b2.set_log_level(b2.LogLevel.INFO)
32
33# The collector module
34eclMuMuE = b2.register_module('eclMuMuECollector')
35eclMuMuE.param('minPairMass', 9.0)
36eclMuMuE.param('minTrackLength', 30.)
37eclMuMuE.param('MaxNeighborAmp', 200.)
38# 3 axial SL = [24,134]; 4 axial SL = [30,126]
39eclMuMuE.param('thetaLabMinDeg', 24.)
40eclMuMuE.param('thetaLabMaxDeg', 134.)
41# Can fill histograms with MC true deposited energy if eclCalDigits have been stored
42eclMuMuE.param('useTrueEnergy', False)
43
44# Set up the modules needed for geometry and track extrapolation by the collector module
45pre_path = b2.create_path()
46gearbox = b2.register_module('Gearbox')
47pre_path.add_module(gearbox)
48geometry = b2.register_module('Geometry')
49pre_path.add_module(geometry)
50pre_path.add_module('SetupGenfitExtrapolation')
51ext = b2.register_module('Ext')
52pdgcodes = [13]
53ext.param('pdgCodes', pdgcodes)
54pre_path.add_module(ext)
55
56# Specify the algorithm. barrel is cells [1152,7775]; barrel plus one endcap ring is [1008,7919]
57algorithm = eclMuMuEAlgorithm()
58algorithm.cellIDLo = 1008
59algorithm.cellIDHi = 7919
60algorithm.minEntries = 150
61algorithm.maxIterations = 10
62algorithm.tRatioMin = 0.2
63algorithm.tRatioMax = 0.25
64algorithm.performFits = True
65
66# Create a single calibration from a collector module name + algorithm + input files
67cal = Calibration(name='eclMuMuECalibration', collector=eclMuMuE, algorithms=algorithm, input_files=inputFileNames)
68cal.pre_collector_path = pre_path
69
70# Create a CAF instance and add the calibration to it.
71cal_fw = CAF()
72cal_fw.add_calibration(cal)
73cal_fw.output_dir = 'fullBG'
74cal_fw.run()