CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
cms::SiPixelRecHitConverter Class Reference
Inheritance diagram for cms::SiPixelRecHitConverter:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c) override
 The "Event" entrypoint: gets called by framework for every event. More...
 
void run (edm::Event &e, edm::Handle< edmNew::DetSetVector< SiPixelCluster >> inputhandle, SiPixelRecHitCollectionNew &output, TrackerGeometry const &geom)
 
 SiPixelRecHitConverter (const edm::ParameterSet &conf)
 Constructor: set the ParameterSet and defer all thinking to setupCPE(). More...
 
 ~SiPixelRecHitConverter () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Types

using HMSstorage = HostProduct< uint32_t[]>
 

Private Attributes

PixelCPEBase const * cpe_ = nullptr
 const PixelClusterParameterEstimator * cpe_; // what we got (for now, one ptr to base class) More...
 
bool m_newCont
 
const edm::InputTag src_
 
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecordtCPE_
 
const edm::EDPutTokenT< HMSstoragetHost_
 
const edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > tPixelCluster_
 
const edm::EDPutTokenT< SiPixelRecHitCollectiontPut_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtTrackerGeom_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 93 of file SiPixelRecHitConverter.cc.

Member Typedef Documentation

◆ HMSstorage

Definition at line 117 of file SiPixelRecHitConverter.cc.

Constructor & Destructor Documentation

◆ SiPixelRecHitConverter()

SiPixelRecHitConverter::SiPixelRecHitConverter ( const edm::ParameterSet conf)
explicit

Constructor: set the ParameterSet and defer all thinking to setupCPE().

Definition at line 134 of file SiPixelRecHitConverter.cc.

135  : src_(conf.getParameter<edm::InputTag>("src")),
137  tPut_(produces<SiPixelRecHitCollection>()),
138  tHost_(produces<HMSstorage>()),
139  tTrackerGeom_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
140  tCPE_(esConsumes<PixelClusterParameterEstimator, TkPixelCPERecord>(
141  edm::ESInputTag("", conf.getParameter<std::string>("CPE")))) {}

◆ ~SiPixelRecHitConverter()

SiPixelRecHitConverter::~SiPixelRecHitConverter ( )
override

Definition at line 144 of file SiPixelRecHitConverter.cc.

144 {}

Member Function Documentation

◆ produce()

void SiPixelRecHitConverter::produce ( edm::Event e,
const edm::EventSetup c 
)
override

The "Event" entrypoint: gets called by framework for every event.

Definition at line 149 of file SiPixelRecHitConverter.cc.

149  {
150  // Step A.1: get input data
152  e.getByToken(tPixelCluster_, input);
153 
154  // Step A.2: get event setup
155  auto const& geom = es.getData(tTrackerGeom_);
156 
157  // Step B: create empty output collection
159 
160  // Step B*: create CPE
161  cpe_ = dynamic_cast<const PixelCPEBase*>(&es.getData(tCPE_));
162 
163  // Step C: Iterate over DetIds and invoke the strip CPE algorithm
164  // on each DetUnit
165 
166  run(e, input, output, geom);
167 
168  output.shrink_to_fit();
169  e.emplace(tPut_, std::move(output));
170  }

References cpe_, MillePedeFileConverter_cfg::e, relativeConstraints::geom, edm::EventSetup::getData(), input, eostools::move(), convertSQLitetoXML_cfg::output, run(), tCPE_, tPixelCluster_, tPut_, and tTrackerGeom_.

◆ run()

void SiPixelRecHitConverter::run ( edm::Event iEvent,
edm::Handle< edmNew::DetSetVector< SiPixelCluster >>  inputhandle,
SiPixelRecHitCollectionNew output,
TrackerGeometry const &  geom 
)

Iterate over DetUnits, then over Clusters and invoke the CPE on each, and make a RecHit to store the result. New interface reading DetSetVector by V.Chiochia (May 30th, 2006)

Definition at line 177 of file SiPixelRecHitConverter.cc.

