CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
GenHFHadronMatcher Class Reference

Finds the origin of each heavy flavour hadron and associated jets to it. More...

#include <GenHFHadronMatcher.cc>

Inheritance diagram for GenHFHadronMatcher:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GenHFHadronMatcher (const edm::ParameterSet &)
 
 ~GenHFHadronMatcher () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::GenParticleCollectiongenParticlesToken_
 
const edm::EDPutTokenT< std::vector< int > > indexToken_
 
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollectionjetFlavourInfosToken_
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GenHFHadronMatcher()

GenHFHadronMatcher::GenHFHadronMatcher ( const edm::ParameterSet cfg)
explicit

Definition at line 169 of file GenHFHadronMatcher.cc.

170  : genParticlesToken_(consumes<reco::GenParticleCollection>(cfg.getParameter<edm::InputTag>("genParticles"))),
172  consumes<reco::JetFlavourInfoMatchingCollection>(cfg.getParameter<edm::InputTag>("jetFlavourInfos"))),
173  flavour_{std::abs(cfg.getParameter<int>("flavour"))},
174  noBBbarResonances_{cfg.getParameter<bool>("noBBbarResonances")},
175  onlyJetClusteredHadrons_{cfg.getParameter<bool>("onlyJetClusteredHadrons")},
176  flavourStr_{flavourName(flavour_)},
177  plusMothersToken_{produces<std::vector<reco::GenParticle>>(
178  "gen" + flavourStr_ +
179  "HadPlusMothers")}, // All mothers in all decay chains above any hadron of specified flavour
180  plusMothersIndicesToken_{produces<std::vector<std::vector<int>>>(
181  "gen" + flavourStr_ + "HadPlusMothersIndices")}, // Indices of mothers of each hadMother
182  indexToken_{
183  produces<std::vector<int>>("gen" + flavourStr_ + "HadIndex")}, // Index of hadron in the vector of hadMothers
184  flavourToken_{produces<std::vector<int>>(
185  "gen" + flavourStr_ +
186  "HadFlavour")}, // PdgId of the first non-b(c) quark mother with sign corresponding to hadron charge
187  jetIndexToken_{produces<std::vector<int>>(
188  "gen" + flavourStr_ + "HadJetIndex")}, // Index of genJet matched to each hadron by jet clustering algorithm
189  leptonIndexToken_{produces<std::vector<int>>(
190  "gen" + flavourStr_ +
191  "HadLeptonIndex")}, // Index of lepton found among the hadron decay products in the list of mothers
192  leptonHadronIndexToken_{produces<std::vector<int>>(
193  "gen" + flavourStr_ + "HadLeptonHadronIndex")}, // Index of hadron the lepton is associated to
194  leptonViaTauToken_{produces<std::vector<int>>(
195  "gen" + flavourStr_ + "HadLeptonViaTau")}, // Whether lepton comes directly from hadron or via tau decay
196  fromTopWeakDecayToken_{produces<std::vector<int>>(
197  "gen" + flavourStr_ +
198  "HadFromTopWeakDecay")}, // Tells whether the hadron appears in the chain after top decay
199  bHadronIdToken_{produces<std::vector<int>>("gen" + flavourStr_ + "HadBHadronId")}
200 // Index of a b-hadron which the current hadron comes from (for c-hadrons)
201 {
202  // Hadron matching products
203 }

References funct::abs(), and looper::cfg.

◆ ~GenHFHadronMatcher()

GenHFHadronMatcher::~GenHFHadronMatcher ( )
override

Definition at line 205 of file GenHFHadronMatcher.cc.

205 {}

Member Function Documentation

◆ analyzeMothers()

int GenHFHadronMatcher::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
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_

Parameters
[in]thisParticlecurrent particle from which starts the search of the hadron and all its mothers up to proton
[out]hadronthe last hadron in the decay chain [that decays weekly]
[out]leptonlepton found in the current decay chain
[out]topDaughterQIdId of the top quark daughter b(c) quark
[out]topBarDaughterQIdId of the antitop quark daughter b(c) quark
[out]hadMotherslist of all processed particles ending with proton
[out]hadMothersIndiceslist of i-vectors containing j-indices representing particles that are mothers of each i-particle from hadMothers
[out]analyzedParticleslist of particles analysed in the chain [used for infinite loop detection]
[out]prevPartIndexindex of the previous particle in the current chain [used for infinite loop detection]
Returns
index of hadron in the hadMothers list [-1 if no hadron found]

Definition at line 726 of file GenHFHadronMatcher.cc.

732  {
733  // Getting the index of the particle which is a hadron in the first call
734  int hadronIndex = -1; // Index of the hadron that is returned by this function
735  int index = idInList(hadMothers, thisParticle);
736  if (index < 0) { // If hadron is not in the list of mothers yet
737  hadMothers.push_back(thisParticle);
738  hadronIndex = hadMothers.size() - 1;
739  } else { // If hadron is in the list of mothers already
740  hadronIndex = index;
741  }
742 
743  int partIndex = -1; // Index of particle being checked in the list of mothers
744  partIndex = idInList(hadMothers, thisParticle);
745 
746  // Checking whether this particle is already in the chain of analyzed particles in order to identify a loop
747  bool isLoop = false;
748  if (!analyzedParticles) {
749  analyzedParticles = new std::set<const reco::Candidate *>;
750  }
751  for (unsigned int i = 0; i < analyzedParticles->size(); i++) {
752  if (analyzedParticles->count(thisParticle) <= 0) {
753  continue;
754  }
755  isLoop = true;
756  break;
757  }
758 
759  // If a loop has been detected
760  if (isLoop) {
761  if (prevPartIndex >= 0) {
762  putMotherIndex(hadMothersIndices, prevPartIndex, -1); // Setting mother index of previous particle to -1
763  }
764  return hadronIndex; // Stopping further processing of the current chain
765  }
766  analyzedParticles->insert(thisParticle);
767 
768  // Putting the mothers to the list of mothers
769  for (size_t iMother = 0; iMother < thisParticle->numberOfMothers(); ++iMother) {
770  const reco::Candidate *mother = thisParticle->mother(iMother);
771  int mothIndex = idInList(hadMothers, mother);
772  if (mothIndex == partIndex && partIndex >= 0) {
773  continue; // Skipping the mother that is its own daughter
774  }
775 
776  // If this mother isn't yet in the list and hadron or lepton is in the list
777  if (mothIndex < 0) {
778  hadMothers.push_back(mother);
779  mothIndex = hadMothers.size() - 1;
780  }
781  // If hadron has already been found in current chain and the mother isn't a duplicate of the particle being checked
782  if (mothIndex != partIndex && partIndex >= 0) {
783  putMotherIndex(hadMothersIndices, partIndex, mothIndex); // Putting the index of mother for current particle
784  }
786  mother, topDaughterQId, topBarDaughterQId, hadMothers, hadMothersIndices, analyzedParticles, partIndex);
787  // Setting the id of the particle which is a quark from the top decay
788  if (std::abs(mother->pdgId()) == 6) {
789  int &bId = mother->pdgId() < 0 ? topBarDaughterQId : topDaughterQId;
790  int thisFlav = std::abs(thisParticle->pdgId());
791  if (bId < 0) {
792  if (thisFlav <= 5)
793  bId = partIndex;
794  } else {
795  int bIdFlav = std::abs(hadMothers.at(bId)->pdgId());
796  if (bIdFlav != 5 && thisFlav == 5)
797  bId = partIndex;
798  else if (thisFlav == 5 && thisParticle->pt() > hadMothers.at(bId)->pt())
799  bId = partIndex;
800  } // If daughter quark of the top not found yet
801  } // If the mother is a top quark and hadron has been found
802  } // End of loop over mothers
803 
804  analyzedParticles->erase(thisParticle); // Removing current particle from the current chain that is being analyzed
805 
806  if (partIndex < 0) {
807  return hadronIndex; // Safety check
808  }
809 
810  // Adding -1 to the list of mother indices for current particle if it has no mothers (for consistency between numbering of indices and mothers)
811  if ((int)thisParticle->numberOfMothers() <= 0) {
812  putMotherIndex(hadMothersIndices, partIndex, -1);
813  }
814 
815  return hadronIndex;
816 }

