CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiPixelDigisClustersFromSoAAlpaka< TrackerTraits > Class Template Reference
Inheritance diagram for SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SiPixelDigisClustersFromSoAAlpaka (const edm::ParameterSet &iConfig)
 
 ~SiPixelDigisClustersFromSoAAlpaka () override=default
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 

Private Attributes

edm::EDPutTokenT< SiPixelClusterCollectionNewclustersPutToken_
 
const SiPixelClusterThresholds clusterThresholds_
 
edm::EDGetTokenT< SiPixelDigisHost > const digisHostToken_
 
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digisPutToken_
 
const bool produceDigis_
 
const bool storeDigis_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > const topoToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

template<typename TrackerTraits>
class SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >

Definition at line 28 of file SiPixelDigisClustersFromSoAAlpaka.cc.

Constructor & Destructor Documentation

◆ SiPixelDigisClustersFromSoAAlpaka()

template<typename TrackerTraits >
SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::SiPixelDigisClustersFromSoAAlpaka ( const edm::ParameterSet iConfig)
explicit

Definition at line 49 of file SiPixelDigisClustersFromSoAAlpaka.cc.

References SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::digisPutToken_, and SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::produceDigis_.

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")),
57  if (produceDigis_)
58  digisPutToken_ = produces<edm::DetSetVector<PixelDigi>>();
59 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > const topoToken_
edm::EDGetTokenT< SiPixelDigisHost > const digisHostToken_
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digisPutToken_
edm::EDPutTokenT< SiPixelClusterCollectionNew > clustersPutToken_

◆ ~SiPixelDigisClustersFromSoAAlpaka()

template<typename TrackerTraits >
SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::~SiPixelDigisClustersFromSoAAlpaka ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

template<typename TrackerTraits >
void SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 62 of file SiPixelDigisClustersFromSoAAlpaka.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), pixelClustering::clusterThresholdLayerOne, pixelClustering::clusterThresholdOtherLayers, submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

62  {
64  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigisSoA"));
65  desc.add<int>("clusterThreshold_layer1", pixelClustering::clusterThresholdLayerOne);
66  desc.add<int>("clusterThreshold_otherLayers", pixelClustering::clusterThresholdOtherLayers);
67  desc.add<bool>("produceDigis", true);
68  desc.add<bool>("storeDigis", true);
69 
70  descriptions.addWithDefaultLabel(desc);
71 }
constexpr uint16_t clusterThresholdOtherLayers
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
constexpr uint16_t clusterThresholdLayerOne

◆ produce()

template<typename TrackerTraits >
void SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 74 of file SiPixelDigisClustersFromSoAAlpaka.cc.

References edmNew::DetSetVector< T >::FastFiller::abort(), gpuClustering::adc, PixelClusterizerBase::AccretionCluster::add(), cms::cuda::assert(), edmNew::DetSetVector< T >::FastFiller::back(), edmNew::DetSetVector< T >::FastFiller::begin(), GetRecoTauVFromDQM_MC_cff::cl2, PixelClusterizerBase::AccretionCluster::clear(), EMEnrichingFilter_cfi::clusterThreshold, cuy::col, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), gather_cfg::cout, edm::DetSet< T >::data, hcalRecHitTable_cff::detId, edmNew::DetSetVector< T >::FastFiller::emplace_back(), edmNew::DetSetVector< T >::FastFiller::empty(), edmNew::DetSetVector< T >::FastFiller::end(), edm::EventSetup::getData(), mps_fire::i, iEvent, pixelClustering::invalidClusterId, pixelClustering::invalidModuleId, nano_mu_digi_cff::layer, LogDebug, WZElectronSkims53X_cff::max, pixelClustering::maxNumClustersPerModules, SiPixelCluster::minPixelRow(), eostools::move(), phase1PixelTopology::numberOfModules, slimmedTrackExtras_cff::outputClusters, and DetId::subdetId().

