33 using size_type = traccc::edm::silicon_cell_collection::buffer::size_type;
44 size_type nPix = 0, nStrip = 0;
46 for (
const auto* coll : *pixelRDOHandle) {
51 for (
const auto* coll : *stripRDOHandle) {
58 std::bitset<3> timePattern(raw3->
getTimeBin());
59 if (!
m_common.passTiming(timePattern)) {
63 nStrip += rdo->getGroupSize();
68 ATH_MSG_DEBUG(
"Found " << nPix <<
" Pixel RDOs and " << nStrip
69 <<
" Strip RDOs, total " << (nPix + nStrip) <<
" RDOs");
70 size_type
const nCells = nPix + nStrip;
74 auto host_copy =
m_common.m_copiesTool->hostCopy(ctx);
75 traccc::edm::silicon_cell_collection::buffer traccc_cells_host_buffer{
77 host_copy->setup(traccc_cells_host_buffer)->wait();
80 ATH_MSG_DEBUG(
"no input hits — writing empty cell collection");
82 return StatusCode::SUCCESS;
86 traccc::edm::silicon_cell_collection::device cells{traccc_cells_host_buffer};
91 size_type cell_index = 0;
92 uint64_t current_geometry_id = detray::geometry::identifier{}.value();
93 unsigned int current_det_cond_idx = -1;
96 for (
const auto* coll : *pixelRDOHandle) {
105 const std::optional<detray_id_type> geoIdOpt =
m_common.m_geoIdMapping->athenaToDetray(modId);
106 if (!geoIdOpt.has_value()) {
107 ATH_MSG_FATAL(
"No detray id found for Athena identifier " << modId);
108 return StatusCode::FAILURE;
112 if (geoId != current_geometry_id) {
113 current_geometry_id = geoId;
114 std::optional<unsigned int> det_cond_idx_opt =
115 m_common.m_geoIdMapping->detrayToDetDescIndex(current_geometry_id);
116 if (!det_cond_idx_opt.has_value()) {
117 ATH_MSG_FATAL(
"No detector conditions index found for detray identifier " << current_geometry_id);
118 return StatusCode::FAILURE;
120 current_det_cond_idx = det_cond_idx_opt.value();
123 float activation = 1.;
124 if (
m_common.m_UsePixelToTForCellActivation) {
125 activation =
static_cast<float>(rdo->getToT());
126 if (activation == 0.) {
127 ATH_MSG_ERROR(
"input data error: RDO must not have ToT=0; RDO index: "
132 traccc::edm::silicon_cell cell = cells.at(cell_index++);
133 cell.channel0() =
static_cast<uint32_t
>(cellId.
phiIndex());
134 cell.channel1() =
static_cast<uint32_t
>(cellId.
etaIndex());
135 cell.module_index() = current_det_cond_idx;
136 cell.activation() = activation;
142 for (
const auto* coll : *stripRDOHandle) {
145 assert(
dynamic_cast<const SCT3_RawData*
>(rdo)!=
nullptr);
148 std::bitset<3> timePattern(raw3->
getTimeBin());
149 if (!
m_common.passTiming(timePattern)) {
160 const std::optional<detray_id_type> geoIdOpt =
m_common.m_geoIdMapping->athenaToDetray(modId);
161 if (!geoIdOpt.has_value()) {
162 ATH_MSG_FATAL(
"No detray id found for Athena identifier " << modId);
163 return StatusCode::FAILURE;
167 if (geoId != current_geometry_id) {
168 current_geometry_id = geoId;
169 std::optional<unsigned int> det_cond_idx_opt =
170 m_common.m_geoIdMapping->detrayToDetDescIndex(current_geometry_id);
171 if (!det_cond_idx_opt.has_value()) {
172 ATH_MSG_FATAL(
"No detector conditions index found for detray identifier " << current_geometry_id);
173 return StatusCode::FAILURE;
175 current_det_cond_idx = det_cond_idx_opt.value();
178 if (
m_common.m_stripID->barrel_ec(modId) == 0) {
179 for (
int i = 0; i < rdo->getGroupSize(); ++i) {
181 traccc::edm::silicon_cell cell = cells.at(cell_index++);
182 cell.channel0() =
static_cast<uint32_t
>(cellId.
phiIndex() + i);
184 cell.module_index() = current_det_cond_idx;
185 cell.activation() = 1.;
190 for (
int i = 0; i < rdo->getGroupSize(); ++i) {
192 traccc::edm::silicon_cell cell = cells.at(cell_index++);
194 cell.channel1() =
static_cast<uint32_t
>(cellId.
phiIndex() + i);
195 cell.module_index() = current_det_cond_idx;
196 cell.activation() = 1.;
206 traccc::edm::silicon_cell_collection::buffer sorted_cells_host_buffer =
207 m_common.sortCells(*host_copy, cells);
225 <<
m_common.m_tracccCellsKey.key() <<
"'");
226 return StatusCode::SUCCESS;