CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GenJetFlavourTableProducer Class Reference
Inheritance diagram for GenJetFlavourTableProducer:
edm::stream::EDProducer<>

Public Member Functions

 GenJetFlavourTableProducer (const edm::ParameterSet &iConfig)
 
 ~GenJetFlavourTableProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

const StringCutObjectSelector< reco::GenJetcut_
 
const double deltaR_
 
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollectionjetFlavourInfosToken_
 
std::string name_
 
edm::EDGetTokenT< std::vector< reco::GenJet > > src_
 

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

Definition at line 24 of file GenJetFlavourTableProducer.cc.

Constructor & Destructor Documentation

◆ GenJetFlavourTableProducer()

GenJetFlavourTableProducer::GenJetFlavourTableProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 26 of file GenJetFlavourTableProducer.cc.

27  : name_(iConfig.getParameter<std::string>("name")),
28  src_(consumes<std::vector<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("src"))),
29  cut_(iConfig.getParameter<std::string>("cut"), true),
30  deltaR_(iConfig.getParameter<double>("deltaR")),
32  consumes<reco::JetFlavourInfoMatchingCollection>(iConfig.getParameter<edm::InputTag>("jetFlavourInfos"))) {
33  produces<nanoaod::FlatTable>();
34  }

◆ ~GenJetFlavourTableProducer()

GenJetFlavourTableProducer::~GenJetFlavourTableProducer ( )
inlineoverride

Definition at line 36 of file GenJetFlavourTableProducer.cc.

36 {};

Member Function Documentation

◆ fillDescriptions()

static void GenJetFlavourTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 38 of file GenJetFlavourTableProducer.cc.

38  {
40  desc.add<edm::InputTag>("src")->setComment("input genJet collection");
41  desc.add<edm::InputTag>("jetFlavourInfos")->setComment("input flavour info collection");
42  desc.add<std::string>("name")->setComment("name of the genJet FlatTable we are extending with flavour information");
43  desc.add<std::string>("cut")->setComment("cut on input genJet collection");
44  desc.add<double>("deltaR")->setComment("deltaR to match genjets");
45  descriptions.add("genJetFlavourTable", desc);
46  }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

void GenJetFlavourTableProducer::produce ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivate

Definition at line 59 of file GenJetFlavourTableProducer.cc.

59  {
61  iEvent.getByToken(src_, jets);
62 
65 
66  unsigned int ncand = 0;
67  std::vector<int> partonFlavour;
68  std::vector<uint8_t> hadronFlavour;
69 
70  for (const reco::GenJet& jet : *jets) {
71  if (!cut_(jet))
72  continue;
73  ++ncand;
74  bool matched = false;
75  for (const reco::JetFlavourInfoMatching& jetFlavourInfoMatching : *jetFlavourInfos) {
76  if (deltaR(jet.p4(), jetFlavourInfoMatching.first->p4()) < deltaR_) {
77  partonFlavour.push_back(jetFlavourInfoMatching.second.getPartonFlavour());
78  hadronFlavour.push_back(jetFlavourInfoMatching.second.getHadronFlavour());
79  matched = true;
80  break;
81  }
82  }
83  if (!matched) {
84  partonFlavour.push_back(0);
85  hadronFlavour.push_back(0);
86  }
87  }
88 
89  auto tab = std::make_unique<nanoaod::FlatTable>(ncand, name_, false, true);
90  tab->addColumn<int>("partonFlavour", partonFlavour, "flavour from parton matching");
91  tab->addColumn<uint8_t>("hadronFlavour", hadronFlavour, "flavour from hadron ghost clustering");
92 
93  iEvent.put(std::move(tab));
94 }

References cut_, PbPb_ZMuSkimMuonDPG_cff::deltaR, deltaR_, jets_cff::hadronFlavour, iEvent, metsig::jet, GenHFHadronMatcher_cfi::jetFlavourInfos, jetFlavourInfosToken_, singleTopDQM_cfi::jets, muonTagProbeFilters_cff::matched, eostools::move(), name_, jets_cff::partonFlavour, and src_.

Member Data Documentation

◆ cut_

const StringCutObjectSelector<reco::GenJet> GenJetFlavourTableProducer::cut_
private

Definition at line 53 of file GenJetFlavourTableProducer.cc.

Referenced by produce().

◆ deltaR_

const double GenJetFlavourTableProducer::deltaR_
private

Definition at line 54 of file GenJetFlavourTableProducer.cc.

Referenced by produce().

◆ jetFlavourInfosToken_

edm::EDGetTokenT<reco::JetFlavourInfoMatchingCollection> GenJetFlavourTableProducer::jetFlavourInfosToken_
private

Definition at line 55 of file GenJetFlavourTableProducer.cc.

Referenced by produce().

◆ name_

std::string GenJetFlavourTableProducer::name_
private

Definition at line 51 of file GenJetFlavourTableProducer.cc.

Referenced by produce().

◆ src_

edm::EDGetTokenT<std::vector<reco::GenJet> > GenJetFlavourTableProducer::src_
private

Definition at line 52 of file GenJetFlavourTableProducer.cc.

Referenced by produce().

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
jets_cff.hadronFlavour
hadronFlavour
Definition: jets_cff.py:591
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle< reco::GenJetCollection >
GenJetFlavourTableProducer::name_
std::string name_
Definition: GenJetFlavourTableProducer.cc:51
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
GenJetFlavourTableProducer::deltaR_
const double deltaR_
Definition: GenJetFlavourTableProducer.cc:54
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
jets_cff.partonFlavour
partonFlavour
Definition: jets_cff.py:590
metsig::jet
Definition: SignAlgoResolutions.h:47
reco::JetFlavourInfoMatching
JetFlavourInfoMatchingCollection::value_type JetFlavourInfoMatching
Definition: JetFlavourInfoMatching.h:26
GenJetFlavourTableProducer::src_
edm::EDGetTokenT< std::vector< reco::GenJet > > src_
Definition: GenJetFlavourTableProducer.cc:52
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GenHFHadronMatcher_cfi.jetFlavourInfos
jetFlavourInfos
Definition: GenHFHadronMatcher_cfi.py:5
edm::InputTag
Definition: InputTag.h:15
GenJetFlavourTableProducer::jetFlavourInfosToken_
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfosToken_
Definition: GenJetFlavourTableProducer.cc:55
GenJetFlavourTableProducer::cut_
const StringCutObjectSelector< reco::GenJet > cut_
Definition: GenJetFlavourTableProducer.cc:53