76  {
77  const auto& digisHost = iEvent.get(digisHostToken_);
78  const auto& digisView = digisHost.const_view();
79  const uint32_t nDigis = digisHost.nDigis();
80 
81  const auto& ttopo = iSetup.getData(topoToken_);
82  constexpr auto maxModules = TrackerTraits::numberOfModules;
83 
84  std::unique_ptr<edm::DetSetVector<PixelDigi>> outputDigis;
85  if (produceDigis_)
86  outputDigis = std::make_unique<edm::DetSetVector<PixelDigi>>();
87  if (storeDigis_)
88  outputDigis->reserve(maxModules);
89  auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
90  outputClusters->reserve(maxModules, nDigis / 2);
91 
92  edm::DetSet<PixelDigi>* detDigis = nullptr;
93  uint32_t detId = 0;
94 
95  for (uint32_t i = 0; i < nDigis; i++) {
96  // check for uninitialized digis
97  // this is set in RawToDigi_kernel in SiPixelRawToClusterGPUKernel.cu
98  if (digisView[i].rawIdArr() == 0)
99  continue;
100 
101  // check for noisy/dead pixels (electrons set to 0)
102  if (digisView[i].adc() == 0)
103  continue;
104 
105  detId = digisView[i].rawIdArr();
106  if (storeDigis_) {
107  detDigis = &outputDigis->find_or_insert(detId);
108 
109  if ((*detDigis).empty())
110  (*detDigis).data.reserve(64); // avoid the first relocations
111  }
112 
113  break;
114  }
115 
116  int32_t nclus = -1;
118 #ifdef EDM_ML_DEBUG
119  auto totClustersFilled = 0;
120 #endif
121 
122  auto fillClusters = [&](uint32_t detId) {
123  if (nclus < 0)
124  return; // this in reality should never happen
126  auto layer = (DetId(detId).subdetId() == 1) ? ttopo.pxbLayer(detId) : 0;
128  for (int32_t ic = 0; ic < nclus + 1; ++ic) {
129  auto const& acluster = aclusters[ic];
130  // in any case we cannot go out of sync with gpu...
131  if (acluster.charge < clusterThreshold)
132  edm::LogWarning("SiPixelDigisClustersFromSoAAlpaka")
133  << "cluster below charge Threshold "
134  << "Layer/DetId/clusId " << layer << '/' << detId << '/' << ic << " size/charge " << acluster.isize << '/'
135  << acluster.charge << "\n";
136  // sort by row (x)
137  spc.emplace_back(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin, ic);
138  aclusters[ic].clear();
139 #ifdef EDM_ML_DEBUG
140  ++totClustersFilled;
141  const auto& cluster{spc.back()};
142  // LogDebug("SiPixelDigisClustersFromSoAAlpaka")
143  std::cout << "putting in this cluster " << ic << " " << cluster.charge() << " " << cluster.pixelADC().size()
144  << "\n";
145 #endif
146  std::push_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
147  return cl1.minPixelRow() < cl2.minPixelRow();
148  });
149  }
150  nclus = -1;
151  // sort by row (x)
152  std::sort_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
153  return cl1.minPixelRow() < cl2.minPixelRow();
154  });
155  if (spc.empty())
156  spc.abort();
157  };
158 
159 #ifdef GPU_DEBUG
160  std::cout << "Dumping all digis. nDigis = " << nDigis << std::endl;
161 #endif
162  for (uint32_t i = 0; i < nDigis; i++) {
163  // check for uninitialized digis
164  if (digisView[i].rawIdArr() == 0)
165  continue;
166  // check for noisy/dead pixels (electrons set to 0)
167  if (digisView[i].adc() == 0)
168  continue;
169  // not in cluster; TODO add an assert for the size
170  if (digisView[i].clus() == pixelClustering::invalidClusterId) {
171  continue;
172  }
173  // unexpected invalid value
174  if (digisView[i].clus() < pixelClustering::invalidClusterId) {
175  edm::LogError("SiPixelDigisClustersFromSoAAlpaka")
176  << "Skipping pixel digi with unexpected invalid cluster id " << digisView[i].clus();
177  continue;
178  }
179  // from clusters killed by charge cut
180  if (digisView[i].clus() == pixelClustering::invalidModuleId)
181  continue;
182 
183 #ifdef EDM_ML_DEBUG
184  assert(digisView[i].rawIdArr() > 109999);
185 #endif
186  if (detId != digisView[i].rawIdArr()) {
187 #ifdef GPU_DEBUG
188  std::cout << ">> Closed module --" << detId << "; nclus = " << nclus << std::endl;
189 #endif
190  // new module
191  fillClusters(detId);
192 #ifdef EDM_ML_DEBUG
193  assert(nclus == -1);
194 #endif
195  detId = digisView[i].rawIdArr();
196  if (storeDigis_) {
197  detDigis = &outputDigis->find_or_insert(detId);
198  if ((*detDigis).empty())
199  (*detDigis).data.reserve(64); // avoid the first relocations
200  else {
201  edm::LogWarning("SiPixelDigisClustersFromSoAAlpaka")
202  << "Problem det present twice in input! " << (*detDigis).detId();
203  }
204  }
205  }
206  PixelDigi dig{digisView[i].pdigi()};
207 #ifdef GPU_DEBUG
208  std::cout << i << ";" << digisView[i].rawIdArr() << ";" << digisView[i].clus() << ";" << digisView[i].pdigi() << ";"
209  << digisView[i].adc() << ";" << dig.row() << ";" << dig.column() << std::endl;
210 #endif
211 
212  if (storeDigis_)
213  (*detDigis).data.emplace_back(dig);
214  // fill clusters
215 #ifdef EDM_ML_DEBUG
216  assert(digisView[i].clus() >= 0);
217  assert(digisView[i].clus() < static_cast<int>(TrackerTraits::maxNumClustersPerModules));
218 #endif
219  nclus = std::max(digisView[i].clus(), nclus);
220  auto row = dig.row();
221  auto col = dig.column();
222  SiPixelCluster::PixelPos pix(row, col);
223  aclusters[digisView[i].clus()].add(pix, digisView[i].adc());
224  }
225 
226  // fill final clusters
227  if (detId > 0)
228  fillClusters(detId);
229 
230 #ifdef EDM_ML_DEBUG
231  LogDebug("SiPixelDigisClustersFromSoAAlpaka") << "filled " << totClustersFilled << " clusters";
232 #endif
233 
234  if (produceDigis_)
235  iEvent.put(digisPutToken_, std::move(outputDigis));
236 
238 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Log< level::Error, false > LogError
assert(be >=bs)
constexpr uint16_t numberOfModules
int minPixelRow() const
constexpr int32_t getThresholdForLayerOnCondition(bool isLayer1) const noexcept
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > const topoToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< SiPixelDigisHost > const digisHostToken_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digisPutToken_
Definition: DetId.h:17
constexpr int invalidClusterId
collection_type data
Definition: DetSet.h:80
Pixel cluster – collection of neighboring pixels above threshold.
constexpr int32_t maxNumClustersPerModules
col
Definition: cuy.py:1009
bool add(SiPixelCluster::PixelPos const &p, uint16_t const iadc)
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511
edm::EDPutTokenT< SiPixelClusterCollectionNew > clustersPutToken_
constexpr uint16_t invalidModuleId
uint16_t *__restrict__ uint16_t const *__restrict__ adc
#define LogDebug(id)

