ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::RDOtoTracccCellConverterCommons Struct Reference

This struct contains the components common to RDOtoTracccCellConverterAlg and PhaseIIRDOtoTracccCellConverterAlg. More...

#include <RDOtoTracccCellConverterCommons.h>

Inheritance diagram for ActsTrk::RDOtoTracccCellConverterCommons:
Collaboration diagram for ActsTrk::RDOtoTracccCellConverterCommons:

Public Member Functions

 RDOtoTracccCellConverterCommons (AthReentrantAlgorithm &parent)
StatusCode initialize ()
StatusCode finalize ()
traccc::edm::silicon_cell_collection::buffer sortCells (vecmem::copy const &host_copy, traccc::edm::silicon_cell_collection::device const &cells) const
StatusCode copyToGpuAndRecordToSG (EventContext const &ctx, traccc::edm::silicon_cell_collection::buffer const &cells) const
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Public Attributes

AthReentrantAlgorithmm_parent
SG::WriteHandleKey< traccc::edm::silicon_cell_collection::buffer > m_tracccCellsKey
std::atomic< int > m_nPix = 0
std::atomic< int > m_nStrip = 0
std::atomic< int > m_nCells = 0
const PixelIDm_pixelID {nullptr}
const SCT_IDm_stripID {nullptr}
ToolHandle< AthDevice::IMemoryResourceToolm_hostMR
ToolHandle< AthDevice::IMemoryResourceToolm_deviceMR
ToolHandle< AthDevice::ICopiesToolm_copiesTool
ServiceHandle< ActsTrk::IDeviceDetectorDescriptionProviderSvcm_detDescSvc
Gaudi::Property< std::string > m_hostCondObjectName
const traccc::detector_conditions_description::host * m_hostCond {nullptr}
const std::unordered_map< Identifier, uint64_t > * m_athenaToDetray {nullptr}
std::unordered_map< uint64_t, unsigned int > m_DetrayIdToDetDescrIndexMap {}
Gaudi::Property< bool > m_CPUCellSorting
Gaudi::Property< bool > m_UsePixelToTForCellActivation

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

This struct contains the components common to RDOtoTracccCellConverterAlg and PhaseIIRDOtoTracccCellConverterAlg.

Output key, copy objects, memory resources, detector descriptions and conditions, athena to detray conversion maps, ...

Definition at line 36 of file RDOtoTracccCellConverterCommons.h.

Constructor & Destructor Documentation

◆ RDOtoTracccCellConverterCommons()

ActsTrk::RDOtoTracccCellConverterCommons::RDOtoTracccCellConverterCommons ( AthReentrantAlgorithm & parent)

Definition at line 17 of file RDOtoTracccCellConverterCommons.cxx.

19 : AthMessaging{"RDOtoTracccCellConverterCommons"}
21 , m_tracccCellsKey{&parent, "TracccCells", "", "Output traccc cell collection buffer"}
22 , m_hostMR{&parent, "HostMR", "", "The host memory resource tool to use"}
23 , m_deviceMR{&parent, "DeviceMR", "", "The device memory resource tool to use"}
24 , m_copiesTool{&parent, "CopiesTool", "", "Tool that provides host and device copy objects"}
25 , m_detDescSvc{&parent, "DetectorDescriptionSvc", "ActsTrk::JSONDeviceDetectorDescriptionProviderSvc"}
26 , m_hostCondObjectName{&parent, "HostConditionsObjectName", "",
27 "Traccc host conditions object"}
28 , m_CPUCellSorting{&parent, "CPUCellSorting", false,
29 "Whether to sort traccc cells on CPU or GPU"}
30 , m_UsePixelToTForCellActivation{&parent, "UsePixelToTForCellActivation", true,
31 "Use Pixel hit time over threshold value to set traccc cell activation value, otherwise defaults to 1"}
32{
33}
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
ToolHandle< AthDevice::IMemoryResourceTool > m_deviceMR
SG::WriteHandleKey< traccc::edm::silicon_cell_collection::buffer > m_tracccCellsKey
ToolHandle< AthDevice::ICopiesTool > m_copiesTool
ToolHandle< AthDevice::IMemoryResourceTool > m_hostMR
ServiceHandle< ActsTrk::IDeviceDetectorDescriptionProviderSvc > m_detDescSvc

