1 #include <cuda_runtime.h> 3 #include <fmt/printf.h> 27 template <
typename TrackerTraits>
55 template <
typename TrackerTraits>
63 template <
typename TrackerTraits>
72 template <
typename TrackerTraits>
80 auto const& inputData = ctx.get(inputDataWrapped);
82 nHits_ = inputData.nHits();
83 LogDebug(
"SiPixelRecHitFromCUDA") <<
"converting " << nHits_ <<
" Hits";
87 store32_ = inputData.localCoordToHostAsync(ctx.stream());
89 hitsModuleStart_ = inputData.hitsModuleStartToHostAsync(ctx.stream());
92 template <
typename TrackerTraits>
96 auto hmsp = std::make_unique<uint32_t[]>(
nMaxModules + 1);
112 auto xl = store32_.get();
113 auto yl = xl + nHits_;
114 auto xe = yl + nHits_;
115 auto ye = xe + nHits_;
120 auto const&
input = *hclusters;
124 int numberOfDetUnits = 0;
126 for (
auto const& dsv :
input) {
128 unsigned int detid = dsv.detId();
129 DetId detIdObject(detid);
131 auto gind = genericDet->
index();
135 auto fc = hitsModuleStart_[gind];
136 auto lc = hitsModuleStart_[gind + 1];
137 auto nhits = lc - fc;
140 LogDebug(
"SiPixelRecHitFromCUDA") <<
"in det " << gind <<
": conv " <<
nhits <<
" hits from " << dsv.size()
141 <<
" legacy clusters" <<
' ' << fc <<
',' << lc <<
"\n";
144 "Too many clusters %d in module %d. Only the first %d hits will be converted",
nhits, gind,
maxHitsInModule);
147 LogDebug(
"SiPixelRecHitFromCUDA") <<
"in det " << gind <<
"conv " <<
nhits <<
" hits from " << dsv.size()
148 <<
" legacy clusters" <<
' ' << lc <<
',' << fc;
152 auto jnd = [&](
int k) {
return fc +
k; };
154 if (
nhits != dsv.size()) {
157 for (
auto const& clust : dsv) {
158 assert(clust.originalId() >= 0);
159 assert(clust.originalId() < dsv.size());
160 if (clust.originalId() >=
nhits)
162 auto ij = jnd(clust.originalId());
179 recHitsOnDetUnit.
emplace_back(lp, le, rqw, *genericDet, cluster);
187 LogDebug(
"SiPixelRecHitFromCUDA") <<
"found " << recHitsOnDetUnit.
size() <<
" RecHits on " << detid;
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
constexpr int nMaxModules
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::EDPutTokenT< HMSstorage > hostPutToken_
const edm::EDGetTokenT< cms::cuda::Product< HitsOnDevice > > hitsToken_
constexpr uint16_t numberOfModules
static std::string const input
const edm::EDPutTokenT< SiPixelRecHitCollection > rechitsPutToken_
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clusterToken_
cms::cuda::host::unique_ptr< uint32_t[]> hitsModuleStart_
SiPixelRecHitFromCUDAT(const edm::ParameterSet &iConfig)
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
#define DEFINE_FWK_MODULE(type)
cms::cuda::host::unique_ptr< float[]> store32_
Namespace of DDCMS conversion namespace.
~SiPixelRecHitFromCUDAT() override=default
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup) override
Pixel cluster – collection of neighboring pixels above threshold.
unsigned int QualWordType
void emplace_back(Args &&... args)
std::unique_ptr< T, impl::HostDeleter > unique_ptr
Log< level::Warning, false > LogWarning
constexpr uint32_t maxHitsInModule()