CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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
< SiPixelClusterCollectionNew
clusterPutToken_
 
const SiPixelClusterThresholds clusterThresholds_
 
edm::EDGetTokenT< SiPixelDigisSoAdigiGetToken_
 
edm::EDPutTokenT
< edm::DetSetVector< PixelDigi > > 
digiPutToken_
 
const bool produceDigis_
 
const bool storeDigis_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
topoToken_
 

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
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< B > consumes (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 () noexcept
 
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...
 
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 23 of file SiPixelDigisClustersFromSoA.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file SiPixelDigisClustersFromSoA.cc.

References edm::ParameterSet::getParameter().

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

Member Function Documentation

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

Definition at line 58 of file SiPixelDigisClustersFromSoA.cc.

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

58  {
60  desc.add<edm::InputTag>("src", edm::InputTag("siPixelDigisSoA"));
61  desc.add<int>("clusterThreshold_layer1", kSiPixelClusterThresholdsDefaultPhase1.layer1);
62  desc.add<int>("clusterThreshold_otherLayers", kSiPixelClusterThresholdsDefaultPhase1.otherLayers);
63  desc.add<bool>("produceDigis", true);
64  desc.add<bool>("storeDigis", true);
65  descriptions.addWithDefaultLabel(desc);
66 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr SiPixelClusterThresholds kSiPixelClusterThresholdsDefaultPhase1
void SiPixelDigisClustersFromSoA::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 68 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_, clusterThresholds_, cuy::col, universalConfigTemplate::collection, edm::DetSet< T >::data, digiGetToken_, digiPutToken_, edmNew::DetSetVector< T >::FastFiller::emplace_back(), edmNew::DetSetVector< T >::FastFiller::empty(), edmNew::DetSetVector< T >::FastFiller::end(), edm::Event::get(), edm::EventSetup::getData(), SiPixelClusterThresholds::getThresholdForLayerOnCondition(), mps_fire::i, phase1PixelTopology::layer, LogDebug, SiStripPI::max, gpuClustering::maxNumClustersPerModules, gpuClustering::maxNumModules, SiPixelCluster::minPixelRow(), eostools::move(), slimmedTrackExtras_cff::outputClusters, produceDigis_, edm::Event::put(), storeDigis_, DetId::subdetId(), and topoToken_.

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

Member Data Documentation

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

Definition at line 38 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

const SiPixelClusterThresholds SiPixelDigisClustersFromSoA::clusterThresholds_
private

Definition at line 40 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

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

Definition at line 35 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

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

Definition at line 37 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

const bool SiPixelDigisClustersFromSoA::produceDigis_
private

Definition at line 42 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

const bool SiPixelDigisClustersFromSoA::storeDigis_
private

Definition at line 43 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().

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

Definition at line 33 of file SiPixelDigisClustersFromSoA.cc.

Referenced by produce().