180  {
181  if (!cpe_) {
182  edm::LogError("SiPixelRecHitConverter") << " at least one CPE is not ready -- can't run!";
183  // TO DO: throw an exception here? The user may want to know...
184  assert(0);
185  return; // clusterizer is invalid, bail out
186  }
187 
188  int numberOfDetUnits = 0;
189  int numberOfClusters = 0;
190 
191  const edmNew::DetSetVector<SiPixelCluster>& input = *inputhandle;
192 
193  // allocate a buffer for the indices of the clusters
194  auto hmsp = std::make_unique<uint32_t[]>(gpuClustering::maxNumModules + 1);
195  // hitsModuleStart is a non-owning pointer to the buffer
196  auto hitsModuleStart = hmsp.get();
197  // fill cluster arrays
198  std::array<uint32_t, gpuClustering::maxNumModules + 1> clusInModule{};
199  for (auto const& dsv : input) {
200  unsigned int detid = dsv.detId();
201  DetId detIdObject(detid);
202  const GeomDetUnit* genericDet = geom.idToDetUnit(detIdObject);
203  auto gind = genericDet->index();
204  // FIXME to be changed to support Phase2
205  if (gind >= int(gpuClustering::maxNumModules))
206  continue;
207  auto const nclus = dsv.size();
208  assert(nclus > 0);
209  clusInModule[gind] = nclus;
210  numberOfClusters += nclus;
211  }
212  hitsModuleStart[0] = 0;
213  assert(clusInModule.size() > gpuClustering::maxNumModules);
214  for (int i = 1, n = clusInModule.size(); i < n; ++i)
215  hitsModuleStart[i] = hitsModuleStart[i - 1] + clusInModule[i - 1];
216  assert(numberOfClusters == int(hitsModuleStart[gpuClustering::maxNumModules]));
217 
218  // wrap the buffer in a HostProduct, and move it to the Event, without reallocating the buffer or affecting hitsModuleStart
219  iEvent.emplace(tHost_, std::move(hmsp));
220 
221  numberOfClusters = 0;
222  for (auto const& dsv : input) {
223  numberOfDetUnits++;
224  unsigned int detid = dsv.detId();
225  DetId detIdObject(detid);
226  const GeomDetUnit* genericDet = geom.idToDetUnit(detIdObject);
227  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
228  assert(pixDet);
229  SiPixelRecHitCollectionNew::FastFiller recHitsOnDetUnit(output, detid);
230 
231  edmNew::DetSet<SiPixelCluster>::const_iterator clustIt = dsv.begin(), clustEnd = dsv.end();
232 
233  for (; clustIt != clustEnd; clustIt++) {
234  numberOfClusters++;
235  std::tuple<LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType> tuple =
236  cpe_->getParameters(*clustIt, *genericDet);
237  LocalPoint lp(std::get<0>(tuple));
238  LocalError le(std::get<1>(tuple));
239  SiPixelRecHitQuality::QualWordType rqw(std::get<2>(tuple));
240  // Create a persistent edm::Ref to the cluster
242  edmNew::makeRefTo(inputhandle, clustIt);
243  // Make a RecHit and add it to the DetSet
244  // old : recHitsOnDetUnit.push_back( new SiPixelRecHit( lp, le, detIdObject, &*clustIt) );
245  SiPixelRecHit hit(lp, le, rqw, *genericDet, cluster);
246  //
247  // Now save it =================
248  recHitsOnDetUnit.push_back(hit);
249  // =============================
250 
251  // std::cout << "SiPixelRecHitConverterVI " << numberOfClusters << ' '<< lp << " " << le << std::endl;
252  } // <-- End loop on Clusters
253 
254  // LogDebug("SiPixelRecHitConverter")
255  //std::cout << "SiPixelRecHitConverterVI "
256  // << " Found " << recHitsOnDetUnit.size() << " RecHits on " << detid //;
257  // << std::endl;
258 
259  } // <-- End loop on DetUnits
260 
261  // LogDebug ("SiPixelRecHitConverter")
262  // std::cout << "SiPixelRecHitConverterVI "
263  // << cpeName_ << " converted " << numberOfClusters
264  // << " SiPixelClusters into SiPixelRecHits, in "
265  // << numberOfDetUnits << " DetUnits." //;
266  // << std::endl;
267  }

References cms::cuda::assert(), cpe_, relativeConstraints::geom, PixelCPEBase::getParameters(), mps_fire::i, iEvent, GeomDet::index(), input, edmNew::makeRefTo(), gpuClustering::maxNumModules, eostools::move(), dqmiodumpmetadata::n, convertSQLitetoXML_cfg::output, edmNew::DetSetVector< T >::FastFiller::push_back(), and tHost_.

Referenced by produce().

Member Data Documentation

◆ cpe_

PixelCPEBase const* cms::SiPixelRecHitConverter::cpe_ = nullptr
private

const PixelClusterParameterEstimator * cpe_; // what we got (for now, one ptr to base class)

Definition at line 121 of file SiPixelRecHitConverter.cc.

Referenced by produce(), and run().

◆ m_newCont

bool cms::SiPixelRecHitConverter::m_newCont
private

Definition at line 128 of file SiPixelRecHitConverter.cc.

◆ src_

const edm::InputTag cms::SiPixelRecHitConverter::src_
private

Definition at line 122 of file SiPixelRecHitConverter.cc.

◆ tCPE_

const edm::ESGetToken<PixelClusterParameterEstimator, TkPixelCPERecord> cms::SiPixelRecHitConverter::tCPE_
private

Definition at line 127 of file SiPixelRecHitConverter.cc.

Referenced by produce().

◆ tHost_

const edm::EDPutTokenT<HMSstorage> cms::SiPixelRecHitConverter::tHost_
private

Definition at line 125 of file SiPixelRecHitConverter.cc.

Referenced by run().

◆ tPixelCluster_

const edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > cms::SiPixelRecHitConverter::tPixelCluster_
private

Definition at line 123 of file SiPixelRecHitConverter.cc.

Referenced by produce().

◆ tPut_

const edm::EDPutTokenT<SiPixelRecHitCollection> cms::SiPixelRecHitConverter::tPut_
private

Definition at line 124 of file SiPixelRecHitConverter.cc.

Referenced by produce().

◆ tTrackerGeom_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> cms::SiPixelRecHitConverter::tTrackerGeom_
private

Definition at line 126 of file SiPixelRecHitConverter.cc.

Referenced by produce().

PixelCPEBase::getParameters
ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const override
Definition: PixelCPEBase.h:133
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
input
static const std::string input
Definition: EdmProvDump.cc:48
cms::SiPixelRecHitConverter::run
void run(edm::Event &e, edm::Handle< edmNew::DetSetVector< SiPixelCluster >> inputhandle, SiPixelRecHitCollectionNew &output, TrackerGeometry const &geom)
Definition: SiPixelRecHitConverter.cc:177
cms::SiPixelRecHitConverter::src_
const edm::InputTag src_
Definition: SiPixelRecHitConverter.cc:122
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
cms::SiPixelRecHitConverter::cpe_
PixelCPEBase const * cpe_
const PixelClusterParameterEstimator * cpe_; // what we got (for now, one ptr to base class)
Definition: SiPixelRecHitConverter.cc:121
GeomDet
Definition: GeomDet.h:27
cms::SiPixelRecHitConverter::tPut_
const edm::EDPutTokenT< SiPixelRecHitCollection > tPut_
Definition: SiPixelRecHitConverter.cc:124
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edmNew::makeRefTo
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)
Definition: DetSetVectorNew.h:704
cms::cuda::assert
assert(be >=bs)
GeomDet::index
int index() const
Definition: GeomDet.h:83
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:28
edm::Handle
Definition: AssociativeIterator.h:50
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
edm::Ref
Definition: AssociativeIterator.h:58
DetId
Definition: DetId.h:17
cms::SiPixelRecHitConverter::tCPE_
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > tCPE_
Definition: SiPixelRecHitConverter.cc:127
SiPixelRecHitQuality::QualWordType
unsigned int QualWordType
Definition: SiPixelRecHitQuality.h:9
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, LocalTag >
gpuClustering::maxNumModules
constexpr uint16_t maxNumModules
Definition: gpuClusteringConstants.h:18
LocalError
Definition: LocalError.h:12
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
cms::SiPixelRecHitConverter::tPixelCluster_
const edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > tPixelCluster_
Definition: SiPixelRecHitConverter.cc:123
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
cms::SiPixelRecHitConverter::tHost_
const edm::EDPutTokenT< HMSstorage > tHost_
Definition: SiPixelRecHitConverter.cc:125
cms::SiPixelRecHitConverter::tTrackerGeom_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tTrackerGeom_
Definition: SiPixelRecHitConverter.cc:126
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31