Skip to content

Commit

Permalink
Merge pull request #620 in B2/basf2 from feature/modify-TDCPV-skim-fo…
Browse files Browse the repository at this point in the history
…r-K_S0-pi0-gamma-rel6 to release/06-00

* commit '2a00fcd4f5a7a53779c32f3e39a97341f058dc5f':
  modified test script to be consistent with the implementation
  recover a mistakenly removed line
  add SkimHighEFF in stdPi0s and modified TDCPV_qqs skim
  add eff60_May2020_nomcmatch in stdPi0s
  • Loading branch information
GiacomoXT committed Jan 14, 2022
2 parents 28b6e57 + 2a00fcd commit 563b94a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 7 deletions.
32 changes: 29 additions & 3 deletions analysis/scripts/stdPi0s.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,28 @@ def stdPi0s(listtype="eff60_May2020", path=None, loadPhotonBeamBackgroundMVA=Fal
stdPi0s('eff50_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
ma.cutAndCopyList('pi0:eff50_May2020', 'pi0:eff50_May2020_nomcmatch', '', True, path)
ma.matchMCTruth('pi0:eff50_May2020', path)
elif 'eff60_May2020' == listtype:
elif 'eff60_May2020_nomcmatch' == listtype:
stdPhotons('pi0eff60_May2020', path, loadPhotonBeamBackgroundMVA)
ma.reconstructDecay('pi0:eff60_May2020 -> gamma:pi0eff60_May2020 gamma:pi0eff60_May2020', '0.03<InvM', 1, True, path)
ma.reconstructDecay(
'pi0:eff60_May2020_nomcmatch -> gamma:pi0eff60_May2020 gamma:pi0eff60_May2020',
'0.03<InvM',
1,
True,
path)
elif 'eff60_May2020' == listtype:
stdPi0s('eff60_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
ma.cutAndCopyList('pi0:eff60_May2020', 'pi0:eff60_May2020_nomcmatch', '', True, path)
ma.matchMCTruth('pi0:eff60_May2020', path)

# skim list(s)
elif listtype == 'skim':
stdPi0s('eff50_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
ma.cutAndCopyList('pi0:skim', 'pi0:eff50_May2020_nomcmatch', '', True, path)
kFit('pi0:skim', 0.0, 'mass', path=path)
elif listtype == 'SkimHighEff':
stdPi0s('eff60_May2020_nomcmatch', path, loadPhotonBeamBackgroundMVA)
ma.cutAndCopyList('pi0:SkimHighEff', 'pi0:eff60_May2020_nomcmatch', '', True, path)
kFit('pi0:SkimHighEff', 0.0, 'mass', path=path)

# same lists with, but with mass constraints fits
elif listtype == 'allFit':
Expand Down Expand Up @@ -126,7 +138,7 @@ def stdPi0s(listtype="eff60_May2020", path=None, loadPhotonBeamBackgroundMVA=Fal
else:
raise ValueError(f"\"{listtype}\" is none of the allowed standardized types of pi0 lists!")

# pi0 list for skims (and ONLY for skims)
# pi0 list(s) for skims (and ONLY for skims)


def loadStdSkimPi0(path):
Expand All @@ -141,3 +153,17 @@ def loadStdSkimPi0(path):
"""
stdPi0s('skim', path, loadPhotonBeamBackgroundMVA=False)


def loadStdSkimHighEffPi0(path):
"""
Function to prepare the high-efficiency skim pi0 lists based on eff60_May2020 list.
Warning:
Should only be used by skims.
Parameters:
path (basf2.Path) modules are added to this path
"""
stdPi0s('SkimHighEff', path, loadPhotonBeamBackgroundMVA=False)
36 changes: 34 additions & 2 deletions analysis/tests/test_std_pi0s.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ def test_default_list_works(self):
"""Check that the default list type works."""
stdPi0s_signature = inspect.signature(stdPi0s.stdPi0s)
default_listtype = stdPi0s_signature.parameters["listtype"].default
self._check_list(expected_lists=["pi0" + default_listtype, "pi0" + default_listtype, default_listtype])
self._check_list(
expected_lists=[
"pi0" +
default_listtype,
"pi0" +
default_listtype,
default_listtype +
"_nomcmatch",
default_listtype])

def test_all_list(self):
"""check that the builder function works with the all list"""
Expand Down Expand Up @@ -111,9 +119,22 @@ def test_eff50_May2020_list(self):
"eff50_May2020_nomcmatch",
"eff50_May2020"])

def test_eff60_May2020_nomcmatch_list(self):
"""check that the builder function works with the eff50_May2020_nomcmatch list"""
self._check_list("eff60_May2020_nomcmatch",
expected_lists=["pi0eff60_May2020",
"pi0eff60_May2020",
"eff60_May2020_nomcmatch"])

def test_eff60_May2020_list(self):
"""check that the builder function works with the eff60_May2020 list"""
self._check_list("eff60_May2020", expected_lists=["pi0eff60_May2020", "pi0eff60_May2020", "eff60_May2020"])
self._check_list(
"eff60_May2020",
expected_lists=[
"pi0eff60_May2020",
"pi0eff60_May2020",
"eff60_May2020_nomcmatch",
"eff60_May2020"])

def test_allfit_list(self):
"""check that the builder function works with the allFit list"""
Expand Down Expand Up @@ -177,6 +198,7 @@ def test_eff60_May2020fit_list(self):
expected_lists=[
"pi0eff60_May2020",
"pi0eff60_May2020",
'eff60_May2020_nomcmatch',
"eff60_May2020",
"eff60_May2020Fit"])

Expand All @@ -190,6 +212,16 @@ def test_skim(self):
"eff50_May2020_nomcmatch",
"skim"])

def test_SkimHighEff(self):
"""check that the builder function works with the skim list"""
self._check_list(
std_function=stdPi0s.loadStdSkimHighEffPi0,
expected_lists=[
"pi0eff60_May2020",
"pi0eff60_May2020",
"eff60_May2020_nomcmatch",
"SkimHighEff"])


if __name__ == '__main__':
unittest.main()
9 changes: 7 additions & 2 deletions skim/scripts/skim/WGs/tdcpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from skim import BaseSkim, fancy_skim_header
from stdCharged import stdE, stdK, stdMu, stdPi
from stdPhotons import stdPhotons
from stdPi0s import loadStdSkimPi0, stdPi0s
from stdPi0s import loadStdSkimPi0, stdPi0s, loadStdSkimHighEffPi0
from stdV0s import stdKshorts
from variables import variables as vm
from stdKlongs import stdKlongs
Expand Down Expand Up @@ -73,6 +73,7 @@ class TDCPV_qqs(BaseSkim):
* ``eta:SkimHighEff``
* ``pi0:eff40_May2020``
* ``pi0:skim``
* ``pi0:SkimHighEff``
* ``rho0:SkimHighEff``
* ``omega:SkimHighEff``
* ``f_0:SkimHighEff``
Expand All @@ -81,7 +82,8 @@ class TDCPV_qqs(BaseSkim):
* ``omega:SkimHighEff``
* ``K*0:SkimHighEff``
* ``gamma:E15 , cut : 1.4 < E < 4``
* ``k_S0:merged``
* ``gamma:ECMS16 , cut : 1.6 < useCMSFrame(E)``
* ``K_S0:merged``
* ``K+:1%``
**Cuts used**:
Expand All @@ -108,6 +110,7 @@ def load_standard_lists(self, path):
loadStdSkimHighEffTracks('pi', path=path)
loadStdSkimHighEffTracks('K', path=path)
loadStdSkimPi0(path=path)
loadStdSkimHighEffPi0(path=path)
stdKshorts(path=path)
stdPi0s("eff40_May2020", path=path, loadPhotonBeamBackgroundMVA=False)

Expand All @@ -121,6 +124,7 @@ def load_standard_lists(self, path):

def additional_setup(self, path):
ma.cutAndCopyList('gamma:E15', 'gamma:all', '1.4<E<4', path=path)
ma.cutAndCopyList('gamma:ECMS16', 'gamma:all', '1.6<useCMSFrame(E)', path=path)

def build_lists(self, path):
vm.addAlias('E_ECL_pi_TDCPV', 'totalECLEnergyOfParticlesInList(pi+:TDCPV_eventshape)')
Expand All @@ -145,6 +149,7 @@ def build_lists(self, path):
'pi+:SkimHighEff pi-:SkimHighEff K_S0:merged',
'pi+:SkimHighEff pi-:SkimHighEff K_S0:merged gamma:E15',
'pi0:skim K_S0:merged gamma:E15',
'pi0:SkimHighEff K_S0:merged gamma:ECMS16',
]

bu_qqs_Channels = [
Expand Down

0 comments on commit 563b94a

Please sign in to comment.