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 
39 };
40 
42  token_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("src")))
43 {
44  if(iConfig.getParameter<bool>("onDemand")) {
45  throw cms::Exception("OnDemandNotAllowed")<<"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 
70  ClusterData data; // reused
71  ClusterShape clusterShape;
72 
73  for(const auto& detSet: *input) {
74  const GeomDetUnit *genericDet = geom->idToDetUnit(detSet.detId());
75  const PixelGeomDetUnit *pixDet = dynamic_cast<const PixelGeomDetUnit *>(genericDet);
76  assert(pixDet);
77 
78  edmNew::DetSet<SiPixelCluster>::const_iterator iCluster = detSet.begin(), endCluster = detSet.end();
79  for(; iCluster != endCluster; ++iCluster) {
80  SiPixelClusterShapeCache::ClusterRef clusterRef = edmNew::makeRefTo(input, iCluster);
81  if(not output->isFilled(clusterRef)) {
82  data.size.clear();
83  clusterShape.determineShape(*pixDet,*iCluster, data);
84  output->insert(clusterRef,data);
85  }
86  }
87  }
88  output->shrink_to_fit();
89 
90  iEvent.put(std::move(output));
91 }
92 
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:125
SiPixelClusterShapeCacheProducer(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< InputCollection > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void determineShape(const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
Definition: ClusterShape.cc:80
data_type const * const_iterator
Definition: DetSetNew.h:30
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:82
T get() const
Definition: EventSetup.h:71
ArrayType size
Definition: ClusterData.h:11
def move(src, dest)
Definition: eostools.py:511