Belle II Software  release-08-01-10
run_eclMuMuE_algorithm.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 import sys
13 import glob
14 from ROOT import Belle2
15 
16 # Usage: basf2 run_eclMuMuE_algorithm.py
17 # or bsub -q s -o logfile.txt 'basf2 run_eclMuMuE_algorithm.py "inputfiles*.root"'
18 
19 # Run just the algorithm part of the eclMuMuE calibration, which calibrates the single crystal
20 # energy response using muon pairs. Runs on the output produced by run_eclMuMuE_collector.py.
21 # Standard usage: algo.performFits = True; performs a Novosibirsk fit on specified crystals to
22 # extract the calibration constant.
23 # algo.performFits = False just copies the input histograms into the output file for debugging.
24 
25 # algo.storeConst = 0 fills database payloads ECLCrystalEnergyMuMu or ECLExpMuMuE (if findExpValues=True)
26 # for all crystals with successful fits and writes to localdb
27 # algo.storeConst = 1 fills writes the payloads only if every crystal in specified range is successful
28 # algo.storeConst = -1 do not write to the database
29 
30 # Specified output file contains many diagnostic histograms.
31 
33 fileNames = ['eclMuMuECollectorOutput.root']
34 narg = len(sys.argv)
35 if(narg == 2):
36  fileNames = glob.glob(sys.argv[1])
37 print("input fileNames = ", fileNames)
38 algo.setInputFileNames(fileNames)
39 # barrel is [1153,7776]
40 algo.cellIDLo = 1
41 algo.cellIDHi = 8736
42 algo.minEntries = 150
43 algo.maxIterations = 10
44 algo.tRatioMin = 0.2
45 algo.tRatioMax = 0.25
46 algo.performFits = True
47 algo.findExpValues = False
48 algo.storeConst = 0
49 
50 # Run algorithm after merging all input files, as opposed to one run at a time
51 alg_result = algo.execute()
52 print("result of eclMuMuEAlgorithm was", alg_result)
53 
54 # Commits a successful list of dbobjects to localdb/
55 algo.commit()
Calibrate ecl crystals using muon pair events.