References funct::abs(), mps_fire::i, idInList(), reco::Candidate::mother(), reco::Candidate::numberOfMothers(), reco::Candidate::pdgId(), reco::Candidate::pt(), and putMotherIndex().

Referenced by findHadronJets().

◆ checkForLoop()

bool GenHFHadronMatcher::checkForLoop ( std::vector< const reco::Candidate * > &  particleChain,
const reco::Candidate particle 
) const
private

◆ fillDescriptions()

void GenHFHadronMatcher::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

description of the run-time parameters

Definition at line 212 of file GenHFHadronMatcher.cc.

212  {
214  desc.add<edm::InputTag>("genParticles")
215  ->setComment("Collection of GenParticle objects which contains all particles produced in the event");
216  desc.add<edm::InputTag>("jetFlavourInfos")
217  ->setComment(
218  "Output from the JetFlavour tool. Contains information about partons/hadrons/leptons associated to jets");
219  desc.add<bool>("noBBbarResonances", true)->setComment("Whether resonances should not be treated as hadrons");
220  desc.add<bool>("onlyJetClusteredHadrons", false)
221  ->setComment("Whether only hadrons that are matched to jets should be analysed. Runs x1000 faster in Sherpa");
222  desc.add<int>("flavour", 5)->setComment("Flavour of weakly decaying hadron that should be analysed (4-c, 5-b)");
223  descriptions.add("matchGenHFHadron", desc);
224 }

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

◆ findHadronJets()

