CMS 3D CMS Logo

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

Public Types

using HitsOnHost = TrackingRecHitHost< TrackerTraits >
 
- 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
 

Public Member Functions

 SiPixelRecHitFromSoAAlpaka (const edm::ParameterSet &iConfig)
 
 ~SiPixelRecHitFromSoAAlpaka () 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const 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 Types

using hindex_type = typename TrackerTraits::hindex_type
 
using HitModuleStartArray = typename TrackingRecHitSoA< TrackerTraits >::HitModuleStartArray
 
using HMSstorage = typename std::vector< hindex_type >
 

Private Member Functions

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

Private Attributes

const edm::EDGetTokenT< SiPixelClusterCollectionNewclusterToken_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
const edm::EDGetTokenT< HitsOnHosthitsToken_
 
const edm::EDPutTokenT< HMSstoragehostPutToken_
 
const edm::EDPutTokenT< SiPixelRecHitCollectionrechitsPutToken_
 

Additional Inherited Members

- 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 SiPixelRecHitFromSoAAlpaka< TrackerTraits >

Definition at line 25 of file SiPixelRecHitFromSoAAlpaka.cc.

Member Typedef Documentation

◆ hindex_type

template<typename TrackerTraits >
using SiPixelRecHitFromSoAAlpaka< TrackerTraits >::hindex_type = typename TrackerTraits::hindex_type
private

Definition at line 27 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ HitModuleStartArray

template<typename TrackerTraits >
using SiPixelRecHitFromSoAAlpaka< TrackerTraits >::HitModuleStartArray = typename TrackingRecHitSoA<TrackerTraits>::HitModuleStartArray
private

Definition at line 26 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ HitsOnHost

template<typename TrackerTraits >
using SiPixelRecHitFromSoAAlpaka< TrackerTraits >::HitsOnHost = TrackingRecHitHost<TrackerTraits>

Definition at line 37 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ HMSstorage

template<typename TrackerTraits >
using SiPixelRecHitFromSoAAlpaka< TrackerTraits >::HMSstorage = typename std::vector<hindex_type>
private

Definition at line 28 of file SiPixelRecHitFromSoAAlpaka.cc.

Constructor & Destructor Documentation

◆ SiPixelRecHitFromSoAAlpaka()

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

Definition at line 50 of file SiPixelRecHitFromSoAAlpaka.cc.

52  hitsToken_(consumes(iConfig.getParameter<edm::InputTag>("pixelRecHitSrc"))),
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clusterToken_
const edm::EDPutTokenT< HMSstorage > hostPutToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDPutTokenT< SiPixelRecHitCollection > rechitsPutToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
const edm::EDGetTokenT< HitsOnHost > hitsToken_

◆ ~SiPixelRecHitFromSoAAlpaka()

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

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 58 of file SiPixelRecHitFromSoAAlpaka.cc.

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

58  {
60  desc.add<edm::InputTag>("pixelRecHitSrc", edm::InputTag("siPixelRecHitsPreSplittingAlpaka"));
61  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClustersPreSplitting"));
62  descriptions.addWithDefaultLabel(desc);
63 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 66 of file SiPixelRecHitFromSoAAlpaka.cc.

References cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), edmNew::DetSetVector< T >::FastFiller::emplace_back(), relativeConstraints::geom, edm::EventSetup::getData(), hfClusterShapes_cfi::hits, heavyIonCSV_trainingSettings::idx, iEvent, GeomDet::index(), dqmdumpme::k, LogDebug, edmNew::makeRefTo(), pixelClustering::maxHitsInModule(), SiStripPI::min, eostools::move(), nHits, nhits, gpuClustering::nMaxModules, phase1PixelTopology::numberOfModules, convertSQLitetoXML_cfg::output, and edmNew::DetSetVector< T >::FastFiller::size().

