CMS 3D CMS Logo

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

Public Member Functions

 SiPixelDigisClustersFromSoA (const edm::ParameterSet &iConfig)
 
 ~SiPixelDigisClustersFromSoA () 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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< SiPixelClusterCollectionNewclusterPutToken_
 
const SiPixelClusterThresholds clusterThresholds_
 
edm::EDGetTokenT< SiPixelDigisSoAdigiGetToken_
 
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digiPutToken_
 
const bool isPhase2_
 
const bool produceDigis_
 
const bool storeDigis_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 

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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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

Definition at line 24 of file SiPixelDigisClustersFromSoA.cc.

Constructor & Destructor Documentation

◆ SiPixelDigisClustersFromSoA()

SiPixelDigisClustersFromSoA::SiPixelDigisClustersFromSoA ( const edm::ParameterSet iConfig)
explicit

Definition at line 48 of file SiPixelDigisClustersFromSoA.cc.

References edm::ParameterSet::getParameter().

50  digiGetToken_(consumes<SiPixelDigisSoA>(iConfig.getParameter<edm::InputTag>("src"))),
51  clusterPutToken_(produces<SiPixelClusterCollectionNew>()),
52  clusterThresholds_{iConfig.getParameter<int>("clusterThreshold_layer1"),
53  iConfig.getParameter<int>("clusterThreshold_otherLayers")},
54  produceDigis_(iConfig.getParameter<bool>("produceDigis")),
55  storeDigis_(iConfig.getParameter<bool>("produceDigis") & iConfig.getParameter<bool>("storeDigis")),
56  isPhase2_(iConfig.getParameter<bool>("isPhase2")) {
57  if (produceDigis_)
58  digiPutToken_ = produces<edm::DetSetVector<PixelDigi>>();
59 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digiPutToken_
const SiPixelClusterThresholds clusterThresholds_
edm::EDPutTokenT< SiPixelClusterCollectionNew > clusterPutToken_
edm::EDGetTokenT< SiPixelDigisSoA > digiGetToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_

◆ ~SiPixelDigisClustersFromSoA()

SiPixelDigisClustersFromSoA::~SiPixelDigisClustersFromSoA ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void SiPixelDigisClustersFromSoA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 61 of file SiPixelDigisClustersFromSoA.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_2022v15_cff::InputTag, kSiPixelClusterThresholdsDefaultPhase1, SiPixelClusterThresholds::layer1, and SiPixelClusterThresholds::otherLayers.

61  {
63  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigisSoA"));
64  desc.add<int>("clusterThreshold_layer1", kSiPixelClusterThresholdsDefaultPhase1.layer1);
65  desc.add<int>("clusterThreshold_otherLayers", kSiPixelClusterThresholdsDefaultPhase1.otherLayers);
66  desc.add<bool>("produceDigis", true);
67  desc.add<bool>("storeDigis", true);
68  desc.add<bool>("isPhase2", false);
69  descriptions.addWithDefaultLabel(desc);
70 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
constexpr SiPixelClusterThresholds kSiPixelClusterThresholdsDefaultPhase1

◆ produce()

void SiPixelDigisClustersFromSoA::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 72 of file SiPixelDigisClustersFromSoA.cc.

References edmNew::DetSetVector< T >::FastFiller::abort(), PixelClusterizerBase::AccretionCluster::add(), cms::cuda::assert(), edmNew::DetSetVector< T >::FastFiller::back(), edmNew::DetSetVector< T >::FastFiller::begin(), GetRecoTauVFromDQM_MC_cff::cl2, PixelClusterizerBase::AccretionCluster::clear(), clusterPutToken_, EMEnrichingFilter_cfi::clusterThreshold, clusterThresholds_, cuy::col, universalConfigTemplate::collection, digiGetToken_, digiPutToken_, edmNew::DetSetVector< T >::FastFiller::emplace_back(), edmNew::DetSetVector< T >::FastFiller::empty(), edmNew::DetSetVector< T >::FastFiller::end(), edm::EventSetup::getData(), SiPixelClusterThresholds::getThresholdForLayerOnCondition(), mps_fire::i, iEvent, isPhase2_, phase1PixelTopology::layer, LogDebug, SiStripPI::max, gpuClustering::maxNumClustersPerModules, SiPixelCluster::minPixelRow(), eostools::move(), phase1PixelTopology::numberOfModules, phase2PixelTopology::numberOfModules, slimmedTrackExtras_cff::outputClusters, produceDigis_, storeDigis_, DetId::subdetId(), and topoToken_.

72  {
73  const auto& digis = iEvent.get(digiGetToken_);
74  const uint32_t nDigis = digis.size();
75  const auto& ttopo = iSetup.getData(topoToken_);
77  std::unique_ptr<edm::DetSetVector<PixelDigi>> collection;
78  if (produceDigis_)
79  collection = std::make_unique<edm::DetSetVector<PixelDigi>>();
80  if (storeDigis_)
81  collection->reserve(maxModules);
82  auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
83  outputClusters->reserve(maxModules, nDigis / 2);
84 
85  edm::DetSet<PixelDigi>* detDigis = nullptr;
86  uint32_t detId = 0;
87  for (uint32_t i = 0; i < nDigis; i++) {
88  // check for uninitialized digis
89  // this is set in RawToDigi_kernel in SiPixelRawToClusterGPUKernel.cu
90  if (digis.rawIdArr(i) == 0)
91  continue;
92  // check for noisy/dead pixels (electrons set to 0)
93  if (digis.adc(i) == 0)
94  continue;
95 
96  detId = digis.rawIdArr(i);
97  if (storeDigis_) {
98  detDigis = &collection->find_or_insert(detId);
99  if ((*detDigis).empty())
100  (*detDigis).data.reserve(64); // avoid the first relocations
101  }
102  break;
103  }
104 
105  int32_t nclus = -1;
107 #ifdef EDM_ML_DEBUG
108  auto totClustersFilled = 0;
109 #endif
110 
111  auto fillClusters = [&](uint32_t detId) {
112  if (nclus < 0)
113  return; // this in reality should never happen
115  auto layer = (DetId(detId).subdetId() == 1) ? ttopo.pxbLayer(detId) : 0;
117  for (int32_t ic = 0; ic < nclus + 1; ++ic) {
118  auto const& acluster = aclusters[ic];
119  // in any case we cannot go out of sync with gpu...
120  if (acluster.charge < clusterThreshold and !isPhase2_)
121  edm::LogWarning("SiPixelDigisClustersFromSoA") << "cluster below charge Threshold "
122  << "Layer/DetId/clusId " << layer << '/' << detId << '/' << ic
123  << " size/charge " << acluster.isize << '/' << acluster.charge;
124  // sort by row (x)
125  spc.emplace_back(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin, ic);
126  aclusters[ic].clear();
127 #ifdef EDM_ML_DEBUG
128  ++totClustersFilled;
129  const auto& cluster{spc.back()};
130  LogDebug("SiPixelDigisClustersFromSoA")
131  << "putting in this cluster " << ic << " " << cluster.charge() << " " << cluster.pixelADC().size();
132 #endif
133  std::push_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
134  return cl1.minPixelRow() < cl2.minPixelRow();
135  });
136  }
137  nclus = -1;
138  // sort by row (x)
139  std::sort_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
140  return cl1.minPixelRow() < cl2.minPixelRow();
141  });
142  if (spc.empty())
143  spc.abort();
144  };
145 
146  for (uint32_t i = 0; i < nDigis; i++) {
147  // check for uninitialized digis
148  if (digis.rawIdArr(i) == 0)
149  continue;
150  // check for noisy/dead pixels (electrons set to 0)
151  if (digis.adc(i) == 0)
152  continue;
153  if (digis.clus(i) > 9000)
154  continue; // not in cluster; TODO add an assert for the size
155 #ifdef EDM_ML_DEBUG
156  assert(digis.rawIdArr(i) > 109999);
157 #endif
158  if (detId != digis.rawIdArr(i)) {
159  // new module
160  fillClusters(detId);
161 #ifdef EDM_ML_DEBUG
162  assert(nclus == -1);
163 #endif
164  detId = digis.rawIdArr(i);
165  if (storeDigis_) {
166  detDigis = &collection->find_or_insert(detId);
167  if ((*detDigis).empty())
168  (*detDigis).data.reserve(64); // avoid the first relocations
169  else {
170  edm::LogWarning("SiPixelDigisClustersFromSoA")
171  << "Problem det present twice in input! " << (*detDigis).detId();
172  }
173  }
174  }
175  PixelDigi dig(digis.pdigi(i));
176  if (storeDigis_)
177  (*detDigis).data.emplace_back(dig);
178  // fill clusters
179 #ifdef EDM_ML_DEBUG
180  assert(digis.clus(i) >= 0);
182 #endif
183  nclus = std::max(digis.clus(i), nclus);
184  auto row = dig.row();
185  auto col = dig.column();
186  SiPixelCluster::PixelPos pix(row, col);
187  aclusters[digis.clus(i)].add(pix, digis.adc(i));
188  }
189 
190  // fill final clusters
191  if (detId > 0)
192  fillClusters(detId);
193 
194 #ifdef EDM_ML_DEBUG
195  LogDebug("SiPixelDigisClustersFromSoA") << "filled " << totClustersFilled << " clusters";
196 #endif
197 
198  if (produceDigis_)
201 }
constexpr uint32_t numberOfModules
assert(be >=bs)
constexpr std::array< uint8_t, layerIndexSize > layer
int minPixelRow() const
constexpr int32_t getThresholdForLayerOnCondition(bool isLayer1) const noexcept
int iEvent
Definition: GenABIO.cc:224
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digiPutToken_
const SiPixelClusterThresholds clusterThresholds_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
constexpr int32_t maxNumClustersPerModules
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Definition: DetId.h:17
edm::EDPutTokenT< SiPixelClusterCollectionNew > clusterPutToken_
constexpr uint32_t numberOfModules
edm::EDGetTokenT< SiPixelDigisSoA > digiGetToken_
Pixel cluster – collection of neighboring pixels above threshold.
col
Definition: cuy.py:1009
bool add(SiPixelCluster::PixelPos const &p, uint16_t const iadc)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ clusterPutToken_

edm::EDPutTokenT<SiPixelClusterCollectionNew> SiPixelDigisClustersFromSoA::clusterPutToken_
private

Definition at line 39 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ clusterThresholds_

const SiPixelClusterThresholds SiPixelDigisClustersFromSoA::clusterThresholds_
private

Definition at line 41 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ digiGetToken_

edm::EDGetTokenT<SiPixelDigisSoA> SiPixelDigisClustersFromSoA::digiGetToken_
private

Definition at line 36 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ digiPutToken_

edm::EDPutTokenT<edm::DetSetVector<PixelDigi> > SiPixelDigisClustersFromSoA::digiPutToken_
private

Definition at line 38 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ isPhase2_

const bool SiPixelDigisClustersFromSoA::isPhase2_
private

Definition at line 45 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ produceDigis_

const bool SiPixelDigisClustersFromSoA::produceDigis_
private

Definition at line 43 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ storeDigis_

const bool SiPixelDigisClustersFromSoA::storeDigis_
private

Definition at line 44 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ topoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelDigisClustersFromSoA::topoToken_
private

Definition at line 34 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().