Skip to content
Snippets Groups Projects
Commit 615f265b authored by Tamas Marton Baer's avatar Tamas Marton Baer Committed by Louis D'Eramo
Browse files

Truth parents (Higgs, Top, and Z) for taus

parent 14860864
No related branches found
No related tags found
No related merge requests found
Pipeline #7849987 passed with stages
in 9 minutes and 44 seconds
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def tau_parent_decorator_cfg(
flags,
tau_collection,
name_prefix="",
match_dr=0.2,
):
sm_particles = flags.Analysis.container_names.input.truthSMParticles
# add in leptonic tau decay via a W to tau neutrino and other lepton+nu
tau_decay_pdgIds = [24, 11, 12, 13, 14, 15, 16]
tau_decay_pdgIds_all = [-x for x in tau_decay_pdgIds] + tau_decay_pdgIds
tau_common = dict(
targetContainer=tau_collection,
cascades=[
"TruthBoson",
"TruthBosonsWithDecayParticles",
"TruthTaus",
"TruthMuons",
"TruthElectrons",
"TruthNeutrinos"
],
cascadePdgIds=tau_decay_pdgIds_all,
addBsToCascade=False,
addCsToCascade=False,
vetoSoftLeptonCascade=True,
vetoSoftCharmCascade=True,
matchDeltaR=match_dr,
)
cfg = ComponentAccumulator()
cfg.addEventAlgo(
CompFactory.TruthParentDecoratorAlg(
name=f"{name_prefix}ParentHiggsDecorator",
parents=sm_particles,
decoratorPrefix="parentHiggs",
parentPdgIds=[25],
**tau_common,
)
)
cfg.addEventAlgo(
CompFactory.TruthParentDecoratorAlg(
name=f"{name_prefix}ParentZDecorator",
parents=sm_particles,
decoratorPrefix="parentZ",
parentPdgIds=[23],
**tau_common
)
)
# we want to label any lepton or neutrino coming via a W
top_decay_pdgids = [24, 11, 12, 13, 14, 15, 16]
top_decay_pdgids_all = [-x for x in top_decay_pdgids] + top_decay_pdgids
cfg.addEventAlgo(
CompFactory.TruthParentDecoratorAlg(
name=f"{name_prefix}ParentTopDecorator",
parents="TruthTop",
decoratorPrefix="parentTop",
parentPdgIds=[-6, 6],
cascadePdgIds=top_decay_pdgids_all,
cascades=[
"TruthBoson",
"TruthBosonsWithDecayParticles",
"TruthBottom",
"TruthCharm",
"TruthElectrons",
"TruthForwardProtons",
"TruthHFWithDecayParticles",
"TruthTaus",
],
countChildrenInCascadeWithPdgIds={
"nTopToWChildren": [-24, 24],
},
targetContainer=tau_collection,
matchDeltaR=match_dr
)
)
return cfg
......@@ -2,6 +2,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from EasyjetHub.steering.utils.log_helper import log
from EasyjetHub.algs.truth.jet_parent_decorator_config import jet_parent_decorator_cfg
from EasyjetHub.algs.truth.tau_parent_decorator_config import tau_parent_decorator_cfg
from EasyjetHub.algs.truth_particle_info_config import truth_particle_info_cfg
......@@ -38,6 +39,14 @@ def truth_info_cfg(
match_dr=1.0,
))
if flags.Analysis.do_tau_parent_decoration and not flags.Input.isPHYSLITE:
cfg.merge(tau_parent_decorator_cfg(
flags,
tau_collection=flags.Analysis.container_names.input.taus,
name_prefix="Tau",
match_dr=0.2,
))
log.info("Adding truth particle info seq")
cfg.merge(
truth_particle_info_cfg(flags)
......
from EasyjetHub.output.ttree.branch_manager import BranchManager, SystOption
from EasyjetHub.steering.sample_metadata import get_valid_ami_tag
from EasyjetHub.output.ttree.truth_taus import get_TopHiggs_tau_truth_labels
def get_tau_branches(flags, tree_flags, input_container, output_prefix):
......@@ -54,6 +55,9 @@ def get_tau_branches(flags, tree_flags, input_container, output_prefix):
"truthType"
]
if flags.Input.isMC and tree_flags.collection_options.taus.higgs_parent_info:
tau_branches.variables += get_TopHiggs_tau_truth_labels(flags)
if tree_flags.collection_options.taus.run_selection:
tau_branches.variables += ["isAnalysisTau_%SYS%"]
for index in range(flags.Analysis.Tau.amount):
......
from EasyjetHub.output.ttree.branch_manager import BranchManager
def get_TopHiggs_tau_truth_labels(flags):
truth_labels = []
if not flags.Input.isPHYSLITE:
truth_labels += [
*[f"parent{p}ParentsMask" for p in ["Higgs", "Z", "Top"]],
]
return truth_labels
def get_truthtau_branches(flags, input_container, output_prefix):
truthtau_branches = BranchManager(
input_container,
......
......@@ -34,6 +34,7 @@ collection_options:
taus:
score_branches: false
truth_branches: false
higgs_parent_info: false
run_selection: false
photons:
......
......@@ -12,6 +12,7 @@ do_muons: false
do_electrons: false
do_photons: false
do_taus: false
do_tau_parent_decoration: false
do_met: false
do_mmc: false
save_HF_classification: false
......
......@@ -20,6 +20,7 @@ do_small_R_jets: true
do_muons: true
do_electrons: true
do_taus: true
do_tau_parent_decoration: true
do_met : true
do_mmc : true
......
......@@ -19,6 +19,7 @@ ttree_output:
run_selection: true
taus:
truth_branches: True
higgs_parent_info: true
run_selection: true
electrons:
run_selection: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment