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 | 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
 
edm::InputTag const src_
 
edm::ESGetToken
< PixelClusterParameterEstimator,
TkPixelCPERecord > const 
tCPE_
 
edm::EDPutTokenT< HMSstorage >
const 
tHost_
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiPixelCluster > > const 
tPixelCluster_
 
edm::EDPutTokenT
< SiPixelRecHitCollection >
const 
tPut_
 
edm::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord >
const 
tTrackerGeom_
 

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

Definition at line 117 of file SiPixelRecHitConverter.cc.

Constructor & Destructor Documentation

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")))) {}
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > const tPixelCluster_
edm::EDPutTokenT< HMSstorage > const tHost_
edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > const tCPE_
edm::EDPutTokenT< SiPixelRecHitCollection > const tPut_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
SiPixelRecHitConverter::~SiPixelRecHitConverter ( )
override

Definition at line 144 of file SiPixelRecHitConverter.cc.

144 {}

Member Function Documentation

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.

References cpe_, edm::Event::emplace(), relativeConstraints::geom, edm::Event::getByToken(), edm::EventSetup::getData(), input, eostools::move(), convertSQLitetoXML_cfg::output, run(), edmNew::DetSetVector< T >::shrink_to_fit(), tCPE_, tPixelCluster_, tPut_, and tTrackerGeom_.

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  }
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > const tPixelCluster_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > const tCPE_
static std::string const input
Definition: EdmProvDump.cc:47
def move
Definition: eostools.py:511
edm::EDPutTokenT< SiPixelRecHitCollection > const tPut_
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
void run(edm::Event &e, edm::Handle< edmNew::DetSetVector< SiPixelCluster >> inputhandle, SiPixelRecHitCollectionNew &output, TrackerGeometry const &geom)
PixelCPEBase const * cpe_
const PixelClusterParameterEstimator * cpe_; // what we got (for now, one ptr to base class) ...
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > const tTrackerGeom_
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.

References cms::cuda::assert(), cpe_, edm::Event::emplace(), PixelCPEBase::getParameters(), mps_fire::i, TrackerGeometry::idToDetUnit(), GeomDet::index(), input, edmNew::makeRefTo(), gpuClustering::maxNumModules, eostools::move(), dqmiodumpmetadata::n, edmNew::DetSetVector< T >::FastFiller::push_back(), and tHost_.

Referenced by produce().

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  }
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)
edm::EDPutTokenT< HMSstorage > const tHost_
data_type const * const_iterator
Definition: DetSetNew.h:31
Log< level::Error, false > LogError
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:47
def move
Definition: eostools.py:511
ReturnType getParameters(const SiPixelCluster &cl, const GeomDetUnit &det) const override
Definition: PixelCPEBase.h:133
constexpr uint16_t maxNumModules
int index() const
Definition: GeomDet.h:83
Definition: DetId.h:17
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
Definition: Event.h:433
Pixel cluster – collection of neighboring pixels above threshold.
PixelCPEBase const * cpe_
const PixelClusterParameterEstimator * cpe_; // what we got (for now, one ptr to base class) ...
Our base class.
Definition: SiPixelRecHit.h:23

Member Data Documentation

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().

bool cms::SiPixelRecHitConverter::m_newCont
private

Definition at line 128 of file SiPixelRecHitConverter.cc.

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

Definition at line 122 of file SiPixelRecHitConverter.cc.

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

Definition at line 127 of file SiPixelRecHitConverter.cc.

Referenced by produce().

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

Definition at line 125 of file SiPixelRecHitConverter.cc.

Referenced by run().

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

Definition at line 123 of file SiPixelRecHitConverter.cc.

Referenced by produce().

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

Definition at line 124 of file SiPixelRecHitConverter.cc.

Referenced by produce().

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

Definition at line 126 of file SiPixelRecHitConverter.cc.

Referenced by produce().