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::vector< ModuleDescription const * > &modules, 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 725 of file GenHFHadronMatcher.cc.

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

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

References funct::abs(), analyzeMothers(), edm::RefVector< C, T, F >::begin(), PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, edm::RefVector< C, T, F >::end(), spr::find(), findInMothers(), fixExtraSameFlavours(), flavour_, flavourSign(), genParticles2HepMC_cfi::genParticles, reco::JetFlavourInfo::getbHadrons(), reco::JetFlavourInfo::getcHadrons(), jets_cff::hadronFlavour, hasHadronDaughter(), mps_fire::i, createfilelist::int, isHadron(), GenHFHadronMatcher_cfi::jetFlavourInfos, reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::mother(), onlyJetClusteredHadrons_, or, EgammaValidation_cff::pdgId, reco::Candidate::pdgId(), and reco::LeafCandidate::pdgId().

Referenced by produce().

◆ 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 879 of file GenHFHadronMatcher.cc.

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

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 1043 of file GenHFHadronMatcher.cc.

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

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 674 of file GenHFHadronMatcher.cc.

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

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 694 of file GenHFHadronMatcher.cc.

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

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 577 of file GenHFHadronMatcher.cc.

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

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 586 of file GenHFHadronMatcher.cc.

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

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 655 of file GenHFHadronMatcher.cc.

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

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 602 of file GenHFHadronMatcher.cc.

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

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 614 of file GenHFHadronMatcher.cc.

614  {
616  return true;
617 
618  return false;
619 }

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 629 of file GenHFHadronMatcher.cc.

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

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 1020 of file GenHFHadronMatcher.cc.

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

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 826 of file GenHFHadronMatcher.cc.

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

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:826
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:587
GenHFHadronMatcher::flavourSign
int flavourSign(const int pdgId) const
Sign of the flavour (matter/antimatter)
Definition: GenHFHadronMatcher.cc:674
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:577
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:1043
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:614
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:629
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:531
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:425
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
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:694
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:1020
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:879
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:655
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:725
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:602
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