ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerEDMSerialiserTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
5#define TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
6
7#include <string>
9#include "GaudiKernel/IClassIDSvc.h"
10#include "GaudiKernel/ServiceHandle.h"
19#include "Gaudi/Parsers/Factory.h" // Needed to declare less common Property types
20
21// Forward declarations
22class DataObject;
23
37class TriggerEDMSerialiserTool: public extends<AthAlgTool, HLTResultMTMakerTool>
38{
39
40 public:
41
42 TriggerEDMSerialiserTool( const std::string& type,
43 const std::string& name,
44 const IInterface* parent );
45
46 virtual ~TriggerEDMSerialiserTool() override = default;
47 virtual StatusCode fill( HLT::HLTResultMT& resultToFill, const EventContext& ctx ) const override;
48
49 virtual StatusCode initialize() override;
50
51 private:
52 friend StatusCode tester( TriggerEDMSerialiserTool* );
53 Gaudi::Property< std::vector< std::string > > m_collectionsToSerialize {
54 this, "CollectionsToSerialize", {},
55 "EDM streaming configuration \'collectionKeyType;module1,module2,...[;allowTruncation]\' where collectionKeyType is a string "
56 "formatted like for AthenaOutputStream, e.g. TYPE#SG.aux1.aux2..etc. For xAOD classes the typedef type should be "
57 "used and the _vN version number is automatically detected. For old T/P classes the persistent version has to be "
58 "given. Module IDs following the semicolon are the HLT result ROB module IDs to which the collection should be "
59 "written. ID=0 is the main result, other IDs are used for data scouting. The optional allowTruncation "
60 "indicates if the collection can be truncated without raising an ERROR.",
61 "OrderedSet<std::string>"
62 };
63 Gaudi::Property<bool> m_saveDynamic {
64 this, "SaveDynamic", true, "If false skips serialising of dynamic variables. Use for test purpose only."
65 };
66 Gaudi::Property<std::map<uint16_t,uint32_t>> m_truncationThresholds {
67 this, "TruncationThresholds", {}, "HLT result truncation thresholds. Key is module ID, value is max size in bytes"
68 };
69 Gaudi::Property<int> m_eventSizeHardLimitMB {
70 this, "EventSizeHardLimitMB", -1,
71 "Hard limit for output event size in megabytes. Set automatically in initialize from run parameters. "
72 "In partition, it corresponds to DCM sbaBlockSize_MiB. Value <0 means no limit."
73 };
74 Gaudi::Property<float> m_fullResultTruncationFrac {
75 this, "FullResultTruncationFrac", 0.8,
76 "Fraction of EventSizeHardLimitMB which defines the limit on the total size of HLT output (sum of all modules)"
77 };
78
80 this, "DebugInfoWHKey", "TruncationDebugInfo"
81 };
82
84 this, "NavigationSummaryRHKey", "HLTNav_Summary"
85 };
86
91 struct Address {
92 enum class Category : uint8_t { xAODInterface, xAODAux, OldTP, xAODDecoration, None };
93 enum class Truncation { Error, Allowed };
94 std::string transType;
95 std::string persType; // actual versioned type
97 std::string key;
98 std::vector<uint16_t> moduleIdVec{};
102
103 std::string transTypeName() const {return transType+"#"+key;}
104 std::string persTypeName() const {return persType+"#"+key;}
105 };
106
112 const Address* addrPtr{nullptr};
113 size_t size{0};
114 bool recorded{false};
115 };
116
118 using TruncationInfoMap = std::unordered_map<uint16_t, std::vector<TruncationInfo>>;
119
120 std::vector< Address > m_toSerialise; // postprocessed configuration info
121
122 ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc",
123 "Service to translate class name to CLID" };
124 ServiceHandle<IAthenaSerializeSvc> m_serializerSvc{ this, "Serializer", "AthenaRootSerializeSvc",
125 "Service to translate transient to persistent representation" };
126
127 ToolHandle<TrigSerTPTool> m_tpTool{ this, "TPTool", "TrigSerTPTool/TrigSerTPTool",
128 "Tool to do Transient/Persistent conversion (Old EDM)"};
129
130 ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" };
131
135 StatusCode addCollectionToSerialise(const std::string& typeKeyAuxIDs, std::vector<Address>& addressVec) const;
136
140 static StatusCode makeHeader( const TriggerEDMSerialiserTool::Address& address, std::vector<uint32_t>& buffer );
141
147 StatusCode fillPayload( const void* data, size_t sz, std::vector<uint32_t>& buffer ) const;
148
149
154 StatusCode serialiseContainer( void* data, const Address& address, std::vector<uint32_t>& buffer ) const;
159 StatusCode serialisexAODAuxContainer( void* data, const Address& address, std::vector<uint32_t>& buffer, SGImplSvc* evtStore ) const;
160
165 StatusCode serialiseTPContainer( void* data, const Address& address, std::vector<uint32_t>& buffer ) const;
166
170 StatusCode serialiseDynAux( DataObject* dObject, const Address& address, std::vector<uint32_t>& buffer, size_t& nDynWritten ) const;
171
176 StatusCode serialise( const Address& address, std::vector<uint32_t>& buffer, SGImplSvc* evtStore ) const;
177
183 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;
184
188 StatusCode fillDebugInfo(const TruncationInfoMap& truncationInfoMap, xAOD::TrigCompositeContainer& debugInfoCont, HLT::HLTResultMT& resultToFill, SGImplSvc* evtStore) const;
189
193 static std::string version( const std::string& name );
194
198 static std::set<uint16_t> activeModuleIDs(const HLT::HLTResultMT& result);
199
200};
201
202
203#endif //> !TRIGOUTPUTHANDLING_TRIGGEREDMSERIALISERTOOL_H
uint32_t CLID
The Class ID type.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sz
Header file to be included by clients of the Monitored infrastructure.
A container class for data required to build online output from HLT.
Definition HLTResultMT.h:38
The Athena Transient Store API.
Definition SGImplSvc.h:110
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
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
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.
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.