CMS 3D CMS Logo

HiSignalGenJetProducer.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <vector>
3 
6 
9 
12 
16 
18 public:
20  ~HiSignalGenJetProducer() override = default;
21 
23 
24 private:
25  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
26 
28 };
29 
31  : jetSrc_(consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("src"))) {
32  std::string alias = (iConfig.getParameter<edm::InputTag>("src")).label();
33  produces<reco::GenJetCollection>().setBranchAlias(alias);
34 }
35 
37  auto jets = std::make_unique<reco::GenJetCollection>();
38 
40  iEvent.getByToken(jetSrc_, genjets);
41 
42  for (const reco::GenJet& jet1 : *genjets) {
43  const reco::GenParticle* gencon = jet1.getGenConstituent(0);
44 
45  if (gencon == nullptr)
46  throw cms::Exception("GenConstituent", "GenJet is missing its constituents");
47  else if (gencon->collisionId() == 0) {
48  jets->push_back(jet1);
49  }
50  }
51 
52  iEvent.put(std::move(jets));
53 }
54 
57  desc.setComment("Selects genJets from collision id = 0");
58  desc.add<edm::InputTag>("src", edm::InputTag("akHiGenJets"));
59  descriptions.addWithDefaultLabel(desc);
60 }
61 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::View< reco::GenJet > > jetSrc_
~HiSignalGenJetProducer() override=default
static void fillDescriptions(edm::ConfigurationDescriptions &)
int iEvent
Definition: GenABIO.cc:224
HiSignalGenJetProducer(const edm::ParameterSet &)
int collisionId() const
Definition: GenParticle.h:36
Jets made from MC generator particles.
Definition: GenJet.h:23
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511