CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HiSignalParticleProducer(const edm::ParameterSet &)
~HiSignalParticleProducer() override=default
void setComment(std::string const &value)
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< edm::View< reco::GenParticle > > genParticleSrc_