Finds the origin of each heavy flavour hadron and associated jets to it. More...
#include <GenHFHadronMatcher.cc>
Static Public Member Functions | |
static void | fillDescriptions (edm::ConfigurationDescriptions &descriptions) |
description of the run-time parameters More... | |
Static Public Member Functions inherited from edm::global::EDProducerBase | |
static const std::string & | baseType () |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
static void | prevalidate (ConfigurationDescriptions &descriptions) |
Private Member Functions | |
int | analyzeMothers (const reco::Candidate *thisParticle, int &topDaughterQId, int &topBarDaughterQId, std::vector< const reco::Candidate * > &hadMothers, std::vector< std::vector< int >> &hadMothersIndices, std::set< const reco::Candidate * > *analyzedParticles, const int prevPartIndex) const |
do a recursive search for the mother particles until the b-quark is found or the absolute mother is found More... | |
bool | checkForLoop (std::vector< const reco::Candidate * > &particleChain, const reco::Candidate *particle) const |
std::vector< int > | findHadronJets (const reco::GenParticleCollection *genParticles, const reco::JetFlavourInfoMatchingCollection *jetFlavourInfos, std::vector< int > &hadIndex, std::vector< reco::GenParticle > &hadMothersGenPart, std::vector< std::vector< int >> &hadMothersIndices, std::vector< int > &hadLeptonIndex, std::vector< int > &hadLeptonHadIndex, std::vector< int > &hadLeptonViaTau, std::vector< int > &hadFlavour, std::vector< int > &hadFromTopWeakDecay, std::vector< int > &hadBHadronId) const |
identify the jets that contain b-hadrons More... | |
int | findInMothers (int idx, std::vector< int > &mothChains, const std::vector< std::vector< int >> &hadMothersIndices, const std::vector< reco::GenParticle > &hadMothers, int status, int pdgId, bool pdgAbs, int stopId, int firstLast, bool verbose) const |
helper function to find indices of particles with particular pdgId and status from the list of mothers of a given particle More... | |
bool | fixExtraSameFlavours (const unsigned int hadId, const std::vector< int > &hadIndices, const std::vector< reco::GenParticle > &hadMothers, const std::vector< std::vector< int >> &hadMothersIndices, const std::vector< int > &isFromTopWeakDecay, const std::vector< std::vector< int >> &LastQuarkIds, const std::vector< std::vector< int >> &LastQuarkMotherIds, std::vector< int > &lastQuarkIndices, std::vector< int > &hadronFlavour, std::set< int > &checkedHadronIds, const int lastQuarkIndex) const |
int | flavourSign (const int pdgId) const |
Sign of the flavour (matter/antimatter) More... | |
std::string | getParticleName (int id) const |
bool | hasHadronDaughter (const int flavour, const reco::Candidate *thisParticle) const |
Check if the particle has bHadron among daughters. More... | |
int | idInList (std::vector< const reco::Candidate * > particleList, const reco::Candidate *particle) const |
Check if the cpecified particle is already in the list of particles. More... | |
int | idInList (std::vector< int > list, const int value) const |
bool | isBaryonPdgId (const int flavour, const int pdgId) const |
Check the pdgId if it represents a baryon of particular flavour. More... | |
bool | isHadron (const int flavour, const reco::Candidate *thisParticle) const |
Check the pdgId of a given particle if it is a hadron. More... | |
bool | isHadronPdgId (const int flavour, const int pdgId) const |
Check the pdgId if it represents a hadron of particular flavour. More... | |
bool | isMesonPdgId (const int flavour, const int pdgId) const |
Check the pdgId if it represents a meson of particular flavour. More... | |
bool | isNeutralPdg (int pdgId) const |
Check whether a given pdgId represents neutral particle. More... | |
void | produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override |
bool | putMotherIndex (std::vector< std::vector< int >> &hadMothersIndices, int partIndex, int mothIndex) const |
puts mother index to the list of mothers of particle, if it isn't there already More... | |
Private Attributes | |
const edm::EDPutTokenT< std::vector< int > > | bHadronIdToken_ |
const int | flavour_ |
const std::string | flavourStr_ |
const edm::EDPutTokenT< std::vector< int > > | flavourToken_ |
const edm::EDPutTokenT< std::vector< int > > | fromTopWeakDecayToken_ |
const edm::EDGetTokenT< reco::GenParticleCollection > | genParticlesToken_ |
const edm::EDPutTokenT< std::vector< int > > | indexToken_ |
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > | jetFlavourInfosToken_ |
const edm::EDPutTokenT< std::vector< int > > | jetIndexToken_ |
const edm::EDPutTokenT< std::vector< int > > | leptonHadronIndexToken_ |
const edm::EDPutTokenT< std::vector< int > > | leptonIndexToken_ |
const edm::EDPutTokenT< std::vector< int > > | leptonViaTauToken_ |
const bool | noBBbarResonances_ |
const bool | onlyJetClusteredHadrons_ |
const edm::EDPutTokenT< std::vector< std::vector< int > > > | plusMothersIndicesToken_ |
const edm::EDPutTokenT< std::vector< reco::GenParticle > > | plusMothersToken_ |
Additional Inherited Members | |
Public Types inherited from edm::global::EDProducerBase | |
typedef EDProducerBase | 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 |
Protected Member Functions inherited from edm::ProducerBase | |
template<class ProductType > | |
BranchAliasSetterT< ProductType > | produces () |
declare what type of product will make and with which optional label More... | |
template<typename ProductType , BranchType B> | |
BranchAliasSetterT< ProductType > | produces () |
template<typename ProductType , Transition B> | |
BranchAliasSetterT< ProductType > | produces () |
BranchAliasSetter | produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true) |
template<BranchType B> | |
BranchAliasSetter | produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true) |
template<Transition B> | |
BranchAliasSetter | produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true) |
template<typename ProductType , Transition B> | |
BranchAliasSetterT< ProductType > | produces (std::string instanceName) |
template<class ProductType > | |
BranchAliasSetterT< ProductType > | produces (std::string instanceName) |
template<typename ProductType , BranchType B> | |
BranchAliasSetterT< ProductType > | produces (std::string instanceName) |
ProducesCollector | producesCollector () |
Protected Member Functions inherited from edm::EDConsumerBase | |
EDGetToken | consumes (const TypeToGet &id, edm::InputTag const &tag) |
template<typename ProductType , BranchType B = InEvent> | |
EDGetTokenT< ProductType > | consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes () |
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag const &tag) |
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
template<BranchType B> | |
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
template<typename ProductType , BranchType B = InEvent> | |
EDGetTokenT< ProductType > | mayConsume (edm::InputTag const &tag) |
Finds the origin of each heavy flavour hadron and associated jets to it.
Starting from each consituent of each jet, tracks back in chain to find heavy flavour hadrons. From each hadron traces back until finds the b quark and its mother. For each hadron identifies the jet to which it was injected as a ghost hadron.
The description of the run-time parameters can be found at fillDescriptions()
The description of the products can be found at GenHFHadronMatcher()
Definition at line 53 of file GenHFHadronMatcher.cc.
|
explicit |
Definition at line 169 of file GenHFHadronMatcher.cc.
References funct::abs(), and looper::cfg.
|
override |
Definition at line 205 of file GenHFHadronMatcher.cc.
|
private |
do a recursive search for the mother particles until the b-quark is found or the absolute mother is found
the treatment of b-bar resonances depends on the global parameter noBBbarResonances_
[in] | thisParticle | current particle from which starts the search of the hadron and all its mothers up to proton |
[out] | hadron | the last hadron in the decay chain [that decays weekly] |
[out] | lepton | lepton found in the current decay chain |
[out] | topDaughterQId | Id of the top quark daughter b(c) quark |
[out] | topBarDaughterQId | Id of the antitop quark daughter b(c) quark |
[out] | hadMothers | list of all processed particles ending with proton |
[out] | hadMothersIndices | list of i-vectors containing j-indices representing particles that are mothers of each i-particle from hadMothers |
[out] | analyzedParticles | list of particles analysed in the chain [used for infinite loop detection] |
[out] | prevPartIndex | index of the previous particle in the current chain [used for infinite loop detection] |
Definition at line 725 of file GenHFHadronMatcher.cc.
References funct::abs(), mps_fire::i, idInList(), reco::Candidate::mother(), reco::Candidate::numberOfMothers(), reco::Candidate::pdgId(), reco::Candidate::pt(), and putMotherIndex().
Referenced by findHadronJets().
|
private |
|
static |
description of the run-time parameters
Definition at line 212 of file GenHFHadronMatcher.cc.
References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().
|
private |
identify the jets that contain b-hadrons
For each hadron all mothers from all levels and chains are analysed to find the quark or gluon from which the hadron has originated. This is done by searching through the generator particle decay tree starting from the hadron, performing checks for flavour and kinematic consistency. The hadrons that are not last in the decay chain (don't decay weakly) are skipped. Additionally for each hadron it is checked whether it comes from the top weak decay branch and whether it comes from some other b-hadron decay
b-bbar (c-cbar) resonances can either be considered as hadrons or not, depending on the configuration.
[out] | hadIndex | vector of indices of found hadrons in hadMothers |
[out] | hadMothers | vector of all mothers at all levels of each found hadron |
[out] | hadMothersIndices | connection between each particle from hadMothers and its mothers |
[out] | hadLeptonIndex | index of lepton among the hadMothers |
[out] | hadLeptonHadIndex | index of hadron associated to each lepton |
[out] | hadLeptonViaTau | whether lepton is from direct hadron->lepton or hadron->tau->lepton |
[out] | hadFlavour | flavour of each found hadron |
[out] | hadFromTopWeakDecay | whether each hadron contains the top quark in its decay chain [works only for B-Hadrons] |
[out] | hadBHadronId | for each hadron - index of the ancestor b-hadron [-1 if hadron doesn't come from another b-hdaron] |
Definition at line 299 of file GenHFHadronMatcher.cc.
References funct::abs(), analyzeMothers(), edm::RefVector< C, T, F >::begin(), PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, edm::RefVector< C, T, F >::end(), spr::find(), findInMothers(), fixExtraSameFlavours(), flavour_, flavourSign(), genParticles2HepMC_cfi::genParticles, reco::JetFlavourInfo::getbHadrons(), reco::JetFlavourInfo::getcHadrons(), jets_cff::hadronFlavour, hasHadronDaughter(), mps_fire::i, createfilelist::int, isHadron(), GenHFHadronMatcher_cfi::jetFlavourInfos, reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), onlyJetClusteredHadrons_, or, EgammaValidation_cff::pdgId, reco::Candidate::pdgId(), and reco::LeafCandidate::pdgId().
Referenced by produce().
|
private |
helper function to find indices of particles with particular pdgId and status from the list of mothers of a given particle
[in] | idx | index of particle, mothers of which should be searched |
[in] | mothChains | vector of indices where the found mothers are stored |
[in] | hadMothersIndices | list of indices pointing to mothers of each particle from list of mothers |
[in] | hadMothers | vector of all hadron mother particles of all levels |
[in] | status | status of mother that is being looked for |
[in] | pdgId | pdgId of mother that is being looked for [flavour*111111 used to identify hadrons of particular flavour] |
[in] | pdgAbs | whether the sign of pdgId should be taken into account |
[in] | stopId | id of the particle in the hadMothers array after which the checking should stop |
[in] | firstLast | should all(0), first(1) or last(2) occurances of the searched particle be stored |
[in] | verbose | option to print every particle that is processed during the search |
Definition at line 879 of file GenHFHadronMatcher.cc.
References funct::abs(), spr::find(), mps_fire::i, training_settings::idx, isHadronPdgId(), EgammaValidation_cff::pdgId, mps_update::status, and verbose.
Referenced by findHadronJets().
|
private |
Finds hadrons that have the same flavour and origin and resolve this ambiguity @method fixExtraSameFlavours
hadId | Index of the hadron being checked |
hadIndex | Vector of indices of each hadron pointing to the hadMothers |
hadMothers | Vector of gen particles (contain hadrons and all its ancestors) |
hadMothersIndices | Vector of indices for each particle from hadMothers |
isFromTopWeakDecay | Vector of values showing whether particle comes from the top weak decay |
LastQuarkIds | Vector of indices of last quarks for each hadron |
LastQuarkMotherIds | Vector of indices of mothers for each last quark from LastQuarkIds |
lastQuakIndices | Vector of indices pointing to particular index from the LastQuarkIds and LastQuarkMotherIds to be used for each hadron |
lastQuarkIndex | Index from the LastQuarkIds and LastQuarkMotherIds for this particular hadron with index hadId |
Definition at line 1043 of file GenHFHadronMatcher.cc.
References funct::abs(), jets_cff::hadronFlavour, and isNeutralPdg().
Referenced by findHadronJets().
|
private |
Sign of the flavour (matter/antimatter)
[in] | pdgId | pdgId to be checked |
Definition at line 674 of file GenHFHadronMatcher.cc.
References funct::abs(), isMesonPdgId(), and EgammaValidation_cff::pdgId.
Referenced by findHadronJets().
|
private |
|
private |
Check if the particle has bHadron among daughters.
[in] | flavour | flavour of a hadron that is being searched (5-B, 4-C) |
[in] | thisParticle | a particle that is to be analysed |
Definition at line 694 of file GenHFHadronMatcher.cc.
References reco::Candidate::daughter(), GenHFHadronMatcher_cff::flavour, createfilelist::int, isHadron(), dqmdumpme::k, and reco::Candidate::numberOfDaughters().
Referenced by findHadronJets().
|
private |
Check if the cpecified particle is already in the list of particles.
[in] | particleList | list of particles to be checked |
[in] | particle | particle that should be checked |
Definition at line 577 of file GenHFHadronMatcher.cc.
References spr::find(), and position.
Referenced by analyzeMothers().
|
private |
Definition at line 586 of file GenHFHadronMatcher.cc.
References spr::find(), list(), position, and relativeConstraints::value.
|
private |
Check the pdgId if it represents a baryon of particular flavour.
[in] | flavour | flavour of a hadron that is being searched (5-B, 4-C) |
[in] | pdgId | pdgId to be checked |
Definition at line 655 of file GenHFHadronMatcher.cc.
References funct::abs(), GenHFHadronMatcher_cff::flavour, and EgammaValidation_cff::pdgId.
Referenced by isHadronPdgId().
|
private |
Check the pdgId of a given particle if it is a hadron.
[in] | flavour | flavour of a hadron that is being searched (5-B, 4-C) |
[in] | thisParticle | a particle that is to be analysed |
Definition at line 602 of file GenHFHadronMatcher.cc.
References GenHFHadronMatcher_cff::flavour, isHadronPdgId(), and reco::Candidate::pdgId().
Referenced by findHadronJets(), and hasHadronDaughter().
|
private |
Check the pdgId if it represents a hadron of particular flavour.
[in] | flavour | flavour of a hadron that is being searched (5-B, 4-C) |
[in] | pdgId | pdgId to be checked |
Definition at line 614 of file GenHFHadronMatcher.cc.
References GenHFHadronMatcher_cff::flavour, isBaryonPdgId(), isMesonPdgId(), and EgammaValidation_cff::pdgId.
Referenced by findInMothers(), and isHadron().
|
private |
Check the pdgId if it represents a meson of particular flavour.
[in] | flavour | flavour of a hadron that is being searched (5-B, 4-C) |
[in] | pdgId | pdgId to be checked |
Definition at line 629 of file GenHFHadronMatcher.cc.
References funct::abs(), GenHFHadronMatcher_cff::flavour, noBBbarResonances_, and EgammaValidation_cff::pdgId.
Referenced by flavourSign(), and isHadronPdgId().
|
private |
Check whether a given pdgId represents neutral particle.
[in] | pdgId | |
[in] | thisParticle | - a particle that is to be analysed |
Definition at line 1020 of file GenHFHadronMatcher.cc.
References funct::abs(), spr::find(), and EgammaValidation_cff::pdgId.
Referenced by fixExtraSameFlavours().
|
overrideprivatevirtual |
Implements edm::global::EDProducerBase.
Definition at line 231 of file GenHFHadronMatcher.cc.
References bHadronIdToken_, edm::Event::emplace(), findHadronJets(), flavourToken_, fromTopWeakDecayToken_, genParticles2HepMC_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), indexToken_, GenHFHadronMatcher_cfi::jetFlavourInfos, jetFlavourInfosToken_, jetIndexToken_, leptonHadronIndexToken_, leptonIndexToken_, leptonViaTauToken_, eostools::move(), plusMothersIndicesToken_, and plusMothersToken_.
|
private |
puts mother index to the list of mothers of particle, if it isn't there already
[in] | hadMothersIndices | vector of indices of mothers for each particle |
[in] | partIndex | index of the particle for which the mother index should be stored |
[in] | mothIndex | index of mother that should be stored for current particle |
Definition at line 826 of file GenHFHadronMatcher.cc.
References createfilelist::int, and dqmdumpme::k.
Referenced by analyzeMothers().
|
private |
Definition at line 134 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 120 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets().
|
private |
Definition at line 124 of file GenHFHadronMatcher.cc.
|
private |
Definition at line 128 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 133 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 118 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 127 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 119 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 129 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 131 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 130 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 132 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 121 of file GenHFHadronMatcher.cc.
Referenced by isMesonPdgId().
|
private |
Definition at line 122 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets().
|
private |
Definition at line 126 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 125 of file GenHFHadronMatcher.cc.
Referenced by produce().