Finds the origin of each heavy flavour hadron and associated jets to it. More...
#include <GenHFHadronMatcher.cc>
Public Member Functions | |
GenHFHadronMatcher (const edm::ParameterSet &) | |
constructor initialising producer products and config parameters More... | |
~GenHFHadronMatcher () | |
Public Member Functions inherited from edm::EDProducer | |
EDProducer () | |
ModuleDescription const & | moduleDescription () const |
virtual | ~EDProducer () |
Public Member Functions inherited from edm::ProducerBase | |
ProducerBase () | |
void | registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &) |
std::function< void(BranchDescription const &)> | registrationCallback () const |
used by the fwk to register list of products More... | |
virtual | ~ProducerBase () |
Public Member Functions inherited from edm::EDConsumerBase | |
EDConsumerBase () | |
ProductHolderIndexAndSkipBit | indexFrom (EDGetToken, BranchType, TypeID const &) const |
void | itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const |
void | itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const |
std::vector < ProductHolderIndexAndSkipBit > const & | itemsToGetFromEvent () const |
void | labelsForToken (EDGetToken iToken, Labels &oLabels) const |
void | modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const |
bool | registeredToConsume (ProductHolderIndex, bool, BranchType) const |
bool | registeredToConsumeMany (TypeID const &, BranchType) const |
void | updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &) |
virtual | ~EDConsumerBase () |
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) |
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... | |
virtual void | beginJob () |
virtual void | beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &) |
virtual void | beginRun (edm::Run &, edm::EventSetup const &) |
bool | checkForLoop (std::vector< const reco::Candidate * > &particleChain, const reco::Candidate *particle) |
virtual void | endJob () |
virtual void | endLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &) |
virtual void | endRun (edm::Run &, edm::EventSetup 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) |
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... | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
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 | |
typedef ProductRegistryHelper::TypeLabelList | TypeLabelList |
Protected Member Functions inherited from edm::ProducerBase | |
void | callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func) |
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 139 of file GenHFHadronMatcher.cc.
References funct::abs(), flavour_, flavourStr_, edm::ParameterSet::getParameter(), noBBbarResonances_, and onlyJetClusteredHadrons_.
GenHFHadronMatcher::~GenHFHadronMatcher | ( | ) |
Definition at line 169 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 644 of file GenHFHadronMatcher.cc.
References funct::abs(), i, idInList(), cmsHarvester::index, reco::Candidate::mother(), reco::Candidate::numberOfMothers(), reco::Candidate::pdgId(), reco::Candidate::pt(), and putMotherIndex().
Referenced by findHadronJets().
|
privatevirtual |
Reimplemented from edm::EDProducer.
Definition at line 237 of file GenHFHadronMatcher.cc.
|
privatevirtual |
Definition at line 258 of file GenHFHadronMatcher.cc.
|
privatevirtual |
Definition at line 247 of file GenHFHadronMatcher.cc.
|
private |
|
privatevirtual |
Reimplemented from edm::EDProducer.
Definition at line 242 of file GenHFHadronMatcher.cc.
|
privatevirtual |
Definition at line 263 of file GenHFHadronMatcher.cc.
|
privatevirtual |
Definition at line 253 of file GenHFHadronMatcher.cc.
|
static |
description of the run-time parameters
Definition at line 179 of file GenHFHadronMatcher.cc.
References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::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 291 of file GenHFHadronMatcher.cc.
References funct::abs(), analyzeMothers(), edm::RefVector< C, T, F >::begin(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), edm::RefVector< C, T, F >::end(), edm::false, spr::find(), findInMothers(), fixExtraSameFlavours(), flavour_, flavourSign(), reco::JetFlavourInfo::getbHadrons(), reco::JetFlavourInfo::getcHadrons(), hasHadronDaughter(), i, isHadron(), reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), onlyJetClusteredHadrons_, benchmark_cfg::pdgId, reco::Candidate::pdgId(), reco::LeafCandidate::pdgId(), and python.multivaluedict::sort().
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 791 of file GenHFHadronMatcher.cc.
References funct::abs(), edm::false, spr::find(), i, customizeTrackingMonitorSeedNumber::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 936 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 591 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 611 of file GenHFHadronMatcher.cc.
References reco::Candidate::daughter(), 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 493 of file GenHFHadronMatcher.cc.
References spr::find(), and position.
Referenced by analyzeMothers().
|
private |
Definition at line 501 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 572 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 518 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 532 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 548 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 912 of file GenHFHadronMatcher.cc.
References funct::abs(), and spr::find().
Referenced by fixExtraSameFlavours().
|
privatevirtual |
Implements edm::EDProducer.
Definition at line 197 of file GenHFHadronMatcher.cc.
References findHadronJets(), flavourStr_, genParticleCandidates2GenParticles_cfi::genParticles, genParticlesToken_, edm::Event::getByToken(), edm::EventSetup::getData(), jetFlavourInfosToken_, pdt_, 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 738 of file GenHFHadronMatcher.cc.
References gen::k.
Referenced by analyzeMothers().
|
private |
Definition at line 110 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets(), and GenHFHadronMatcher().
|
private |
Definition at line 114 of file GenHFHadronMatcher.cc.
Referenced by GenHFHadronMatcher(), and produce().
|
private |
Definition at line 108 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 109 of file GenHFHadronMatcher.cc.
Referenced by produce().
|
private |
Definition at line 111 of file GenHFHadronMatcher.cc.
Referenced by GenHFHadronMatcher(), and isMesonPdgId().
|
private |
Definition at line 112 of file GenHFHadronMatcher.cc.
Referenced by findHadronJets(), and GenHFHadronMatcher().
|
private |
Definition at line 116 of file GenHFHadronMatcher.cc.
Referenced by produce().