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 
edm::StreamID
Definition: StreamID.h:30
GenJetCollection.h
reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
reco::GenParticle::collisionId
int collisionId() const
Definition: GenParticle.h:36
HiSignalGenJetProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: HiSignalGenJetProducer.cc:55
sistrip::View
View
Definition: ConstantsForView.h:26
reco::GenParticle
Definition: GenParticle.h:21
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HiSignalGenJetProducer
Definition: HiSignalGenJetProducer.cc:17
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
HiSignalGenJetProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HiSignalGenJetProducer.cc:36
edm::Handle
Definition: AssociativeIterator.h:50
GenParticle.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HiSignalGenJetProducer::~HiSignalGenJetProducer
~HiSignalGenJetProducer() override=default
Frameworkfwd.h
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
Exception
Definition: hltDiff.cc:245
HiSignalGenJetProducer::jetSrc_
edm::EDGetTokenT< edm::View< reco::GenJet > > jetSrc_
Definition: HiSignalGenJetProducer.cc:27
HiSignalGenJetProducer::HiSignalGenJetProducer
HiSignalGenJetProducer(const edm::ParameterSet &)
Definition: HiSignalGenJetProducer.cc:30
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
nanoDQM_cfi.GenJet
GenJet
Definition: nanoDQM_cfi.py:299
View.h
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87