81 throw cms::Exception(
"Configuration") <<
"SiPixelRecHitSoAFromLegacy can only use a CPE of type PixelCPEFast";
83 auto const& cpeView = fcpe->getCPUProduct();
94 auto const&
input = *hclusters;
103 auto hmsp = std::make_unique<uint32_t[]>(
nMaxModules + 1);
105 auto hitsModuleStart = hmsp.get();
107 auto hms = std::make_unique<HMSstorage>(
std::move(hmsp));
112 auto legacyOutput = std::make_unique<SiPixelRecHitCollectionNew>();
115 std::vector<uint16_t>
xx;
116 std::vector<uint16_t>
yy;
117 std::vector<uint16_t>
adc;
118 std::vector<uint16_t> moduleInd;
119 std::vector<int32_t> clus;
121 std::vector<edm::Ref<edmNew::DetSetVector<SiPixelCluster>,
SiPixelCluster>> clusterRef;
135 moduleStart_.data(), clusInModule_.data(), &moduleId_, hitsModuleStart};
138 int numberOfClusters = 0;
139 for (
auto const& dsv :
input) {
140 unsigned int detid = dsv.detId();
141 DetId detIdObject(detid);
143 auto gind = genericDet->
index();
145 auto const nclus = dsv.size();
146 clusInModule_[gind] = nclus;
147 numberOfClusters += nclus;
149 hitsModuleStart[0] = 0;
152 hitsModuleStart[
i] = hitsModuleStart[
i - 1] + clusInModule_[
i - 1];
159 auto output = std::make_unique<TrackingRecHit2DCPU>(
160 numberOfClusters,
isPhase2_, hitsModuleStart[
startBPIX2], &cpeView, hitsModuleStart,
nullptr);
163 if (0 == numberOfClusters) {
171 legacyOutput->reserve(
nMaxModules, numberOfClusters);
173 int numberOfDetUnits = 0;
174 int numberOfHits = 0;
175 for (
auto const& dsv :
input) {
177 unsigned int detid = dsv.detId();
178 DetId detIdObject(detid);
180 auto const gind = genericDet->
index();
184 auto const nclus = dsv.size();
185 assert(clusInModule_[gind] == nclus);
189 auto const fc = hitsModuleStart[gind];
190 auto const lc = hitsModuleStart[gind + 1];
192 LogDebug(
"SiPixelRecHitSoAFromLegacy") <<
"in det " << gind <<
": conv " << nclus <<
" hits from " << dsv.size()
193 <<
" legacy clusters" <<
' ' << fc <<
',' << lc;
194 assert((lc - fc) == nclus);
197 "WARNING: too many clusters %d in Module %d. Only first %d Hits converted\n", nclus, gind,
maxHitsInModule);
209 for (
auto const& clust : dsv) {
211 for (
int i = 0, nd = clust.size();
i < nd; ++
i) {
212 auto px = clust.pixel(
i);
215 adc.push_back(
px.adc);
216 moduleInd.push_back(gind);
226 assert(clus.size() == ndigi);
227 numberOfHits += nclus;
230 digiView.
xx_ =
xx.data();
231 digiView.
yy_ =
yy.data();
234 digiView.
clus_ = clus.data();
235 digiView.
pdigi_ =
nullptr;
239 gpuPixelRecHits::getHits(&cpeView, &bsHost, digiView, ndigi, &clusterView,
output->view());
240 for (
auto h = fc;
h < lc; ++
h)
247 for (
auto h = fc;
h < lc; ++
h) {
252 assert(ih < clusterRef.size());
257 recHitsOnDetUnit.push_back(
hit);
262 assert(numberOfHits == numberOfClusters);
267 output->hitsLayerStart()[
i] = hitsModuleStart[cpeView.layerGeometry().layerStart[
i]];
268 LogDebug(
"SiPixelRecHitSoAFromLegacy")
269 <<
"Layer n." <<
i <<
" - starting at module: " << cpeView.layerGeometry().layerStart[
i]
270 <<
" - starts ad cluster: " <<
output->hitsLayerStart()[
i] <<
"\n";
273 cms::cuda::fillManyFromVector(
output->phiBinner(),
279 output->phiBinnerStorage());
281 LogDebug(
"SiPixelRecHitSoAFromLegacy") <<
"created HitSoa for " << numberOfClusters <<
" clusters in " 282 << numberOfDetUnits <<
" Dets";
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)
constexpr int nMaxModules
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
constexpr uint32_t numberOfLayers
constexpr uint32_t layerStart[numberOfLayers+1]
constexpr uint32_t maxHitsInModule()
const edm::EDGetTokenT< reco::BeamSpot > bsGetToken_
constexpr uint32_t numberOfModules
static std::string const input
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
constexpr uint16_t maxNumModules
const uint16_t * adc() const
constexpr uint16_t invalidModuleId
constexpr uint32_t numberOfModules
std::array< uint32_t, gpuClustering::maxNumModules+1 > HitModuleStart
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > cpeToken_
constexpr uint8_t numberOfLayers
Pixel cluster – collection of neighboring pixels above threshold.
unsigned int QualWordType
const edm::EDPutTokenT< HMSstorage > tokenModuleStart_
constexpr uint32_t layerStart[numberOfLayers+1]
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clusterToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const bool convert2Legacy_
uint16_t *__restrict__ uint16_t const *__restrict__ adc