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
StatusCode decodeTimeBins ()
bool passTiming (const std::bitset< 3 > &timePattern) const
StatusCode buildDetrayMaps () 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
Gaudi::Property< std::string > m_geoIdMappingObjectName
const ActsTrk::GeometryIdMappingm_geoIdMapping {nullptr}
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
StringProperty m_stripRDOTimeBinStr
int m_stripRDOTimeBinBits [3] {-1, -1, -1}

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 37 of file RDOtoTracccCellConverterCommons.h.

Constructor & Destructor Documentation

◆ RDOtoTracccCellConverterCommons()

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

Definition at line 18 of file RDOtoTracccCellConverterCommons.cxx.

20 : AthMessaging{"RDOtoTracccCellConverterCommons"}
22 , m_tracccCellsKey{&parent, "TracccCells", "", "Output traccc cell collection buffer"}
23 , m_hostMR{&parent, "HostMR", "", "The host memory resource tool to use"}
24 , m_deviceMR{&parent, "DeviceMR", "", "The device memory resource tool to use"}
25 , m_copiesTool{&parent, "CopiesTool", "", "Tool that provides host and device copy objects"}
26 , m_geoIdMappingObjectName{&parent, "GeoIdMappingObjectName", "",
27 "StoreGate name for the detray/acts/athena geo id mapping"}
28 , m_hostCondObjectName{&parent, "HostConditionsObjectName", "",
29 "Traccc host conditions object"}
30 , m_CPUCellSorting{&parent, "CPUCellSorting", false,
31 "Whether to sort traccc cells on CPU or GPU"}
32 , m_UsePixelToTForCellActivation{&parent, "UsePixelToTForCellActivation", true,
33 "Use Pixel hit time over threshold value to set traccc cell activation value, otherwise defaults to 1"}
34 , m_stripRDOTimeBinStr{&parent, "timeBins", "Allowed time bins pattern for Strip RDOs"}
35{
36}
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

Member Function Documentation

◆ buildDetrayMaps()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::buildDetrayMaps ( ) const

Definition at line 58 of file RDOtoTracccCellConverterCommons.cxx.

59{
60
61 const auto& gids = m_hostCond->geometry_id();
62 // NOTE: m_DetrayIdToDetDescrIndexMap is built once here;
63 // meaning it is only valid as long as the geometry does not change.
64 // if the job ever spans multiple IOVs with a
65 // genuinely different geometry_id() payload, this caching strategy
66 // would need to become IOV-aware instead.
67 const_cast<RDOtoTracccCellConverterCommons*>(this)->m_DetrayIdToDetDescrIndexMap.reserve(gids.size());
68 for (unsigned int i = 0; i < gids.size(); ++i) {
70 }
71 ATH_MSG_INFO("Built detray→detcond map with "
72 << m_DetrayIdToDetDescrIndexMap.size() << " entries");
73
74 return StatusCode::SUCCESS;
75}
#define ATH_MSG_INFO(x,...)
std::unordered_map< uint64_t, unsigned int > m_DetrayIdToDetDescrIndexMap
const traccc::detector_conditions_description::host * m_hostCond

◆ copyToGpuAndRecordToSG()

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

Definition at line 101 of file RDOtoTracccCellConverterCommons.cxx.

105{
106 auto device_copy = m_copiesTool->deviceCopy(ctx);
107 auto traccc_cells_gpu_buffer = std::make_unique<traccc::edm::silicon_cell_collection::buffer>(
108 cells.capacity(), m_deviceMR->mr());
109
110 // We ignore() the setup and wait() on the copy to allow parallelism.
111 device_copy->setup(*traccc_cells_gpu_buffer)->ignore();
112 (*device_copy)(cells, *traccc_cells_gpu_buffer)->wait();
113
114 auto outputTracccCells = SG::makeHandle(m_tracccCellsKey, ctx);
115 ATH_CHECK(outputTracccCells.record(std::move(traccc_cells_gpu_buffer)));
116 return StatusCode::SUCCESS;
117}
#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())

◆ decodeTimeBins()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::decodeTimeBins ( )

Definition at line 142 of file RDOtoTracccCellConverterCommons.cxx.

143{
144 static const size_t MAX_BINS = 2;
145 if (m_stripRDOTimeBinStr.size() > MAX_BINS) {
146 ATH_MSG_WARNING("Time bin string has excess characters");
147 }
148
149 for (size_t i = 0; i < MAX_BINS; ++i) {
150 switch (std::toupper(m_stripRDOTimeBinStr[i])) {
151 case 'X': m_stripRDOTimeBinBits[i] = -1; break;
152 case '0': m_stripRDOTimeBinBits[i] = 0; break;
153 case '1': m_stripRDOTimeBinBits[i] = 1; break;
154 default:
155 ATH_MSG_FATAL("Invalid time bin string: " << m_stripRDOTimeBinStr);
156 return StatusCode::FAILURE;
157 }
158 }
159 return StatusCode::SUCCESS;
160}
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_FATAL(x,...)

◆ finalize()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::finalize ( )

Definition at line 77 of file RDOtoTracccCellConverterCommons.cxx.

78{
79 //TODO: change to DEBUG once we figure how to set the log level of this class
80 // from that of the parent class
81 ATH_MSG_INFO("Read total number of pixel hits = " << m_nPix
82 << ", total number of strip hits = " << m_nStrip
83 << " and created total number of traccc cells = " << m_nCells
84 );
85 return StatusCode::SUCCESS;
86}

