27 template <
typename TrackerTraits>
48 template <
typename TrackerTraits>
51 digisHostToken_(consumes(iConfig.getParameter<
edm::
InputTag>(
"src"))),
52 clusterThresholds_(iConfig.getParameter<
int>(
"clusterThreshold_layer1"),
53 iConfig.getParameter<
int>(
"clusterThreshold_otherLayers")),
54 produceDigis_(iConfig.getParameter<
bool>(
"produceDigis")),
55 storeDigis_(produceDigis_ && iConfig.getParameter<
bool>(
"storeDigis")),
56 clustersPutToken_(produces()) {
61 template <
typename TrackerTraits>
67 desc.add<
bool>(
"produceDigis",
true);
68 desc.add<
bool>(
"storeDigis",
true);
73 template <
typename TrackerTraits>
77 const auto& digisHost =
iEvent.get(digisHostToken_);
78 const auto& digisView = digisHost.const_view();
79 const uint32_t nDigis = digisHost.nDigis();
81 const auto& ttopo = iSetup.
getData(topoToken_);
84 std::unique_ptr<edm::DetSetVector<PixelDigi>> outputDigis;
86 outputDigis = std::make_unique<edm::DetSetVector<PixelDigi>>();
88 outputDigis->reserve(maxModules);
89 auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
95 for (uint32_t
i = 0;
i < nDigis;
i++) {
98 if (digisView[
i].rawIdArr() == 0)
102 if (digisView[
i].
adc() == 0)
105 detId = digisView[
i].rawIdArr();
107 detDigis = &outputDigis->find_or_insert(
detId);
109 if ((*detDigis).empty())
110 (*detDigis).
data.reserve(64);
119 auto totClustersFilled = 0;
122 auto fillClusters = [&](uint32_t
detId) {
128 for (int32_t ic = 0; ic < nclus + 1; ++ic) {
129 auto const& acluster = aclusters[ic];
133 <<
"cluster below charge Threshold " 134 <<
"Layer/DetId/clusId " <<
layer <<
'/' <<
detId <<
'/' << ic <<
" size/charge " << acluster.isize <<
'/' 135 << acluster.charge <<
"\n";
137 spc.
emplace_back(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin, ic);
138 aclusters[ic].
clear();
141 const auto& cluster{spc.
back()};
143 std::cout <<
"putting in this cluster " << ic <<
" " << cluster.charge() <<
" " << cluster.pixelADC().size()
160 std::cout <<
"Dumping all digis. nDigis = " << nDigis << std::endl;
162 for (uint32_t
i = 0;
i < nDigis;
i++) {
165 std::cout <<
i <<
";" << digisView[
i].rawIdArr() <<
";" << digisView[
i].clus() <<
";" << digisView[
i].pdigi() <<
";" 166 << digisView[
i].adc() <<
";" << dig2.row() <<
";" << dig2.column() << std::endl;
170 if (digisView[
i].rawIdArr() == 0)
173 if (digisView[
i].
adc() == 0)
180 assert(digisView[
i].rawIdArr() > 109999);
182 if (
detId != digisView[
i].rawIdArr()) {
184 std::cout <<
">> Closed module --" <<
detId <<
"; nclus = " << nclus << std::endl;
191 detId = digisView[
i].rawIdArr();
193 detDigis = &outputDigis->find_or_insert(
detId);
194 if ((*detDigis).empty())
195 (*detDigis).
data.reserve(64);
198 <<
"Problem det present twice in input! " << (*detDigis).detId();
205 (*detDigis).data.emplace_back(dig);
208 assert(digisView[
i].clus() >= 0);
211 nclus =
std::max(digisView[
i].clus(), nclus);
212 auto row = dig.row();
213 auto col = dig.column();
215 aclusters[digisView[
i].clus()].
add(pix, digisView[
i].
adc());
223 LogDebug(
"SiPixelDigisClustersFromSoAAlpaka") <<
"filled " << totClustersFilled <<
" clusters";
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr uint16_t clusterThresholdOtherLayers
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const SiPixelClusterThresholds clusterThresholds_
constexpr uint16_t numberOfModules
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > const topoToken_
edm::EDGetTokenT< SiPixelDigisHost > const digisHostToken_
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
constexpr uint16_t clusterThresholdLayerOne
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digisPutToken_
constexpr int invalidClusterId
SiPixelDigisClustersFromSoAAlpaka(const edm::ParameterSet &iConfig)
Pixel cluster – collection of neighboring pixels above threshold.
constexpr int32_t maxNumClustersPerModules
void emplace_back(Args &&... args)
bool add(SiPixelCluster::PixelPos const &p, uint16_t const iadc)
Log< level::Warning, false > LogWarning
~SiPixelDigisClustersFromSoAAlpaka() override=default
edm::EDPutTokenT< SiPixelClusterCollectionNew > clustersPutToken_
constexpr uint16_t invalidModuleId
uint16_t *__restrict__ uint16_t const *__restrict__ adc