Belle II Software development
run_eclGammaGammaE_algorithm.py
1#!/usr/bin/env python3
2
3
10
11import sys
12import glob
13from ROOT import Belle2
14
15# Usage: basf2 run_eclGammaGammaE_algorithm.py
16# or: bsub -q s -o logfile.txt 'basf2 run_eclGammaGammaE_algorithm.py "inputfiles*.root"'
17
18# Run just the algorithm part of the eclGammaGammaE calibration, which calibrates the single crystal
19# energy response using e+e- --> gamma gamma events. Runs on the output produced by
20# run_eclGammaGammaE_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 ECLCrystalEnergyGammaGamma or ECLExpGammaGammaE
26# (if findExpValues=True) 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
33fileNames = ['eclGammaGammaECollectorOutput.root']
34narg = len(sys.argv)
35if(narg == 2):
36 fileNames = glob.glob(sys.argv[1])
37print("input fileNames = ", fileNames)
38algo.setInputFileNames(fileNames)
39algo.setOutputName("eclGammaGammaE_algorithm.root")
40# barrel is [1153,7776]; range clear of cdc walls is [161,8608]
41algo.setCellIDLo(1)
42algo.setCellIDHi(8736)
43algo.setMinEntries(150)
44algo.setMaxIterations(10)
45algo.setTRatioMin(0.45)
46algo.setTRatioMax(0.60)
47algo.setUpperEdgeThresh(0.02)
48algo.setPerformFits(True)
49algo.setFindExpValues(False)
50algo.setStoreConst(0)
51
52
53# Run algorithm after merging all input files, as opposed to one run at a time
54alg_result = algo.execute()
55print("result of eclGammaGammaEAlgorithm was", alg_result)
56
57# Commits a successful list of dbobjects to localdb/
58algo.commit()
Calibrate ecl crystals using gamma pair events.