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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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 edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 23 of file SiPixelDigisClustersFromSoA.cc.

Constructor & Destructor Documentation

◆ SiPixelDigisClustersFromSoA()

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

Definition at line 43 of file SiPixelDigisClustersFromSoA.cc.

45  digiGetToken_(consumes<SiPixelDigisSoA>(iConfig.getParameter<edm::InputTag>("src"))),
47  clusterPutToken_(produces<SiPixelClusterCollectionNew>()),
48  clusterThresholds_{iConfig.getParameter<int>("clusterThreshold_layer1"),
49  iConfig.getParameter<int>("clusterThreshold_otherLayers")} {}

References edm::ParameterSet::getParameter().

◆ ~SiPixelDigisClustersFromSoA()

SiPixelDigisClustersFromSoA::~SiPixelDigisClustersFromSoA ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 59 of file SiPixelDigisClustersFromSoA.cc.

59  {
60  const auto& digis = iEvent.get(digiGetToken_);
61  const uint32_t nDigis = digis.size();
62  const auto& ttopo = iSetup.getData(topoToken_);
63 
64  auto collection = std::make_unique<edm::DetSetVector<PixelDigi>>();
65  auto outputClusters = std::make_unique<SiPixelClusterCollectionNew>();
66  outputClusters->reserve(gpuClustering::maxNumModules, nDigis / 4);
67 
68  edm::DetSet<PixelDigi>* detDigis = nullptr;
69  for (uint32_t i = 0; i < nDigis; i++) {
70  if (digis.pdigi(i) == 0)
71  continue;
72  detDigis = &collection->find_or_insert(digis.rawIdArr(i));
73  if ((*detDigis).empty())
74  (*detDigis).data.reserve(64); // avoid the first relocations
75  break;
76  }
77 
78  int32_t nclus = -1;
79  std::vector<PixelClusterizerBase::AccretionCluster> aclusters(gpuClustering::maxNumClustersPerModules);
80 #ifdef EDM_ML_DEBUG
81  auto totClustersFilled = 0;
82 #endif
83 
84  auto fillClusters = [&](uint32_t detId) {
85  if (nclus < 0)
86  return; // this in reality should never happen
88  auto layer = (DetId(detId).subdetId() == 1) ? ttopo.pxbLayer(detId) : 0;
90  for (int32_t ic = 0; ic < nclus + 1; ++ic) {
91  auto const& acluster = aclusters[ic];
92  // in any case we cannot go out of sync with gpu...
93  if (acluster.charge < clusterThreshold)
94  edm::LogWarning("SiPixelDigisClustersFromSoA") << "cluster below charge Threshold "
95  << "Layer/DetId/clusId " << layer << '/' << detId << '/' << ic
96  << " size/charge " << acluster.isize << '/' << acluster.charge;
97  SiPixelCluster cluster(acluster.isize, acluster.adc, acluster.x, acluster.y, acluster.xmin, acluster.ymin, ic);
98 #ifdef EDM_ML_DEBUG
99  ++totClustersFilled;
100 #endif
101  LogDebug("SiPixelDigisClustersFromSoA")
102  << "putting in this cluster " << ic << " " << cluster.charge() << " " << cluster.pixelADC().size();
103  // sort by row (x)
104  spc.push_back(std::move(cluster));
105  std::push_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
106  return cl1.minPixelRow() < cl2.minPixelRow();
107  });
108  }
109  for (int32_t ic = 0; ic < nclus + 1; ++ic)
110  aclusters[ic].clear();
111  nclus = -1;
112  // sort by row (x)
113  std::sort_heap(spc.begin(), spc.end(), [](SiPixelCluster const& cl1, SiPixelCluster const& cl2) {
114  return cl1.minPixelRow() < cl2.minPixelRow();
115  });
116  if (spc.empty())
117  spc.abort();
118  };
119 
120  for (uint32_t i = 0; i < nDigis; i++) {
121  if (digis.pdigi(i) == 0)
122  continue;
123  if (digis.clus(i) > 9000)
124  continue; // not in cluster; TODO add an assert for the size
125  assert(digis.rawIdArr(i) > 109999);
126  if ((*detDigis).detId() != digis.rawIdArr(i)) {
127  fillClusters((*detDigis).detId());
128  assert(nclus == -1);
129  detDigis = &collection->find_or_insert(digis.rawIdArr(i));
130  if ((*detDigis).empty())
131  (*detDigis).data.reserve(64); // avoid the first relocations
132  else {
133  edm::LogWarning("SiPixelDigisClustersFromSoA") << "Problem det present twice in input! " << (*detDigis).detId();
134  }
135  }
136  (*detDigis).data.emplace_back(digis.pdigi(i));
137  auto const& dig = (*detDigis).data.back();
138  // fill clusters
139  assert(digis.clus(i) >= 0);
141  nclus = std::max(digis.clus(i), nclus);
142  auto row = dig.row();
143  auto col = dig.column();
144  SiPixelCluster::PixelPos pix(row, col);
145  aclusters[digis.clus(i)].add(pix, digis.adc(i));
146  }
147 
148  // fill final clusters
149  if (detDigis)
150  fillClusters((*detDigis).detId());
151 #ifdef EDM_ML_DEBUG
152  LogDebug("SiPixelDigisClustersFromSoA") << "filled " << totClustersFilled << " clusters";
153 #endif
154 
157 }

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

