Belle II Software development
RemoveTimingCutsFromSectorMap.py
1#!/usr/bin/env python3
2
3
10
11
19
20import basf2 as b2
21import sys
22
23# file with the sector map
24if(len(sys.argv) <= 1):
25 print("Error: you have to specify the file the SectorMap is stored in!")
26 exit(1)
27sectorMapFile = sys.argv[1]
28
29# this should currently be the only setup used in reconstruction
30setupToRead = "SVDOnlyDefault"
31# the second parameter is interpreted as setup to read
32if(len(sys.argv) > 2):
33 setupToRead = sys.argv[2]
34
35# read the sectormap from file
36SMBSM1 = b2.register_module("SectorMapBootstrap")
37SMBSM1.param("ReadSecMapFromDB", False)
38SMBSM1.param("ReadSectorMap", True)
39SMBSM1.param("SectorMapsInputFile", sectorMapFile)
40SMBSM1.param("SetupToRead", setupToRead)
41
42# assumes it is a root file so replace the last 5 letters
43outputMapFile = sectorMapFile[:-5] + '_timingRemoved.root'
44# the following setting will make the module write the altered sectormap to a root file
45SMBSM1.param("SectorMapsOutputFile", outputMapFile)
46SMBSM1.param("WriteSectorMap", True)
47
48
51
52# NOTE: the indizes in the example below may have changed if the code changed! So you have to cross check!
53
54# three hit filter
55# (#19 <= DistanceInTime <= #20)
56SMBSM1.param('threeHitFilterAdjustFunctions', [(19, "-TMath::Infinity()"), (20, "TMath::Infinity()")])
57# two hit filters:
58# (#12 <= DistanceInTimeUside <= #13)
59# (#10 <= DistanceInTimeVside <= #11)
60SMBSM1.param('twoHitFilterAdjustFunctions', [(12, "-TMath::Infinity()"), (13, "TMath::Infinity()"),
61 (10, "-TMath::Infinity()"), (11, "TMath::Infinity()")])
62
63# this will, in addition to other debbugging output, print the original filter ("BEFORE")
64# and the altered filter ("AFTER") to the screen.
65# NOTE: there are order of 10th of thousends of filters both for 2-hits and 3-hits. So expect lots of output.
66# SMBSM1.logging.log_level = LogLevel.DEBUG
67
68
69# needed else no sectormap from DB can be loaded
70eventinfosetter = b2.register_module('EventInfoSetter')
71
72# create path
73main = b2.create_path()
74main.add_module(eventinfosetter)
75main.add_module(SMBSM1)
76b2.print_path(main)
77# run path
78b2.process(main)
79print(b2.statistics)