Member Function Documentation

◆ copyToGpuAndRecordToSG()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::copyToGpuAndRecordToSG ( EventContext const & ctx,
traccc::edm::silicon_cell_collection::buffer const & cells ) const

Definition at line 82 of file RDOtoTracccCellConverterCommons.cxx.

86{
87 auto device_copy = m_copiesTool->deviceCopy(ctx);
88 auto traccc_cells_gpu_buffer = std::make_unique<traccc::edm::silicon_cell_collection::buffer>(
89 cells.capacity(), m_deviceMR->mr());
90
91 // We ignore() the setup and wait() on the copy to allow parallelism.
92 device_copy->setup(*traccc_cells_gpu_buffer)->ignore();
93 (*device_copy)(cells, *traccc_cells_gpu_buffer)->wait();
94
95 auto outputTracccCells = SG::makeHandle(m_tracccCellsKey, ctx);
96 ATH_CHECK(outputTracccCells.record(std::move(traccc_cells_gpu_buffer)));
97 return StatusCode::SUCCESS;
98}
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ finalize()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::finalize ( )

Definition at line 58 of file RDOtoTracccCellConverterCommons.cxx.

59{
60 //TODO: change to DEBUG once we figure how to set the log level of this class
61 // from that of the parent class
62 ATH_MSG_INFO("Read total number of pixel hits = " << m_nPix
63 << ", total number of strip hits = " << m_nStrip
64 << " and created total number of traccc cells = " << m_nCells
65 );
66 return StatusCode::SUCCESS;
67}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::initialize ( )

Definition at line 35 of file RDOtoTracccCellConverterCommons.cxx.

36{
37 ATH_CHECK(m_parent.detStore()->retrieve(m_pixelID, "PixelID"));
38 ATH_CHECK(m_parent.detStore()->retrieve(m_stripID, "SCT_ID"));
39
40 ATH_CHECK(m_hostMR.retrieve());
41 ATH_CHECK(m_tracccCellsKey.initialize());
42 ATH_CHECK(m_copiesTool.retrieve());
43
44 m_athenaToDetray = &m_detDescSvc->athenaToDetrayMap();
45 ATH_CHECK(m_parent.detStore()->retrieve(m_hostCond, m_hostCondObjectName.value()));
46
47 const auto& gids = m_hostCond->geometry_id();
48 m_DetrayIdToDetDescrIndexMap.reserve(gids.size());
49 for (unsigned int i = 0; i < gids.size(); ++i) {
50 m_DetrayIdToDetDescrIndexMap[gids[i].value()] = i;
51 }
52 ATH_MSG_INFO("Built detray→detcond map with "
53 << m_DetrayIdToDetDescrIndexMap.size() << " entries");
54
55 return StatusCode::SUCCESS;
56}
std::unordered_map< uint64_t, unsigned int > m_DetrayIdToDetDescrIndexMap
const std::unordered_map< Identifier, uint64_t > * m_athenaToDetray
const traccc::detector_conditions_description::host * m_hostCond

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ sortCells()

traccc::edm::silicon_cell_collection::buffer ActsTrk::RDOtoTracccCellConverterCommons::sortCells ( vecmem::copy const & host_copy,
traccc::edm::silicon_cell_collection::device const & cells ) const

Definition at line 69 of file RDOtoTracccCellConverterCommons.cxx.

73{
74 traccc::edm::silicon_cell_collection::buffer sorted_cells_host_buffer{
75 cells.size(), m_hostMR->mr()};
76 host_copy.setup(sorted_cells_host_buffer)->wait();
77 traccc::edm::silicon_cell_collection::device sorted_cells{sorted_cells_host_buffer};
78 sort_traccc_soa(sorted_cells, cells);
79 return sorted_cells_host_buffer;
80}
void sort_traccc_soa(traccc::edm::silicon_cell_collection::device &sorted_cells, traccc::edm::silicon_cell_collection::device const &cells)

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_athenaToDetray

