Skip to content
Snippets Groups Projects
Commit acbe7b2f authored by amathad's avatar amathad
Browse files

remove process from truth matching and use get_str

parent 856dcbf9
No related branches found
No related tags found
1 merge request!731Make "process" a required input and configure pyconf functions globally once with user input
This commit is part of merge request !731. Comments created here will be created in the context of that merge request.
......@@ -15,13 +15,12 @@ from PyConf.Algorithms import MCTruthAndBkgCatAlg
from PyConf.Tools import DaVinciSmartAssociator, MCMatchObjP2MCRelator, ParticleDescendants
from PyConf.Tools import BackgroundCategory, BackgroundCategoryViaRelations
from PyConf.Tools import P2MCPFromProtoP
from PyConf.reading import get_pp2mcp_relations, get_mc_particles, get_charged_protoparticles, get_neutral_protoparticles
from PyConf.reading import get_pp2mcp_relations, get_mc_particles, get_charged_protoparticles, get_neutral_protoparticles, get_stream
from PyConf.location_prefix import prefix
def configured_MCTruthAndBkgCatAlg(
inputs,
process,
relations_locs=["Relations/ChargedPP2MCP", "Relations/NeutralPP2MCP"],
root_in_tes=None,
redo_neutral_assoc=False,
......@@ -45,9 +44,8 @@ def configured_MCTruthAndBkgCatAlg(
inputs (DataHandle): Output of `Gaudi::Hive::FetchDataFromFile` (the input TES location to the particles).
relations_locs (list, optional): TES locations to the pre-existing relations for charged and neutral particles.
Defaults to ["Relations/ChargedPP2MCP", "Relations/NeutralPP2MCP"].
process (str, optional): Specifies the output being processed i.e. 'Hlt2' or 'Spruce'. Default is 'Spruce'.
root_in_tes (str, optional): RootInTES location that can be different for streamed output. Defaults is None.
If not 'None' then the 'process' argument is completely ignored.
If not 'None' then it is inferred from the 'process' option in yaml file.
redo_neutral_assoc (bool, optional): Whether or not to redo MC association of pure neutral calorimetric basic particle,
i.e. gamma and pi0-merged with pi0-resolved treated as composite.
Defaults to False.
......@@ -59,26 +57,19 @@ def configured_MCTruthAndBkgCatAlg(
"""
if not root_in_tes:
if process == 'Spruce':
root_in_tes = '/Event/Spruce/HLT2'
elif process == 'Hlt2' or process == 'Turbo':
root_in_tes = '/Event/HLT2'
else:
raise ValueError(
f"The specified 'process' {process} is not recognised. Can only be 'Hlt2' or 'Spruce' or 'Turbo'. Please check!"
)
root_in_tes = get_stream()
# No algorithm is asking for mc particles and proto particles explicitely
# But pp2mcp relation unpacker needs them, so give them as extra_inputs
extra_inputs = []
extra_inputs += [get_charged_protoparticles(process)]
extra_inputs += [get_neutral_protoparticles(process)]
extra_inputs += [get_charged_protoparticles()]
extra_inputs += [get_neutral_protoparticles()]
mc_loc = root_in_tes + "/MC/Particles"
extra_inputs += [get_mc_particles(mc_loc)]
relations = [
get_pp2mcp_relations(prefix(rel, root_in_tes), process, extra_inputs)
get_pp2mcp_relations(prefix(rel, root_in_tes), extra_inputs)
for rel in relations_locs
]
......
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