Skip to content
Snippets Groups Projects
Commit 876a945e authored by Dylan Remberto Van Arneman's avatar Dylan Remberto Van Arneman
Browse files

Merge branch 'fixAllowTruncation' into '24.0'

Fix bug for allowed truncation collections without Aux

See merge request !71549
parents 783f6cca 1f47da91
No related branches found
No related tags found
2 merge requests!718572024-05-31: merge of 24.0 into main,!71549Fix bug for allowed truncation collections without Aux
......@@ -432,6 +432,7 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill, const
std::vector<uint32_t> buffer;
buffer.reserve(1000);
std::unordered_map<uint16_t, std::vector<uint32_t>> deferredInterfaceBuffer;
for ( const Address& address: m_toSerialise ) {
// Check if we need to serialise this object for this event
std::vector<uint16_t> addressActiveModuleIds;
......@@ -451,14 +452,23 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill, const
ATH_MSG_DEBUG("Streaming of " << address.persTypeName() << " is skipped");
continue;
}
const size_t thisFragmentSize = buffer.size()*sizeof(uint32_t);
ATH_MSG_DEBUG( "Serialised size of " << address.persTypeName() << " is " << thisFragmentSize << " bytes" );
for (const uint16_t id : addressActiveModuleIds) {
// If result not yet truncated, try adding the serialised data
if (resultToFill.getTruncatedModuleIds().count(id)==0) {
ATH_CHECK(tryAddData(resultToFill, id, buffer, address.truncationMode));
// for truncation allowed collections, save the interface for a deferred addition
if (address.truncationMode==Address::Truncation::Allowed &&
address.category == Address::Category::xAODInterface){
deferredInterfaceBuffer[id]=buffer;
continue;
}
else {
ATH_CHECK(tryAddData(resultToFill, id, buffer, address.truncationMode, deferredInterfaceBuffer));
// clean up the deferred interface buffer, if used
deferredInterfaceBuffer.erase(id);
}
}
// Check for truncation after adding data
if (resultToFill.getTruncatedModuleIds().count(id)==0) {
......@@ -484,7 +494,8 @@ StatusCode TriggerEDMSerialiserTool::fill( HLT::HLTResultMT& resultToFill, const
StatusCode TriggerEDMSerialiserTool::tryAddData(HLT::HLTResultMT& hltResult,
const uint16_t id,
const std::vector<uint32_t>& data,
Address::Truncation truncationMode) const {
Address::Truncation truncationMode,
const std::unordered_map<uint16_t, std::vector<uint32_t>> & deferredInterfaceBuffer) const {
if (m_truncationThresholds.value().count(id)==0) {
ATH_MSG_ERROR("Module ID " << id << " missing from TruncationThresholds map. Cannot determine if result needs truncation");
return StatusCode::FAILURE;
......@@ -513,6 +524,10 @@ StatusCode TriggerEDMSerialiserTool::tryAddData(HLT::HLTResultMT& hltResult,
hltResult.addTruncatedModuleId(id, severeTruncation);
}
else {
// for truncation allowed collections, add first the interface, only if the Aux is can be stored
if (truncationMode==Address::Truncation::Allowed){
hltResult.addSerialisedData(id, deferredInterfaceBuffer.at(id));
}
// The data fits, so add it to the result
ATH_MSG_DEBUG("Adding data to result with module ID " << id);
hltResult.addSerialisedData(id, data);
......@@ -546,9 +561,11 @@ StatusCode TriggerEDMSerialiserTool::fillDebugInfo(const TruncationInfoMap& trun
xAOD::TrigComposite::Accessor<std::vector<char>> isRecordedVec("isRecorded");
std::pair<std::string, size_t> largestRecorded{"None", 0};
std::pair<std::string, size_t> largestDropped{"None", 0};
std::pair<std::string, size_t> firstDropped{"None", 0};
moduleId(*debugInfoThisModule) = id;
uint32_t sizeSum = 0;
bool severeTruncation = false;
bool truncated = false;
for (const TruncationInfo& truncationInfo : truncationInfoVec) {
// Store typeName and size information
sizeSum += truncationInfo.size;
......@@ -561,6 +578,10 @@ StatusCode TriggerEDMSerialiserTool::fillDebugInfo(const TruncationInfoMap& trun
if (!truncationInfo.recorded && truncationInfo.size > largestDropped.second) {
largestDropped = {truncationInfo.addrPtr->persTypeName(), truncationInfo.size};
}
if (!truncationInfo.recorded && !truncated) {
firstDropped = {truncationInfo.addrPtr->persTypeName(), truncationInfo.size};
truncated = true;
}
// Decide if this was a severe truncation (event goes to debug stream)
if (!truncationInfo.recorded) {
severeTruncation |= (truncationInfo.addrPtr->truncationMode==Address::Truncation::Error);
......@@ -573,7 +594,8 @@ StatusCode TriggerEDMSerialiserTool::fillDebugInfo(const TruncationInfoMap& trun
<< m_truncationThresholds.value().at(id)/1024. << " kB, total size: "
<< sizeSum/1024. << " kB, largest recorded collection: " << largestRecorded.first
<< " (" << largestRecorded.second/1024. << " kB), largest dropped collection: "
<< largestDropped.first << " (" << largestDropped.second/1024. << " kB)."
<< largestDropped.first << " (" << largestDropped.second/1024. << " kB), "
<< " first dropped collection: " <<firstDropped.first << " (" << firstDropped.second/1024. << " kB)"
<< endmsg;
// Give more information on the chains which accepted this event
using namespace TrigCompositeUtils;
......
......@@ -180,7 +180,7 @@ class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool>
* corresponding module ID as truncated.
* @return FAILURE in case the truncation threshold is undefined
*/
StatusCode tryAddData(HLT::HLTResultMT& hltResult, const uint16_t id, const std::vector<uint32_t>& data, Address::Truncation truncationMode) const;
StatusCode tryAddData(HLT::HLTResultMT& hltResult, const uint16_t id, const std::vector<uint32_t>& data, Address::Truncation truncationMode, const std::unordered_map<uint16_t, std::vector<uint32_t>>& deferredInterfaceBuffer) const;
/**
* Parse the truncation debug information, fill monitoring histograms, fill and record the debug info collection
......
......@@ -20,7 +20,7 @@ __log = logging.getLogger('TriggerEDMRun3Config')
# ------------------------------------------------------------
# Additional properties for EDM collections
# ------------------------------------------------------------
from TrigEDMConfig.TriggerEDMDefs import Alias, InViews
from TrigEDMConfig.TriggerEDMDefs import Alias, InViews, allowTruncation
# ------------------------------------------------------------
# Lists of variables to be kept in the collections
......@@ -1137,12 +1137,12 @@ TriggerHLTListRun3 = [
('xAOD::TrigCompositeAuxContainer#HLT_MuRoICluster_CompositesAux.'+MuRoiVars, 'BS ESD AODFULL AODSLIM', 'Muon'),
# tau calo clusters (moved as last because of the truncation errors ATR-29142)
('xAOD::CaloClusterContainer#HLT_TopoCaloClustersLC', 'BS ESD AODFULL', 'Tau', [InViews('tauCaloMVAViews')]),
('xAOD::CaloClusterTrigAuxContainer#HLT_TopoCaloClustersLCAux.nCells.CENTER_MAG', 'BS ESD AODFULL', 'Tau'),
('xAOD::CaloClusterContainer#HLT_TopoCaloClustersLC', 'BS ESD AODFULL', 'Tau', [InViews('tauCaloMVAViews'), allowTruncation]),
('xAOD::CaloClusterTrigAuxContainer#HLT_TopoCaloClustersLCAux.nCells.CENTER_MAG', 'BS ESD AODFULL', 'Tau', [allowTruncation]),
# FS tracks (moved as last because of the truncation errors ATR-29142)
('xAOD::TrackParticleContainer#HLT_IDTrack_FS_FTF', 'BS PhysicsTLA ESD AODFULL', 'Jet'),
('xAOD::TrackParticleAuxContainer#HLT_IDTrack_FS_FTFAux.passPFTrackPresel.muonCaloTag.muonScore.ptCone20.etConeCore.trackIso.RErr.EOverP.caloIso.trkPtFraction.tagFakeTrack.tagMuonTrack.tagIsoTrack', 'BS PhysicsTLA ESD AODFULL', 'Jet'),
('xAOD::TrackParticleContainer#HLT_IDTrack_FS_FTF', 'BS PhysicsTLA ESD AODFULL', 'Jet', [allowTruncation]),
('xAOD::TrackParticleAuxContainer#HLT_IDTrack_FS_FTFAux.passPFTrackPresel.muonCaloTag.muonScore.ptCone20.etConeCore.trackIso.RErr.EOverP.caloIso.trkPtFraction.tagFakeTrack.tagMuonTrack.tagIsoTrack', 'BS PhysicsTLA ESD AODFULL', 'Jet', [allowTruncation]),
]
......
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