Skip to content
Snippets Groups Projects
Commit b587b765 authored by Jiahui Zhuo's avatar Jiahui Zhuo :penguin: Committed by Patrick Koppenburg
Browse files

Fix the relation location in MCReconstructed tool

parent e8d966dc
No related branches found
No related tags found
1 merge request!924Fix the relation location in MCReconstructed tool
......@@ -26,12 +26,13 @@ class MCReconstructed:
Args:
mcparticles_input(DataHandle): MCParticle data handle (TES)
relations_locs (list, optional): TES locations to the pre-existing relations (Particle -> MCParticle)
for charged and neutral particles, default = ["Relations/ChargedPP2MCP", "Relations/NeutralPP2MCP"]
relations_charged (str, DataHandle, optional): TES locations to the pre-existing relations (Particle -> MCParticle)
for charged particles, default = "Relations/ChargedPP2MCP"
relations_neutral (str, DataHandle, optional): TES locations to the pre-existing relations (Particle -> MCParticle)
for neutral particles, default = "Relations/NeutralPP2MCP"
use_best_mcmatch (bool, optional): If False, associates reconstructed track
to all the MCParticles rather than the best matched MCParticle, default = False.
process (str, optional): Process type (Hlt2 or Spruce or Turbo), default = 'Spruce'
root_in_tes (str, optional): Standard Gaudi Algorithm RootInTES location
output_level (int, optional): Standard Gaudi Algorithm OutputLevel
Example:
......@@ -48,34 +49,25 @@ class MCReconstructed:
def __init__(self,
mcparticles_input,
use_best_mcmatch=True,
relations_locs=[
"Relations/ChargedPP2MCP", "Relations/NeutralPP2MCP"
],
relations_charged="Relations/ChargedPP2MCP",
relations_neutral="Relations/NeutralPP2MCP",
process='Spruce',
root_in_tes=None,
output_level=INFO):
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!"
)
if isinstance(relations_locs[0], str):
if root_in_tes:
relations_locs = [
f'{root_in_tes}/{table_loc}'
for table_loc in relations_locs
]
ChargedPP2MCP = force_location(relations_locs[0])
NeutralPP2MCP = force_location(relations_locs[1])
if process == 'Spruce':
root_in_tes = '/Event/Spruce/HLT2'
elif process == 'Hlt2' or process == 'Turbo':
root_in_tes = '/Event/HLT2'
else:
ChargedPP2MCP = relations_locs[0]
NeutralPP2MCP = relations_locs[1]
raise ValueError(
f"The specified 'process' {process} is not recognised. Can only be 'Hlt2' or 'Spruce' or 'Turbo'. Please check!"
)
ChargedPP2MCP = force_location(
f'{root_in_tes}/{relations_charged}') if isinstance(
relations_charged, str) and root_in_tes else relations_charged
NeutralPP2MCP = force_location(
f'{root_in_tes}/{relations_neutral}') if isinstance(
relations_neutral, str) and root_in_tes else relations_neutral
# Save setup
self.use_best_mcmatch = use_best_mcmatch
......
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