CMS 3D CMS Logo

HGC3DClusterGenMatchSelector.cc
Go to the documentation of this file.
6 
10 
11 namespace l1t {
13  public:
16 
17  private:
20  double dR_;
21  void produce(edm::Event &, const edm::EventSetup &) override;
22 
23  }; // class
24 } // namespace l1t
25 
27  : src_(consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("src"))),
28  genParticleSrc_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("genSrc"))),
29  dR_(iConfig.getParameter<double>("dR")) {
30  produces<l1t::HGCalMulticlusterBxCollection>();
31 }
32 
34  auto out = std::make_unique<l1t::HGCalMulticlusterBxCollection>();
35 
37  iEvent.getByToken(src_, multiclusters);
38 
40  iEvent.getByToken(genParticleSrc_, genParticles);
41 
42  for (int bx = multiclusters->getFirstBX(); bx <= multiclusters->getLastBX(); ++bx) {
43  for (auto it = multiclusters->begin(bx), ed = multiclusters->end(bx); it != ed; ++it) {
44  const auto &multicluster = *it;
45  for (const auto &particle : *genParticles) {
46  if (particle.status() != 1)
47  continue;
48  if (deltaR(multicluster, particle) < dR_) {
49  out->push_back(bx, multicluster);
50  break; // don't save duplicate multiclusters!
51  }
52  }
53  }
54  }
55 
56  iEvent.put(std::move(out));
57 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
delete x;
Definition: CaloConfig.h:22
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &, const edm::EventSetup &) override
HGC3DClusterGenMatchSelector(const edm::ParameterSet &)
edm::EDGetTokenT< l1t::HGCalMulticlusterBxCollection > src_
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511