ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsGPUEventCnv
src
TracccCellValidationAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
TracccCellValidationAlg.h
"
5
6
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
7
#include "
StoreGate/ReadHandle.h
"
8
9
#include <GaudiKernel/StatusCode.h>
10
#include <traccc/edm/silicon_cell_collection.hpp>
11
12
namespace
{
13
// A printer for traccc cells used to display values of unmatched cells
14
template
<
typename
SILICON_CELL_BASE>
15
MsgStream &
operator<<
(MsgStream & ms, traccc::edm::silicon_cell<SILICON_CELL_BASE>
const
& cell) {
16
ms
<<
"c0: "
<<
cell
.channel0()
17
<<
", c1: "
<<
cell
.channel1()
18
<<
", mi: "
<<
cell
.module_index()
19
<<
", ac: "
<<
cell
.activation()
20
<<
", ti: "
<<
cell
.time()
21
;
22
return
ms
;
23
}
24
}
25
26
namespace
ActsTrk
{
27
28
StatusCode
TracccCellValidationAlg::initialize
()
29
{
30
ATH_MSG_DEBUG
(
"Initializing"
);
31
32
ATH_CHECK
(
m_referenceCellsKey
.initialize());
33
ATH_CHECK
(
m_cellsKey
.initialize());
34
35
return
StatusCode::SUCCESS;
36
}
37
38
StatusCode
TracccCellValidationAlg::execute
(
const
EventContext& ctx)
const
39
{
40
using
size_type = traccc::edm::silicon_cell_collection::buffer::size_type;
41
42
auto
reference_cells_handle =
SG::makeHandle
(
m_referenceCellsKey
, ctx);
43
ATH_CHECK
(reference_cells_handle.isValid());
44
auto
cells_handle =
SG::makeHandle
(
m_cellsKey
, ctx);
45
ATH_CHECK
(cells_handle.isValid());
46
47
auto
copy =
m_deviceCopy
->copy(ctx);
48
49
// The data are on device so they need to be copied to host first
50
traccc::edm::silicon_cell_collection::buffer reference_cells_host_buffer{
51
copy->get_size(*reference_cells_handle),
m_hostMR
->mr()};
52
copy->setup(reference_cells_host_buffer)->ignore();
53
(*copy)(*reference_cells_handle, reference_cells_host_buffer)->wait();
54
55
traccc::edm::silicon_cell_collection::buffer cells_host_buffer{
56
copy->get_size(*cells_handle),
m_hostMR
->mr()};
57
copy->setup(cells_host_buffer)->ignore();
58
(*copy)(*cells_handle, cells_host_buffer)->wait();
59
60
traccc::edm::silicon_cell_collection::const_device reference_cells{reference_cells_host_buffer};
61
traccc::edm::silicon_cell_collection::const_device cells{cells_host_buffer};
62
63
if
(reference_cells.size() != cells.size()) {
64
ATH_MSG_ERROR
(
"different sizes"
);
65
return
StatusCode::FAILURE;
66
}
67
68
bool
error
=
false
;
69
for
(size_type i = 0; i < cells.size(); ++i) {
70
if
(cells.at(i) != reference_cells.at(i)) {
71
error
=
true
;
72
ATH_MSG_ERROR
(
"cells differ at "
<< i
73
<<
": ref=["
<< reference_cells.at(i) <<
']'
74
<<
", mon=["
<< cells.at(i) <<
']'
);
75
}
76
}
77
78
return
error
? StatusCode::FAILURE : StatusCode::SUCCESS;
79
}
80
81
}
// namespace ActsTrk
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthMsgStreamMacros.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadHandle.h
Handle class for reading from StoreGate.
operator<<
std::ostream & operator<<(std::ostream &lhs, const TestGaudiProperty &rhs)
Definition
TestGaudiProperty.cxx:69
TracccCellValidationAlg.h
ActsTrk::TracccCellValidationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
TracccCellValidationAlg.cxx:38
ActsTrk::TracccCellValidationAlg::m_referenceCellsKey
SG::ReadHandleKey< traccc::edm::silicon_cell_collection::const_view > m_referenceCellsKey
Definition
TracccCellValidationAlg.h:33
ActsTrk::TracccCellValidationAlg::m_hostMR
ToolHandle< AthDevice::IMemoryResourceTool > m_hostMR
Definition
TracccCellValidationAlg.h:38
ActsTrk::TracccCellValidationAlg::m_deviceCopy
ToolHandle< AthDevice::ICopyTool > m_deviceCopy
Definition
TracccCellValidationAlg.h:40
ActsTrk::TracccCellValidationAlg::initialize
virtual StatusCode initialize() override
Definition
TracccCellValidationAlg.cxx:28
ActsTrk::TracccCellValidationAlg::m_cellsKey
SG::ReadHandleKey< traccc::edm::silicon_cell_collection::const_view > m_cellsKey
Definition
TracccCellValidationAlg.h:35
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ReadCellNoiseFromCrest.cell
int cell
Definition
ReadCellNoiseFromCrest.py:59
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
error
Definition
IImpactPoint3dEstimator.h:72
python.SystemOfUnits.ms
float ms
Definition
SystemOfUnits.py:148
Generated on
for ATLAS Offline Software by
1.17.0