Skip to content
Snippets Groups Projects
Commit a5f97642 authored by Andrii Verbytskyi's avatar Andrii Verbytskyi
Browse files

Migrate TrigInDetTrackTruth to HepMC3

parent 338bb564
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,7 @@ int TrigInDetTrackTruth::updateFamilyTree() ...@@ -112,7 +112,7 @@ int TrigInDetTrackTruth::updateFamilyTree()
// first get GenParticle pointer // first get GenParticle pointer
if ( !it1->isValid() ) continue; if ( !it1->isValid() ) continue;
const HepMC::GenParticle* p_child = (*it1); auto p_child = (*it1);
log << MSG::DEBUG << "GenParticle " << child << " (" << p_child << "); PDG id=" log << MSG::DEBUG << "GenParticle " << child << " (" << p_child << "); PDG id="
<< p_child->pdg_id() << "; status=" << p_child->status() << p_child->pdg_id() << "; status=" << p_child->status()
<< "; pT=" << p_child->momentum().perp() << "; pT=" << p_child->momentum().perp()
...@@ -120,8 +120,8 @@ int TrigInDetTrackTruth::updateFamilyTree() ...@@ -120,8 +120,8 @@ int TrigInDetTrackTruth::updateFamilyTree()
<< endmsg; << endmsg;
// then get production vertex (check against null) // then get production vertex (check against null)
HepMC::GenVertex* p_child_vtx = p_child->production_vertex(); auto p_child_vtx = p_child->production_vertex();
if ( p_child_vtx == NULL ) if ( !p_child_vtx)
{ {
log << MSG::DEBUG<<"GenVertex pointer null: jump to next particle"<<endmsg; log << MSG::DEBUG<<"GenVertex pointer null: jump to next particle"<<endmsg;
continue; continue;
...@@ -131,6 +131,16 @@ int TrigInDetTrackTruth::updateFamilyTree() ...@@ -131,6 +131,16 @@ int TrigInDetTrackTruth::updateFamilyTree()
/* find mother: there should be only one for final state particles /* find mother: there should be only one for final state particles
(particles which can leave energy deposits in detectors) */ (particles which can leave energy deposits in detectors) */
#ifdef HEPMC3
// check a mother was found
if ( p_child_vtx->particles_in().size()==0)
{
log << MSG::DEBUG<< "Mother not found: go to next particle" <<endmsg;
continue;
}
auto p_mum = p_child_vtx->particles_in().begin();
#else
HepMC::GenVertex::particles_in_const_iterator p_mum = p_child_vtx->particles_in_const_begin(); HepMC::GenVertex::particles_in_const_iterator p_mum = p_child_vtx->particles_in_const_begin();
// check a mother was found // check a mother was found
...@@ -139,6 +149,7 @@ int TrigInDetTrackTruth::updateFamilyTree() ...@@ -139,6 +149,7 @@ int TrigInDetTrackTruth::updateFamilyTree()
log << MSG::DEBUG<< "Mother not found: go to next particle" <<endmsg; log << MSG::DEBUG<< "Mother not found: go to next particle" <<endmsg;
continue; continue;
} }
#endif
log << MSG::DEBUG<< "Mother GenParticle (" << *p_mum << ") found; PDG id=" log << MSG::DEBUG<< "Mother GenParticle (" << *p_mum << ") found; PDG id="
<< (*p_mum)->pdg_id() << "; status=" << (*p_mum)->status() << (*p_mum)->pdg_id() << "; status=" << (*p_mum)->status()
<< "; pT=" << (*p_mum)->momentum().perp() << "; pT=" << (*p_mum)->momentum().perp()
...@@ -152,7 +163,7 @@ int TrigInDetTrackTruth::updateFamilyTree() ...@@ -152,7 +163,7 @@ int TrigInDetTrackTruth::updateFamilyTree()
{ {
log << MSG::DEBUG << "* Trying daughter index=" << child log << MSG::DEBUG << "* Trying daughter index=" << child
<< " and mother index=" << mum << endmsg; << " and mother index=" << mum << endmsg;
const HepMC::GenParticle* p2 = *it2; auto p2 = *it2;
if ( *p_mum == p2 ) if ( *p_mum == p2 )
{ // mother also matches track { // mother also matches track
m_family_tree.push_back( std::pair<unsigned int, unsigned int>(mum,child) ); m_family_tree.push_back( std::pair<unsigned int, unsigned int>(mum,child) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment