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::EDProducer | |
static const std::string & | baseType () |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
static void | prevalidate (ConfigurationDescriptions &descriptions) |
static bool | wantsGlobalLuminosityBlocks () |
static bool | wantsGlobalRuns () |
static bool | wantsStreamLuminosityBlocks () |
static bool | wantsStreamRuns () |
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) |
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) |
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) |
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) |
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) |
int | flavourSign (const int pdgId) |
Sign of the flavour (matter/antimatter) More... | |
std::string | getParticleName (int id) const |
bool | hasHadronDaughter (const int flavour, const reco::Candidate *thisParticle) |
Check if the particle has bHadron among daughters. More... | |
int | idInList (std::vector< const reco::Candidate * > particleList, const reco::Candidate *particle) |
Check if the cpecified particle is already in the list of particles. More... | |
int | idInList (std::vector< int > list, const int value) |
bool | isBaryonPdgId (const int flavour, const int pdgId) |
Check the pdgId if it represents a baryon of particular flavour. More... | |
bool | isHadron (const int flavour, const reco::Candidate *thisParticle) |
Check the pdgId of a given particle if it is a hadron. More... | |
bool | isHadronPdgId (const int flavour, const int pdgId) |
Check the pdgId if it represents a hadron of particular flavour. More... | |
bool | isMesonPdgId (const int flavour, const int pdgId) |
Check the pdgId if it represents a meson of particular flavour. More... | |
bool | isNeutralPdg (int pdgId) |
Check whether a given pdgId represents neutral particle. More... | |
void | produce (edm::Event &, const edm::EventSetup &) override |
bool | putMotherIndex (std::vector< std::vector< int > > &hadMothersIndices, int partIndex, int mothIndex) |
puts mother index to the list of mothers of particle, if it isn't there already More... | |
Private Attributes | |
int | flavour_ |
std::string | flavourStr_ |
edm::EDGetTokenT< reco::GenParticleCollection > | genParticlesToken_ |
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > | jetFlavourInfosToken_ |
bool | noBBbarResonances_ |
bool | onlyJetClusteredHadrons_ |
edm::ESHandle< ParticleDataTable > | pdt_ |
Additional Inherited Members | |
Public Types inherited from edm::EDProducer | |
typedef EDProducer | 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::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) |
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 58 of file GenHFHadronMatcher.cc.
|
explicit |
constructor initialising producer products and config parameters
Definition at line 132 of file GenHFHadronMatcher.cc.
References funct::abs(), flavour_, flavourStr_, edm::ParameterSet::getParameter(), noBBbarResonances_, and onlyJetClusteredHadrons_.
|
override |
Definition at line 162 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 605 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 172 of file GenHFHadronMatcher.cc.
References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), funct::false, and funct::true.
|
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 252 of file GenHFHadronMatcher.cc.
References funct::abs(), analyzeMothers(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), edm::RefVector< C, T, F >::begin(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), edm::RefVector< C, T, F >::end(), funct::false, spr::find(), findInMothers(), fixExtraSameFlavours(), flavour_, flavourSign(), reco::JetFlavourInfo::getbHadrons(), reco::JetFlavourInfo::getcHadrons(), jets_cff::hadronFlavour, hasHadronDaughter(), mps_fire::i, createfilelist::int, isHadron(), reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), onlyJetClusteredHadrons_, common_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 752 of file GenHFHadronMatcher.cc.
References funct::abs(), funct::false, spr::find(), mps_fire::i, training_settings::idx, isHadronPdgId(), and funct::true.
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 897 of file GenHFHadronMatcher.cc.
References funct::abs(), DEFINE_FWK_MODULE, and isNeutralPdg().
Referenced by findHadronJets().
|
private |
Sign of the flavour (matter/antimatter)
[in] | pdgId | pdgId to be checked |
Definition at line 552 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 572 of file GenHFHadronMatcher.cc.
References reco::Candidate::daughter(), createfilelist::int, isHadron(), gen::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 454 of file GenHFHadronMatcher.cc.
References spr::find(), and position.
Referenced by analyzeMothers().
|
private |
Definition at line 462 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 533 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 479 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 493 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 509 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 873 of file GenHFHadronMatcher.cc.
References funct::abs(), and spr::find().
Referenced by fixExtraSameFlavours().
|
overrideprivate |
Definition at line 190 of file GenHFHadronMatcher.cc.
References findHadronJets(), flavourStr_, GenHFHadronMatcher_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), edm::EventSetup::getData(), GenHFHadronMatcher_cfi::jetFlavourInfos, jetFlavourInfosToken_, eostools::move(), pdt_, edm::Handle< T >::product(), and edm::Event::put().
|
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 699 of file GenHFHadronMatcher.cc.
References createfilelist::int, and gen::k.
Referenced by analyzeMothers().
|
private |
Definition at line 103 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets(), and GenHFHadronMatcher().
|
private |
Definition at line 107 of file GenHFHadronMatcher.cc.
Referenced by GenHFHadronMatcher(), and produce().
|
private |
Definition at line 101 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 102 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 104 of file GenHFHadronMatcher.cc.
Referenced by GenHFHadronMatcher(), and isMesonPdgId().
|
private |
Definition at line 105 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets(), and GenHFHadronMatcher().
|
private |
Definition at line 109 of file GenHFHadronMatcher.cc.
Referenced by produce().