68  {
69  auto const& hits = iEvent.get(hitsToken_);
70  auto nHits = hits.view().metadata().size();
71  LogDebug("SiPixelRecHitFromSoAAlpaka") << "converting " << nHits << " Hits";
72 
73  // allocate a buffer for the indices of the clusters
75 
77  output.reserve(nMaxModules, nHits);
78 
79  HMSstorage hmsp(nMaxModules + 1);
80 
81  if (0 == nHits) {
82  hmsp.clear();
84  iEvent.emplace(hostPutToken_, std::move(hmsp));
85  return;
86  }
87 
88  // fill content of HMSstorage product, and put it into the Event
89  for (unsigned int idx = 0; idx < hmsp.size(); ++idx) {
90  hmsp[idx] = hits.view().hitsModuleStart()[idx];
91  }
92  iEvent.emplace(hostPutToken_, std::move(hmsp));
93 
94  auto xl = hits.view().xLocal();
95  auto yl = hits.view().yLocal();
96  auto xe = hits.view().xerrLocal();
97  auto ye = hits.view().yerrLocal();
98 
99  TrackerGeometry const& geom = iSetup.getData(geomToken_);
100 
101  auto const hclusters = iEvent.getHandle(clusterToken_);
102 
104 
105  int numberOfDetUnits = 0;
106  int numberOfClusters = 0;
107  for (auto const& dsv : *hclusters) {
108  numberOfDetUnits++;
109  unsigned int detid = dsv.detId();
110  DetId detIdObject(detid);
111  const GeomDetUnit* genericDet = geom.idToDetUnit(detIdObject);
112  auto gind = genericDet->index();
113  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
114  assert(pixDet);
115  SiPixelRecHitCollection::FastFiller recHitsOnDetUnit(output, detid);
116  auto fc = hits.view().hitsModuleStart()[gind];
117  auto lc = hits.view().hitsModuleStart()[gind + 1];
118  auto nhits = lc - fc;
119 
120  assert(lc > fc);
121  LogDebug("SiPixelRecHitFromSoAAlpaka") << "in det " << gind << ": conv " << nhits << " hits from " << dsv.size()
122  << " legacy clusters" << ' ' << fc << ',' << lc << "\n";
123  if (nhits > maxHitsInModule)
124  edm::LogWarning("SiPixelRecHitFromSoAAlpaka")
125  .format("Too many clusters {} in module {}. Only the first {} hits will be converted",
126  nhits,
127  gind,
129 
131 
132  LogDebug("SiPixelRecHitFromSoAAlpaka") << "in det " << gind << "conv " << nhits << " hits from " << dsv.size()
133  << " legacy clusters" << ' ' << lc << ',' << fc;
134 
135  if (0 == nhits)
136  continue;
137  auto jnd = [&](int k) { return fc + k; };
138  assert(nhits <= dsv.size());
139  if (nhits != dsv.size()) {
140  edm::LogWarning("GPUHits2CPU") << "nhits!= nclus " << nhits << ' ' << dsv.size();
141  }
142  for (auto const& clust : dsv) {
143  assert(clust.originalId() >= 0);
144  assert(clust.originalId() < dsv.size());
145  if (clust.originalId() >= nhits)
146  continue;
147  auto ij = jnd(clust.originalId());
148  LocalPoint lp(xl[ij], yl[ij]);
149  LocalError le(xe[ij], 0, ye[ij]);
151 
152  numberOfClusters++;
153 
154  /* cpu version.... (for reference)
155  std::tuple<LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType> tuple = cpe_->getParameters( clust, *genericDet );
156  LocalPoint lp( std::get<0>(tuple) );
157  LocalError le( std::get<1>(tuple) );
158  SiPixelRecHitQuality::QualWordType rqw( std::get<2>(tuple) );
159  */
160 
161  // Create a persistent edm::Ref to the cluster
163  // Make a RecHit and add it to the DetSet
164  recHitsOnDetUnit.emplace_back(lp, le, rqw, *genericDet, cluster);
165  // =============================
166 
167  LogDebug("SiPixelRecHitFromSoAAlpaka") << "cluster " << numberOfClusters << " at " << lp << ' ' << le;
168 
169  } // <-- End loop on Clusters
170 
171  // LogDebug("SiPixelRecHitGPU")
172  LogDebug("SiPixelRecHitFromSoAAlpaka") << "found " << recHitsOnDetUnit.size() << " RecHits on " << detid;
173 
174  } // <-- End loop on DetUnits
175 
176  LogDebug("SiPixelRecHitFromSoAAlpaka") << "found " << numberOfDetUnits << " dets, " << numberOfClusters
177  << " clusters";
178 
180 }
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< SiPixelClusterCollectionNew > clusterToken_
int index() const
Definition: GeomDet.h:83
typename std::vector< hindex_type > HMSstorage
const edm::EDPutTokenT< HMSstorage > hostPutToken_
assert(be >=bs)
constexpr uint16_t numberOfModules
int iEvent
Definition: GenABIO.cc:224
const edm::EDPutTokenT< SiPixelRecHitCollection > rechitsPutToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: DetId.h:17
Pixel cluster – collection of neighboring pixels above threshold.
Definition: output.py:1
Log< level::Warning, false > LogWarning
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
const edm::EDGetTokenT< HitsOnHost > hitsToken_
def move(src, dest)
Definition: eostools.py:511
constexpr uint32_t maxHitsInModule()
#define LogDebug(id)

Member Data Documentation

◆ clusterToken_

template<typename TrackerTraits >
const edm::EDGetTokenT<SiPixelClusterCollectionNew> SiPixelRecHitFromSoAAlpaka< TrackerTraits >::clusterToken_
private

Definition at line 44 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ geomToken_

template<typename TrackerTraits >
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelRecHitFromSoAAlpaka< TrackerTraits >::geomToken_
private

Definition at line 42 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ hitsToken_

template<typename TrackerTraits >
const edm::EDGetTokenT<HitsOnHost> SiPixelRecHitFromSoAAlpaka< TrackerTraits >::hitsToken_
private

Definition at line 43 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ hostPutToken_

template<typename TrackerTraits >
const edm::EDPutTokenT<HMSstorage> SiPixelRecHitFromSoAAlpaka< TrackerTraits >::hostPutToken_
private

Definition at line 46 of file SiPixelRecHitFromSoAAlpaka.cc.

◆ rechitsPutToken_

template<typename TrackerTraits >
const edm::EDPutTokenT<SiPixelRecHitCollection> SiPixelRecHitFromSoAAlpaka< TrackerTraits >::rechitsPutToken_
private

Definition at line 45 of file SiPixelRecHitFromSoAAlpaka.cc.