◆ initialize()

StatusCode ActsTrk::RDOtoTracccCellConverterCommons::initialize ( )

Definition at line 38 of file RDOtoTracccCellConverterCommons.cxx.

39{
40 ATH_CHECK(m_parent.detStore()->retrieve(m_pixelID, "PixelID"));
41 ATH_CHECK(m_parent.detStore()->retrieve(m_stripID, "SCT_ID"));
42
43 ATH_CHECK(m_hostMR.retrieve());
44 ATH_CHECK(m_tracccCellsKey.initialize());
45 ATH_CHECK(m_copiesTool.retrieve());
46
47 ATH_CHECK(m_parent.detStore()->retrieve(m_geoIdMapping, m_geoIdMappingObjectName.value()));
48 ATH_CHECK(m_parent.detStore()->retrieve(m_hostCond, m_hostCondObjectName.value()));
49
50 ATH_MSG_INFO("Built detray→detcond map with "
51 << m_DetrayIdToDetDescrIndexMap.size() << " entries");
52
54
55 return StatusCode::SUCCESS;
56}

◆ 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)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ 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}

◆ passTiming()

bool ActsTrk::RDOtoTracccCellConverterCommons::passTiming ( const std::bitset< 3 > & timePattern) const

Definition at line 162 of file RDOtoTracccCellConverterCommons.cxx.

163{
164 // Convert the given timebin to a bit set and test each bit
165 // if bit is -1 (i.e. X) it always passes, otherwise require exact match of 0/1
166 // N.B. bitset has opposite order to the bit pattern we define
167 if (m_stripRDOTimeBinBits[0] != -1 and timePattern.test(2) != static_cast<bool>(m_stripRDOTimeBinBits[0])) return false;
168 if (m_stripRDOTimeBinBits[1] != -1 and timePattern.test(1) != static_cast<bool>(m_stripRDOTimeBinBits[1])) return false;
169 if (m_stripRDOTimeBinBits[2] != -1 and timePattern.test(0) != static_cast<bool>(m_stripRDOTimeBinBits[2])) return false;
170 return true;
171}

◆ 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 88 of file RDOtoTracccCellConverterCommons.cxx.

92{
93 traccc::edm::silicon_cell_collection::buffer sorted_cells_host_buffer{
94 cells.size(), m_hostMR->mr()};
95 host_copy.setup(sorted_cells_host_buffer)->wait();
96 traccc::edm::silicon_cell_collection::device sorted_cells{sorted_cells_host_buffer};
97 sort_traccc_soa(sorted_cells, cells);
98 return sorted_cells_host_buffer;
99}
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 65 of file RDOtoTracccCellConverterCommons.h.

65{nullptr};

◆ m_copiesTool

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

Definition at line 57 of file RDOtoTracccCellConverterCommons.h.

◆ m_CPUCellSorting

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

Definition at line 68 of file RDOtoTracccCellConverterCommons.h.

◆ m_DetrayIdToDetDescrIndexMap

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

Definition at line 66 of file RDOtoTracccCellConverterCommons.h.

66{};

◆ m_deviceMR

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

Definition at line 56 of file RDOtoTracccCellConverterCommons.h.

◆ m_geoIdMapping

const ActsTrk::GeometryIdMapping* ActsTrk::RDOtoTracccCellConverterCommons::m_geoIdMapping {nullptr}

Definition at line 60 of file RDOtoTracccCellConverterCommons.h.

60{nullptr};

◆ m_geoIdMappingObjectName

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

Definition at line 59 of file RDOtoTracccCellConverterCommons.h.

◆ m_hostCond

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

Definition at line 62 of file RDOtoTracccCellConverterCommons.h.

62{nullptr};

◆ m_hostCondObjectName

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

Definition at line 61 of file RDOtoTracccCellConverterCommons.h.

◆ m_hostMR

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

Definition at line 55 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 50 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 48 of file RDOtoTracccCellConverterCommons.h.

◆ m_nStrip

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

Definition at line 49 of file RDOtoTracccCellConverterCommons.h.

◆ m_parent

AthReentrantAlgorithm& ActsTrk::RDOtoTracccCellConverterCommons::m_parent

Definition at line 44 of file RDOtoTracccCellConverterCommons.h.

◆ m_pixelID

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

Definition at line 52 of file RDOtoTracccCellConverterCommons.h.

52{nullptr};

◆ m_stripID

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

Definition at line 53 of file RDOtoTracccCellConverterCommons.h.

53{nullptr};

◆ m_stripRDOTimeBinBits

int ActsTrk::RDOtoTracccCellConverterCommons::m_stripRDOTimeBinBits[3] {-1, -1, -1}

Definition at line 82 of file RDOtoTracccCellConverterCommons.h.

82{-1, -1, -1};

◆ m_stripRDOTimeBinStr

StringProperty ActsTrk::RDOtoTracccCellConverterCommons::m_stripRDOTimeBinStr

Definition at line 81 of file RDOtoTracccCellConverterCommons.h.

◆ m_tracccCellsKey

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

Definition at line 46 of file RDOtoTracccCellConverterCommons.h.

◆ m_UsePixelToTForCellActivation

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

Definition at line 69 of file RDOtoTracccCellConverterCommons.h.


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