std::vector< int > GenHFHadronMatcher::findHadronJets ( const reco::GenParticleCollection genParticles,
const reco::JetFlavourInfoMatchingCollection jetFlavourInfos,
std::vector< int > &  hadIndex,
std::vector< reco::GenParticle > &  hadMothers,
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
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.

Parameters
[out]hadIndexvector of indices of found hadrons in hadMothers
[out]hadMothersvector of all mothers at all levels of each found hadron
[out]hadMothersIndicesconnection between each particle from hadMothers and its mothers
[out]hadLeptonIndexindex of lepton among the hadMothers
[out]hadLeptonHadIndexindex of hadron associated to each lepton
[out]hadLeptonViaTauwhether lepton is from direct hadron->lepton or hadron->tau->lepton
[out]hadFlavourflavour of each found hadron
[out]hadFromTopWeakDecaywhether each hadron contains the top quark in its decay chain [works only for B-Hadrons]
[out]hadBHadronIdfor each hadron - index of the ancestor b-hadron [-1 if hadron doesn't come from another b-hdaron]
Returns
vector of jet indices that were matched to each hadron [by the jet clustering algorithm]

Definition at line 299 of file GenHFHadronMatcher.cc.

309  {
310  std::vector<int> hadJetIndex;
311  std::vector<const reco::Candidate *> hadMothersCand;
312 
313  int topDaughterQId = -1;
314  int topBarDaughterQId = -1;
315 
316  // Looping over all jets to get hadrons associated to them
318  i_info != jetFlavourInfos->end();
319  ++i_info) {
320  reco::JetFlavourInfo jetInfo = i_info->second;
321  const int jetIndex = i_info - jetFlavourInfos->begin();
322  // Looping over each hadron associated with the jet and finding its origin
323  const reco::GenParticleRefVector &hadronsInJet = flavour_ == 5 ? jetInfo.getbHadrons()
324  : flavour_ == 4 ? jetInfo.getcHadrons()
326  for (reco::GenParticleRefVector::const_iterator hadron = hadronsInJet.begin(); hadron != hadronsInJet.end();
327  ++hadron) {
328  // Check that the hadron satisfies criteria configured in the module
329  if (!isHadron(flavour_, (&**hadron)))
330  continue;
331  if (hasHadronDaughter(flavour_, (reco::Candidate *)(&**hadron)))
332  continue;
333  // Scanning the chain starting from the hadron
334  int hadronIndex = analyzeMothers((reco::Candidate *)(&**hadron),
335  topDaughterQId,
336  topBarDaughterQId,
337  hadMothersCand,
338  hadMothersIndices,
339  nullptr,
340  -1);
341  // Storing the index of the hadron to the list
342  hadIndex.push_back(hadronIndex);
343  hadJetIndex.push_back(jetIndex); // Putting jet index to the result list
344  }
345  } // End of loop over jets
346 
347  // Access all hadrons which are not associated with jets, if requested
349  for (reco::GenParticleCollection::const_iterator i_particle = genParticles->begin();
350  i_particle != genParticles->end();
351  ++i_particle) {
352  const reco::GenParticle *thisParticle = &*i_particle;
353  if (!isHadron(flavour_, thisParticle))
354  continue;
355  // Skipping the hadron if it was already found directly from jets
356  if (std::find(hadMothersCand.begin(), hadMothersCand.end(), thisParticle) != hadMothersCand.end())
357  continue;
358 
359  // Scanning the chain starting from the hadron
360  int hadronIndex = analyzeMothers(
361  thisParticle, topDaughterQId, topBarDaughterQId, hadMothersCand, hadMothersIndices, nullptr, -1);
362  // Storing the index of the hadron to the list
363  hadIndex.push_back(hadronIndex);
364  hadJetIndex.push_back(-1); // Jet index undefined
365  }
366  }
367 
368  // Transfering Candidates to the list of processed particles for further analysis
369  for (int i = 0; i < (int)hadMothersCand.size(); i++) {
370  const reco::GenParticle *particle = dynamic_cast<const reco::GenParticle *>(hadMothersCand.at(i));
371  hadMothers.push_back(*particle);
372  }
373 
374  // Adding leptons from hadron decays
375  for (reco::GenParticleCollection::const_iterator i_particle = genParticles->begin();
376  i_particle != genParticles->end();
377  ++i_particle) {
378  const reco::GenParticle lepton = *i_particle;
379  const int pdg_abs = lepton.pdgId();
380  // Skipping if not a lepton: e/mu
381  if (pdg_abs != 11 && pdg_abs != 13)
382  continue;
383  bool leptonViaTau = false;
384  const reco::Candidate *leptonMother = lepton.mother();
385  if (!leptonMother)
386  continue;
387  // Taking next mother if direct mother is a tau
388  if (std::abs(leptonMother->pdgId()) == 15) {
389  leptonViaTau = true;
390  leptonMother = leptonMother->mother();
391  }
392  // Skipping this lepton if its mother is not a proper hadron
393  if (leptonMother == nullptr or !isHadron(flavour_, leptonMother))
394  continue;
395  // Finding the index of this hadron in the list of analysed particles
396  size_t leptonHadronParticleIndex =
397  std::find(hadMothersCand.begin(), hadMothersCand.end(), leptonMother) - hadMothersCand.begin();
398  if (leptonHadronParticleIndex >= hadMothersCand.size())
399  continue;
400  // Finding the actual hadron index among those that were found
401  size_t leptonHadronIndex =
402  std::find(hadIndex.begin(), hadIndex.end(), leptonHadronParticleIndex) - hadIndex.begin();
403  if (leptonHadronIndex >= hadIndex.size())
404  continue;
405  // Putting the lepton, its index and hadron index to the corresponding lists
406  hadMothers.push_back(lepton);
407  const int leptonIndex = hadMothersCand.size() - 1;
408  hadLeptonIndex.push_back(leptonIndex);
409  hadLeptonViaTau.push_back(leptonViaTau);
410  hadLeptonHadIndex.push_back(leptonHadronIndex);
411  }
412 
413  // Checking mothers of hadrons in order to assign flags (where the hadron comes from)
414  unsigned int nHad = hadIndex.size();
415 
416  std::vector<std::vector<int>> LastQuarkMotherIds;
417  std::vector<std::vector<int>> LastQuarkIds;
418  std::vector<int> lastQuarkIndices(nHad, -1);
419 
420  // Looping over all hadrons
421  for (unsigned int hadNum = 0; hadNum < nHad; hadNum++) {
422  unsigned int hadIdx = hadIndex.at(hadNum); // Index of hadron in the hadMothers
423 
424  std::vector<int> FirstQuarkId;
425  std::vector<int> LastQuarkId;
426  std::vector<int> LastQuarkMotherId;
427 
428  const int hadronFlavourSign = flavourSign(hadMothers.at(hadIdx).pdgId());
429 
430  // Searching only first quark in the chain with the same flavour as hadron
431  if (hadronFlavourSign != 0) {
433  hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, hadronFlavourSign * flavour_, false, -1, 1, false);
434  }
435  // Searching for quarks with both flavours since it is a bb/cc resonance
436  else {
437  findInMothers(hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, flavour_, false, -1, 1, false);
438  findInMothers(hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, -1 * flavour_, false, -1, 1, false);
439  }
440 
441  // Finding last quark for each first quark
442  for (unsigned int qId = 0; qId < FirstQuarkId.size(); qId++) {
443  // Identifying the flavour of the first quark to find the last quark of the same flavour
444  const int quarkFlavourSign = flavourSign(hadMothers.at(FirstQuarkId.at(qId)).pdgId());
445  // Finding last quark of the hadron starting from the first quark
446  findInMothers(FirstQuarkId.at(qId),
447  LastQuarkId,
448  hadMothersIndices,
449  hadMothers,
450  0,
451  quarkFlavourSign * flavour_,
452  false,
453  -1,
454  2,
455  false);
456  } // End of loop over all first quarks of the hadron
457 
458  // Setting initial flavour of the hadron
459  int hadronFlavour = 0;
460 
461  // Initialising pairs of last quark index and its distance from the hadron (to sort by distance)
462  std::vector<std::pair<double, int>> lastQuark_dR_id_pairs;
463 
464  // Finding the closest quark in dR
465  for (unsigned int qId = 0; qId < LastQuarkId.size(); qId++) {
466  int qIdx = LastQuarkId.at(qId);
467  // Calculating the dR between hadron and quark
468  float dR = deltaR(hadMothers.at(hadIdx).eta(),
469  hadMothers.at(hadIdx).phi(),
470  hadMothers.at(qIdx).eta(),
471  hadMothers.at(qIdx).phi());
472 
473  std::pair<double, int> dR_hadId_pair(dR, qIdx);
474  lastQuark_dR_id_pairs.push_back(dR_hadId_pair);
475  } // End of loop over all last quarks of the hadron
476 
477  std::sort(lastQuark_dR_id_pairs.begin(), lastQuark_dR_id_pairs.end());
478 
479  if (lastQuark_dR_id_pairs.size() > 1) {
480  double dRratio =
481  (lastQuark_dR_id_pairs.at(1).first - lastQuark_dR_id_pairs.at(0).first) / lastQuark_dR_id_pairs.at(1).first;
482  int qIdx_closest = lastQuark_dR_id_pairs.at(0).second;
483  LastQuarkId.clear();
484  if (dRratio > 0.5)
485  LastQuarkId.push_back(qIdx_closest);
486  else
487  for (std::pair<double, int> qIdDrPair : lastQuark_dR_id_pairs)
488  LastQuarkId.push_back(qIdDrPair.second);
489  }
490  for (int qIdx : LastQuarkId) {
491  int qmIdx = hadMothersIndices.at(qIdx).at(0);
492  LastQuarkMotherId.push_back(qmIdx);
493  }
494 
495  if ((int)LastQuarkId.size() > 0)
496  lastQuarkIndices.at(hadNum) = 0; // Setting the first quark in array as a candidate if it exists
497 
498  LastQuarkIds.push_back(LastQuarkId);
499 
500  LastQuarkMotherIds.push_back(LastQuarkMotherId);
501 
502  if (LastQuarkMotherId.empty()) {
503  hadronFlavour = 0;
504  } else {
505  int qIdx = LastQuarkId.at(lastQuarkIndices.at(hadNum));
506  int qFlav = flavourSign(hadMothers.at(qIdx).pdgId());
507  hadronFlavour = qFlav * std::abs(hadMothers.at(LastQuarkMotherId.at(lastQuarkIndices.at(hadNum))).pdgId());
508  }
509  hadFlavour.push_back(hadronFlavour); // Adding hadron flavour to the list of flavours
510 
511  // Checking whether hadron comes from the Top weak decay
512  int isFromTopWeakDecay = 1;
513  std::vector<int> checkedParticles;
514  if (hadFlavour.at(hadNum) != 0) {
515  int lastQIndex = LastQuarkId.at(lastQuarkIndices.at(hadNum));
516  bool fromTB = topDaughterQId >= 0 ? findInMothers(lastQIndex,
517  checkedParticles,
518  hadMothersIndices,
519  hadMothers,
520  -1,
521  0,
522  false,
523  topDaughterQId,
524  2,
525  false) >= 0
526  : false;
527  checkedParticles.clear();
528  bool fromTbarB = topBarDaughterQId >= 0 ? findInMothers(lastQIndex,
529  checkedParticles,
530  hadMothersIndices,
531  hadMothers,
532  -1,
533  0,
534  false,
535  topBarDaughterQId,
536  2,
537  false) >= 0
538  : false;
539  checkedParticles.clear();
540  if (!fromTB && !fromTbarB) {
541  isFromTopWeakDecay = 0;
542  }
543  } else
544  isFromTopWeakDecay = 2;
545  hadFromTopWeakDecay.push_back(isFromTopWeakDecay);
546  int bHadronMotherId =
547  findInMothers(hadIdx, checkedParticles, hadMothersIndices, hadMothers, 0, 555555, true, -1, 1, false);
548  hadBHadronId.push_back(bHadronMotherId);
549 
550  if (!LastQuarkMotherId.empty()) {
551  std::set<int> checkedHadronIds;
552  fixExtraSameFlavours(hadNum,
553  hadIndex,
554  hadMothers,
555  hadMothersIndices,
556  hadFromTopWeakDecay,
557  LastQuarkIds,
558  LastQuarkMotherIds,
559  lastQuarkIndices,
560  hadFlavour,
561  checkedHadronIds,
562  0);
563  }
564 
565  } // End of loop over all hadrons
566 
567  return hadJetIndex;
568 }

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(), reco::LeafCandidate::pdgId(), and jetUpdater_cfi::sort.

