Belle II Software  release-08-01-10
run_eclGammaGammaE_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_eclGammaGammaE_algorithm.py
17 # or: bsub -q s -o logfile.txt 'basf2 run_eclGammaGammaE_algorithm.py "inputfiles*.root"'
18 
19 # Run just the algorithm part of the eclGammaGammaE calibration, which calibrates the single crystal
20 # energy response using e+e- --> gamma gamma events. Runs on the output produced by
21 # run_eclGammaGammaE_collector.py.
22 # Standard usage: algo.performFits = True; performs a Novosibirsk fit on specified crystals to
23 # extract the calibration constant.
24 # algo.performFits = False just copies the input histograms into the output file for debugging.
25 
26 # algo.storeConst = 0 fills database payloads ECLCrystalEnergyGammaGamma or ECLExpGammaGammaE
27 # (if findExpValues=True) for all crystals with successful fits and writes to localdb
28 # algo.storeConst = 1 fills writes the payloads only if every crystal in specified range is successful
29 # algo.storeConst = -1 do not write to the database
30 
31 # Specified output file contains many diagnostic histograms.
32 
34 fileNames = ['eclGammaGammaECollectorOutput.root']
35 narg = len(sys.argv)
36 if(narg == 2):
37  fileNames = glob.glob(sys.argv[1])
38 print("input fileNames = ", fileNames)
39 algo.setInputFileNames(fileNames)
40 algo.setOutputName("eclGammaGammaE_algorithm.root")
41 # barrel is [1153,7776]; range clear of cdc walls is [161,8608]
42 algo.setCellIDLo(1)
43 algo.setCellIDHi(8736)
44 algo.setMinEntries(150)
45 algo.setMaxIterations(10)
46 algo.setTRatioMin(0.45)
47 algo.setTRatioMax(0.60)
48 algo.setUpperEdgeThresh(0.02)
49 algo.setPerformFits(True)
50 algo.setFindExpValues(False)
51 algo.setStoreConst(0)
52 
53 
54 # Run algorithm after merging all input files, as opposed to one run at a time
55 alg_result = algo.execute()
56 print("result of eclGammaGammaEAlgorithm was", alg_result)
57 
58 # Commits a successful list of dbobjects to localdb/
59 algo.commit()
Calibrate ecl crystals using gamma pair events.