ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
TracccTritonClient
src
TracccTritonTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TracccTritonTool.h
"
6
7
#include "
AthenaKernel/ExtendedEventContext.h
"
8
9
#include <chrono>
10
11
TracccTritonTool::TracccTritonTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
12
: base_class(
type
, name, parent) {
13
14
declareInterface<ITracccTritonTool>(
this
);
15
}
16
17
StatusCode
TracccTritonTool::initialize
() {
18
19
ATH_CHECK
(
m_TracccTritonTool
.retrieve());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
TracccTritonTool::getTracks
(
25
const
EventContext& ctx,
26
std::vector<uint8_t>& cellBytes,
27
TracccTritonResult
& result
28
)
const
{
29
30
// Forward the serialized traccc silicon_cell_collection as a single UINT8
31
AthInfer::InputDataMap
inputData;
32
inputData[
"CELLS"
] = std::make_pair(
33
std::vector<int64_t>{
static_cast<
int64_t
>
(cellBytes.size())},
34
cellBytes);
35
36
// The IOV the server looks the event's conditions up for: run,
37
// lumiblock, time stamp [s], time stamp ns offset, conditions run (the
38
// MC override of the run number)
39
const
EventIDBase& eventID = ctx.eventID();
40
std::vector<int64_t> iov{
41
eventID.run_number(), eventID.lumi_block(), eventID.time_stamp(),
42
eventID.time_stamp_ns_offset(),
43
Atlas::getExtendedEventContext
(ctx).
conditionsRun
()};
44
ATH_MSG_DEBUG
(
"Sending event IOV run "
<< iov[0] <<
" lb "
<< iov[1]
45
<<
" time stamp "
<< iov[2] <<
"."
<< iov[3]
46
<<
" conditions run "
<< iov[4]);
47
inputData[
"EVENT_IOV"
] = std::make_pair(
48
std::vector<int64_t>{
static_cast<
int64_t
>
(iov.size())}, std::move(iov));
49
50
// Every output is one serialized traccc EDM collection
51
AthInfer::OutputDataMap
outputData;
52
for
(
const
char
* name : {
"MEASUREMENTS"
,
"CLUSTERS"
,
"TRACKS"
,
"TRACK_STATES"
}) {
53
outputData[name] = std::make_pair(
54
std::vector<int64_t>{-1}, std::vector<uint8_t>{});
55
}
56
57
auto
start_inference = std::chrono::high_resolution_clock::now();
58
ATH_CHECK
(
m_TracccTritonTool
->inference(inputData, outputData));
59
auto
end_inference = std::chrono::high_resolution_clock::now();
60
std::chrono::duration<double, std::milli> inference_time = end_inference - start_inference;
61
ATH_MSG_INFO
(
"Traccc Triton inference time: "
<< inference_time.count() <<
" ms"
);
62
63
auto
take = [&outputData](
const
char
* name) {
64
return
std::move(std::get<std::vector<uint8_t>>(outputData[name].second));
65
};
66
result.measurements = take(
"MEASUREMENTS"
);
67
result.clusters = take(
"CLUSTERS"
);
68
result.tracks = take(
"TRACKS"
);
69
result.trackStates = take(
"TRACK_STATES"
);
70
71
ATH_MSG_DEBUG
(
"Received "
<< result.measurements.size() <<
" + "
72
<< result.clusters.size() <<
" + "
<< result.tracks.size()
73
<<
" + "
<< result.trackStates.size()
74
<<
" bytes of measurements, clusters, tracks and track states"
);
75
76
return
StatusCode::SUCCESS;
77
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ExtendedEventContext.h
TracccTritonTool.h
Atlas::ExtendedEventContext::conditionsRun
EventIDBase::number_type conditionsRun() const
Definition
ExtendedEventContext.h:38
TracccTritonTool::initialize
virtual StatusCode initialize() override
Definition
TracccTritonTool.cxx:17
TracccTritonTool::m_TracccTritonTool
ToolHandle< AthInfer::IAthInferenceTool > m_TracccTritonTool
Definition
TracccTritonTool.h:42
TracccTritonTool::getTracks
virtual StatusCode getTracks(const EventContext &ctx, std::vector< uint8_t > &cellBytes, TracccTritonResult &result) const override
Reconstruct the tracks of one event on the server.
Definition
TracccTritonTool.cxx:24
TracccTritonTool::TracccTritonTool
TracccTritonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TracccTritonTool.cxx:11
AthInfer::OutputDataMap
std::map< std::string, InferenceData > OutputDataMap
Definition
IAthInferenceTool.h:18
AthInfer::InputDataMap
std::map< std::string, InferenceData > InputDataMap
Definition
IAthInferenceTool.h:17
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition
ExtendedEventContext.cxx:32
type
TracccTritonResult
The (serialized) traccc EDM collections returned by the server.
Definition
ITracccTritonTool.h:14
Generated on
for ATLAS Offline Software by
1.17.0