Referenced by produce().

◆ findInMothers()

int GenHFHadronMatcher::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 = false,
int  stopId = -1,
int  firstLast = 0,
bool  verbose = false 
) const
private

helper function to find indices of particles with particular pdgId and status from the list of mothers of a given particle

Parameters
[in]idxindex of particle, mothers of which should be searched
[in]mothChainsvector of indices where the found mothers are stored
[in]hadMothersIndiceslist of indices pointing to mothers of each particle from list of mothers
[in]hadMothersvector of all hadron mother particles of all levels
[in]statusstatus of mother that is being looked for
[in]pdgIdpdgId of mother that is being looked for [flavour*111111 used to identify hadrons of particular flavour]
[in]pdgAbswhether the sign of pdgId should be taken into account
[in]stopIdid of the particle in the hadMothers array after which the checking should stop
[in]firstLastshould all(0), first(1) or last(2) occurances of the searched particle be stored
[in]verboseoption to print every particle that is processed during the search
Returns
index of the found particle in the hadMothers array [-1 if the specified particle not found]

Definition at line 880 of file GenHFHadronMatcher.cc.

889  {
890  int foundStopId = -1;
891  int pdg_1 = hadMothers.at(idx).pdgId();
892 
893  if ((int)hadMothersIndices.size() <= idx) {
894  if (verbose) {
895  printf(" Stopping checking particle %d. No mothers are stored.\n", idx);
896  }
897  return -1; // Skipping if no mothers are stored for this particle
898  }
899 
900  if (std::abs(hadMothers.at(idx).pdgId()) > 10 && std::abs(hadMothers.at(idx).pdgId()) < 19)
901  printf("Lepton: %d\n", hadMothers.at(idx).pdgId());
902 
903  std::vector<int> mothers = hadMothersIndices.at(idx);
904  unsigned int nMothers = mothers.size();
905  bool isCorrect = false; // Whether current particle is what is being searched
906  if (verbose) {
907  if (std::abs(hadMothers.at(idx).pdgId()) == 2212) {
908  printf("Chk: %d\tpdg: %d\tstatus: %d", idx, hadMothers.at(idx).pdgId(), hadMothers.at(idx).status());
909  } else {
910  printf(" Chk: %d(%d mothers)\tpdg: %d\tstatus: %d\tPt: %.3f\tEta: %.3f",
911  idx,
912  nMothers,
913  hadMothers.at(idx).pdgId(),
914  hadMothers.at(idx).status(),
915  hadMothers.at(idx).pt(),
916  hadMothers.at(idx).eta());
917  }
918  }
919  bool hasCorrectMothers = true;
920  if (nMothers < 1)
921  hasCorrectMothers = false;
922  else if (mothers.at(0) < 0)
923  hasCorrectMothers = false;
924  if (!hasCorrectMothers) {
925  if (verbose)
926  printf(" NO CORRECT MOTHER\n");
927  return -1;
928  }
929  // Stopping if the particular particle has been found
930  if (stopId >= 0 && idx == stopId)
931  return idx;
932 
933  // Stopping if the hadron of particular flavour has been found
934  if (pdgId % 111111 == 0 && pdgId != 0) {
935  if (isHadronPdgId(pdgId / 111111, hadMothers.at(idx).pdgId())) {
936  return idx;
937  }
938  }
939 
940  // Checking whether current mother satisfies selection criteria
941  if (((hadMothers.at(idx).pdgId() == pdgId && pdgAbs == false) ||
942  (std::abs(hadMothers.at(idx).pdgId()) == std::abs(pdgId) && pdgAbs == true)) &&
943  (hadMothers.at(idx).status() == status || status == 0) && hasCorrectMothers) {
944  isCorrect = true;
945  // Adding to the list of candidates if not there and if mother of this quark has correct flavour sign
946  const bool inList = std::find(mothChains.begin(), mothChains.end(), idx) != mothChains.end();
947  if (!inList && mothers.at(0) >= 0 && (hadMothers.at(idx).pdgId() * pdgId > 0 || !pdgAbs)) {
948  if (firstLast == 0 || firstLast == 1) {
949  mothChains.push_back(idx);
950  }
951  if (verbose) {
952  printf(" *");
953  }
954  }
955  if (verbose) {
956  printf(" +++");
957  }
958  }
959  if (verbose) {
960  printf("\n");
961  }
962 
963  if (isCorrect && firstLast == 1) {
964  return -1; // Stopping if only the first particle in the chain is looked for
965  }
966 
967  // Checking next level mothers
968  unsigned int nDifferingMothers = 0;
969  for (unsigned int i = 0; i < nMothers; i++) {
970  int idx2 = mothers.at(i);
971  if (idx2 < 0) {
972  if (verbose)
973  printf("^^^ Has no mother\n");
974  continue; // Skipping if mother's id is -1 (no mother), that means current particle is a proton
975  }
976  if (idx2 == idx) {
977  if (verbose)
978  printf("^^^ Stored as its own mother\n");
979  continue; // Skipping if particle is stored as its own mother
980  }
981  int pdg_2 = hadMothers[idx2].pdgId();
982  // Inverting the flavour if bb oscillation detected
983  if (isHadronPdgId(pdgId, pdg_1) && isHadronPdgId(pdgId, pdg_2) && pdg_1 * pdg_2 < 0) {
984  pdgId *= -1;
985  if (verbose)
986  printf("######### Inverting flavour of the hadron\n");
987  }
988  // Counting how many mothers are different from this particle
989  if ((std::abs(pdg_2) != std::abs(pdgId) && pdgAbs == true) || (pdg_2 != pdgId && pdgAbs == false)) {
990  nDifferingMothers++;
991  }
992 
993  // Checking next level mother
994  if (verbose) {
995  printf("Checking mother %d out of %d mothers (%d -> %d), looking for pdgId: %d\n", i, nMothers, idx, idx2, pdgId);
996  }
997  if (firstLast == 2 && pdg_1 != pdg_2)
998  continue; // Requiring the same flavour when finding the last quark
999  foundStopId = findInMothers(
1000  idx2, mothChains, hadMothersIndices, hadMothers, status, pdgId, pdgAbs, stopId, firstLast, verbose);
1001  }
1002  // Storing this particle if all its mothers are of another type and the last of its kind should be stored
1003  if (firstLast == 2 && isCorrect && nDifferingMothers >= nMothers) {
1004  if (verbose) {
1005  printf("Checking particle %d once more to store it as the last quark\n", idx);
1006  }
1007  foundStopId = findInMothers(idx, mothChains, hadMothersIndices, hadMothers, 0, pdgId, pdgAbs, stopId, 1, verbose);
1008  }
1009 
1010  return foundStopId;
1011 }

