68 std::vector<int> &hadIndex, std::vector<reco::GenParticle> &hadMothersGenPart,
69 std::vector<std::vector<int> > &hadMothersIndices, std::vector<int> &hadLeptonIndex,
70 std::vector<int> &hadLeptonHadIndex, std::vector<int> &hadLeptonViaTau,
71 std::vector<int> &hadFlavour, std::vector<int> &hadFromTopWeakDecay, std::vector<int> &hadBHadronId )
const;
73 std::vector<const reco::Candidate*> &hadMothers, std::vector<std::vector<int> > &hadMothersIndices,
74 std::set<const reco::Candidate*> *analyzedParticles,
const int prevPartIndex )
const;
75 bool putMotherIndex( std::vector<std::vector<int> > &hadMothersIndices,
int partIndex,
int mothIndex )
const;
78 bool isMesonPdgId(
const int flavour,
const int pdgId )
const;
79 bool isBaryonPdgId(
const int flavour,
const int pdgId )
const;
84 int findInMothers(
int idx, std::vector<int> &mothChains,
const std::vector<std::vector<int> > &hadMothersIndices,
85 const std::vector<reco::GenParticle> &hadMothers,
int status,
int pdgId,
bool pdgAbs,
86 int stopId,
int firstLast,
bool verbose )
const;
93 const std::vector<reco::GenParticle> &hadMothers,
const std::vector<std::vector<int> > &hadMothersIndices,
94 const std::vector<int> &isFromTopWeakDecay,
const std::vector<std::vector<int> > &LastQuarkIds,
95 const std::vector<std::vector<int> > &LastQuarkMotherIds, std::vector<int> &lastQuarkIndices,
96 std::vector<int> &
hadronFlavour, std::set<int> &checkedHadronIds,
const int lastQuarkIndex )
const;
144 }
else if ( flavour==4 ) {
147 edm::LogError (
"GenHFHadronMatcher" ) <<
"Flavour option must be 4 (c-jet) or 5 (b-jet), but is: " << flavour <<
". Correct this!";
186 desc.
add<
edm::InputTag>(
"genParticles")->setComment(
"Collection of GenParticle objects which contains all particles produced in the event" );
187 desc.
add<
edm::InputTag>(
"jetFlavourInfos")->setComment(
"Output from the JetFlavour tool. Contains information about partons/hadrons/leptons associated to jets" );
188 desc.
add<
bool> (
"noBBbarResonances",
true )->setComment (
"Whether resonances should not be treated as hadrons" );
189 desc.
add<
bool> (
"onlyJetClusteredHadrons",
false )->setComment (
"Whether only hadrons that are matched to jets should be analysed. Runs x1000 faster in Sherpa" );
190 desc.
add<
int> (
"flavour",5 )->setComment (
"Flavour of weakly decaying hadron that should be analysed (4-c, 5-b)" );
191 descriptions.
add (
"matchGenHFHadron",desc );
212 std::vector<reco::GenParticle> hadMothers;
213 std::vector<std::vector<int>> hadMothersIndices;
214 std::vector<int> hadIndex;
215 std::vector<int> hadFlavour;
216 std::vector<int> hadJetIndex;
217 std::vector<int> hadLeptonIndex;
218 std::vector<int> hadLeptonHadIndex;
219 std::vector<int> hadLeptonViaTau;
220 std::vector<int> hadFromTopWeakDecay;
221 std::vector<int> hadBHadronId;
223 hadJetIndex =
findHadronJets (genParticles.
product(), jetFlavourInfos.
product(), hadIndex, hadMothers, hadMothersIndices, hadLeptonIndex, hadLeptonHadIndex, hadLeptonViaTau, hadFlavour, hadFromTopWeakDecay, hadBHadronId );
263 std::vector<int> &hadIndex,
264 std::vector<reco::GenParticle> &hadMothers, std::vector<std::vector<int> > &hadMothersIndices,
265 std::vector<int> &hadLeptonIndex, std::vector<int> &hadLeptonHadIndex,
266 std::vector<int> &hadLeptonViaTau, std::vector<int> &hadFlavour,
267 std::vector<int> &hadFromTopWeakDecay, std::vector<int> &hadBHadronId )
const 269 std::vector<int> hadJetIndex;
270 std::vector<const reco::Candidate*> hadMothersCand;
272 int topDaughterQId = -1;
273 int topBarDaughterQId = -1;
278 const int jetIndex = i_info - jetFlavourInfos->
begin();
286 int hadronIndex =
analyzeMothers ( (
reco::Candidate*)(&**hadron), topDaughterQId, topBarDaughterQId, hadMothersCand, hadMothersIndices,
nullptr, -1 );
288 hadIndex.push_back ( hadronIndex );
289 hadJetIndex.push_back ( jetIndex );
295 for(reco::GenParticleCollection::const_iterator i_particle = genParticles->begin(); i_particle != genParticles->end(); ++i_particle){
299 if(
std::find(hadMothersCand.begin(), hadMothersCand.end(), thisParticle) != hadMothersCand.end())
continue;
302 int hadronIndex =
analyzeMothers ( thisParticle, topDaughterQId, topBarDaughterQId, hadMothersCand, hadMothersIndices,
nullptr, -1 );
304 hadIndex.push_back ( hadronIndex );
305 hadJetIndex.push_back ( -1 );
310 for (
int i=0;
i< (
int)hadMothersCand.size();
i++ ) {
312 hadMothers.push_back(*particle);
316 for(reco::GenParticleCollection::const_iterator i_particle = genParticles->begin(); i_particle != genParticles->end(); ++i_particle){
318 const int pdg_abs = lepton.
pdgId();
320 if(pdg_abs != 11 && pdg_abs != 13)
continue;
321 bool leptonViaTau =
false;
323 if(!leptonMother)
continue;
327 leptonMother = leptonMother->
mother();
332 size_t leptonHadronParticleIndex =
std::find(hadMothersCand.begin(), hadMothersCand.end(), leptonMother) - hadMothersCand.begin();
333 if(leptonHadronParticleIndex >= hadMothersCand.size())
continue;
335 size_t leptonHadronIndex =
std::find(hadIndex.begin(), hadIndex.end(), leptonHadronParticleIndex) - hadIndex.begin();
336 if(leptonHadronIndex >= hadIndex.size())
continue;
338 hadMothers.push_back(lepton);
339 const int leptonIndex = hadMothersCand.size()-1;
340 hadLeptonIndex.push_back(leptonIndex);
341 hadLeptonViaTau.push_back(leptonViaTau);
342 hadLeptonHadIndex.push_back(leptonHadronIndex);
346 unsigned int nHad = hadIndex.size();
348 std::vector<std::vector<int> > LastQuarkMotherIds;
349 std::vector<std::vector<int> > LastQuarkIds;
350 std::vector<int> lastQuarkIndices(nHad, -1);
353 for (
unsigned int hadNum=0; hadNum<nHad; hadNum++ ) {
354 unsigned int hadIdx = hadIndex.at(hadNum);
356 std::vector <int> FirstQuarkId;
357 std::vector <int> LastQuarkId;
358 std::vector <int> LastQuarkMotherId;
360 const int hadronFlavourSign =
flavourSign( hadMothers.at(hadIdx).pdgId() );
363 if(hadronFlavourSign != 0) {
364 findInMothers( hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, hadronFlavourSign*
flavour_,
false, -1, 1,
false );
368 findInMothers( hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0,
flavour_,
false, -1, 1,
false );
369 findInMothers( hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, -1*
flavour_,
false, -1, 1,
false );
373 for (
unsigned int qId=0; qId<FirstQuarkId.size(); qId++ ) {
375 const int quarkFlavourSign =
flavourSign( hadMothers.at(FirstQuarkId.at(qId)).
pdgId() );
377 findInMothers( FirstQuarkId.at(qId), LastQuarkId, hadMothersIndices, hadMothers, 0, quarkFlavourSign*
flavour_,
false, -1, 2,
false );
385 std::vector<std::pair<double, int> > lastQuark_dR_id_pairs;
388 for (
unsigned int qId = 0; qId < LastQuarkId.size(); qId++ ) {
389 int qIdx = LastQuarkId.at(qId);
391 float dR =
deltaR ( hadMothers.at(hadIdx).eta(),hadMothers.at(hadIdx).phi(),hadMothers.at(qIdx).eta(),hadMothers.at(qIdx).phi() );
393 std::pair<double, int> dR_hadId_pair(dR,qIdx);
394 lastQuark_dR_id_pairs.push_back(dR_hadId_pair);
397 std::sort(lastQuark_dR_id_pairs.begin(), lastQuark_dR_id_pairs.end());
399 if(lastQuark_dR_id_pairs.size() > 1) {
400 double dRratio = (lastQuark_dR_id_pairs.at(1).first - lastQuark_dR_id_pairs.at(0).first)/lastQuark_dR_id_pairs.at(1).first;
401 int qIdx_closest = lastQuark_dR_id_pairs.at(0).second;
403 if(dRratio>0.5) LastQuarkId.push_back(qIdx_closest);
404 else for(std::pair<double, int> qIdDrPair : lastQuark_dR_id_pairs) LastQuarkId.push_back(qIdDrPair.second);
406 for(
int qIdx : LastQuarkId) {
407 int qmIdx = hadMothersIndices.at(qIdx).at(0);
408 LastQuarkMotherId.push_back(qmIdx);
411 if((
int)LastQuarkId.size()>0) lastQuarkIndices.at(hadNum) = 0;
413 LastQuarkIds.push_back( LastQuarkId );
415 LastQuarkMotherIds.push_back ( LastQuarkMotherId );
417 if(LastQuarkMotherId.empty()) {
420 int qIdx = LastQuarkId.at( lastQuarkIndices.at(hadNum) );
421 int qFlav =
flavourSign( hadMothers.at(qIdx).pdgId() );
422 hadronFlavour = qFlav*
std::abs( hadMothers.at( LastQuarkMotherId.at( lastQuarkIndices.at(hadNum) ) ).pdgId() );
424 hadFlavour.push_back(hadronFlavour);
427 int isFromTopWeakDecay = 1;
428 std::vector <int> checkedParticles;
429 if(hadFlavour.at(hadNum) != 0) {
430 int lastQIndex = LastQuarkId.at(lastQuarkIndices.at(hadNum));
431 bool fromTB = topDaughterQId >= 0 ?
findInMothers( lastQIndex, checkedParticles, hadMothersIndices, hadMothers, -1, 0,
false, topDaughterQId, 2,
false ) >= 0 :
false;
432 checkedParticles.clear();
433 bool fromTbarB = topBarDaughterQId >= 0 ?
findInMothers( lastQIndex, checkedParticles, hadMothersIndices, hadMothers, -1, 0,
false, topBarDaughterQId, 2,
false) >= 0 :
false;
434 checkedParticles.clear();
435 if(!fromTB && !fromTbarB) {
436 isFromTopWeakDecay = 0;
438 }
else isFromTopWeakDecay = 2;
439 hadFromTopWeakDecay.push_back(isFromTopWeakDecay);
440 int bHadronMotherId =
findInMothers( hadIdx, checkedParticles, hadMothersIndices, hadMothers, 0, 555555,
true, -1, 1,
false );
441 hadBHadronId.push_back(bHadronMotherId);
444 if(!LastQuarkMotherId.empty()) {
445 std::set<int> checkedHadronIds;
446 fixExtraSameFlavours(hadNum, hadIndex, hadMothers, hadMothersIndices, hadFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadFlavour, checkedHadronIds, 0);
465 const unsigned int position =
std::find(particleList.begin(), particleList.end(), particle) - particleList.begin();
466 if( position >= particleList.size() )
return -1;
474 if( position >= list.size() )
return -1;
520 const int flavour_abs =
std::abs(flavour);
521 if(flavour_abs != 5 && flavour_abs != 4)
return false;
522 const int pdgId_abs =
std::abs(pdgId);
524 if( pdgId_abs/100%10 != flavour_abs)
return false;
526 if ( pdgId_abs/1000 == flavour_abs)
return false;
544 const int flavour_abs =
std::abs(flavour);
545 if(flavour_abs != 5 && flavour_abs != 4)
return false;
546 const int pdgId_abs =
std::abs(pdgId);
548 if ( pdgId_abs/1000 != flavour_abs)
return false;
567 if(pdgId % 1000 / 10 / 11 > 0) flavourSign = 0;
584 bool hasDaughter =
false;
614 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 620 hadMothers.push_back ( thisParticle );
621 hadronIndex=hadMothers.size()-1;
627 partIndex =
idInList( hadMothers, thisParticle );
631 if ( !analyzedParticles ) {
632 analyzedParticles =
new std::set<const reco::Candidate*>;
634 for (
unsigned int i=0;
i<analyzedParticles->size();
i++ ) {
635 if ( analyzedParticles->count ( thisParticle ) <=0 ) {
644 if ( prevPartIndex>=0 ) {
649 analyzedParticles->insert ( thisParticle );
652 for (
size_t iMother = 0; iMother < thisParticle->
numberOfMothers(); ++iMother ) {
654 int mothIndex =
idInList( hadMothers, mother );
655 if ( mothIndex == partIndex && partIndex>=0 ) {
661 hadMothers.push_back ( mother );
662 mothIndex=hadMothers.size()-1;
665 if ( mothIndex!=partIndex && partIndex>=0 ) {
668 analyzeMothers ( mother, topDaughterQId, topBarDaughterQId, hadMothers, hadMothersIndices, analyzedParticles, partIndex );
671 int& bId = mother->
pdgId() < 0 ? topBarDaughterQId : topDaughterQId;
674 if(thisFlav <= 5) bId = partIndex;
676 int bIdFlav =
std::abs(hadMothers.at(bId)->pdgId());
677 if( bIdFlav != 5 && thisFlav == 5) bId = partIndex;
678 else if( thisFlav == 5 && thisParticle->
pt() > hadMothers.at(bId)->pt() ) bId = partIndex;
683 analyzedParticles->erase ( thisParticle );
716 while ( (
int)hadMothersIndices.size() <= partIndex ) {
717 std::vector<int> mothersIndices;
718 hadMothersIndices.push_back ( mothersIndices );
721 std::vector<int> *hadMotherIndices = &hadMothersIndices.at(partIndex);
723 if ( mothIndex == -1 ) {
724 hadMotherIndices->clear();
727 for (
int k = 0;
k < (
int)hadMotherIndices->size();
k++ ) {
728 if ( hadMotherIndices->at(
k) != mothIndex && hadMotherIndices->at(
k) != -1 ) {
737 hadMotherIndices->push_back(mothIndex);
762 const std::vector<reco::GenParticle> &hadMothers,
int status,
int pdgId,
bool pdgAbs=
false,
763 int stopId=-1,
int firstLast=0,
bool verbose=
false)
const 765 int foundStopId = -1;
766 int pdg_1 = hadMothers.at(idx).pdgId();
768 if ( (
int)hadMothersIndices.size() <=
idx ) {
770 printf (
" Stopping checking particle %d. No mothers are stored.\n",idx );
775 if(
std::abs(hadMothers.at( idx ).pdgId()) > 10 &&
std::abs(hadMothers.at( idx ).pdgId()) < 19) printf(
"Lepton: %d\n", hadMothers.at( idx ).pdgId());
777 std::vector<int> mothers = hadMothersIndices.at(idx);
778 unsigned int nMothers = mothers.size();
779 bool isCorrect=
false;
781 if (
std::abs( hadMothers.at(idx).pdgId() ) ==2212 ) {
782 printf (
"Chk: %d\tpdg: %d\tstatus: %d",idx, hadMothers.at(idx).pdgId(), hadMothers.at(idx).status() );
784 printf (
" Chk: %d(%d mothers)\tpdg: %d\tstatus: %d\tPt: %.3f\tEta: %.3f",idx, nMothers, hadMothers.at(idx).pdgId(), hadMothers.at(idx).status(), hadMothers.at(idx).pt(),hadMothers.at(idx).eta() );
787 bool hasCorrectMothers =
true;
788 if(nMothers<1) hasCorrectMothers=
false;
else if(mothers.at(0)<0) hasCorrectMothers=
false;
789 if(!hasCorrectMothers) {
790 if(
verbose) printf(
" NO CORRECT MOTHER\n");
794 if(stopId>=0 && idx == stopId)
return idx;
797 if(pdgId%111111==0 && pdgId!=0) {
798 if(
isHadronPdgId(pdgId/111111, hadMothers.at(idx).pdgId())) {
804 if ( ( ( hadMothers.at(idx).pdgId() == pdgId && pdgAbs==
false )
806 && ( hadMothers.at(idx).status() == status || status==0 )
807 && hasCorrectMothers ) {
810 const bool inList =
std::find(mothChains.begin(), mothChains.end(),
idx) != mothChains.end();
811 if ( !inList && mothers.at(0) >= 0 && ( hadMothers.at(idx).pdgId()*pdgId > 0 || !pdgAbs ) ) {
812 if ( firstLast==0 || firstLast==1 ) {
813 mothChains.push_back(idx);
827 if ( isCorrect && firstLast==1 ) {
832 unsigned int nDifferingMothers = 0;
833 for (
unsigned int i = 0;
i < nMothers;
i++ ) {
834 int idx2 = mothers.at(
i);
836 if(
verbose) printf(
"^^^ Has no mother\n");
840 if(
verbose) printf(
"^^^ Stored as its own mother\n");
843 int pdg_2 = hadMothers[idx2].pdgId();
847 if(
verbose) printf(
"######### Inverting flavour of the hadron\n");
851 ( pdg_2 != pdgId && pdgAbs ==
false ) ) {
857 printf (
"Checking mother %d out of %d mothers (%d -> %d), looking for pdgId: %d\n",
i,nMothers,idx, idx2, pdgId );
859 if(firstLast==2 && pdg_1 != pdg_2)
continue;
860 foundStopId =
findInMothers ( idx2, mothChains, hadMothersIndices, hadMothers, status, pdgId, pdgAbs, stopId, firstLast,
verbose );
863 if(firstLast==2 && isCorrect && nDifferingMothers >= nMothers) {
865 printf (
"Checking particle %d once more to store it as the last quark\n",idx);
867 foundStopId =
findInMothers ( idx, mothChains, hadMothersIndices, hadMothers, 0, pdgId, pdgAbs, stopId, 1,
verbose );
884 const int neutralPdgs_array[] = {9, 21, 22, 23, 25};
885 const std::vector<int> neutralPdgs( neutralPdgs_array, neutralPdgs_array +
sizeof(neutralPdgs_array) /
sizeof(
int) );
886 if(
std::find( neutralPdgs.begin(), neutralPdgs.end(),
std::abs(pdgId) ) == neutralPdgs.end() )
return false;
907 const unsigned int hadId,
const std::vector<int> &hadIndices,
const std::vector<reco::GenParticle> &hadMothers,
908 const std::vector<std::vector<int> > &hadMothersIndices,
const std::vector<int> &isFromTopWeakDecay,
909 const std::vector<std::vector<int> > &LastQuarkIds,
const std::vector<std::vector<int> > &LastQuarkMotherIds,
910 std::vector<int> &lastQuarkIndices, std::vector<int> &
hadronFlavour,
911 std::set<int> &checkedHadronIds,
const int lastQuarkIndex)
const 913 if(checkedHadronIds.count(hadId) != 0)
return false;
914 checkedHadronIds.insert(hadId);
916 if(lastQuarkIndex<0)
return false;
917 if((
int)LastQuarkIds.at(hadId).size()<lastQuarkIndex+1)
return false;
918 int LastQuarkId = LastQuarkIds.at(hadId).at(lastQuarkIndex);
919 int LastQuarkMotherId = LastQuarkMotherIds.at( hadId ).at( lastQuarkIndex );
920 int qmFlav = hadMothers.at(LastQuarkId).pdgId() < 0 ? -1 : 1;
921 int hadFlavour = qmFlav*
std::abs( hadMothers.at( LastQuarkMotherId ).pdgId() );
922 bool ambiguityResolved =
true;
924 if( (hadMothers.at(LastQuarkId).pdgId()*hadMothers.at(LastQuarkMotherId).pdgId() < 0 && !
isNeutralPdg(hadMothers.at(LastQuarkMotherId).pdgId())) ||
926 (
std::abs(hadronFlavour.at(hadId))==6 && isFromTopWeakDecay.at(hadId)==0) ) {
927 if((
int)LastQuarkIds.at(hadId).size()>lastQuarkIndex+1)
fixExtraSameFlavours(hadId, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, lastQuarkIndex+1);
928 else hadronFlavour.at(hadId) = qmFlav*21;
932 int nSameFlavourHadrons = 0;
934 for(
unsigned int iHad = 0; iHad<hadronFlavour.size(); iHad++) {
935 if(iHad==hadId)
continue;
936 int theLastQuarkIndex = lastQuarkIndices.at(iHad);
937 if(theLastQuarkIndex<0)
continue;
938 if((
int)LastQuarkMotherIds.at( iHad ).size() <= theLastQuarkIndex)
continue;
939 int theLastQuarkMotherId = LastQuarkMotherIds.at( iHad ).at( theLastQuarkIndex );
940 int theHadFlavour = hadronFlavour.at(iHad);
942 if(theHadFlavour==0 ||
std::abs(theHadFlavour)==21)
continue;
943 if(theHadFlavour != hadFlavour || theLastQuarkMotherId != LastQuarkMotherId)
continue;
944 ambiguityResolved =
false;
945 nSameFlavourHadrons++;
948 if((
int)LastQuarkIds.at(hadId).size() > lastQuarkIndex+1) {
949 if(
fixExtraSameFlavours(hadId, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, lastQuarkIndex+1) ) {
950 ambiguityResolved =
true;
955 if((
int)LastQuarkIds.at(iHad).size() > theLastQuarkIndex+1) {
956 if(
fixExtraSameFlavours(iHad, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, theLastQuarkIndex+1) ) {
957 ambiguityResolved =
true;
964 checkedHadronIds.erase(hadId);
965 if(nSameFlavourHadrons>0 && !ambiguityResolved) {
966 hadronFlavour.at(hadId) = qmFlav*21;
969 lastQuarkIndices.at(hadId) = lastQuarkIndex;
970 hadronFlavour.at(hadId) = hadFlavour;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
const edm::EDPutTokenT< std::vector< int > > bHadronIdToken_
bool isMesonPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a meson of particular flavour.
const edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
transient_vector_type::const_iterator const_iterator
const edm::EDPutTokenT< std::vector< int > > leptonIndexToken_
const GenParticleRefVector & getbHadrons() const
Return a vector of GenParticleRef's to b hadrons clustered inside the jet.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const GenParticleRefVector & getcHadrons() const
Return a vector of GenParticleRef's to c hadrons clustered inside the jet.
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
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...
const_iterator end() const
def setup(process, global_tag, zero_tesla=False)
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
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.
bool checkForLoop(std::vector< const reco::Candidate * > &particleChain, const reco::Candidate *particle) const
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const bool noBBbarResonances_
const_iterator begin() const
Initialize an iterator over the RefVector.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDPutTokenT< std::vector< reco::GenParticle > > plusMothersToken_
#define DEFINE_FWK_MODULE(type)
int flavourSign(const int pdgId) const
Sign of the flavour (matter/antimatter)
~GenHFHadronMatcher() override
virtual int pdgId() const =0
PDG identifier.
const edm::EDPutTokenT< std::vector< int > > leptonViaTauToken_
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
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
Class storing the jet flavour information.
const std::string flavourStr_
Abs< T >::type abs(const T &t)
const edm::EDPutTokenT< std::vector< int > > indexToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool hasHadronDaughter(const int flavour, const reco::Candidate *thisParticle) const
Check if the particle has bHadron among daughters.
const bool onlyJetClusteredHadrons_
bool isHadronPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a hadron of particular flavour.
bool isHadron(const int flavour, const reco::Candidate *thisParticle) const
Check the pdgId of a given particle if it is a hadron.
edm::RefVector< GenParticleCollection > GenParticleRefVector
vector of reference to GenParticle in the same collection
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
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
description of the run-time parameters
const edm::EDPutTokenT< std::vector< std::vector< int > > > plusMothersIndicesToken_
T const * product() const
OrphanHandle< PROD > emplace(EDPutTokenT< PROD > token, Args &&...args)
puts a new product
virtual double pt() const =0
transverse momentum
bool isNeutralPdg(int pdgId) const
Check whether a given pdgId represents neutral particle.
const edm::EDPutTokenT< std::vector< int > > leptonHadronIndexToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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...
const edm::EDPutTokenT< std::vector< int > > fromTopWeakDecayToken_
static int position[264][3]
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
const edm::EDPutTokenT< std::vector< int > > jetIndexToken_
GenHFHadronMatcher(const edm::ParameterSet &)
bool isBaryonPdgId(const int flavour, const int pdgId) const
Check the pdgId if it represents a baryon of particular flavour.
const edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfosToken_
virtual size_type numberOfDaughters() const =0
number of daughters
const_iterator begin() const
const edm::EDPutTokenT< std::vector< int > > flavourToken_
Finds the origin of each heavy flavour hadron and associated jets to it.
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::string getParticleName(int id) const