55 iter->second->push_back(pCluster);
56 return STATUS_CODE_SUCCESS;
60 std::cout <<
"Failed to create cluster: " << statusCodeException.
ToString() << std::endl;
71 return this->
Modifiable(pCluster)->AlterMetadata(metadata);
85 bool isAvailable(
true);
87 for (
const Cluster *
const pCluster : *pClusterList)
98 this->
Modifiable(pCluster)->SetAvailability(isAvailable);
104 for (
const Cluster *
const pCluster : *pClusterList)
112 return this->
Modifiable(pCluster)->AddCaloHit(pCaloHit);
119 return this->
Modifiable(pCluster)->RemoveCaloHit(pCaloHit);
126 return this->
Modifiable(pCluster)->AddIsolatedCaloHit(pCaloHit);
133 return this->
Modifiable(pCluster)->RemoveIsolatedCaloHit(pCaloHit);
139 const std::string &deleteListName)
141 if (pClusterToEnlarge == pClusterToDelete)
142 return STATUS_CODE_INVALID_PARAMETER;
144 NameToListMap::iterator enlargeListIter =
m_nameToListMap.find(enlargeListName);
145 NameToListMap::iterator deleteListIter =
m_nameToListMap.find(deleteListName);
148 return STATUS_CODE_NOT_INITIALIZED;
150 ClusterList::iterator clusterToEnlargeIter = std::find(enlargeListIter->second->begin(), enlargeListIter->second->end(), pClusterToEnlarge);
151 ClusterList::iterator clusterToDeleteIter = std::find(deleteListIter->second->begin(), deleteListIter->second->end(), pClusterToDelete);
153 if ((enlargeListIter->second->end() == clusterToEnlargeIter) || (deleteListIter->second->end() == clusterToDeleteIter))
154 return STATUS_CODE_NOT_FOUND;
158 clusterToDeleteIter = deleteListIter->second->erase(clusterToDeleteIter);
159 delete pClusterToDelete;
161 return STATUS_CODE_SUCCESS;
175 return this->
Modifiable(pCluster)->RemoveTrackAssociation(pTrack);
184 for (
const Cluster *
const pCluster : *mapEntry.second)
186 const TrackList trackList(pCluster->GetAssociatedTrackList());
188 for (
const Track *
const pTrack : trackList)
193 return STATUS_CODE_SUCCESS;
203 return STATUS_CODE_NOT_INITIALIZED;
205 for (
const Cluster *
const pCluster : *iter->second)
207 const TrackList trackList(pCluster->GetAssociatedTrackList());
209 danglingTracks.insert(danglingTracks.end(), trackList.begin(), trackList.end());
211 for (
const Track *
const pTrack : trackList)
215 return STATUS_CODE_SUCCESS;
222 for (TrackToClusterMap::const_iterator iter = trackToClusterList.begin(), iterEnd = trackToClusterList.end(); iter != iterEnd; ++iter)
225 return STATUS_CODE_SUCCESS;
Header file for the cluster class.
Header file for the cluster manager class.
Header file for the object factory class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
AlgorithmObjectManager class.
bool m_canMakeNewObjects
Whether the manager is allowed to make new objects when requested by algorithms.
virtual StatusCode EraseAllContent()
Erase all manager content.
bool IsAvailable() const
Whether the cluster is available to be added to a particle flow object.
StatusCode AddTrackAssociation(const Track *const pTrack)
Add an association between the cluster and a track.
bool IsAvailable(const T *const pT) const
Is a cluster, or a list of clusters, available to add to a particle flow object.
StatusCode RemoveFromCluster(const Cluster *const pCluster, const CaloHit *const pCaloHit)
Remove a calo hit from a cluster.
StatusCode RemoveIsolatedFromCluster(const Cluster *const pCluster, const CaloHit *const pCaloHit)
Remove an isolated calo hit from a cluster.
StatusCode RemoveTrackAssociation(const Cluster *const pCluster, const Track *const pTrack) const
Remove an association between a cluster and a track.
void SetAvailability(const T *const pT, bool isAvailable) const
Set availability of a cluster, or a list of clusters, to be added to a particle flow object.
StatusCode AddToCluster(const Cluster *const pCluster, const CaloHit *const pCaloHit)
Add a calo hit to a cluster.
StatusCode RemoveCurrentTrackAssociations(TrackList &danglingTracks) const
Remove cluster to track associations from all clusters in the current list.
StatusCode RemoveAllTrackAssociations() const
Remove all cluster to track associations.
StatusCode MergeAndDeleteClusters(const Cluster *const pClusterToEnlarge, const Cluster *const pClusterToDelete, const std::string &enlargeListName, const std::string &deleteListName)
Merge two clusters from two specified lists, enlarging one cluster and deleting the second.
StatusCode RemoveTrackAssociations(const TrackToClusterMap &trackToClusterList) const
Remove a specified list of cluster to track associations.
StatusCode AddIsolatedToCluster(const Cluster *const pCluster, const CaloHit *const pCaloHit)
Add an isolated calo hit to a cluster. This is not counted as a regular calo hit: it contributes only...
ClusterManager(const Pandora *const pPandora)
Constructor.
StatusCode AddTrackAssociation(const Cluster *const pCluster, const Track *const pTrack) const
Add an association between a cluster and a track.
~ClusterManager()
Destructor.
StatusCode Create(const object_creation::Cluster::Parameters ¶meters, const Cluster *&pCluster, const ObjectFactory< object_creation::Cluster::Parameters, object_creation::Cluster::Object > &factory)
Create cluster.
StatusCode AlterMetadata(const Cluster *const pCluster, const object_creation::Cluster::Metadata &metadata) const
Alter the metadata information stored in a cluster.
std::string m_currentListName
The name of the current list.
virtual T * Modifiable(const T *const pT) const
Access a modifiable object, when provided with address to const object.
NameToListMap m_nameToListMap
The name to list map.
virtual StatusCode CreateInitialLists()
Create initial lists.
ObjectFactory class responsible for extended pandora object creation.
virtual StatusCode Create(const Parameters ¶meters, const Object *&pObject) const =0
Create an object with the given parameters.
StatusCodeException class.
std::string ToString() const
Get status code as a string.
StatusCode GetStatusCode() const
Get status code.
MANAGED_CONTAINER< const Cluster * > ClusterList
MANAGED_CONTAINER< const Track * > TrackList
std::unordered_map< const Track *, const Cluster * > TrackToClusterMap
StatusCode
The StatusCode enum.