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