CMS 3D CMS Logo

HiSignalParticleProducer.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <vector>
3 
6 
9 
12 
17 
19 public:
21  ~HiSignalParticleProducer() override = default;
22 
24 
25 private:
26  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
27 
29 };
30 
32  : genParticleSrc_(consumes<edm::View<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("src"))) {
33  std::string alias = (iConfig.getParameter<edm::InputTag>("src")).label();
34  produces<reco::GenParticleCollection>().setBranchAlias(alias);
35 }
36 
38  auto signalGenParticles = std::make_unique<reco::GenParticleCollection>();
39 
41  iEvent.getByToken(genParticleSrc_, genParticles);
42 
43  for (const reco::GenParticle& genParticle : *genParticles) {
44  if (genParticle.collisionId() == 0) {
45  signalGenParticles->push_back(genParticle);
46  }
47  }
48 
49  iEvent.put(std::move(signalGenParticles));
50 }
51 
54  desc.setComment("Selects genParticles from collision id = 0");
55  desc.add<edm::InputTag>("src", edm::InputTag("genParticles"));
56  descriptions.addWithDefaultLabel(desc);
57 }
58 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HiSignalParticleProducer(const edm::ParameterSet &)
~HiSignalParticleProducer() override=default
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &)
fixed size matrix
HLT enums.
edm::EDGetTokenT< edm::View< reco::GenParticle > > genParticleSrc_
def move(src, dest)
Definition: eostools.py:511