References funct::abs(), spr::find(), mps_fire::i, heavyIonCSV_trainingSettings::idx, isHadronPdgId(), EgammaValidation_cff::pdgId, mps_update::status, and verbose.

Referenced by findHadronJets().

◆ fixExtraSameFlavours()

bool GenHFHadronMatcher::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
private

Finds hadrons that have the same flavour and origin and resolve this ambiguity @method fixExtraSameFlavours

Parameters
hadIdIndex of the hadron being checked
hadIndexVector of indices of each hadron pointing to the hadMothers
hadMothersVector of gen particles (contain hadrons and all its ancestors)
hadMothersIndicesVector of indices for each particle from hadMothers
isFromTopWeakDecayVector of values showing whether particle comes from the top weak decay
LastQuarkIdsVector of indices of last quarks for each hadron
LastQuarkMotherIdsVector of indices of mothers for each last quark from LastQuarkIds
lastQuakIndicesVector of indices pointing to particular index from the LastQuarkIds and LastQuarkMotherIds to be used for each hadron
lastQuarkIndexIndex from the LastQuarkIds and LastQuarkMotherIds for this particular hadron with index hadId
Returns
Whether other mother with unique association has been found for the hadrons

Definition at line 1044 of file GenHFHadronMatcher.cc.

1054  {
1055  if (checkedHadronIds.count(hadId) != 0)
1056  return false; // Hadron already checked previously and should be skipped
1057  checkedHadronIds.insert(hadId); // Putting hadron to the list of checked ones in this run
1058 
1059  if (lastQuarkIndex < 0)
1060  return false;
1061  if ((int)LastQuarkIds.at(hadId).size() < lastQuarkIndex + 1)
1062  return false;
1063  int LastQuarkId = LastQuarkIds.at(hadId).at(lastQuarkIndex);
1064  int LastQuarkMotherId = LastQuarkMotherIds.at(hadId).at(lastQuarkIndex);
1065  int qmFlav = hadMothers.at(LastQuarkId).pdgId() < 0 ? -1 : 1;
1066  int hadFlavour = qmFlav * std::abs(hadMothers.at(LastQuarkMotherId).pdgId());
1067  bool ambiguityResolved = true;
1068  // If last quark has inconsistent flavour with its mother, setting the hadron flavour to gluon
1069  if ((hadMothers.at(LastQuarkId).pdgId() * hadMothers.at(LastQuarkMotherId).pdgId() < 0 &&
1070  !isNeutralPdg(hadMothers.at(LastQuarkMotherId).pdgId())) ||
1071  // If particle not coming from the Top weak decay has Top flavour
1072  (std::abs(hadronFlavour.at(hadId)) == 6 && isFromTopWeakDecay.at(hadId) == 0)) {
1073  if ((int)LastQuarkIds.at(hadId).size() > lastQuarkIndex + 1)
1074  fixExtraSameFlavours(hadId,
1075  hadIndices,
1076  hadMothers,
1077  hadMothersIndices,
1078  isFromTopWeakDecay,
1079  LastQuarkIds,
1080  LastQuarkMotherIds,
1081  lastQuarkIndices,
1082  hadronFlavour,
1083  checkedHadronIds,
1084  lastQuarkIndex + 1);
1085  else
1086  hadronFlavour.at(hadId) = qmFlav * 21;
1087  return true;
1088  }
1089 
1090  int nSameFlavourHadrons = 0;
1091  // Looping over all previous hadrons
1092  for (unsigned int iHad = 0; iHad < hadronFlavour.size(); iHad++) {
1093  if (iHad == hadId)
1094  continue;
1095  int theLastQuarkIndex = lastQuarkIndices.at(iHad);
1096  if (theLastQuarkIndex < 0)
1097  continue;
1098  if ((int)LastQuarkMotherIds.at(iHad).size() <= theLastQuarkIndex)
1099  continue;
1100  int theLastQuarkMotherId = LastQuarkMotherIds.at(iHad).at(theLastQuarkIndex);
1101  int theHadFlavour = hadronFlavour.at(iHad);
1102  // Skipping hadrons with different flavour
1103  if (theHadFlavour == 0 || std::abs(theHadFlavour) == 21)
1104  continue;
1105  if (theHadFlavour != hadFlavour || theLastQuarkMotherId != LastQuarkMotherId)
1106  continue;
1107  ambiguityResolved = false;
1108  nSameFlavourHadrons++;
1109 
1110  // Checking other b-quark mother candidates of this hadron
1111  if ((int)LastQuarkIds.at(hadId).size() > lastQuarkIndex + 1) {
1112  if (fixExtraSameFlavours(hadId,
1113  hadIndices,
1114  hadMothers,
1115  hadMothersIndices,
1116  isFromTopWeakDecay,
1117  LastQuarkIds,
1118  LastQuarkMotherIds,
1119  lastQuarkIndices,
1120  hadronFlavour,
1121  checkedHadronIds,
1122  lastQuarkIndex + 1)) {
1123  ambiguityResolved = true;
1124  break;
1125  }
1126  } else
1127  // Checking other b-quark mother candidates of the particular previous hadron
1128  if ((int)LastQuarkIds.at(iHad).size() > theLastQuarkIndex + 1) {
1129  if (fixExtraSameFlavours(iHad,
1130  hadIndices,
1131  hadMothers,
1132  hadMothersIndices,
1133  isFromTopWeakDecay,
1134  LastQuarkIds,
1135  LastQuarkMotherIds,
1136  lastQuarkIndices,
1137  hadronFlavour,
1138  checkedHadronIds,
1139  theLastQuarkIndex + 1)) {
1140  ambiguityResolved = true;
1141  break;
1142  };
1143  }
1144 
1145  } // End of loop over all previous hadrons
1146 
1147  checkedHadronIds.erase(hadId); // Removing the hadron from the list of checked hadrons
1148  if (nSameFlavourHadrons > 0 && !ambiguityResolved) {
1149  hadronFlavour.at(hadId) = qmFlav * 21;
1150  return true;
1151  }
1152  lastQuarkIndices.at(hadId) = lastQuarkIndex;
1153  hadronFlavour.at(hadId) = hadFlavour;
1154  return true;
1155 }

