RecoHI
HiJetAlgos
plugins
HiSignalGenJetProducer.cc
Go to the documentation of this file.
1
#include <memory>
2
#include <vector>
3
4
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
5
#include "
FWCore/Framework/interface/global/EDProducer.h
"
6
7
#include "
FWCore/Framework/interface/Event.h
"
8
#include "
FWCore/Framework/interface/MakerMacros.h
"
9
10
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
11
#include "
FWCore/Utilities/interface/InputTag.h
"
12
13
#include "
DataFormats/Common/interface/View.h
"
14
#include "
DataFormats/JetReco/interface/GenJetCollection.h
"
15
#include "
DataFormats/HepMCCandidate/interface/GenParticle.h
"
16
17
class
HiSignalGenJetProducer
:
public
edm::global::EDProducer
<> {
18
public
:
19
explicit
HiSignalGenJetProducer
(
const
edm::ParameterSet
&);
20
~HiSignalGenJetProducer
()
override
=
default
;
21
22
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
&);
23
24
private
:
25
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
26
27
edm::EDGetTokenT<edm::View<reco::GenJet>
>
jetSrc_
;
28
};
29
30
HiSignalGenJetProducer::HiSignalGenJetProducer
(
const
edm::ParameterSet
& iConfig)
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
36
void
HiSignalGenJetProducer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
&)
const
{
37
auto
jets
= std::make_unique<reco::GenJetCollection>();
38
39
edm::Handle<edm::View<reco::GenJet>
> genjets;
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
55
void
HiSignalGenJetProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
56
edm::ParameterSetDescription
desc
;
57
desc
.setComment(
"Selects genJets from collision id = 0"
);
58
desc
.add<
edm::InputTag
>(
"src"
,
edm::InputTag
(
"akHiGenJets"
));
59
descriptions.
addWithDefaultLabel
(
desc
);
60
}
61
62
DEFINE_FWK_MODULE
(
HiSignalGenJetProducer
);
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
Generated for CMSSW Reference Manual by
1.8.16