CMS 3D CMS Logo

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 
40 };
41 
43  : token_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("src"))), geomToken_(esConsumes()) {
44  if (iConfig.getParameter<bool>("onDemand")) {
45  throw cms::Exception("OnDemandNotAllowed")
46  << "Use of the `onDemand` feature of SiPixelClusterShapeCacheProducer is no longer supported";
47  }
48  produces<SiPixelClusterShapeCache>();
49 }
50 
52 
55  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClusters"));
56  desc.add<bool>("onDemand", false)->setComment("The on demand feature is no longer supported");
57  descriptions.add("siPixelClusterShapeCache", desc);
58 }
59 
62  iEvent.getByToken(token_, input);
63 
64  const auto& geom = &iSetup.getData(geomToken_);
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) {
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 
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)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiPixelClusterShapeCacheProducer(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< InputCollection > token_
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
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
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
int iEvent
Definition: GenABIO.cc:224
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
def move(src, dest)
Definition: eostools.py:511