References funct::abs(), jets_cff::hadronFlavour, and isNeutralPdg().

Referenced by findHadronJets().

◆ flavourSign()

int GenHFHadronMatcher::flavourSign ( const int  pdgId) const
private

Sign of the flavour (matter/antimatter)

Parameters
[in]pdgIdpdgId to be checked
Returns
+1/-1/0 matter/antimatter/undefined

Definition at line 675 of file GenHFHadronMatcher.cc.

675  {
676  int flavourSign = pdgId / std::abs(pdgId);
677  // B mesons have opposite sign
678  if (isMesonPdgId(5, pdgId))
679  flavourSign *= -1;
680  // Returning 0 for bb/cc resonances
681  if (pdgId % 1000 / 10 / 11 > 0)
682  flavourSign = 0;
683 
684  return flavourSign;
685 }

References funct::abs(), isMesonPdgId(), and EgammaValidation_cff::pdgId.

Referenced by findHadronJets().

◆ getParticleName()

std::string GenHFHadronMatcher::getParticleName ( int  id) const
private

◆ hasHadronDaughter()

bool GenHFHadronMatcher::hasHadronDaughter ( const int  flavour,
const reco::Candidate thisParticle 
) const
private

Check if the particle has bHadron among daughters.

Parameters
[in]flavourflavour of a hadron that is being searched (5-B, 4-C)
[in]thisParticlea particle that is to be analysed
Returns
whether the particle has a hadron among its daughters

Definition at line 695 of file GenHFHadronMatcher.cc.

695  {
696  // Looping through daughters of the particle
697  bool hasDaughter = false;
698  for (int k = 0; k < (int)thisParticle->numberOfDaughters(); k++) {
699  if (!isHadron(flavour, thisParticle->daughter(k))) {
700  continue;
701  }
702  hasDaughter = true;
703  break;
704  }
705 
706  return hasDaughter;
707 }

References reco::Candidate::daughter(), GenHFHadronMatcher_cff::flavour, createfilelist::int, isHadron(), dqmdumpme::k, and reco::Candidate::numberOfDaughters().

Referenced by findHadronJets().

◆ idInList() [1/2]

int GenHFHadronMatcher::idInList ( std::vector< const reco::Candidate * >  particleList,
const reco::Candidate particle 
) const
private

Check if the cpecified particle is already in the list of particles.

Parameters
[in]particleListlist of particles to be checked
[in]particleparticle that should be checked
Returns
the index of the particle in the list [-1 if particle not found]

Definition at line 578 of file GenHFHadronMatcher.cc.

579  {
580  const unsigned int position = std::find(particleList.begin(), particleList.end(), particle) - particleList.begin();
581  if (position >= particleList.size())
582  return -1;
583 
584  return position;
585 }

References spr::find(), and position.

Referenced by analyzeMothers().

◆ idInList() [2/2]

int GenHFHadronMatcher::idInList ( std::vector< int >  list,
const int  value 
) const
private

Definition at line 587 of file GenHFHadronMatcher.cc.

587  {
588  const unsigned int position = std::find(list.begin(), list.end(), value) - list.begin();
589  if (position >= list.size())
590  return -1;
591 
592  return position;
593 }

References spr::find(), position, and relativeConstraints::value.

◆ isBaryonPdgId()

bool GenHFHadronMatcher::isBaryonPdgId ( const int  flavour,
const int  pdgId 
) const
private

Check the pdgId if it represents a baryon of particular flavour.

Parameters
[in]flavourflavour of a hadron that is being searched (5-B, 4-C)
[in]pdgIdpdgId to be checked
Returns
true if the pdgId represents a baryon of specified flavour

Definition at line 656 of file GenHFHadronMatcher.cc.

656  {
657  const int flavour_abs = std::abs(flavour);
658  if (flavour_abs != 5 && flavour_abs != 4)
659  return false;
660  const int pdgId_abs = std::abs(pdgId);
661 
662  if (pdgId_abs / 1000 != flavour_abs)
663  return false;
664 
665  return true;
666 }

References funct::abs(), GenHFHadronMatcher_cff::flavour, and EgammaValidation_cff::pdgId.

Referenced by isHadronPdgId().

◆ isHadron()

bool GenHFHadronMatcher::isHadron ( const int  flavour,
const reco::Candidate thisParticle 
) const
private

Check the pdgId of a given particle if it is a hadron.

Parameters
[in]flavourflavour of a hadron that is being searched (5-B, 4-C)
[in]thisParticlea particle that is to be analysed
Returns
whether the particle is a hadron of specified flavour

Definition at line 603 of file GenHFHadronMatcher.cc.

603  {
604  return isHadronPdgId(flavour, thisParticle->pdgId());
605 }

References GenHFHadronMatcher_cff::flavour, isHadronPdgId(), and reco::Candidate::pdgId().

Referenced by findHadronJets(), and hasHadronDaughter().

◆ isHadronPdgId()

bool GenHFHadronMatcher::isHadronPdgId ( const int  flavour,
const int  pdgId 
) const
private

Check the pdgId if it represents a hadron of particular flavour.

Parameters
[in]flavourflavour of a hadron that is being searched (5-B, 4-C)
[in]pdgIdpdgId to be checked
Returns
true if the pdgId represents a hadron of specified flavour

Definition at line 615 of file GenHFHadronMatcher.cc.

615  {
617  return true;
618 
619  return false;
620 }

References GenHFHadronMatcher_cff::flavour, isBaryonPdgId(), isMesonPdgId(), and EgammaValidation_cff::pdgId.

Referenced by findInMothers(), and isHadron().

◆ isMesonPdgId()

bool GenHFHadronMatcher::isMesonPdgId ( const int  flavour,
const int  pdgId 
) const
private

Check the pdgId if it represents a meson of particular flavour.

Parameters
[in]flavourflavour of a hadron that is being searched (5-B, 4-C)
[in]pdgIdpdgId to be checked
Returns
true if the pdgId represents a meson of specified flavour

Definition at line 630 of file GenHFHadronMatcher.cc.

630  {
631  const int flavour_abs = std::abs(flavour);
632  if (flavour_abs != 5 && flavour_abs != 4)
633  return false;
634  const int pdgId_abs = std::abs(pdgId);
635 
636  if (pdgId_abs / 100 % 10 != flavour_abs)
637  return false;
638  // Excluding baryons
639  if (pdgId_abs / 1000 == flavour_abs)
640  return false;
641  // Excluding bb/cc resonances if required
642  if (noBBbarResonances_ && pdgId_abs / 10 % 100 == 11 * flavour_abs)
643  return false;
644 
645  return true;
646 }

References funct::abs(), GenHFHadronMatcher_cff::flavour, noBBbarResonances_, and EgammaValidation_cff::pdgId.

Referenced by flavourSign(), and isHadronPdgId().

◆ isNeutralPdg()

bool GenHFHadronMatcher::isNeutralPdg ( int  pdgId) const
private

Check whether a given pdgId represents neutral particle.

