ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerEDMSerialiserTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
5#define TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
6
7#include <string>
12#include "GaudiKernel/IClassIDSvc.h"
13#include "GaudiKernel/ServiceHandle.h"
22#include "Gaudi/Parsers/Factory.h" // Needed to declare less common Property types
23
24// Forward declarations
25class DataObject;
26
40class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool>
41{
42
43 public:
44
45 TriggerEDMSerialiserTool( const std::string& type,
46 const std::string& name,
47 const IInterface* parent );
48
49 virtual ~TriggerEDMSerialiserTool() override = default;
50 virtual StatusCode fill( HLT::HLTResultMT& resultToFill, const EventContext& ctx ) const override;
51
52 virtual StatusCode initialize() override;
53
54 private:
55 friend StatusCode tester( TriggerEDMSerialiserTool* );
56 Gaudi::Property< std::vector< std::string > > m_collectionsToSerialize {
57 this, "CollectionsToSerialize", {},
58 "EDM streaming configuration \'collectionKeyType;module1,module2,...[;allowTruncation]\' where collectionKeyType is a string "
59 "formatted like for AthenaOutputStream, e.g. TYPE#SG.aux1.aux2..etc. For xAOD classes the typedef type should be "
60 "used and the _vN version number is automatically detected. For old T/P classes the persistent version has to be "
61 "given. Module IDs following the semicolon are the HLT result ROB module IDs to which the collection should be "
62 "written. ID=0 is the main result, other IDs are used for data scouting. The optional allowTruncation "
63 "indicates if the collection can be truncated without raising an ERROR.",
64 "OrderedSet<std::string>"
65 };
66 Gaudi::Property<bool> m_saveDynamic {
67 this, "SaveDynamic", true, "If false skips serialising of dynamic variables. Use for test purpose only."
68 };
69 Gaudi::Property<std::map<uint16_t,uint32_t>> m_truncationThresholds {
70 this, "TruncationThresholds", {}, "HLT result truncation thresholds. Key is module ID, value is max size in bytes"
71 };
72 Gaudi::Property<int> m_eventSizeHardLimitMB {
73 this, "EventSizeHardLimitMB", -1,
74 "Hard limit for output event size in megabytes. Set automatically in initialize from run parameters. "
75 "In partition, it corresponds to DCM sbaBlockSize_MiB. Value <0 means no limit."
76 };
77 Gaudi::Property<float> m_fullResultTruncationFrac {
78 this, "FullResultTruncationFrac", 0.8,
79 "Fraction of EventSizeHardLimitMB which defines the limit on the total size of HLT output (sum of all modules)"
80 };
81
83 this, "DebugInfoWHKey", "TruncationDebugInfo"
84 };
85
87 this, "NavigationSummaryRHKey", "HLTNav_Summary"
88 };
89
94 struct Address {
95 enum class Category : uint8_t { xAODInterface, xAODAux, OldTP, xAODDecoration, None };
96 enum class Truncation { Error, Allowed };
97 std::string transType;
98 std::string persType; // actual versioned type
101 std::string key;
102 std::vector<uint16_t> moduleIdVec{};
106
107 std::string transTypeName() const {return transType+"#"+key;}
108 std::string persTypeName() const {return persType+"#"+key;}
109 };
110
114 std::hash<SG::auxid_t>,
115 std::equal_to<SG::auxid_t>,
117
118 mutable AuxIdTypeMap_t m_dynAuxAddress ATLAS_THREAD_SAFE;
119
125 const Address* addrPtr{nullptr};
126 size_t size{0};
127 bool recorded{false};
128 };
129
131 using TruncationInfoMap = std::unordered_map<uint16_t, std::vector<TruncationInfo>>;
132
133 std::vector< Address > m_toSerialise; // postprocessed configuration info
134
135 ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc",
136 "Service to translate class name to CLID" };
137 ServiceHandle<IAthenaSerializeSvc> m_serializerSvc{ this, "Serializer", "AthenaRootSerializeSvc",
138 "Service to translate transient to persistent representation" };
139
140 ToolHandle<TrigSerTPTool> m_tpTool{ this, "TPTool", "TrigSerTPTool/TrigSerTPTool",
141 "Tool to do Transient/Persistent conversion (Old EDM)"};
142
143 ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" };
144
148 StatusCode addCollectionToSerialise(const std::string& typeKeyAuxIDs, std::vector<Address>& addressVec) const;
149
153 static StatusCode makeHeader( const TriggerEDMSerialiserTool::Address& address, std::vector<uint32_t>& buffer );
154
160 StatusCode fillPayload( const void* data, size_t sz, std::vector<uint32_t>& buffer ) const;
161
162
167 StatusCode serialiseContainer( void* data, const Address& address, std::vector<uint32_t>& buffer ) const;
172 StatusCode serialisexAODAuxContainer( void* data, const Address& address, std::vector<uint32_t>& buffer, SGImplSvc* evtStore ) const;
173
178 StatusCode serialiseTPContainer( void* data, const Address& address, std::vector<uint32_t>& buffer ) const;
179
183 StatusCode serialiseDynAux( DataObject* dObject, const Address& address, std::vector<uint32_t>& buffer, size_t& nDynWritten ) const;
184
189 StatusCode serialise( const Address& address, std::vector<uint32_t>& buffer, SGImplSvc* evtStore ) const;
190
196 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;
197
201 StatusCode fillDebugInfo(const TruncationInfoMap& truncationInfoMap, xAOD::TrigCompositeContainer& debugInfoCont, HLT::HLTResultMT& resultToFill, SGImplSvc* evtStore) const;
202
206 static std::string version( const std::string& name );
207
211 static std::set<uint16_t> activeModuleIDs(const HLT::HLTResultMT& result);
212
213};
214
215
216#endif //> !TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
Hash map from pointers/integers to arbitrary objects allowing concurrent, lockless reads.
uint32_t CLID
The Class ID type.
static Double_t sz
Header file to be included by clients of the Monitored infrastructure.
TTypeAdapter RootType
Definition RootType.h:211
Simple (non-deleting) Updater implementation.
@ None
Define macros for attributes used to control the static checker.
Simple (non-deleting) Updater implementation.
A container class for data required to build online output from HLT.
Definition HLTResultMT.h:38
The Athena Transient Store API.
Definition SGImplSvc.h:109
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Gaudi::Property< bool > m_saveDynamic
static StatusCode makeHeader(const TriggerEDMSerialiserTool::Address &address, std::vector< uint32_t > &buffer)
Given the ID of the collection (in address arg) insert basic streaming info into the buffer.
Gaudi::Property< int > m_eventSizeHardLimitMB
StatusCode serialiseTPContainer(void *data, const Address &address, std::vector< uint32_t > &buffer) const
Place inside the buffer the serialised old type of container involves T/P conversion.
SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > m_debugNavigationSummaryRHKey
StoreGate key for the navigation summary object - with this we can print which chains accepted the ev...
std::vector< Address > m_toSerialise
ToolHandle< TrigSerTPTool > m_tpTool
CxxUtils::ConcurrentToValMap< SG::auxid_t, Address, CxxUtils::SimpleUpdater, std::hash< SG::auxid_t >, std::equal_to< SG::auxid_t >, SG::null_auxid > AuxIdTypeMap_t
A thread-safe map to store the AuxId to Address mapping for dynamic variables.
StatusCode fillDebugInfo(const TruncationInfoMap &truncationInfoMap, xAOD::TrigCompositeContainer &debugInfoCont, HLT::HLTResultMT &resultToFill, SGImplSvc *evtStore) const
Parse the truncation debug information, fill monitoring histograms, fill and record the debug info co...
static std::string version(const std::string &name)
Obtain version from the actual type name.
TriggerEDMSerialiserTool(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode fillPayload(const void *data, size_t sz, std::vector< uint32_t > &buffer) const
Copy bytes from the memory into the buffer converting from char[] to uint32_t[] This function is cand...
Gaudi::Property< std::vector< std::string > > m_collectionsToSerialize
AuxIdTypeMap_t m_dynAuxAddress ATLAS_THREAD_SAFE
virtual StatusCode fill(HLT::HLTResultMT &resultToFill, const EventContext &ctx) const override
StatusCode serialiseContainer(void *data, const Address &address, std::vector< uint32_t > &buffer) const
Place inside the buffer the serialised container (can be either TP, xAOD) involves simple invocation ...
friend StatusCode tester(TriggerEDMSerialiserTool *)
StatusCode serialise(const Address &address, std::vector< uint32_t > &buffer, SGImplSvc *evtStore) const
Retrieve data from event store, serialise and fill the buffer using one of the specific serialise met...
std::unordered_map< uint16_t, std::vector< TruncationInfo > > TruncationInfoMap
Typedef for collection of TruncationInfo objects for full event.
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_debugInfoWHKey
StoreGate key for the truncation debug info object.
ServiceHandle< IAthenaSerializeSvc > m_serializerSvc
Gaudi::Property< std::map< uint16_t, uint32_t > > m_truncationThresholds
virtual ~TriggerEDMSerialiserTool() override=default
StatusCode addCollectionToSerialise(const std::string &typeKeyAuxIDs, std::vector< Address > &addressVec) const
Parse entry from m_collectionsToSerialize and add it to m_toSerialise.
StatusCode serialisexAODAuxContainer(void *data, const Address &address, std::vector< uint32_t > &buffer, SGImplSvc *evtStore) const
Place inside the buffer serialised the xAOD Aux container involves selection and recording of dynamic...
ServiceHandle< IClassIDSvc > m_clidSvc
StatusCode serialiseDynAux(DataObject *dObject, const Address &address, std::vector< uint32_t > &buffer, size_t &nDynWritten) const
Add dynamic variables to the payload.
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
Try appending serialised data to HLT result.
ToolHandle< GenericMonitoringTool > m_monTool
static std::set< uint16_t > activeModuleIDs(const HLT::HLTResultMT &result)
Build a list of module IDs to serialise based on the stream tags.
Gaudi::Property< float > m_fullResultTruncationFrac
virtual StatusCode initialize() override
Class helping in dealing with dynamic branch selection.
ConcurrentToValMap(Updater_t &&updater, size_type capacity=64, const Context_t &ctx=Updater_t::defaultContext())
Hash map from pointers/integers to arbitrary objects allowing concurrent, lockless reads.
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
Internal structure to keep configuration organised conveniently.
xAOD::AuxSelection sel
xAOD dynamic variables selection, relevant only for xAODAux category
Internal structure to keep information for truncation debugging.