Belle II Software  release-08-01-10
run_ee5x5_algorithm_crystalEnergy.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_ee5x5_algorithm_crystalEnergy.py "inputfiles*.root"
17 # or: bsub -q s -o logfile.txt 'basf2 run_ee5x5_algorithm_crystalEnergy.py "inputfiles*.root"'
18 
19 # Run just the algorithm part of the eclee5x5 calibration, which calibrates the single crystal
20 # energy response using Bhabha events. Runs on the output produced by the collector stage.
21 
22 # This scripts sets parameters to find payload ECLCrystalEnergy5x5 using data. Other scripts
23 # are available to obtain payloads "ECLExpee5x5E", "ECLeedPhiData", or "ECLeedPhiMC", or to
24 # just merge the input histograms and write them to the specified output file.
25 
26 # algo.setStoreConst = True: store the specified payload, if calculation is successful.
27 # algo.setStoreConst = False: do not write to the database
28 
29 # specified output file includes diagnostic histograms.
30 
32 fileNames = ['eclee5x5CollectorOutput.root']
33 narg = len(sys.argv)
34 if(narg == 2):
35  fileNames = glob.glob(sys.argv[1])
36 print("input fileNames = ", fileNames)
37 algo.setInputFileNames(fileNames)
38 algo.setOutputName("eclee5x5_algorithm_crystalEnergy.root")
39 algo.setMinEntries(150)
40 algo.setPayloadName("ECLCrystalEnergy5x5")
41 algo.setStoreConst(True)
42 
43 
44 # Run algorithm after merging all input files, as opposed to one run at a time
45 alg_result = algo.execute()
46 print("result of eclee5x5Algorithm was", alg_result)
47 
48 # Commits a successful list of dbobjects to localdb/
49 algo.commit()
Calibrate ecl crystals using Bhabha events.