Parameters
[in]pdgId
[in]thisParticle- a particle that is to be analysed
Returns
if the particle has a hadron among its daughters

Definition at line 1021 of file GenHFHadronMatcher.cc.

1021  {
1022  const int neutralPdgs_array[] = {9, 21, 22, 23, 25};
1023  const std::vector<int> neutralPdgs(neutralPdgs_array, neutralPdgs_array + sizeof(neutralPdgs_array) / sizeof(int));
1024  if (std::find(neutralPdgs.begin(), neutralPdgs.end(), std::abs(pdgId)) == neutralPdgs.end())
1025  return false;
1026 
1027  return true;
1028 }

References funct::abs(), spr::find(), and EgammaValidation_cff::pdgId.

Referenced by fixExtraSameFlavours().

◆ produce()

void GenHFHadronMatcher::produce ( edm::StreamID  ,
edm::Event evt,
const edm::EventSetup setup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 231 of file GenHFHadronMatcher.cc.

231  {
232  using namespace edm;
233 
236 
239 
240  // Defining adron matching variables
241  std::vector<reco::GenParticle> hadMothers;
242  std::vector<std::vector<int>> hadMothersIndices;
243  std::vector<int> hadIndex;
244  std::vector<int> hadFlavour;
245  std::vector<int> hadJetIndex;
246  std::vector<int> hadLeptonIndex;
247  std::vector<int> hadLeptonHadIndex;
248  std::vector<int> hadLeptonViaTau;
249  std::vector<int> hadFromTopWeakDecay;
250  std::vector<int> hadBHadronId;
251 
252  hadJetIndex = findHadronJets(genParticles.product(),
253  jetFlavourInfos.product(),
254  hadIndex,
255  hadMothers,
256  hadMothersIndices,
257  hadLeptonIndex,
258  hadLeptonHadIndex,
259  hadLeptonViaTau,
260  hadFlavour,
261  hadFromTopWeakDecay,
262  hadBHadronId);
263 
264  // Putting products to the event
265  evt.emplace(plusMothersToken_, std::move(hadMothers));
266  evt.emplace(plusMothersIndicesToken_, std::move(hadMothersIndices));
267  evt.emplace(indexToken_, std::move(hadIndex));
268  evt.emplace(flavourToken_, std::move(hadFlavour));
269  evt.emplace(jetIndexToken_, std::move(hadJetIndex));
270  evt.emplace(leptonIndexToken_, std::move(hadLeptonIndex));
271  evt.emplace(leptonHadronIndexToken_, std::move(hadLeptonHadIndex));
272  evt.emplace(leptonViaTauToken_, std::move(hadLeptonViaTau));
273  evt.emplace(fromTopWeakDecayToken_, std::move(hadFromTopWeakDecay));
274  evt.emplace(bHadronIdToken_, std::move(hadBHadronId));
275 }

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_.

◆ putMotherIndex()

bool GenHFHadronMatcher::putMotherIndex ( std::vector< std::vector< int >> &  hadMothersIndices,
int  partIndex,
int  mothIndex 
) const
private

puts mother index to the list of mothers of particle, if it isn't there already

Parameters
[in]hadMothersIndicesvector of indices of mothers for each particle
[in]partIndexindex of the particle for which the mother index should be stored
[in]mothIndexindex of mother that should be stored for current particle
Returns
whether the particle index was alreade in the list

Definition at line 827 of file GenHFHadronMatcher.cc.

829  {
830  // Putting vector of mothers indices for the given particle
831  bool inList = false;
832  if (partIndex < 0) {
833  return false;
834  }
835 
836  while ((int)hadMothersIndices.size() <= partIndex) { // If there is no list of mothers for current particle yet
837  std::vector<int> mothersIndices;
838  hadMothersIndices.push_back(mothersIndices);
839  }
840 
841  std::vector<int> *hadMotherIndices = &hadMothersIndices.at(partIndex);
842  // Removing other mothers if particle must have no mothers
843  if (mothIndex == -1) {
844  hadMotherIndices->clear();
845  } else {
846  // Checking if current mother is already in the list of theParticle's mothers
847  for (int k = 0; k < (int)hadMotherIndices->size(); k++) {
848  if (hadMotherIndices->at(k) != mothIndex && hadMotherIndices->at(k) != -1) {
849  continue;
850  }
851  inList = true;
852  break;
853  }
854  }
855  // Adding current mother to the list of mothers of this particle
856  if (!inList) {
857  hadMotherIndices->push_back(mothIndex);
858  }
859 
860  return inList;
861 }

References createfilelist::int, and dqmdumpme::k.

Referenced by analyzeMothers().

Member Data Documentation

◆ bHadronIdToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::bHadronIdToken_
private

Definition at line 134 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ flavour_

const int GenHFHadronMatcher::flavour_
private

Definition at line 120 of file GenHFHadronMatcher.cc.

Referenced by findHadronJets().

◆ flavourStr_

const std::string GenHFHadronMatcher::flavourStr_
private

Definition at line 124 of file GenHFHadronMatcher.cc.

◆ flavourToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::flavourToken_
private

Definition at line 128 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ fromTopWeakDecayToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::fromTopWeakDecayToken_
private

Definition at line 133 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ genParticlesToken_

const edm::EDGetTokenT<reco::GenParticleCollection> GenHFHadronMatcher::genParticlesToken_
private

Definition at line 118 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ indexToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::indexToken_
private

Definition at line 127 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ jetFlavourInfosToken_

const edm::EDGetTokenT<reco::JetFlavourInfoMatchingCollection> GenHFHadronMatcher::jetFlavourInfosToken_
private

Definition at line 119 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ jetIndexToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::jetIndexToken_
private

Definition at line 129 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ leptonHadronIndexToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::leptonHadronIndexToken_
private

Definition at line 131 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ leptonIndexToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::leptonIndexToken_
private

Definition at line 130 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ leptonViaTauToken_

const edm::EDPutTokenT<std::vector<int> > GenHFHadronMatcher::leptonViaTauToken_
private

Definition at line 132 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ noBBbarResonances_

const bool GenHFHadronMatcher::noBBbarResonances_
private

Definition at line 121 of file GenHFHadronMatcher.cc.

Referenced by isMesonPdgId().

◆ onlyJetClusteredHadrons_

const bool GenHFHadronMatcher::onlyJetClusteredHadrons_
private

Definition at line 122 of file GenHFHadronMatcher.cc.

Referenced by findHadronJets().

◆ plusMothersIndicesToken_

const edm::EDPutTokenT<std::vector<std::vector<int> > > GenHFHadronMatcher::plusMothersIndicesToken_
private

Definition at line 126 of file GenHFHadronMatcher.cc.

Referenced by produce().

◆ plusMothersToken_

const edm::EDPutTokenT<std::vector<reco::GenParticle> > GenHFHadronMatcher::plusMothersToken_
private

Definition at line 125 of file GenHFHadronMatcher.cc.

Referenced by produce().

reco::Candidate::daughter
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
GenHFHadronMatcher::putMotherIndex
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
Definition: GenHFHadronMatcher.cc:827
GenHFHadronMatcher::bHadronIdToken_
const edm::EDPutTokenT< std::vector< int > > bHadronIdToken_
Definition: GenHFHadronMatcher.cc:134
GenHFHadronMatcher_cff.flavour
flavour
Definition: GenHFHadronMatcher_cff.py:8
mps_fire.i
i
Definition: mps_fire.py:428
GenHFHadronMatcher::jetFlavourInfosToken_
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfosToken_
Definition: GenHFHadronMatcher.cc:119
genParticles2HepMC_cfi.genParticles
genParticles
Definition: genParticles2HepMC_cfi.py:4
GenHFHadronMatcher::leptonIndexToken_
const edm::EDPutTokenT< std::vector< int > > leptonIndexToken_
Definition: GenHFHadronMatcher.cc:130
jets_cff.hadronFlavour
hadronFlavour
Definition: jets_cff.py:591
GenHFHadronMatcher::flavourSign
int flavourSign(const int pdgId) const
Sign of the flavour (matter/antimatter)
Definition: GenHFHadronMatcher.cc:675
reco::GenParticle
Definition: GenParticle.h:21
mps_update.status
status
Definition: mps_update.py:69
GenHFHadronMatcher::idInList
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.
Definition: GenHFHadronMatcher.cc:578
reco::CompositeRefCandidateT::mother
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode)
edm
HLT enums.
Definition: AlignableModifier.h:19
GenHFHadronMatcher::flavourToken_
const edm::EDPutTokenT< std::vector< int > > flavourToken_
Definition: GenHFHadronMatcher.cc:128
GenHFHadronMatcher::noBBbarResonances_
const bool noBBbarResonances_
Definition: GenHFHadronMatcher.cc:121
edm::RefVector::begin
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
GenHFHadronMatcher::fixExtraSameFlavours
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
Definition: GenHFHadronMatcher.cc:1044
GenHFHadronMatcher::isHadronPdgId
bool isHadronPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a hadron of particular flavour.
Definition: GenHFHadronMatcher.cc:615
edm::RefVector< GenParticleCollection >
GenHFHadronMatcher::plusMothersToken_
const edm::EDPutTokenT< std::vector< reco::GenParticle > > plusMothersToken_
Definition: GenHFHadronMatcher.cc:125
GenHFHadronMatcher::plusMothersIndicesToken_
const edm::EDPutTokenT< std::vector< std::vector< int > > > plusMothersIndicesToken_
Definition: GenHFHadronMatcher.cc:126
GenHFHadronMatcher::genParticlesToken_
const edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
Definition: GenHFHadronMatcher.cc:118
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reco::Candidate::mother
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
edm::Handle< reco::GenParticleCollection >
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
GenHFHadronMatcher::jetIndexToken_
const edm::EDPutTokenT< std::vector< int > > jetIndexToken_
Definition: GenHFHadronMatcher.cc:129
edm::RefVector::end
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
reco::Candidate::numberOfMothers
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
GenHFHadronMatcher::flavourStr_
const std::string flavourStr_
Definition: GenHFHadronMatcher.cc:124
GenHFHadronMatcher::isMesonPdgId
bool isMesonPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a meson of particular flavour.
Definition: GenHFHadronMatcher.cc:630
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
reco::Candidate::numberOfDaughters
virtual size_type numberOfDaughters() const =0
number of daughters
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::Event::emplace
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&... args)
puts a new product
Definition: Event.h:429
reco::JetFlavourInfo
Class storing the jet flavour information.
Definition: JetFlavourInfo.h:18
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
reco::JetFlavourInfo::getcHadrons
const GenParticleRefVector & getcHadrons() const
Return a vector of GenParticleRef's to c hadrons clustered inside the jet.
Definition: JetFlavourInfo.h:39
reco::JetFlavourInfo::getbHadrons
const GenParticleRefVector & getbHadrons() const
Return a vector of GenParticleRef's to b hadrons clustered inside the jet.
Definition: JetFlavourInfo.h:37
reco::GenParticleRefVector
edm::RefVector< GenParticleCollection > GenParticleRefVector
vector of reference to GenParticle in the same collection
Definition: GenParticleFwd.h:25
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::LeafCandidate::pdgId
int pdgId() const final
PDG identifier.
Definition: LeafCandidate.h:176
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
GenHFHadronMatcher::hasHadronDaughter
bool hasHadronDaughter(const int flavour, const reco::Candidate *thisParticle) const
Check if the particle has bHadron among daughters.
Definition: GenHFHadronMatcher.cc:695
GenHFHadronMatcher::leptonHadronIndexToken_
const edm::EDPutTokenT< std::vector< int > > leptonHadronIndexToken_
Definition: GenHFHadronMatcher.cc:131
createfilelist.int
int
Definition: createfilelist.py:10
GenHFHadronMatcher::isNeutralPdg
bool isNeutralPdg(int pdgId) const
Check whether a given pdgId represents neutral particle.
Definition: GenHFHadronMatcher.cc:1021
edm::AssociationVector::const_iterator
transient_vector_type::const_iterator const_iterator
Definition: AssociationVector.h:106
GenHFHadronMatcher::flavour_
const int flavour_
Definition: GenHFHadronMatcher.cc:120
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
GenHFHadronMatcher::findHadronJets
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
Definition: GenHFHadronMatcher.cc:299
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
GenHFHadronMatcher::fromTopWeakDecayToken_
const edm::EDPutTokenT< std::vector< int > > fromTopWeakDecayToken_
Definition: GenHFHadronMatcher.cc:133
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
GenHFHadronMatcher::findInMothers
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 mother...
Definition: GenHFHadronMatcher.cc:880
eostools.move
def move(src, dest)
Definition: eostools.py:511
GenHFHadronMatcher::leptonViaTauToken_
const edm::EDPutTokenT< std::vector< int > > leptonViaTauToken_
Definition: GenHFHadronMatcher.cc:132
relativeConstraints.value
value
Definition: relativeConstraints.py:53
GenHFHadronMatcher::isBaryonPdgId
bool isBaryonPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a baryon of particular flavour.
Definition: GenHFHadronMatcher.cc:656
edm::RefVectorIterator
Definition: EDProductfwd.h:33
GenHFHadronMatcher::onlyJetClusteredHadrons_
const bool onlyJetClusteredHadrons_
Definition: GenHFHadronMatcher.cc:122
GenHFHadronMatcher::analyzeMothers
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 f...
Definition: GenHFHadronMatcher.cc:726
GenHFHadronMatcher::isHadron
bool isHadron(const int flavour, const reco::Candidate *thisParticle) const
Check the pdgId of a given particle if it is a hadron.
Definition: GenHFHadronMatcher.cc:603
GenHFHadronMatcher::indexToken_
const edm::EDPutTokenT< std::vector< int > > indexToken_
Definition: GenHFHadronMatcher.cc:127
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GenHFHadronMatcher_cfi.jetFlavourInfos
jetFlavourInfos
Definition: GenHFHadronMatcher_cfi.py:5
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
edm::InputTag
Definition: InputTag.h:15