26 template <
typename TrackerTraits>
50 template <
typename TrackerTraits>
55 clusterThresholds_(iConfig.getParameter<
int>(
"clusterThreshold_layer1"),
56 iConfig.getParameter<
int>(
"clusterThreshold_otherLayers")),
57 produceDigis_(iConfig.getParameter<
bool>(
"produceDigis")),
58 storeDigis_(iConfig.getParameter<
bool>(
"produceDigis") && iConfig.getParameter<
bool>(
"storeDigis")) {
63 template <
typename TrackerTraits>
69 desc.add<
bool>(
"produceDigis",
true);
70 desc.add<
bool>(
"storeDigis",
true);
75 template <
typename TrackerTraits>
79 const auto& digis =
iEvent.get(digiGetToken_);
80 const uint32_t nDigis = digis.size();
81 const auto& ttopo = iSetup.
getData(topoToken_);
84 std::unique_ptr<edm::DetSetVector<PixelDigi>>
collection;
86 collection = std::make_unique<edm::DetSetVector<PixelDigi>>();
89 auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
94 for (uint32_t
i = 0;
i < nDigis;
i++) {
97 if (digis.rawIdArr(
i) == 0)
100 if (digis.adc(
i) == 0)
103 detId = digis.rawIdArr(
i);
106 if ((*detDigis).empty())
107 (*detDigis).data.reserve(64);
115 auto totClustersFilled = 0;
118 auto fillClusters = [&](uint32_t
detId) {
124 for (int32_t ic = 0; ic < nclus + 1; ++ic) {
125 auto const& acluster = aclusters[ic];
128 edm::LogWarning(
"SiPixelDigisClustersFromSoA") <<
"cluster below charge Threshold " 129 <<
"Layer/DetId/clusId " <<
layer <<
'/' <<
detId <<
'/' << ic
130 <<
" size/charge " << acluster.isize <<
'/' << acluster.charge;
132 spc.
emplace_back(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin, ic);
133 aclusters[ic].
clear();
136 const auto& cluster{spc.
back()};
137 LogDebug(
"SiPixelDigisClustersFromSoA")
138 <<
"putting in this cluster " << ic <<
" " << cluster.charge() <<
" " << cluster.pixelADC().size();
154 std::cout <<
"Dumping all digis. nDigis = " << nDigis << std::endl;
157 for (uint32_t
i = 0;
i < nDigis;
i++) {
159 if (digis.rawIdArr(
i) == 0)
162 if (digis.adc(
i) == 0)
164 if (digis.clus(
i) > 9000)
167 assert(digis.rawIdArr(
i) > 109999);
169 if (
detId != digis.rawIdArr(
i)) {
171 std::cout <<
">> Closed module --" <<
detId <<
"; nclus = " << nclus << std::endl;
178 detId = digis.rawIdArr(
i);
181 if ((*detDigis).empty())
182 (*detDigis).data.reserve(64);
185 <<
"Problem det present twice in input! " << (*detDigis).detId();
192 std::cout <<
i <<
";" << digis.rawIdArr(
i) <<
";" << digis.clus(
i) <<
";" << digis.pdigi(
i) <<
";" << digis.adc(
i)
193 <<
";" << dig.row() <<
";" << dig.column() << std::endl;
197 (*detDigis).data.emplace_back(dig);
204 auto row = dig.row();
205 auto col = dig.column();
207 aclusters[digis.clus(
i)].
add(pix, digis.adc(
i));
215 LogDebug(
"SiPixelDigisClustersFromSoA") <<
"filled " << totClustersFilled <<
" clusters";
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
~SiPixelDigisClustersFromSoAT() override=default
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
constexpr uint16_t numberOfModules
constexpr uint16_t clusterThresholdOtherLayers
const SiPixelClusterThresholds clusterThresholds_
#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
SiPixelDigisClustersFromSoAT(const edm::ParameterSet &iConfig)
Pixel cluster – collection of neighboring pixels above threshold.
constexpr int32_t maxNumClustersPerModules
void emplace_back(Args &&... args)
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digiPutToken_
edm::EDGetTokenT< legacy::SiPixelDigisSoA > digiGetToken_
bool add(SiPixelCluster::PixelPos const &p, uint16_t const iadc)
Log< level::Warning, false > LogWarning
edm::EDPutTokenT< SiPixelClusterCollectionNew > clusterPutToken_