Belle II Software  release-05-02-19
run_eclMuMuE_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_eclMuMuE_algorithm.py
22 # or bsub -q s -o logfile.txt 'basf2 run_eclMuMuE_algorithm.py "inputfiles*.root"'
23 
24 # Run just the algorithm part of the eclMuMuE calibration, which calibrates the single crystal
25 # energy response using muon pairs. Runs on the output produced by run_eclMuMuE_collector.py.
26 # Standard usage: algo.performFits = True; performs a Novosibirsk fit on specified crystals to
27 # extract the calibration constant.
28 # algo.performFits = False just copies the input histograms into the output file for debugging.
29 
30 # algo.storeConst = 0 fills database payloads ECLCrystalEnergyMuMu or ECLExpMuMuE (if findExpValues=True)
31 # for all crystals with successful fits and writes to localdb
32 # algo.storeConst = 1 fills writes the payloads only if every crystal in specified range is successful
33 # algo.storeConst = -1 do not write to the database
34 
35 # Specified output file contains many diagnostic histograms.
36 
38 fileNames = ['eclMuMuECollectorOutput.root']
39 narg = len(sys.argv)
40 if(narg == 2):
41  fileNames = glob.glob(sys.argv[1])
42 print("input fileNames = ", fileNames)
43 algo.setInputFileNames(fileNames)
44 # barrel is [1153,7776]
45 algo.cellIDLo = 1
46 algo.cellIDHi = 8736
47 algo.minEntries = 150
48 algo.maxIterations = 10
49 algo.tRatioMin = 0.2
50 algo.tRatioMax = 0.25
51 algo.performFits = True
52 algo.findExpValues = False
53 algo.storeConst = 0
54 
55 # Run algorithm after merging all input files, as opposed to one run at a time
56 alg_result = algo.execute()
57 print("result of eclMuMuEAlgorithm was", alg_result)
58 
59 # Commits a successful list of dbobjects to localdb/
60 algo.commit()
Belle2::ECL::eclMuMuEAlgorithm
Calibrate ecl crystals using muon pair events.
Definition: eclMuMuEAlgorithm.h:39