CMS 3D CMS Logo

GenJetFlavourInfoPreserver.cc
Go to the documentation of this file.
1 
14 
19 
22 
23 namespace pat {
24 
26  public:
27  explicit GenJetFlavourInfoPreserver(const edm::ParameterSet& iConfig);
29 
30  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
31 
32  private:
35 
38  };
39 
40 } // namespace pat
41 
43  : genJetsToken_(consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("genJets"))),
44  slimmedGenJetsToken_(consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("slimmedGenJets"))),
45  genJetFlavourInfosToken_(
46  consumes<reco::JetFlavourInfoMatchingCollection>(iConfig.getParameter<edm::InputTag>("genJetFlavourInfos"))),
47  slimmedGenJetAssociationToken_(consumes<edm::Association<std::vector<reco::GenJet> > >(
48  iConfig.getParameter<edm::InputTag>("slimmedGenJetAssociation"))) {
49  produces<reco::JetFlavourInfoMatchingCollection>();
50 }
51 
53  using namespace edm;
54  using namespace std;
55 
57  iEvent.getByToken(genJetsToken_, genJets);
58 
60  iEvent.getByToken(slimmedGenJetsToken_, slimmedGenJets);
61 
63  iEvent.getByToken(genJetFlavourInfosToken_, genJetFlavourInfos);
64 
66  iEvent.getByToken(slimmedGenJetAssociationToken_, slimmedGenJetAssociation);
67 
68  auto jetFlavourInfos = std::make_unique<reco::JetFlavourInfoMatchingCollection>(reco::JetRefBaseProd(slimmedGenJets));
69  assert(genJets->size() == genJetFlavourInfos->size());
70 
71  edm::Ref<std::vector<reco::GenJet> > slimmedGenJetRef;
72 
73  for (unsigned int i = 0; i < genJets->size(); ++i) {
74  slimmedGenJetRef = (*slimmedGenJetAssociation)[genJets->refAt(i)];
75  if (!slimmedGenJetRef)
76  continue;
77  (*jetFlavourInfos)[reco::JetBaseRef(slimmedGenJetRef)] = (*genJetFlavourInfos)[i].second;
78  }
79 
81 }
82 
84 using namespace pat;
JetFlavourInfo.h
GenJetCollection.h
L1CaloJetHTTProducer_cfi.genJets
genJets
Definition: L1CaloJetHTTProducer_cfi.py:7
pat::GenJetFlavourInfoPreserver::~GenJetFlavourInfoPreserver
~GenJetFlavourInfoPreserver() override
Definition: GenJetFlavourInfoPreserver.cc:28
mps_fire.i
i
Definition: mps_fire.py:428
sistrip::View
View
Definition: ConstantsForView.h:26
edm::EDGetTokenT
Definition: EDGetToken.h:33
JetFlavourInfoMatching.h
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
pat::GenJetFlavourInfoPreserver::genJetFlavourInfosToken_
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > genJetFlavourInfosToken_
Definition: GenJetFlavourInfoPreserver.cc:36
slimmedGenJetsFlavourInfos_cfi.slimmedGenJetAssociation
slimmedGenJetAssociation
Definition: slimmedGenJetsFlavourInfos_cfi.py:7
pat::GenJetFlavourInfoPreserver::slimmedGenJetAssociationToken_
const edm::EDGetTokenT< edm::Association< std::vector< reco::GenJet > > > slimmedGenJetAssociationToken_
Definition: GenJetFlavourInfoPreserver.cc:37
cms::cuda::assert
assert(be >=bs)
EDProducer.h
pat::GenJetFlavourInfoPreserver::genJetsToken_
const edm::EDGetTokenT< edm::View< reco::GenJet > > genJetsToken_
Definition: GenJetFlavourInfoPreserver.cc:33
Jet.h
pat::GenJetFlavourInfoPreserver
Transfers the JetFlavourInfos from the original GenJets to the slimmedGenJets in MiniAOD.
Definition: GenJetFlavourInfoPreserver.cc:25
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
Association.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Jet
Definition: Jet.py:1
JetCollection.h
reco::JetBaseRef
edm::RefToBase< Jet > JetBaseRef
Definition: JetCollection.h:12
pat::GenJetFlavourInfoPreserver::slimmedGenJetsToken_
const edm::EDGetTokenT< edm::View< reco::Jet > > slimmedGenJetsToken_
Definition: GenJetFlavourInfoPreserver.cc:34
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
RefToPtr.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
slimmedGenJets_cfi.slimmedGenJets
slimmedGenJets
Definition: slimmedGenJets_cfi.py:3
slimmedGenJetsFlavourInfos_cfi.genJetFlavourInfos
genJetFlavourInfos
Definition: slimmedGenJetsFlavourInfos_cfi.py:6
GenJet.h
pat::GenJetFlavourInfoPreserver::GenJetFlavourInfoPreserver
GenJetFlavourInfoPreserver(const edm::ParameterSet &iConfig)
Definition: GenJetFlavourInfoPreserver.cc:42
nanoDQM_cfi.GenJet
GenJet
Definition: nanoDQM_cfi.py:299
GenHFHadronMatcher_cfi.jetFlavourInfos
jetFlavourInfos
Definition: GenHFHadronMatcher_cfi.py:5
ParameterSet.h
edm::Event
Definition: Event.h:73
pat::GenJetFlavourInfoPreserver::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: GenJetFlavourInfoPreserver.cc:52
edm::RefToBaseProd
Definition: RefToBase.h:65