CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelClusterShapeCacheProducer.cc
Go to the documentation of this file.
6 
9 
13 
17 
20 
23 
24 #include <cassert>
25 
27 public:
28  explicit SiPixelClusterShapeCacheProducer(const edm::ParameterSet& iConfig);
30 
31  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
32 
33  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
34 
35 private:
37 
39 };
40 
42  : token_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("src"))) {
43  if (iConfig.getParameter<bool>("onDemand")) {
44  throw cms::Exception("OnDemandNotAllowed")
45  << "Use of the `onDemand` feature of SiPixelClusterShapeCacheProducer is no longer supported";
46  }
47  produces<SiPixelClusterShapeCache>();
48 }
49 
51 
54  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClusters"));
55  desc.add<bool>("onDemand", false)->setComment("The on demand feature is no longer supported");
56  descriptions.add("siPixelClusterShapeCache", desc);
57 }
58 
61  iEvent.getByToken(token_, input);
62 
64  iSetup.get<TrackerDigiGeometryRecord>().get(geom);
65 
66  auto output = std::make_unique<SiPixelClusterShapeCache>(input);
67  output->resize(input->data().size());
68 
69  ClusterData data; // reused
70  ClusterShape clusterShape;
71 
72  for (const auto& detSet : *input) {
73  const GeomDetUnit* genericDet = geom->idToDetUnit(detSet.detId());
74  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
75  assert(pixDet);
76 
77  edmNew::DetSet<SiPixelCluster>::const_iterator iCluster = detSet.begin(), endCluster = detSet.end();
78  for (; iCluster != endCluster; ++iCluster) {
79  SiPixelClusterShapeCache::ClusterRef clusterRef = edmNew::makeRefTo(input, iCluster);
80  if (not output->isFilled(clusterRef)) {
81  data.size.clear();
82  clusterShape.determineShape(*pixDet, *iCluster, data);
83  output->insert(clusterRef, data);
84  }
85  }
86  }
87  output->shrink_to_fit();
88 
89  iEvent.put(std::move(output));
90 }
91 
T getParameter(std::string const &) const
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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
SiPixelClusterShapeCacheProducer(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< InputCollection > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void determineShape(const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
Definition: ClusterShape.cc:75
data_type const * const_iterator
Definition: DetSetNew.h:31
static std::string const input
Definition: EdmProvDump.cc:48
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
data_type const * data(size_t cell) const
void clear()
Definition: VecArray.h:73
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
T get() const
Definition: EventSetup.h:73
ArrayType size
Definition: ClusterData.h:10
def move(src, dest)
Definition: eostools.py:511