Skip to content
Snippets Groups Projects

Add explicit data dependency declarations for the targets of MC hit/particle linkers when reading linkers from file

Merged Gerhard Raven requested to merge add-linker-dependencies into master
All threads resolved!
1 file
+ 47
37
Compare changes
  • Side-by-side
  • Inline
@@ -50,26 +50,23 @@ from PyConf.Tools import (
ChargedProtoParticleAddCaloHypos, ChargedProtoParticleAddCombineDLLs)
def _unpacker(forced_type, packed_loc, unpacked_loc, **kwargs):
"""Return unpacker that reads from file and unpacks to a forced output location."""
assert 'name' not in kwargs
_unpack_configurable = {
'LHCb::PackedRecVertices': UnpackRecVertex,
'LHCb::PackedCaloHypos': UnpackCaloHypo,
'LHCb::PackedMuonPID': UnpackMuonPIDs,
'LHCb::PackedRichPID': UnpackRichPIDs,
'LHCb::PackedTracks': UnpackTrack,
'LHCb::PackedProtoParticles': UnpackProtoParticle,
'LHCb::PackedMCParticles': UnpackMCParticle,
'LHCb::PackedMCVertices': UnpackMCVertex,
'LHCb::PackedMCHit': UnpackMCHit,
'LHCb::PackedMCCaloHits': UnpackMCCaloHit,
'LHCb::PackedMCRichHits': MCRichHitUnpacker,
'LHCb::PackedMCRichDigitSummarys': MCRichDigitSummaryUnpacker,
}
'LHCb::PackedRecVertices': UnpackRecVertex,
'LHCb::PackedCaloHypos': UnpackCaloHypo,
'LHCb::PackedMuonPID': UnpackMuonPIDs,
'LHCb::PackedRichPID': UnpackRichPIDs,
'LHCb::PackedTracks': UnpackTrack,
'LHCb::PackedProtoParticles': UnpackProtoParticle,
'LHCb::PackedMCParticles': UnpackMCParticle,
'LHCb::PackedMCVertices': UnpackMCVertex,
'LHCb::PackedMCHit': UnpackMCHit,
'LHCb::PackedMCCaloHits': UnpackMCCaloHit,
'LHCb::PackedMCRichHits': MCRichHitUnpacker,
'LHCb::PackedMCRichDigitSummarys': MCRichDigitSummaryUnpacker,
}
return Algorithm(
_unpack_configurable[forced_type],
name=f"Unpack_{unpacked_loc.replace('/','_')}",
@@ -83,16 +80,21 @@ def reco_unpackers():
# for each key, specify both the location in the TES and the type that is
# expected to be made available by reading it from a file
_packed_reco_from_file = {
'PVs': ('LHCb::PackedRecVertices', '/Event/pRec/Vertex/Primary'),
'CaloElectrons': ('LHCb::PackedCaloHypos', '/Event/pRec/Calo/Electrons'),
'CaloPhotons': ('LHCb::PackedCaloHypos', '/Event/pRec/Calo/Photons'),
'CaloMergedPi0s': ('LHCb::PackedCaloHypos', '/Event/pRec/Calo/MergedPi0s'),
'CaloSplitPhotons': ('LHCb::PackedCaloHypos', '/Event/pRec/Calo/SplitPhotons'),
'MuonPIDs': ('LHCb::PackedMuonPID', '/Event/pRec/Muon/MuonPID'),
'RichPIDs': ('LHCb::PackedRichPID', '/Event/pRec/Rich/PIDs'),
'Tracks': ('LHCb::PackedTracks', '/Event/pRec/Track/Best'),
'NeutralProtos': ('LHCb::PackedProtoParticles', '/Event/pRec/ProtoP/Neutrals'),
'ChargedProtos': ('LHCb::PackedProtoParticles', '/Event/pRec/ProtoP/Charged')
'PVs': ('LHCb::PackedRecVertices', '/Event/pRec/Vertex/Primary'),
'CaloElectrons': ('LHCb::PackedCaloHypos',
'/Event/pRec/Calo/Electrons'),
'CaloPhotons': ('LHCb::PackedCaloHypos', '/Event/pRec/Calo/Photons'),
'CaloMergedPi0s': ('LHCb::PackedCaloHypos',
'/Event/pRec/Calo/MergedPi0s'),
'CaloSplitPhotons': ('LHCb::PackedCaloHypos',
'/Event/pRec/Calo/SplitPhotons'),
'MuonPIDs': ('LHCb::PackedMuonPID', '/Event/pRec/Muon/MuonPID'),
'RichPIDs': ('LHCb::PackedRichPID', '/Event/pRec/Rich/PIDs'),
'Tracks': ('LHCb::PackedTracks', '/Event/pRec/Track/Best'),
'NeutralProtos': ('LHCb::PackedProtoParticles',
'/Event/pRec/ProtoP/Neutrals'),
'ChargedProtos': ('LHCb::PackedProtoParticles',
'/Event/pRec/ProtoP/Charged')
}
def _reco_unpacker(key, **kwargs):
@@ -102,7 +104,8 @@ def reco_unpackers():
# The SmartRefs held by the unpacked MC objects only work if we unpack to these specific locations
unpacked_location = packed_location.replace('/pRec', '/Rec').replace(
'/pHLT2', '/HLT2')
return _unpacker(packed_type, packed_location, unpacked_location, **kwargs)
return _unpacker(packed_type, packed_location, unpacked_location,
**kwargs)
muonPIDs = _reco_unpacker('MuonPIDs')
richPIDs = _reco_unpacker('RichPIDs', OutputLevel=ERROR)
@@ -149,7 +152,8 @@ def mc_unpackers():
'MCEcalHits': ('LHCb::PackedMCCaloHits', '/Event/pSim/Ecal/Hits'),
'MCHcalHits': ('LHCb::PackedMCCaloHits', '/Event/pSim/Hcal/Hits'),
'MCMuonHits': ('LHCb::PackedMCHit', '/Event/pSim/Muon/Hits'),
'MCRichDigitSummaries': ('LHCb::PackedMCRichDigitSummarys', '/Event/pSim/Rich/DigitSummaries'),
'MCRichDigitSummaries': ('LHCb::PackedMCRichDigitSummarys',
'/Event/pSim/Rich/DigitSummaries'),
}
def _mc_unpacker(key, **kwargs):
@@ -159,14 +163,17 @@ def mc_unpackers():
# The SmartRefs held by the unpacked MC objects only work if we unpack to these specific locations
unpacked_location = packed_location.replace('/pSim', '/MC').replace(
'/MC/MC', '/MC/')
return _unpacker(packed_type, packed_location, unpacked_location, **kwargs)
return _unpacker(packed_type, packed_location, unpacked_location,
**kwargs)
# Ordered so that dependents are unpacked first
# Make sure that MC particles and MC vertices are unpacked together,
# see https://gitlab.cern.ch/lhcb/LHCb/issues/57 for details.
mc_vertices = _mc_unpacker('MCVertices')
return collections.OrderedDict([
('MCRichDigitSummaries', _mc_unpacker('MCRichDigitSummaries')),
('MCParticles', _mc_unpacker('MCParticles', ExtraInputs=[mc_vertices])),
('MCParticles', _mc_unpacker('MCParticles',
ExtraInputs=[mc_vertices])),
('MCVertices', mc_vertices),
('MCVPHits', _mc_unpacker('MCVPHits')),
('MCUTHits', _mc_unpacker('MCUTHits')),
@@ -194,7 +201,7 @@ def boole_links_digits_mcparticles():
mc_particles = mc_unpackers()['MCParticles']
return {
key: make_data_with_FetchDataFromFile(
loc, force_type='LHCb::LinksByKey',ExtraInputs=[mc_particles])
loc, force_type='LHCb::LinksByKey', ExtraInputs=[mc_particles])
for key, loc in locations.items()
}
@@ -205,15 +212,18 @@ def boole_links_digits_mchits():
These locations are only propagated out of Boole for eXtendend DIGI and DST types.
"""
locations_and_dep = {
"FTLiteClusters": ("/Event/Link/Raw/FT/LiteClusters2MCHits",'MCFTHits'),
"UTClusters": ("/Event/Link/Raw/UT/Clusters2MCHits",'MCUTHits'),
"UTDigits": ("/Event/Link/Raw/UT/TightDigits2MCHits",'MCUTHits'),
"VPDigits": ("/Event/Link/Raw/VP/Digits2MCHits",'MCVPHits')
"FTLiteClusters": ("/Event/Link/Raw/FT/LiteClusters2MCHits",
'MCFTHits'),
"UTClusters": ("/Event/Link/Raw/UT/Clusters2MCHits", 'MCUTHits'),
"UTDigits": ("/Event/Link/Raw/UT/TightDigits2MCHits", 'MCUTHits'),
"VPDigits": ("/Event/Link/Raw/VP/Digits2MCHits", 'MCVPHits')
}
return {
key: make_data_with_FetchDataFromFile(
loc, force_type='LHCb::LinksByKey',ExtraInputs=[mc_unpackers()[dep]])
for key, (loc,dep) in locations_and_dep.items()
loc,
force_type='LHCb::LinksByKey',
ExtraInputs=[mc_unpackers()[dep]])
for key, (loc, dep) in locations_and_dep.items()
}
Loading