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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 27 of file GenJetFlavourInfoPreserver.cc.

Constructor & Destructor Documentation

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

Definition at line 44 of file GenJetFlavourInfoPreserver.cc.

44  :
47  genJetFlavourInfosToken_(consumes<reco::JetFlavourInfoMatchingCollection>(iConfig.getParameter<edm::InputTag>("genJetFlavourInfos"))),
48  slimmedGenJetAssociationToken_(consumes<edm::Association<std::vector<reco::GenJet> > >(iConfig.getParameter<edm::InputTag>("slimmedGenJetAssociation")))
49 {
50  produces<reco::JetFlavourInfoMatchingCollection>();
51 }
T getParameter(std::string const &) const
const edm::EDGetTokenT< edm::View< reco::Jet > > slimmedGenJetsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > genJetFlavourInfosToken_
const edm::EDGetTokenT< edm::View< reco::GenJet > > genJetsToken_
const edm::EDGetTokenT< edm::Association< std::vector< reco::GenJet > > > slimmedGenJetAssociationToken_
pat::GenJetFlavourInfoPreserver::~GenJetFlavourInfoPreserver ( )
inlineoverride

Definition at line 30 of file GenJetFlavourInfoPreserver.cc.

References iEvent, and produce().

30 { }

Member Function Documentation

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

Definition at line 54 of file GenJetFlavourInfoPreserver.cc.

References DEFINE_FWK_MODULE, slimmedGenJetsFlavourInfos_cfi::genJetFlavourInfos, genJetFlavourInfosToken_, ttbarCategorization_cff::genJets, genJetsToken_, edm::Event::getByToken(), mps_fire::i, GenHFHadronMatcher_cfi::jetFlavourInfos, eostools::move(), edm::Event::put(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::size(), slimmedGenJetsFlavourInfos_cfi::slimmedGenJetAssociation, slimmedGenJetAssociationToken_, slimmedGenJets_cfi::slimmedGenJets, and slimmedGenJetsToken_.

Referenced by ~GenJetFlavourInfoPreserver().

54  {
55  using namespace edm;
56  using namespace std;
57 
59  iEvent.getByToken(genJetsToken_, genJets);
60 
62  iEvent.getByToken(slimmedGenJetsToken_, slimmedGenJets);
63 
65  iEvent.getByToken(genJetFlavourInfosToken_, genJetFlavourInfos);
66 
68  iEvent.getByToken(slimmedGenJetAssociationToken_, slimmedGenJetAssociation);
69 
70  auto jetFlavourInfos = std::make_unique<reco::JetFlavourInfoMatchingCollection>(reco::JetRefBaseProd(slimmedGenJets));
71  assert(genJets->size() == genJetFlavourInfos->size());
72 
73  edm::Ref<std::vector<reco::GenJet> > slimmedGenJetRef;
74 
75 
76  for (unsigned int i=0; i<genJets->size();++i){
77 
78  slimmedGenJetRef = (*slimmedGenJetAssociation)[genJets->refAt(i)];
79  if(!slimmedGenJetRef) continue;
80  (*jetFlavourInfos)[reco::JetBaseRef(slimmedGenJetRef)] = (*genJetFlavourInfos)[i].second;
81 
82  }
83 
84  iEvent.put(std::move(jetFlavourInfos));
85 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const edm::EDGetTokenT< edm::View< reco::Jet > > slimmedGenJetsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::RefToBaseProd< reco::Jet > JetRefBaseProd
Definition: JetCollection.h:14
edm::RefToBase< Jet > JetBaseRef
Definition: JetCollection.h:13
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > genJetFlavourInfosToken_
const edm::EDGetTokenT< edm::View< reco::GenJet > > genJetsToken_
HLT enums.
const edm::EDGetTokenT< edm::Association< std::vector< reco::GenJet > > > slimmedGenJetAssociationToken_
def move(src, dest)
Definition: eostools.py:510
size_type size() const

Member Data Documentation

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

Definition at line 38 of file GenJetFlavourInfoPreserver.cc.

Referenced by produce().

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

Definition at line 35 of file GenJetFlavourInfoPreserver.cc.

Referenced by produce().

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

Definition at line 39 of file GenJetFlavourInfoPreserver.cc.

Referenced by produce().

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

Definition at line 36 of file GenJetFlavourInfoPreserver.cc.

Referenced by produce().