Member Data Documentation

◆ clusterPutToken_

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

Definition at line 38 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ clusterThresholds_

const SiPixelClusterThresholds SiPixelDigisClustersFromSoA::clusterThresholds_
private

Definition at line 40 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ digiGetToken_

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

Definition at line 35 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ digiPutToken_

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

Definition at line 37 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

◆ topoToken_

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

Definition at line 33 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

edm::DetSetVector
Definition: DetSetVector.h:61
SiPixelClusterThresholds::getThresholdForLayerOnCondition
constexpr int32_t getThresholdForLayerOnCondition(bool isLayer1) const noexcept
Definition: SiPixelClusterThresholds.h:5
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelDigisClustersFromSoA::digiGetToken_
edm::EDGetTokenT< SiPixelDigisSoA > digiGetToken_
Definition: SiPixelDigisClustersFromSoA.cc:35
edm::DetSet
Definition: DetSet.h:23
SiPixelDigisClustersFromSoA::topoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: SiPixelDigisClustersFromSoA.cc:33
cuy.col
col
Definition: cuy.py:1010
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SiPixelDigisClustersFromSoA::clusterThresholds_
const SiPixelClusterThresholds clusterThresholds_
Definition: SiPixelDigisClustersFromSoA.cc:40
cms::cuda::assert
assert(be >=bs)
SiPixelDigisClustersFromSoA::digiPutToken_
edm::EDPutTokenT< edm::DetSetVector< PixelDigi > > digiPutToken_
Definition: SiPixelDigisClustersFromSoA.cc:37
GetRecoTauVFromDQM_MC_cff.cl2
cl2
Definition: GetRecoTauVFromDQM_MC_cff.py:44
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:28
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
DetId
Definition: DetId.h:17
kSiPixelClusterThresholdsDefaultPhase1
constexpr SiPixelClusterThresholds kSiPixelClusterThresholdsDefaultPhase1
Definition: SiPixelClusterThresholds.h:12
SiPixelCluster::minPixelRow
int minPixelRow() const
Definition: SiPixelCluster.h:142
slimmedTrackExtras_cff.outputClusters
outputClusters
Definition: slimmedTrackExtras_cff.py:14
EMEnrichingFilter_cfi.clusterThreshold
clusterThreshold
Definition: EMEnrichingFilter_cfi.py:12
gpuClustering::maxNumModules
constexpr uint16_t maxNumModules
Definition: gpuClusteringConstants.h:29
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
clear
void clear(HadCaloObj &c)
Definition: data.h:124
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
iEvent
int iEvent
Definition: GenABIO.cc:224
gpuClustering::maxNumClustersPerModules
constexpr int32_t maxNumClustersPerModules
Definition: gpuClusteringConstants.h:30
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
SiPixelDigisClustersFromSoA::clusterPutToken_
edm::EDPutTokenT< SiPixelClusterCollectionNew > clusterPutToken_
Definition: SiPixelDigisClustersFromSoA.cc:38
SiPixelClusterThresholds::otherLayers
const int32_t otherLayers
Definition: SiPixelClusterThresholds.h:9
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::ProductRegistryHelper::produces
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
Definition: ProductRegistryHelper.h:108
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiPixelClusterThresholds::layer1
const int32_t layer1
Definition: SiPixelClusterThresholds.h:8
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
edm::EDConsumerBase::esConsumes
auto esConsumes()
Definition: EDConsumerBase.h:202
SiPixelCluster::PixelPos
Definition: SiPixelCluster.h:53
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87