test
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;
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  std::auto_ptr<SiPixelClusterShapeCache> output(new 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(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)
SiPixelClusterShapeCacheProducer(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< InputCollection > token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
assert(m_qm.get())
void determineShape(const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
Definition: ClusterShape.cc:92
data_type const * const_iterator
Definition: DetSetNew.h:30
static std::string const input
Definition: EdmProvDump.cc:44
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
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
const T & get() const
Definition: EventSetup.h:56
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ArrayType size
Definition: ClusterData.h:11