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 | |
ProducesCollector | producesCollector () |
Protected Member Functions inherited from edm::EDConsumerBase | |
template<typename ProductType , BranchType B = InEvent> | |
EDGetTokenT< ProductType > | consumes (edm::InputTag const &tag) |
template<BranchType B = InEvent> | |
EDConsumerBaseAdaptor< B > | consumes (edm::InputTag tag) noexcept |
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes () |
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag const &tag) |
template<Transition Tr = Transition::Event> | |
constexpr auto | esConsumes () noexcept |
template<Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag tag) noexcept |
template<Transition Tr = Transition::Event> | |
ESGetTokenGeneric | esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey) |
Used with EventSetupRecord::doGet. More... | |
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) |
void | resetItemsToGetFrom (BranchType iType) |
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 edm::ParameterSet::getParameter().
|
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 726 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(), edm::ParameterSetDescription::add(), and submitPVResolutionJobs::desc.
|
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::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), edm::RefVector< C, T, F >::begin(), HLT_FULL_cff::deltaR, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), edm::RefVector< C, T, F >::end(), spr::find(), findInMothers(), fixExtraSameFlavours(), flavour_, flavourSign(), reco::JetFlavourInfo::getbHadrons(), reco::JetFlavourInfo::getcHadrons(), hasHadronDaughter(), mps_fire::i, isHadron(), reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), onlyJetClusteredHadrons_, or, 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 880 of file GenHFHadronMatcher.cc.
References funct::abs(), spr::find(), mps_fire::i, isHadronPdgId(), gpuVertexFinder::printf(), and verbose.
Referenced by findHadronJets().
|
private |
Finds hadrons that have the same flavour and origin and resolve this ambiguity 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 1044 of file GenHFHadronMatcher.cc.
References funct::abs(), and isNeutralPdg().
Referenced by findHadronJets().
|
private |
Sign of the flavour (matter/antimatter)
[in] | pdgId | pdgId to be checked |
Definition at line 675 of file GenHFHadronMatcher.cc.
References funct::abs(), and isMesonPdgId().
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 695 of file GenHFHadronMatcher.cc.
References reco::Candidate::daughter(), isHadron(), isotrackApplyRegressor::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 578 of file GenHFHadronMatcher.cc.
References spr::find(), and position.
Referenced by analyzeMothers().
|
private |
Definition at line 587 of file GenHFHadronMatcher.cc.
References spr::find(), 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 656 of file GenHFHadronMatcher.cc.
References funct::abs().
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 603 of file GenHFHadronMatcher.cc.
References 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 615 of file GenHFHadronMatcher.cc.
References isBaryonPdgId(), and isMesonPdgId().
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 630 of file GenHFHadronMatcher.cc.
References funct::abs(), and noBBbarResonances_.
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 1021 of file GenHFHadronMatcher.cc.
References funct::abs(), and spr::find().
Referenced by fixExtraSameFlavours().
|
overrideprivatevirtual |
Implements edm::global::EDProducerBase.
Definition at line 231 of file GenHFHadronMatcher.cc.
References bHadronIdToken_, edm::Event::emplace(), findHadronJets(), flavourToken_, fromTopWeakDecayToken_, genParticleCandidates2GenParticles_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), indexToken_, 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 827 of file GenHFHadronMatcher.cc.
References isotrackApplyRegressor::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().