100 def test_kshort_signals(self):
101 """check the number of signals in K_S0:merged and K_S0:scaled lists"""
102
103 main = create_path()
104
106 ma.inputMdst(inputfile, path=main)
107
110
111 ma.matchMCTruth('K_S0:merged', path=main)
112 ma.matchMCTruth('K_S0:scaled', path=main)
113
114 testFile = tempfile.NamedTemporaryFile()
115 ma.variablesToNtuple('K_S0:merged', ['isSignal', 'M'], filename=testFile.name, treename='merged', path=main)
116 ma.variablesToNtuple('K_S0:scaled', ['isSignal', 'M'], filename=testFile.name, treename='scaled', path=main)
117
118 process(main)
119
120 ntuplefile = TFile(testFile.name)
121 ntuple_merged = ntuplefile.Get('merged')
122 ntuple_scaled = ntuplefile.Get('scaled')
123
124 allSig_merged = ntuple_merged.GetEntries("isSignal == 1")
125 allSig_scaled = ntuple_scaled.GetEntries("isSignal == 1")
126
127 print(f"Number of signal K_S0:merged: {allSig_merged}")
128 print(f"Number of signal K_S0:scaled: {allSig_scaled}")
129
130 self.assertTrue(allSig_merged > 999, "Number of signal K_S0:merged is too small.")
131 self.assertTrue(allSig_scaled > 1000, "Number of signal K_S0:scaled is too small.")
132
133 tightMSig_merged = ntuple_merged.GetEntries("isSignal == 1 && M > 0.48 && M < 0.52")
134 tightMSig_scaled = ntuple_scaled.GetEntries("isSignal == 1 && M > 0.48 && M < 0.52")
135
136 print(f"Number of signal K_S0:merged with 0.48<M<0.52: {tightMSig_merged}")
137 print(f"Number of signal K_S0:scaled with 0.48<M<0.52: {tightMSig_scaled}")
138
139 self.assertTrue(tightMSig_merged > 962, "Number of signal K_S0:merged with 0.48<M<0.52 is too small.")
140 self.assertTrue(tightMSig_scaled > 962, "Number of signal K_S0:scaled with 0.48<M<0.52 is too small.")
141
142 print("Test passed, cleaning up.")
143
144
def require_file(filename, data_type="", py_case=None)
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)
def scaleErrorKshorts(prioritiseV0=True, fitter='TreeFit', scaleFactors_V0=[1.125927, 1.058803, 1.205928, 1.066734, 1.047513], scaleFactorsNoPXD_V0=[1.125927, 1.058803, 1.205928, 1.066734, 1.047513], d0Resolution_V0=[0.001174, 0.000779], z0Resolution_V0=[0.001350, 0.000583], d0MomThr_V0=0.500000, z0MomThr_V0=0.00000, scaleFactors_RD=[1.149631, 1.085547, 1.151704, 1.096434, 1.086659], scaleFactorsNoPXD_RD=[1.149631, 1.085547, 1.151704, 1.096434, 1.086659], d0Resolution_RD=[0.00115328, 0.00134704], z0Resolution_RD=[0.00124327, 0.0013272], d0MomThr_RD=0.500000, z0MomThr_RD=0.500000, path=None)