Member Data Documentation

◆ clustersPutToken_

template<typename TrackerTraits >
edm::EDPutTokenT<SiPixelClusterCollectionNew> SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::clustersPutToken_
private

Definition at line 45 of file SiPixelDigisClustersFromSoAAlpaka.cc.

◆ clusterThresholds_

template<typename TrackerTraits >
const SiPixelClusterThresholds SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::clusterThresholds_
private

Definition at line 40 of file SiPixelDigisClustersFromSoAAlpaka.cc.

◆ digisHostToken_

template<typename TrackerTraits >
edm::EDGetTokenT<SiPixelDigisHost> const SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::digisHostToken_
private

Definition at line 39 of file SiPixelDigisClustersFromSoAAlpaka.cc.

◆ digisPutToken_

template<typename TrackerTraits >
edm::EDPutTokenT<edm::DetSetVector<PixelDigi> > SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::digisPutToken_
private

◆ produceDigis_

template<typename TrackerTraits >
const bool SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::produceDigis_
private

◆ storeDigis_

template<typename TrackerTraits >
const bool SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::storeDigis_
private

Definition at line 42 of file SiPixelDigisClustersFromSoAAlpaka.cc.

◆ topoToken_

template<typename TrackerTraits >
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> const SiPixelDigisClustersFromSoAAlpaka< TrackerTraits >::topoToken_
private

Definition at line 38 of file SiPixelDigisClustersFromSoAAlpaka.cc.