Belle II Software  release-05-01-25
run_eclGammaGammaE_algorithm.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # -----------------------------------------------------------
5 # BASF2 (Belle Analysis Framework 2)
6 # Copyright(C) 2017 Belle II Collaboration
7 #
8 # Author: The Belle II Collaboration
9 # Contributors: Christopher Hearty
10 #
11 # This software is provided "as is" without any warranty.
12 # -----------------------------------------------------------
13 
14 import os
15 import sys
16 import glob
17 from basf2 import *
18 import ROOT
19 from ROOT import Belle2
20 
21 # Usage: basf2 run_eclGammaGammaE_algorithm.py
22 # or: bsub -q s -o logfile.txt 'basf2 run_eclGammaGammaE_algorithm.py "inputfiles*.root"'
23 
24 # Run just the algorithm part of the eclGammaGammaE calibration, which calibrates the single crystal
25 # energy response using e+e- --> gamma gamma events. Runs on the output produced by
26 # run_eclGammaGammaE_collector.py.
27 # Standard usage: algo.performFits = True; performs a Novosibirsk fit on specified crystals to
28 # extract the calibration constant.
29 # algo.performFits = False just copies the input histograms into the output file for debugging.
30 
31 # algo.storeConst = 0 fills database payloads ECLCrystalEnergyGammaGamma or ECLExpGammaGammaE
32 # (if findExpValues=True) for all crystals with successful fits and writes to localdb
33 # algo.storeConst = 1 fills writes the payloads only if every crystal in specified range is successful
34 # algo.storeConst = -1 do not write to the database
35 
36 # Specified output file contains many diagnostic histograms.
37 
39 fileNames = ['eclGammaGammaECollectorOutput.root']
40 narg = len(sys.argv)
41 if(narg == 2):
42  fileNames = glob.glob(sys.argv[1])
43 print("input fileNames = ", fileNames)
44 algo.setInputFileNames(fileNames)
45 algo.setOutputName("eclGammaGammaE_algorithm.root")
46 # barrel is [1153,7776]; range clear of cdc walls is [161,8608]
47 algo.setCellIDLo(1)
48 algo.setCellIDHi(8736)
49 algo.setMinEntries(150)
50 algo.setMaxIterations(10)
51 algo.setTRatioMin(0.45)
52 algo.setTRatioMax(0.60)
53 algo.setUpperEdgeThresh(0.02)
54 algo.setPerformFits(True)
55 algo.setFindExpValues(False)
56 algo.setStoreConst(0)
57 
58 
59 # Run algorithm after merging all input files, as opposed to one run at a time
60 alg_result = algo.execute()
61 print("result of eclGammaGammaEAlgorithm was", alg_result)
62 
63 # Commits a successful list of dbobjects to localdb/
64 algo.commit()
Belle2::ECL::eclGammaGammaEAlgorithm
Calibrate ecl crystals using gamma pair events.
Definition: eclGammaGammaEAlgorithm.h:39