40 const pandora::PfoList *pPandoraPfoList = NULL;
41 PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::GetCurrentPfoList(
m_pandora, pPandoraPfoList));
48 const pandora::ParticleFlowObject *
const pPandoraPfo(*pIter);
51 const bool hasTrack(!pPandoraPfo->GetTrackList().empty());
52 const pandora::ClusterList &clusterList(pPandoraPfo->GetClusterList());
54 float clustersTotalEnergy(0.
f);
55 pandora::CartesianVector referencePoint(0.
f, 0.
f, 0.
f), clustersWeightedPosition(0.
f, 0.
f, 0.
f);
59 const pandora::Cluster *
const pPandoraCluster(*cIter);
60 pandora::CaloHitList pandoraCaloHitList;
61 pPandoraCluster->GetOrderedCaloHitList().FillCaloHitList(pandoraCaloHitList);
62 pandoraCaloHitList.insert(pandoraCaloHitList.end(), pPandoraCluster->GetIsolatedCaloHitList().begin(), pPandoraCluster->GetIsolatedCaloHitList().end());
68 float clusterCorrectEnergy(0.
f);
71 pandora::CartesianVector clusterPosition(0.
f, 0.
f, 0.
f);
72 const unsigned int nHitsInCluster(pandoraCaloHitList.size());
77 clustersWeightedPosition += clusterPosition * clusterCorrectEnergy;
78 clustersTotalEnergy += clusterCorrectEnergy;
82 <<
"Adding cluster " << &pCluster
83 <<
" with energy " << pCluster.
Energy();
85 outputClusters->emplace_back(pCluster);
90 if (clustersTotalEnergy < std::numeric_limits<float>::epsilon())
93 <<
"invalid cluster energy " << clustersTotalEnergy;
94 throw pandora::StatusCodeException(pandora::STATUS_CODE_FAILURE);
98 referencePoint = clustersWeightedPosition * (1.f / clustersTotalEnergy);
111 <<
"Adding PFO " << &pReconstructedParticle
112 <<
" with energy " << pReconstructedParticle.
Energy()
113 <<
" , mass " << pReconstructedParticle.
Mass();
118 if (pReconstructedParticle.
Energy() < -1000)
120 <<
" Negative energy. Message should not be printed. " <<
m_rotation.
kAxisX;
122 outputParticles->emplace_back(pReconstructedParticle);
128 return pandora::STATUS_CODE_SUCCESS;
void SetRecoParticleReferencePoint(const pandora::CartesianVector &referencePoint, gar::rec::PFParticle &pReconstructedParticle) const
Set reference point of the reconstructed particle.
std::unique_ptr< std::vector< rec::PFParticle > > PFParticleCollection
pandora::StatusCode CalculateTrackBasedReferencePoint(const pandora::ParticleFlowObject *const pPandoraPfo, pandora::CartesianVector &referencePoint) const
Calculate reference point for pfo with tracks.
void SetClusterEnergyAndError(const pandora::ParticleFlowObject *const pPandoraPfo, const pandora::Cluster *const pPandoraCluster, gar::rec::Cluster &pCluster, float &clusterCorrectEnergy) const
Set cluster energies and errors.
const pandora::Pandora & m_pandora
Reference to the pandora object from which to extract the pfos.
const RotationTransformation & m_rotation
void SetRecoParticlePropertiesFromPFO(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const
Set properties of reconstructed particle from pandora pfo.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void SetClusterSubDetectorEnergies(const pandora::StringVector &subDetectorNames, const pandora::CaloHitList &pandoraCaloHitList, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ) const
Set sub detector energies for a cluster.
void SetClusterPositionAndError(const unsigned int nHitsInCluster, pandora::FloatVector &hitE, pandora::FloatVector &hitX, pandora::FloatVector &hitY, pandora::FloatVector &hitZ, gar::rec::Cluster &pCluster, pandora::CartesianVector &clusterPositionVec) const
Set cluster position, errors and other shape info, by calculating culster shape first.
void InitialiseSubDetectorNames(pandora::StringVector &subDetectorNames) const
initialise sub detector name strings
void AddTracksToRecoParticle(const pandora::ParticleFlowObject *const pPandoraPfo, gar::rec::PFParticle &pReconstructedParticle) const
Add tracks to reconstructed particle.
std::vector< string > StringVector
std::unique_ptr< std::vector< rec::Cluster > > ClusterCollection
Dft::FloatVector FloatVector