CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::GenJetFlavourInfoPreserver Class Reference

Transfers the JetFlavourInfos from the original GenJets to the slimmedGenJets in MiniAOD. More...

Inheritance diagram for pat::GenJetFlavourInfoPreserver:
edm::stream::EDProducer<>

Public Member Functions

 GenJetFlavourInfoPreserver (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~GenJetFlavourInfoPreserver () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollectiongenJetFlavourInfosToken_
 
const edm::EDGetTokenT< edm::View< reco::GenJet > > genJetsToken_
 
const edm::EDGetTokenT< edm::Association< std::vector< reco::GenJet > > > slimmedGenJetAssociationToken_
 
const edm::EDGetTokenT< edm::View< reco::Jet > > slimmedGenJetsToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Transfers the JetFlavourInfos from the original GenJets to the slimmedGenJets in MiniAOD.

Author
Andrej Saibel, andre.nosp@m.j.sa.nosp@m.ibel@.nosp@m.cern.nosp@m..ch

Definition at line 25 of file GenJetFlavourInfoPreserver.cc.

Constructor & Destructor Documentation

◆ GenJetFlavourInfoPreserver()

pat::GenJetFlavourInfoPreserver::GenJetFlavourInfoPreserver ( const edm::ParameterSet iConfig)
explicit

Definition at line 42 of file GenJetFlavourInfoPreserver.cc.

43  : genJetsToken_(consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("genJets"))),
44  slimmedGenJetsToken_(consumes<edm::View<reco::Jet> >(iConfig.getParameter<edm::InputTag>("slimmedGenJets"))),
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 }

◆ ~GenJetFlavourInfoPreserver()

pat::GenJetFlavourInfoPreserver::~GenJetFlavourInfoPreserver ( )
inlineoverride

Definition at line 28 of file GenJetFlavourInfoPreserver.cc.

28 {}

Member Function Documentation

◆ produce()

void pat::GenJetFlavourInfoPreserver::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 52 of file GenJetFlavourInfoPreserver.cc.

52  {
53  using namespace edm;
54  using namespace std;
55 
57  iEvent.getByToken(genJetsToken_, genJets);
58 
61 
64 
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 }

References cms::cuda::assert(), slimmedGenJetsFlavourInfos_cfi::genJetFlavourInfos, ttbarCategorization_cff::genJets, mps_fire::i, iEvent, GenHFHadronMatcher_cfi::jetFlavourInfos, eostools::move(), slimmedGenJetsFlavourInfos_cfi::slimmedGenJetAssociation, and slimmedGenJets_cfi::slimmedGenJets.

Member Data Documentation

◆ genJetFlavourInfosToken_

const edm::EDGetTokenT<reco::JetFlavourInfoMatchingCollection> pat::GenJetFlavourInfoPreserver::genJetFlavourInfosToken_
private

Definition at line 36 of file GenJetFlavourInfoPreserver.cc.

◆ genJetsToken_

const edm::EDGetTokenT<edm::View<reco::GenJet> > pat::GenJetFlavourInfoPreserver::genJetsToken_
private

Definition at line 33 of file GenJetFlavourInfoPreserver.cc.

◆ slimmedGenJetAssociationToken_

const edm::EDGetTokenT<edm::Association<std::vector<reco::GenJet> > > pat::GenJetFlavourInfoPreserver::slimmedGenJetAssociationToken_
private

Definition at line 37 of file GenJetFlavourInfoPreserver.cc.

◆ slimmedGenJetsToken_

const edm::EDGetTokenT<edm::View<reco::Jet> > pat::GenJetFlavourInfoPreserver::slimmedGenJetsToken_
private

Definition at line 34 of file GenJetFlavourInfoPreserver.cc.

mps_fire.i
i
Definition: mps_fire.py:355
edm
HLT enums.
Definition: AlignableModifier.h:19
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)
pat::GenJetFlavourInfoPreserver::genJetsToken_
const edm::EDGetTokenT< edm::View< reco::GenJet > > genJetsToken_
Definition: GenJetFlavourInfoPreserver.cc:33
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
reco::JetBaseRef
edm::RefToBase< Jet > JetBaseRef
Definition: JetCollection.h:12
edm::View
Definition: CaloClusterFwd.h:14
pat::GenJetFlavourInfoPreserver::slimmedGenJetsToken_
const edm::EDGetTokenT< edm::View< reco::Jet > > slimmedGenJetsToken_
Definition: GenJetFlavourInfoPreserver.cc:34
iEvent
int iEvent
Definition: GenABIO.cc:224
ttbarCategorization_cff.genJets
genJets
Definition: ttbarCategorization_cff.py:29
edm::Association
Definition: Association.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
slimmedGenJets_cfi.slimmedGenJets
slimmedGenJets
Definition: slimmedGenJets_cfi.py:3
slimmedGenJetsFlavourInfos_cfi.genJetFlavourInfos
genJetFlavourInfos
Definition: slimmedGenJetsFlavourInfos_cfi.py:6
GenHFHadronMatcher_cfi.jetFlavourInfos
jetFlavourInfos
Definition: GenHFHadronMatcher_cfi.py:5
edm::InputTag
Definition: InputTag.h:15
edm::RefToBaseProd
Definition: RefToBase.h:65