const std::unordered_map<Identifier, uint64_t>* ActsTrk::RDOtoTracccCellConverterCommons::m_athenaToDetray {nullptr}

Definition at line 63 of file RDOtoTracccCellConverterCommons.h.

63{nullptr};

◆ m_copiesTool

ToolHandle<AthDevice::ICopiesTool> ActsTrk::RDOtoTracccCellConverterCommons::m_copiesTool

Definition at line 56 of file RDOtoTracccCellConverterCommons.h.

◆ m_CPUCellSorting

Gaudi::Property<bool> ActsTrk::RDOtoTracccCellConverterCommons::m_CPUCellSorting

Definition at line 66 of file RDOtoTracccCellConverterCommons.h.

◆ m_detDescSvc

ServiceHandle<ActsTrk::IDeviceDetectorDescriptionProviderSvc> ActsTrk::RDOtoTracccCellConverterCommons::m_detDescSvc

Definition at line 58 of file RDOtoTracccCellConverterCommons.h.

◆ m_DetrayIdToDetDescrIndexMap

std::unordered_map<uint64_t, unsigned int> ActsTrk::RDOtoTracccCellConverterCommons::m_DetrayIdToDetDescrIndexMap {}

Definition at line 64 of file RDOtoTracccCellConverterCommons.h.

64{};

◆ m_deviceMR

ToolHandle<AthDevice::IMemoryResourceTool> ActsTrk::RDOtoTracccCellConverterCommons::m_deviceMR

Definition at line 55 of file RDOtoTracccCellConverterCommons.h.

◆ m_hostCond

const traccc::detector_conditions_description::host* ActsTrk::RDOtoTracccCellConverterCommons::m_hostCond {nullptr}

Definition at line 60 of file RDOtoTracccCellConverterCommons.h.

60{nullptr};

◆ m_hostCondObjectName

Gaudi::Property<std::string> ActsTrk::RDOtoTracccCellConverterCommons::m_hostCondObjectName

Definition at line 59 of file RDOtoTracccCellConverterCommons.h.

◆ m_hostMR

ToolHandle<AthDevice::IMemoryResourceTool> ActsTrk::RDOtoTracccCellConverterCommons::m_hostMR

Definition at line 54 of file RDOtoTracccCellConverterCommons.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_nCells

std::atomic<int> ActsTrk::RDOtoTracccCellConverterCommons::m_nCells = 0
mutable

Definition at line 49 of file RDOtoTracccCellConverterCommons.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nPix

std::atomic<int> ActsTrk::RDOtoTracccCellConverterCommons::m_nPix = 0
mutable

Definition at line 47 of file RDOtoTracccCellConverterCommons.h.

◆ m_nStrip

std::atomic<int> ActsTrk::RDOtoTracccCellConverterCommons::m_nStrip = 0
mutable

Definition at line 48 of file RDOtoTracccCellConverterCommons.h.

◆ m_parent

AthReentrantAlgorithm& ActsTrk::RDOtoTracccCellConverterCommons::m_parent

Definition at line 43 of file RDOtoTracccCellConverterCommons.h.

◆ m_pixelID

const PixelID* ActsTrk::RDOtoTracccCellConverterCommons::m_pixelID {nullptr}

Definition at line 51 of file RDOtoTracccCellConverterCommons.h.

51{nullptr};

◆ m_stripID

const SCT_ID* ActsTrk::RDOtoTracccCellConverterCommons::m_stripID {nullptr}

Definition at line 52 of file RDOtoTracccCellConverterCommons.h.

52{nullptr};

◆ m_tracccCellsKey

SG::WriteHandleKey<traccc::edm::silicon_cell_collection::buffer> ActsTrk::RDOtoTracccCellConverterCommons::m_tracccCellsKey

Definition at line 45 of file RDOtoTracccCellConverterCommons.h.

◆ m_UsePixelToTForCellActivation

Gaudi::Property<bool> ActsTrk::RDOtoTracccCellConverterCommons::m_UsePixelToTForCellActivation

Definition at line 67 of file RDOtoTracccCellConverterCommons.h.


The documentation for this struct was generated from the following files: