75 std::vector<int> &hadIndex, std::vector<reco::GenParticle> &hadMothersGenPart,
76 std::vector<std::vector<int> > &hadMothersIndices, std::vector<int> &hadLeptonIndex,
77 std::vector<int> &hadLeptonHadIndex, std::vector<int> &hadLeptonViaTau,
78 std::vector<int> &hadFlavour, std::vector<int> &hadFromTopWeakDecay, std::vector<int> &hadBHadronId );
80 std::vector<const reco::Candidate*> &hadMothers, std::vector<std::vector<int> > &hadMothersIndices,
81 std::set<const reco::Candidate*> *analyzedParticles,
const int prevPartIndex );
82 bool putMotherIndex ( std::vector<std::vector<int> > &hadMothersIndices,
int partIndex,
int mothIndex );
88 int findInMothers (
int idx, std::vector<int> &mothChains, std::vector<std::vector<int> > &hadMothersIndices,
89 std::vector<reco::GenParticle> &hadMothers,
int status,
int pdgId,
bool pdgAbs,
int stopId,
int firstLast,
bool verbose );
95 bool fixExtraSameFlavours(
const unsigned int hadId,
const std::vector<int> &hadIndices,
const std::vector<reco::GenParticle> &hadMothers,
96 const std::vector<std::vector<int> > &hadMothersIndices,
const std::vector<int> &isFromTopWeakDecay,
97 const std::vector<std::vector<int> > &LastQuarkIds,
const std::vector<std::vector<int> > &LastQuarkMotherIds,
98 std::vector<int> &lastQuarkIndices, std::vector<int> &hadronFlavour, std::set<int> &checkedHadronIds,
const int lastQuarkIndex);
134 jetFlavourInfosToken_(consumes<
reco::JetFlavourInfoMatchingCollection>(cfg.getParameter<edm::
InputTag>(
"jetFlavourInfos")))
143 }
else if ( flavour_==4 ) {
146 edm::LogError (
"GenHFHadronMatcher" ) <<
"Flavour option must be 4 (c-jet) or 5 (b-jet), but is: " << flavour_ <<
". Correct this!";
150 produces< std::vector<reco::GenParticle> > (
"gen"+
flavourStr_+
"HadPlusMothers" );
151 produces< std::vector< std::vector<int> > > (
"gen"+
flavourStr_+
"HadPlusMothersIndices" );
152 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadIndex" );
153 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadFlavour" );
154 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadJetIndex" );
155 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadLeptonIndex" );
156 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadLeptonHadronIndex" );
157 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadLeptonViaTau" );
158 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadFromTopWeakDecay" );
159 produces< std::vector<int> > (
"gen"+
flavourStr_+
"HadBHadronId" );
177 desc.
add<
edm::InputTag>(
"genParticles")->setComment(
"Collection of GenParticle objects which contains all particles produced in the event" );
178 desc.
add<
edm::InputTag>(
"jetFlavourInfos")->setComment(
"Output from the JetFlavour tool. Contains information about partons/hadrons/leptons associated to jets" );
179 desc.
add<
bool> (
"noBBbarResonances",
true )->setComment (
"Whether resonances should not be treated as hadrons" );
180 desc.
add<
bool> (
"onlyJetClusteredHadrons",
false )->setComment (
"Whether only hadrons that are matched to jets should be analysed. Runs x1000 faster in Sherpa" );
181 desc.
add<
int> (
"flavour",5 )->setComment (
"Flavour of weakly decaying hadron that should be analysed (4-c, 5-b)" );
182 descriptions.
add (
"matchGenHFHadron",desc );
206 std::auto_ptr<std::vector<reco::GenParticle> > hadMothers (
new std::vector<reco::GenParticle> );
207 std::auto_ptr<std::vector<std::vector<int> > > hadMothersIndices (
new std::vector<std::vector<int> > );
208 std::auto_ptr<std::vector<int> > hadIndex (
new std::vector<int> );
209 std::auto_ptr<std::vector<int> > hadFlavour (
new std::vector<int> );
210 std::auto_ptr<std::vector<int> > hadJetIndex (
new std::vector<int> );
211 std::auto_ptr<std::vector<int> > hadLeptonIndex (
new std::vector<int> );
212 std::auto_ptr<std::vector<int> > hadLeptonHadIndex (
new std::vector<int> );
213 std::auto_ptr<std::vector<int> > hadLeptonViaTau(
new std::vector<int> );
214 std::auto_ptr<std::vector<int> > hadFromTopWeakDecay (
new std::vector<int> );
215 std::auto_ptr<std::vector<int> > hadBHadronId (
new std::vector<int> );
217 *hadJetIndex =
findHadronJets (
genParticles.product(), jetFlavourInfos.product(), *hadIndex, *hadMothers, *hadMothersIndices, *hadLeptonIndex, *hadLeptonHadIndex, *hadLeptonViaTau, *hadFlavour, *hadFromTopWeakDecay, *hadBHadronId );
221 evt.
put ( hadMothersIndices,
"gen"+
flavourStr_+
"HadPlusMothersIndices" );
226 evt.
put ( hadLeptonHadIndex,
"gen"+
flavourStr_+
"HadLeptonHadronIndex" );
228 evt.
put ( hadFromTopWeakDecay,
"gen"+
flavourStr_+
"HadFromTopWeakDecay" );
288 std::vector<int> &hadIndex,
289 std::vector<reco::GenParticle> &hadMothers, std::vector<std::vector<int> > &hadMothersIndices,
290 std::vector<int> &hadLeptonIndex, std::vector<int> &hadLeptonHadIndex,
291 std::vector<int> &hadLeptonViaTau, std::vector<int> &hadFlavour,
292 std::vector<int> &hadFromTopWeakDecay, std::vector<int> &hadBHadronId )
294 std::vector<int> hadJetIndex;
295 std::vector<const reco::Candidate*> hadMothersCand;
297 int topDaughterQId = -1;
298 int topBarDaughterQId= -1;
303 const int jetIndex = i_info - jetFlavourInfos->
begin();
311 int hadronIndex =
analyzeMothers ( (
reco::Candidate*)(&**hadron), topDaughterQId, topBarDaughterQId, hadMothersCand, hadMothersIndices, 0, -1 );
313 hadIndex.push_back ( hadronIndex );
314 hadJetIndex.push_back ( jetIndex );
320 bool leptonViaTau =
false;
322 if(
std::abs((*lepton)->pdgId()) == 15)
continue;
324 if(!leptonMother)
continue;
328 leptonMother = leptonMother->
mother();
333 int leptonHadronParticleIndex =
std::find(hadMothersCand.begin(), hadMothersCand.end(), leptonMother) - hadMothersCand.begin();
334 if(leptonHadronParticleIndex >= (
int)hadMothersCand.size())
continue;
335 if(leptonHadronParticleIndex < 0)
continue;
337 int leptonHadronIndex =
std::find(hadIndex.begin(), hadIndex.end(), leptonHadronParticleIndex) - hadIndex.begin();
338 if(leptonHadronIndex >= (
int)hadIndex.size())
continue;
340 hadMothersCand.push_back(&**lepton);
341 const int leptonIndex = hadMothersCand.size()-1;
342 hadLeptonIndex.push_back(leptonIndex);
343 hadLeptonViaTau.push_back((
int)leptonViaTau);
344 hadLeptonHadIndex.push_back(leptonHadronIndex);
351 for(reco::GenParticleCollection::const_iterator i_particle = genParticles->begin(); i_particle != genParticles->end(); ++i_particle){
355 if(
std::find(hadMothersCand.begin(), hadMothersCand.end(), thisParticle) != hadMothersCand.end())
continue;
358 int hadronIndex =
analyzeMothers ( thisParticle, topDaughterQId, topBarDaughterQId, hadMothersCand, hadMothersIndices, 0, -1 );
360 hadIndex.push_back ( hadronIndex );
361 hadJetIndex.push_back ( -1 );
366 for (
int i=0;
i< ( int ) hadMothersCand.size();
i++ ) {
367 hadMothers.push_back ( ( *dynamic_cast<const reco::GenParticle*> ( hadMothersCand.at(
i) ) ) );
371 unsigned int nHad = hadIndex.size();
373 std::vector<std::vector<int> > LastQuarkMotherIds;
374 std::vector<std::vector<int> > LastQuarkIds;
375 std::vector<int> lastQuarkIndices(nHad, -1);
378 for (
unsigned int hadNum=0; hadNum<nHad; hadNum++ ) {
380 unsigned int hadIdx = hadIndex.at(hadNum);
382 std::vector <int> FirstQuarkId;
383 std::vector <int> LastQuarkId;
384 std::vector <int> LastQuarkMotherId;
386 int hadFlav = hadMothers.at(hadIdx).pdgId() <0?-1:1;
387 if (
abs ( hadMothers.at(hadIdx).pdgId() ) /1000 < 1 ) {
392 findInMothers ( hadIdx, FirstQuarkId, hadMothersIndices, hadMothers, 0, hadFlav*
flavour_,
false, -1, 1,
false );
395 for (
unsigned int qId=0; qId<FirstQuarkId.size(); qId++ ) {
397 int bQFlav = hadMothers.at(FirstQuarkId.at(qId)).
pdgId() < 0?-1:1;
404 int hadronFlavour = 0;
407 std::vector<std::pair<double, int> > lastQuark_dR_id_pairs;
410 for (
unsigned int qId=0; qId<LastQuarkId.size(); qId++ ) {
411 int qIdx = LastQuarkId.at(qId);
413 float dR =
deltaR ( hadMothers.at(hadIdx).eta(),hadMothers.at(hadIdx).phi(),hadMothers.at(qIdx).eta(),hadMothers.at(qIdx).phi() );
415 std::pair<double, int> dR_hadId_pair(dR,qIdx);
416 lastQuark_dR_id_pairs.push_back(dR_hadId_pair);
419 std::sort(lastQuark_dR_id_pairs.begin(), lastQuark_dR_id_pairs.end());
421 if(lastQuark_dR_id_pairs.size()>1) {
422 double dRratio = (lastQuark_dR_id_pairs.at(1).first - lastQuark_dR_id_pairs.at(0).first)/lastQuark_dR_id_pairs.at(1).first;
423 int qIdx_closest = lastQuark_dR_id_pairs.at(0).second;
425 if(dRratio>0.5) LastQuarkId.push_back(qIdx_closest);
426 else for(std::pair<double, int> qIdDrPair : lastQuark_dR_id_pairs) LastQuarkId.push_back(qIdDrPair.second);
428 for(
int qIdx : LastQuarkId) {
429 int qmIdx = hadMothersIndices.at ( qIdx ).at(0);
430 LastQuarkMotherId.push_back( qmIdx );
433 if((
int)LastQuarkId.size()>0) lastQuarkIndices.at(hadNum) = 0;
435 LastQuarkIds.push_back( LastQuarkId );
437 LastQuarkMotherIds.push_back ( LastQuarkMotherId );
439 if(LastQuarkMotherId.size()<1) {
442 int qIdx = LastQuarkId.at( lastQuarkIndices.at(hadNum) );
443 int qFlav = ( hadMothers.at(qIdx).pdgId() < 0 ) ? -1 : 1;
444 hadronFlavour = qFlav*
std::abs( hadMothers.at( LastQuarkMotherId.at( lastQuarkIndices.at(hadNum) ) ).pdgId() );
446 hadFlavour.push_back(hadronFlavour);
449 int isFromTopWeakDecay = 1;
450 std::vector <int> checkedParticles;
451 if(hadFlavour.at(hadNum)!=0) {
452 int lastQIndex = LastQuarkId.at(lastQuarkIndices.at(hadNum));
453 bool fromTB = topDaughterQId>=0?
findInMothers( lastQIndex, checkedParticles, hadMothersIndices, hadMothers, -1, 0,
false, topDaughterQId, 2,
false ) >= 0 :
false;
454 checkedParticles.clear();
455 bool fromTbarB = topBarDaughterQId>=0?
findInMothers( lastQIndex, checkedParticles, hadMothersIndices, hadMothers, -1, 0,
false, topBarDaughterQId, 2,
false) >= 0:
false;
456 checkedParticles.clear();
457 if(!fromTB && !fromTbarB) {
458 isFromTopWeakDecay = 0;
460 }
else isFromTopWeakDecay = 2;
461 hadFromTopWeakDecay.push_back(isFromTopWeakDecay);
462 int bHadronMotherId =
findInMothers( hadIdx, checkedParticles, hadMothersIndices, hadMothers, 0, 555555,
true, -1, 1,
false );
463 hadBHadronId.push_back(bHadronMotherId);
466 if(LastQuarkMotherId.size()>0) {
467 std::set<int> checkedHadronIds;
468 fixExtraSameFlavours(hadNum, hadIndex, hadMothers, hadMothersIndices, hadFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadFlavour, checkedHadronIds, 0);
488 for (
unsigned int i = 0;
i<particleList.size();
i++ )
489 if ( particleList.at(
i)==particle ) {
498 for (
unsigned int i = 0;
i<list.size();
i++ )
499 if ( list.at(
i)==
value ) {
531 int flavour_abs =
std::abs(flavour);
532 if(flavour_abs > 5 || flavour_abs < 1)
return false;
535 if ( pdgId_abs / 1000 == flavour_abs
536 || ( pdgId_abs / 100 % 10 == flavour_abs
558 bool hasDaughter =
false;
587 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 )
594 hadMothers.push_back ( thisParticle );
595 hadronIndex=hadMothers.size()-1;
601 partIndex =
isInList ( hadMothers, thisParticle );
605 if ( !analyzedParticles ) {
606 analyzedParticles =
new std::set<const reco::Candidate*>;
608 for (
unsigned int i=0;
i<analyzedParticles->size();
i++ ) {
609 if ( analyzedParticles->count ( thisParticle ) <=0 ) {
618 if ( prevPartIndex>=0 ) {
623 analyzedParticles->insert ( thisParticle );
626 for (
size_t iMother = 0; iMother < thisParticle->
numberOfMothers(); ++iMother ) {
628 int mothIndex =
isInList ( hadMothers, mother );
629 if ( mothIndex == partIndex && partIndex>=0 ) {
635 hadMothers.push_back ( mother );
636 mothIndex=hadMothers.size()-1;
639 if ( mothIndex!=partIndex && partIndex>=0 ) {
642 analyzeMothers ( mother, topDaughterQId, topBarDaughterQId, hadMothers, hadMothersIndices, analyzedParticles, partIndex );
645 int& bId = mother->
pdgId() < 0 ? topBarDaughterQId : topDaughterQId;
648 if(thisFlav <= 5) bId = partIndex;
650 int bIdFlav =
std::abs(hadMothers.at(bId)->pdgId());
651 if( bIdFlav != 5 && thisFlav == 5) bId = partIndex;
652 else if( thisFlav == 5 && thisParticle->
pt() > hadMothers.at(bId)->pt() ) bId = partIndex;
657 analyzedParticles->erase ( thisParticle );
691 while ( (
int ) hadMothersIndices.size() <=partIndex ) {
692 std::vector<int> mothersIndices;
693 hadMothersIndices.push_back ( mothersIndices );
696 std::vector<int> *hadMotherIndices=&hadMothersIndices.at ( partIndex );
698 if ( mothIndex==-1 ) {
699 hadMotherIndices->clear();
702 for (
int k=0;
k< ( int ) hadMotherIndices->size();
k++ ) {
703 if ( hadMotherIndices->at (
k ) !=mothIndex && hadMotherIndices->at (
k ) !=-1 ) {
712 hadMotherIndices->push_back ( mothIndex );
738 int foundStopId = -1;
739 int pdg_1 = hadMothers.at ( idx ).pdgId();
740 int partCharge = ( hadMothers.at ( idx ).pdgId() >0 ) ?1:-1;
742 if (
abs ( hadMothers.at ( idx ).pdgId() ) /1000 < 1 && (
abs ( hadMothers.at ( idx ).pdgId() ) /100%10 == 4 ||
abs ( hadMothers.at ( idx ).pdgId() ) /100%10 == 5 ) ) {
746 if ( (
int ) hadMothersIndices.size() <=
idx ) {
748 printf (
" Stopping checking particle %d. No mothers are stored.\n",idx );
753 if(
std::abs(hadMothers.at( idx ).pdgId()) > 10 &&
std::abs(hadMothers.at( idx ).pdgId()) < 19) printf(
"Lepton: %d\n", hadMothers.at( idx ).pdgId());
755 std::vector<int> mothers = hadMothersIndices.at ( idx );
756 unsigned int nMothers = mothers.size();
757 bool isCorrect=
false;
759 if (
abs ( hadMothers.at ( idx ).pdgId() ) ==2212 ) {
760 printf (
"Chk: %d\tpdg: %d\tstatus: %d",idx, hadMothers.at ( idx ).pdgId(), hadMothers.at ( idx ).status() );
762 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() );
765 bool hasCorrectMothers =
true;
766 if(nMothers<1) hasCorrectMothers=
false;
else if(mothers.at(0)<0) hasCorrectMothers=
false;
767 if(!hasCorrectMothers) {
768 if(
verbose) printf(
" NO CORRECT MOTHER\n");
772 if(stopId>=0 && idx == stopId)
return idx;
775 if(pdgId%111111==0 && pdgId!=0) {
776 if(
isHadronPdgId(pdgId/111111, hadMothers.at(idx).pdgId())) {
782 if ( ( ( hadMothers.at ( idx ).pdgId() == pdgId && pdgAbs==
false )
783 || (
abs ( hadMothers.at ( idx ).pdgId() ) ==
abs ( pdgId ) && pdgAbs==
true ) )
784 && ( hadMothers.at ( idx ).status() == status || status==0 )
785 && hasCorrectMothers ) {
788 for (
unsigned int k=0;
k<mothChains.size();
k++ )
if ( mothChains[
k]==idx ) {
792 if ( !inList && mothers.at ( 0 ) >=0 && ( hadMothers.at ( idx ).pdgId() *pdgId>0 || !pdgAbs ) ) {
793 if ( firstLast==0 || firstLast==1 ) {
794 mothChains.push_back ( idx );
808 if ( isCorrect && firstLast==1 ) {
813 unsigned int nDifferingMothers = 0;
814 for (
unsigned int i=0;
i<nMothers;
i++ ) {
815 int idx2 = mothers[
i];
817 if(
verbose) printf(
"^^^ Has no mother\n");
821 if(
verbose) printf(
"^^^ Stored as its own mother\n");
824 int pdg_2 = hadMothers[idx2].pdgId();
828 if(
verbose) printf(
"######### Inverting flavour of the hadron\n");
831 if ( (
std::abs ( pdg_2 ) !=
abs ( pdgId ) && pdgAbs==
true ) ||
832 ( pdg_2 != pdgId && pdgAbs==
false ) ) {
838 printf (
"Checking mother %d out of %d mothers (%d -> %d), looking for pdgId: %d\n",
i,nMothers,idx, idx2, pdgId );
840 if(firstLast==2 && pdg_1 != pdg_2)
continue;
841 foundStopId =
findInMothers ( idx2, mothChains, hadMothersIndices, hadMothers, status, pdgId, pdgAbs, stopId, firstLast,
verbose );
844 if(firstLast==2 && isCorrect && nDifferingMothers >= nMothers) {
846 printf (
"Checking particle %d once more to store it as the last quark\n",idx);
848 foundStopId =
findInMothers ( idx, mothChains, hadMothersIndices, hadMothers, 0, pdgId, pdgAbs, stopId, 1,
verbose );
866 int neutralPdgs[
max]= {9,21,22,23,25};
867 for (
int i=0;
i<
max;
i++ )
if (
abs ( pdgId ) ==neutralPdgs[
i] ) {
889 const unsigned int hadId,
const std::vector<int> &hadIndices,
const std::vector<reco::GenParticle> &hadMothers,
890 const std::vector<std::vector<int> > &hadMothersIndices,
const std::vector<int> &isFromTopWeakDecay,
891 const std::vector<std::vector<int> > &LastQuarkIds,
const std::vector<std::vector<int> > &LastQuarkMotherIds,
892 std::vector<int> &lastQuarkIndices, std::vector<int> &hadronFlavour,
893 std::set<int> &checkedHadronIds,
const int lastQuarkIndex)
895 if(checkedHadronIds.count(hadId) != 0)
return false;
896 checkedHadronIds.insert(hadId);
898 if(lastQuarkIndex<0)
return false;
899 if((
int)LastQuarkIds.at(hadId).size()<lastQuarkIndex+1)
return false;
900 int LastQuarkId = LastQuarkIds.at(hadId).at(lastQuarkIndex);
901 int LastQuarkMotherId = LastQuarkMotherIds.at( hadId ).at( lastQuarkIndex );
902 int qmFlav = hadMothers.at(LastQuarkId).pdgId() < 0 ? -1 : 1;
903 int hadFlavour = qmFlav*
std::abs( hadMothers.at( LastQuarkMotherId ).pdgId() );
904 bool ambiguityResolved =
true;
906 if( (hadMothers.at(LastQuarkId).pdgId()*hadMothers.at(LastQuarkMotherId).pdgId() < 0 && !
isNeutralPdg(hadMothers.at(LastQuarkMotherId).pdgId())) ||
908 (
std::abs(hadronFlavour.at(hadId))==6 && isFromTopWeakDecay.at(hadId)==0) ) {
909 if((
int)LastQuarkIds.at(hadId).size()>lastQuarkIndex+1)
fixExtraSameFlavours(hadId, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, lastQuarkIndex+1);
910 else hadronFlavour.at(hadId) = qmFlav*21;
914 int nSameFlavourHadrons = 0;
916 for(
unsigned int iHad = 0; iHad<hadronFlavour.size(); iHad++) {
917 if(iHad==hadId)
continue;
918 int theLastQuarkIndex = lastQuarkIndices.at(iHad);
919 if(theLastQuarkIndex<0)
continue;
920 if((
int)LastQuarkMotherIds.at( iHad ).size() <= theLastQuarkIndex)
continue;
921 int theLastQuarkMotherId = LastQuarkMotherIds.at( iHad ).at( theLastQuarkIndex );
922 int theHadFlavour = hadronFlavour.at(iHad);
924 if(theHadFlavour==0 ||
std::abs(theHadFlavour)==21)
continue;
925 if(theHadFlavour != hadFlavour || theLastQuarkMotherId != LastQuarkMotherId)
continue;
926 ambiguityResolved =
false;
927 nSameFlavourHadrons++;
930 if((
int)LastQuarkIds.at(hadId).size() > lastQuarkIndex+1) {
931 if(
fixExtraSameFlavours(hadId, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, lastQuarkIndex+1) ) {
932 ambiguityResolved =
true;
937 if((
int)LastQuarkIds.at(iHad).size() > theLastQuarkIndex+1) {
938 if(
fixExtraSameFlavours(iHad, hadIndices, hadMothers, hadMothersIndices, isFromTopWeakDecay, LastQuarkIds, LastQuarkMotherIds, lastQuarkIndices, hadronFlavour, checkedHadronIds, theLastQuarkIndex+1) ) {
939 ambiguityResolved =
true;
946 checkedHadronIds.erase(hadId);
947 if(nSameFlavourHadrons>0 && !ambiguityResolved) {
948 hadronFlavour.at(hadId) = qmFlav*21;
951 lastQuarkIndices.at(hadId) = lastQuarkIndex;
952 hadronFlavour.at(hadId) = hadFlavour;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
edm::ESHandle< ParticleDataTable > pdt_
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
transient_vector_type::const_iterator const_iterator
const GenParticleRefVector & getbHadrons() const
Return a vector of GenParticleRef's to b hadrons clustered inside the jet.
bool isHadronPdgId(const int flavour, const int pdgId)
Check the pdgId if it represents a hadron of particular flavour.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
const GenParticleRefVector & getcHadrons() const
Return a vector of GenParticleRef's to c hadrons clustered inside the jet.
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
virtual void endRun(edm::Run &, edm::EventSetup const &)
const reco::GenParticle * mother(const reco::GenParticle &p, unsigned int imoth=0)
const_iterator end() const
bool checkForLoop(std::vector< const reco::Candidate * > &particleChain, const reco::Candidate *particle)
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
bool isNeutralPdg(int pdgId)
Check whether a given pdgId represents neutral particle.
const_iterator begin() const
Initialize an iterator over the RefVector.
void getData(T &iHolder) const
virtual void produce(edm::Event &, const edm::EventSetup &)
int analyzeMothers(const reco::Candidate *thisParticle, int &topDaughterQId, int &topBarDaughterQId, std::vector< const reco::Candidate * > &hadMothers, std::vector< std::vector< int > > &hadMothersIndices, std::set< const reco::Candidate * > *analyzedParticles, const int prevPartIndex)
do a recursive search for the mother particles until the b-quark is found or the absolute mother is f...
virtual size_type numberOfDaughters() const =0
number of daughters
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Class storing the jet flavour information.
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< reco::JetFlavourInfoMatchingCollection > jetFlavourInfosToken_
virtual void beginRun(edm::Run &, edm::EventSetup const &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int findInMothers(int idx, std::vector< int > &mothChains, std::vector< std::vector< int > > &hadMothersIndices, std::vector< reco::GenParticle > &hadMothers, int status, int pdgId, bool pdgAbs, int stopId, int firstLast, bool verbose)
helper function to find indices of particles with particular pdgId and status from the list of mother...
bool putMotherIndex(std::vector< std::vector< int > > &hadMothersIndices, int partIndex, int mothIndex)
puts mother index to the list of mothers of particle, if it isn't there already
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual int pdgId() const =0
PDG identifier.
edm::RefVector< GenParticleCollection > GenParticleRefVector
vector of reference to GenParticle in the same collection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
description of the run-time parameters
virtual void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
const GenParticleRefVector & getLeptons() const
Return a vector of GenParticleRef's to leptons clustered inside the jet.
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
virtual void endLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int isInList(std::vector< const reco::Candidate * > particleList, const reco::Candidate *particle)
Check if the cpecified particle is already in the list of particles.
GenHFHadronMatcher(const edm::ParameterSet &)
constructor initialising producer products and config parameters
volatile std::atomic< bool > shutdown_flag false
bool isHadron(const int flavour, const reco::Candidate *thisParticle)
Check the pdgId of a given particle if it is a hadron.
bool onlyJetClusteredHadrons_
int flavour(const Candidate &part)
const_iterator begin() const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
bool hasHadronDaughter(const int flavour, const reco::Candidate *thisParticle)
Check if the particle has bHadron among daughters.
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)
Finds the origin of each heavy flavour hadron and associated jets to it.
std::vector< int > findHadronJets(const reco::GenParticleCollection *genParticles, const reco::JetFlavourInfoMatchingCollection *jetFlavourInfos, std::vector< int > &hadIndex, std::vector< reco::GenParticle > &hadMothersGenPart, std::vector< std::vector< int > > &hadMothersIndices, std::vector< int > &hadLeptonIndex, std::vector< int > &hadLeptonHadIndex, std::vector< int > &hadLeptonViaTau, std::vector< int > &hadFlavour, std::vector< int > &hadFromTopWeakDecay, std::vector< int > &hadBHadronId)
identify the jets that contain b-hadrons
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
std::string getParticleName(int id) const