CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GenericClusterImporter.cc
Go to the documentation of this file.
4 
6 public:
8  : BlockElementImporterBase(conf, cc),
9  _src(cc.consumes<reco::PFClusterCollection>(conf.getParameter<edm::InputTag>("source"))) {}
10 
11  void importToBlock(const edm::Event&, ElementList&) const override;
12 
13 private:
15 };
16 
18 
20  auto clusters = e.getHandle(_src);
21  auto cbegin = clusters->cbegin();
22  auto cend = clusters->cend();
23  for (auto clus = cbegin; clus != cend; ++clus) {
25  reco::PFClusterRef cref(clusters, std::distance(cbegin, clus));
26  switch (clus->layer()) {
27  case PFLayer::PS1:
29  break;
30  case PFLayer::PS2:
32  break;
36  break;
40  break;
43  break;
44  case PFLayer::HF_EM:
46  break;
47  case PFLayer::HF_HAD:
49  break;
50  case PFLayer::HGCAL:
52  break;
53  default:
54  throw cms::Exception("InvalidPFLayer") << "Layer given, " << clus->layer() << " is not a valid PFLayer!";
55  }
56  reco::PFBlockElement* cptr = new reco::PFBlockElementCluster(cref, type);
57  elems.emplace_back(cptr);
58  }
59 }
Abstract base class for a PFBlock element (track, cluster...)
void importToBlock(const edm::Event &, ElementList &) const override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
std::vector< l1t::PFCluster > PFClusterCollection
Definition: PFCluster.h:73
GenericClusterImporter(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
edm::EDGetTokenT< reco::PFClusterCollection > _src