Skip to content
Snippets Groups Projects
Commit b43d1e9c authored by Miroslav Saur's avatar Miroslav Saur
Browse files

Merge branch 'cleanup-mc-cloning' into '2024-patches'

follow changes in Rec!3919

See merge request !3540
parents 96e46284 294f38cf
No related branches found
No related tags found
6 merge requests!4232Run5: rebase, restructure run5 code, add back examples,!3700Synchronize master branch with 2024-patches,!3694Draft: Sprucing line for Dark Higgs to dimuon with T-Tracks,!3689Draft: Enlarging mass windows for B2cc lines,!3668Draft: New Lines for Lb2LcD Decays,!3540follow changes in Rec!3919
Pipeline #7735183 passed with warnings
......@@ -8,7 +8,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
"""Logic for cloning HLT2 line outputs under ``/Event/HLT2(Spruce/)``.
"""Logic for cloning MC information under ``/Event/HLT2(Spruce/)``.
This is largely a port of the Run 2 logic, up until the serialisation of the
packed containers into raw banks.
......@@ -19,6 +19,7 @@ understand more.
"""
from PyConf.Algorithms import CopySignalMCParticles, CopyMCRelationsTargets
from PyConf.Tools import MCParticleCloner
from PyConf.location_prefix import prefix
from PyConf.reading import get_mc_particles
......@@ -35,10 +36,6 @@ def mc_cloners(stream, protoparticle_relations):
2. The MCParticle objects which can be associated to the reconstructed
objects selected by at least one stripping line.
To mimic this behaviour in Tesla, we run almost the same set of
microDST algorithms, using the relations tables Tesla makes to find the
MC particles that have been associated to the reconstruction.
Args:
stream (str): TES root under which objects will be cloned.
protoparticle_relations (list of DataHandle): ProtoParticle-to-MCParticle relations.
......@@ -47,43 +44,30 @@ def mc_cloners(stream, protoparticle_relations):
#
# The reason this is here is to get the targets of the table to be added to /Event/HLT2/MC...
#
# Algorithm to clone the existing relations tables and the MC particles
# and vertices these tables point to from their original location to
# the same location prefixed by /Event/{stream}
# Algorithm to clone the 'to' entries in the relations tables
# from their original location to the same location prefixed by /Event/{stream}
copy_mcp_targets = CopyMCRelationsTargets(
name='Copy_MC_For_' + '__'.join(
i.location.replace('/', '_') for i in protoparticle_relations),
InputLocations=protoparticle_relations,
OutputPrefix=stream)
MCCloner=MCParticleCloner(OutputPrefix=stream))
# Algorithm to clone all MC particles and vertices that are associated
# to the simulated signal process (using LHCb::MCParticle::fromSignal)
if "Spruce" in stream:
MCParticlesLocation = "/Event/HLT2/MC/Particles"
ExtraOutputs = [
prefix(l, stream)
for l in ['HLT2/MC/Particles', 'HLT2/MC/Vertices']
]
mc_location_mapping = {
"/Event/HLT2/MC/Particles": ExtraOutputs[0],
"/Event/HLT2/MC/Vertices": ExtraOutputs[1]
}
else:
MCParticlesLocation = "/Event/MC/Particles"
ExtraOutputs = [
prefix(l, stream) for l in ['MC/Particles', 'MC/Vertices']
]
mc_location_mapping = {
"/Event/MC/Particles": ExtraOutputs[0],
"/Event/MC/Vertices": ExtraOutputs[1]
}
mc_location_mapping = dict(
(l, prefix(l, stream))
for l in (MCParticlesLocation,
MCParticlesLocation.replace("Particles", "Vertices")))
#TODO must add those MC particles which appear in the 'to' side of the protoparticle_relations!!!
# and then remove the need for CopytProtoParticle2MCRelations...
# and then remove the need for CopyMCRelationsTargets...
copy_signal_mcp = CopySignalMCParticles(
# name='Copy_' + MCParticlesLocation.replace('/', '_'),
MCCloner=MCParticleCloner(OutputPrefix=stream),
MCParticlesLocation=get_mc_particles(MCParticlesLocation),
OutputPrefix=stream,
ExtraOutputs=ExtraOutputs)
ExtraOutputs=list(mc_location_mapping.values()))
return ((copy_mcp_targets, copy_signal_mcp), mc_location_mapping)
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