identifying the primary daughter of a neutrino pfo and set the particle id accordingly
64 unsigned int nPrimaryTwoDHits(0);
65 const ParticleFlowObject *pPrimaryDaughter(
nullptr);
67 PfoVector daughterPfoVector(pNeutrinoPfo->GetDaughterPfoList().begin(), pNeutrinoPfo->GetDaughterPfoList().end());
70 for (
const ParticleFlowObject *
const pDaughterPfo : daughterPfoVector)
74 if (!pPrimaryDaughter || (nTwoDHits > nPrimaryTwoDHits))
76 nPrimaryTwoDHits = nTwoDHits;
77 pPrimaryDaughter = pDaughterPfo;
81 if (!pPrimaryDaughter)
82 throw StatusCodeException(STATUS_CODE_FAILURE);
84 PandoraContentApi::ParticleFlowObject::Metadata
metadata;
86 if (E_MINUS ==
std::abs(pPrimaryDaughter->GetParticleId()))
88 metadata.m_particleId = NU_E;
90 else if (MU_MINUS ==
std::abs(pPrimaryDaughter->GetParticleId()))
92 metadata.m_particleId = NU_MU;
95 if (metadata.m_particleId.IsInitialized())
97 metadata.m_charge = PdgTable::GetParticleCharge(metadata.m_particleId.Get());
98 metadata.m_mass = PdgTable::GetParticleMass(metadata.m_particleId.Get());
99 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ParticleFlowObject::AlterMetadata(*
this, pNeutrinoPfo, metadata));
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
unsigned int GetNTwoDHitsInPfoChain(const pandora::ParticleFlowObject *const pPfo) const
Get the number of two dimensional hits (TPC_VIEW_U, V or W) contained in clusters in a pfo and all it...