1 #include <cuda_runtime.h>
3 #include <fmt/printf.h>
73 auto const& inputData = ctx.get(inputDataWrapped);
75 nHits_ = inputData.nHits();
77 LogDebug(
"SiPixelRecHitFromCUDA") <<
"converting " <<
nHits_ <<
" Hits";
81 store32_ = inputData.localCoordToHostAsync(ctx.stream());
111 auto const&
input = *hclusters;
115 int numberOfDetUnits = 0;
116 int numberOfClusters = 0;
117 for (
auto const& dsv :
input) {
119 unsigned int detid = dsv.detId();
120 DetId detIdObject(detid);
122 auto gind = genericDet->
index();
128 auto nhits = lc - fc;
131 LogDebug(
"SiPixelRecHitFromCUDA") <<
"in det " << gind <<
": conv " <<
nhits <<
" hits from " << dsv.size()
132 <<
" legacy clusters" <<
' ' << fc <<
',' << lc;
133 if (
nhits > maxHitsInModule)
135 "Too many clusters %d in module %d. Only the first %d hits will be converted",
nhits, gind, maxHitsInModule);
138 LogDebug(
"SiPixelRecHitFromCUDA") <<
"in det " << gind <<
"conv " <<
nhits <<
" hits from " << dsv.size()
139 <<
" legacy clusters" <<
' ' << lc <<
',' << fc;
143 auto jnd = [&](
int k) {
return fc +
k; };
145 if (
nhits != dsv.size()) {
148 for (
auto const& clust : dsv) {
149 assert(clust.originalId() >= 0);
150 assert(clust.originalId() < dsv.size());
151 if (clust.originalId() >=
nhits)
153 auto ij = jnd(clust.originalId());
170 recHitsOnDetUnit.
emplace_back(lp, le, rqw, *genericDet, cluster);
173 LogDebug(
"SiPixelRecHitFromCUDA") <<
"cluster " << numberOfClusters <<
" at " << lp <<
' ' << le;
178 LogDebug(
"SiPixelRecHitFromCUDA") <<
"found " << recHitsOnDetUnit.
size() <<
" RecHits on " << detid;
182 LogDebug(
"SiPixelRecHitFromCUDA") <<
"found " << numberOfDetUnits <<
" dets, " << numberOfClusters <<
" clusters";
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clusterToken_
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)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
#define DEFINE_FWK_MODULE(type)
~SiPixelRecHitFromCUDA() override=default
constexpr uint32_t maxHitsInModule()
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static std::string const input
bool getData(T &iHolder) const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
cms::cuda::host::unique_ptr< float[]> store32_
SiPixelRecHitFromCUDA(const edm::ParameterSet &iConfig)
bool get(ProductID const &oid, Handle< PROD > &result) const
constexpr uint16_t maxNumModules
void acquire(edm::Event const &iEvent, edm::EventSetup const &iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup) override
const edm::EDGetTokenT< cms::cuda::Product< TrackingRecHit2DGPU > > hitsToken_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
cms::cuda::host::unique_ptr< uint32_t[]> hitsModuleStart_
Pixel cluster – collection of neighboring pixels above threshold.
unsigned int QualWordType
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
void emplace_back(Args &&...args)
std::unique_ptr< T, impl::HostDeleter > unique_ptr
const edm::EDPutTokenT< HMSstorage > hostPutToken_
Log< level::Warning, false > LogWarning
const edm::EDPutTokenT< SiPixelRecHitCollection > rechitsPutToken_