277 |
|
std::cout << "AMM: Collection genParticles not available! Exception : " << e.what() << ". " << std::endl; |
278 |
|
} |
279 |
|
|
280 |
< |
if (doGen_) HbbParticles(lGenParticles,event_->particles()); |
280 |
> |
//if (doGen_) HbbParticles(lGenParticles,event_->particles()); |
281 |
> |
HbbParticles(lGenParticles,event_->particles()); |
282 |
|
|
283 |
|
unsigned int lNPartons = 0; |
284 |
|
lNPartons = jetFlav_.fillPartons(lGenParticles); |
1669 |
|
lMC.phi = p.phi(); |
1670 |
|
lMC.pdgId = p.pdgId(); |
1671 |
|
lMC.status = p.status(); |
1671 |
– |
if (p.status()==3 || |
1672 |
– |
(p.status()==2 && (abs(p.pdgId())==4 || abs(p.pdgId())==5)) || |
1673 |
– |
(p.status()==1 && ( (p.pt()>5 && abs(p.pdgId()) > 16) || abs(p.pdgId()) <= 16) ) |
1674 |
– |
){ |
1675 |
– |
HbbAnalysis::GenParticle lObj(lMC); |
1676 |
– |
aVec.push_back(lObj); |
1677 |
– |
} |
1678 |
– |
}//loop on particles |
1672 |
|
|
1673 |
< |
//now need to get the list of parents.... |
1674 |
< |
|
1682 |
< |
for (unsigned int mccount = 0;mccount<aCol->size();++mccount) |
1683 |
< |
{//loop on particles |
1684 |
< |
const reco::Candidate & p = (*aCol)[mccount]; |
1673 |
> |
unsigned int nMum = p.numberOfMothers(); |
1674 |
> |
//std::cout << mccount << " index = " << const_cast<reco::GenParticle *>(&p)-lBegin << " has " << nMum << " mother(s)." << std::endl; |
1675 |
|
|
1676 |
< |
unsigned int nD = p.numberOfDaughters(); |
1677 |
< |
//std::cout << mccount << " has " << nD << " daughter(s) : " ; |
1678 |
< |
for(unsigned int dau=0;dau<nD;++dau){//loop on daughters |
1679 |
< |
const reco::Candidate * pDau = p.daughter(dau); |
1680 |
< |
//std::cout << pDau << " ("<<std::flush; |
1681 |
< |
for (unsigned int mccount2 = 0;mccount2<aCol->size();++mccount2) |
1682 |
< |
{//loop on particles |
1683 |
< |
const reco::Candidate & p2 = (*aCol)[mccount2]; |
1684 |
< |
//std::cout<<"DBG: mccount2 = "<<mccount2<<" gen size = "<<data_->gen().size()<<std::endl; |
1685 |
< |
for (unsigned int imc(0); imc < aVec.size(); ++imc){ |
1686 |
< |
HbbAnalysis::GenParticle & part2 = aVec.at(imc); |
1687 |
< |
//part2 = aVec.at(imc); |
1688 |
< |
if (part2.partVars().index == mccount2) { |
1689 |
< |
if (pDau == &p2) { |
1690 |
< |
part2.setParent(mccount); |
1701 |
< |
//std::cout << &p2 << ", index = " << mccount2 << "), "<<std::flush; |
1702 |
< |
break; |
1703 |
< |
} |
1676 |
> |
if ( (!doGen_ && |
1677 |
> |
(p.status()==3 || |
1678 |
> |
(p.status()==2 && (abs(p.pdgId())==4 || abs(p.pdgId())==5)) || |
1679 |
> |
(p.status()==1 && ( (p.pt()>5 && abs(p.pdgId()) > 16) || abs(p.pdgId()) <= 16) ) |
1680 |
> |
)) || doGen_){ |
1681 |
> |
HbbAnalysis::GenParticle lObj(lMC); |
1682 |
> |
for(unsigned int mum=0;mum<nMum;++mum){//loop on mothers |
1683 |
> |
const reco::Candidate * pMother = p.mother(mum); |
1684 |
> |
//std::cout << "-- mother index = " << pMother-lBegin << std::endl; |
1685 |
> |
for (unsigned int mccount2 = 0;mccount2<mccount;++mccount2) |
1686 |
> |
{//loop on particles |
1687 |
> |
const reco::Candidate & p2 = (*aCol)[mccount2]; |
1688 |
> |
if (pMother == &p2) { |
1689 |
> |
lObj.setParent(mccount2); |
1690 |
> |
break; |
1691 |
|
} |
1692 |
|
} |
1693 |
< |
}//loop on particles |
1694 |
< |
//else std::cout << std::endl << "****no match " << mccount2 << " " << &p2 << std::endl; |
1695 |
< |
//if (p2.pdgId() == pDau->pdgId() && fabs(p2.energy()-pDau->energy())<0.000001 && fabs(p2.eta()-pDau->eta())<0.000001 && fabs(p2.phi()-pDau->phi())<0.000001){ |
1709 |
< |
//part2.parent(mccount); |
1710 |
< |
//} |
1711 |
< |
}//loop on daughters |
1712 |
< |
//std::cout << std::endl; |
1713 |
< |
|
1693 |
> |
}//loop on mothers |
1694 |
> |
aVec.push_back(lObj); |
1695 |
> |
} |
1696 |
|
}//loop on particles |
1697 |
|
|
1698 |
+ |
|
1699 |
|
if (debug_>1){ |
1700 |
|
for (unsigned int imc(0); imc < aVec.size(); ++imc){ |
1701 |
|
HbbAnalysis::GenParticle & p = aVec.at(imc); |