Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:19

0001 /**
0002  *  @file   PandoraSDK/include/Managers/TrackManager.h
0003  * 
0004  *  @brief  Header file for the track manager class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_TRACK_MANAGER_H
0009 #define PANDORA_TRACK_MANAGER_H 1
0010 
0011 #include "Managers/InputObjectManager.h"
0012 
0013 #include "Pandora/ObjectCreation.h"
0014 #include "Pandora/PandoraInternal.h"
0015 
0016 namespace pandora
0017 {
0018 
0019 /**
0020  *    @brief TrackManager class
0021  */
0022 class TrackManager : public InputObjectManager<Track>
0023 {
0024 public:
0025     /**
0026      *  @brief  Constructor
0027      * 
0028      *  @param  pPandora address of the associated pandora object
0029      */
0030     TrackManager(const Pandora *const pPandora);
0031 
0032     /**
0033      *  @brief  Destructor
0034      */
0035     ~TrackManager();
0036 
0037 private:
0038     /**
0039      *  @brief  Create track
0040      * 
0041      *  @param  parameters the track parameters
0042      *  @param  pTrack to receive the address of the track
0043      *  @param  factory the factory that performs the object allocation
0044      */
0045     StatusCode Create(const object_creation::Track::Parameters &parameters, const Track *&pTrack,
0046         const ObjectFactory<object_creation::Track::Parameters, object_creation::Track::Object> &factory);
0047 
0048     /**
0049      *  @brief  Is a track, or a list of tracks, available to add to a particle flow object
0050      * 
0051      *  @param  pT address of the object or object list
0052      * 
0053      *  @return boolean
0054      */
0055     template <typename T>
0056     bool IsAvailable(const T *const pT) const;
0057 
0058     /**
0059      *  @brief  Set availability of a track, or a list of tracks, to be added to a particle flow object
0060      * 
0061      *  @param  pT the address of the object or object list
0062      *  @param  isAvailable the availability
0063      */
0064     template <typename T>
0065     void SetAvailability(const T *const pT, bool isAvailable) const;
0066 
0067     /**
0068      *  @brief  Erase all track manager content
0069      */
0070     StatusCode EraseAllContent();
0071 
0072     /**
0073      *  @brief  Match tracks to their correct mc particles for particle flow
0074      *
0075      *  @param  trackToPfoTargetsMap the track uid to mc pfo target map
0076      */
0077     StatusCode MatchTracksToMCPfoTargets(const UidToMCParticleWeightMap &trackToPfoTargetsMap);
0078 
0079     /**
0080      *  @brief  Remove all mc particle associations that have been registered with tracks
0081      */
0082     StatusCode RemoveAllMCParticleRelationships();
0083 
0084     /**
0085      *  @brief  Set a track parent-daughter relationship
0086      * 
0087      *  @param  parentUid the parent track unique identifier
0088      *  @param  daughterUid the daughter track unique identifier
0089      */
0090     StatusCode SetTrackParentDaughterRelationship(const Uid parentUid, const Uid daughterUid);
0091 
0092     /**
0093      *  @brief  Set a track sibling relationship
0094      * 
0095      *  @param  firstSiblingUid the first sibling track unique identifier
0096      *  @param  secondSiblingUid the second sibling track unique identifier
0097      */
0098     StatusCode SetTrackSiblingRelationship(const Uid firstSiblingUid, const Uid secondSiblingUid);
0099 
0100     /**
0101      *  @brief  Apply track associations (parent-daughter and sibling) that have been registered with the track manager
0102      */
0103     StatusCode AssociateTracks() const;
0104 
0105     /**
0106      *  @brief  Add parent-daughter associations to tracks
0107      */
0108     StatusCode AddParentDaughterAssociations() const;
0109 
0110     /**
0111      *  @brief  Add sibling associations to tracks
0112      */
0113     StatusCode AddSiblingAssociations() const;
0114 
0115     /**
0116      *  @brief  Set the cluster associated with a track
0117      * 
0118      *  @param  pTrack the address of the relevant track
0119      *  @param  pCluster the address of the associated cluster
0120      */
0121     StatusCode SetAssociatedCluster(const Track *const pTrack, const Cluster *const pCluster) const;
0122 
0123     /**
0124      *  @brief  Remove the association of a track with a cluster
0125      *
0126      *  @param  pTrack the address of the relevant track
0127      *  @param  pCluster the address of the cluster with which the track is no longer associated
0128      */
0129     StatusCode RemoveAssociatedCluster(const Track *const pTrack, const Cluster *const pCluster) const;
0130 
0131     /**
0132      *  @brief  Remove all track to cluster associations
0133      */
0134     StatusCode RemoveAllClusterAssociations() const;
0135 
0136     /**
0137      *  @brief  Remove track to cluster associations from all tracks in the current list
0138      * 
0139      *  @param  danglingClusters to receive the list of "dangling" associations
0140      */
0141     StatusCode RemoveCurrentClusterAssociations(TrackToClusterMap &danglingClusters) const;
0142 
0143     /**
0144      *  @brief  Remove track to cluster associations from a specified list of tracks
0145      * 
0146      *  @param  trackList the specified track list
0147      */
0148     StatusCode RemoveClusterAssociations(const TrackList &trackList) const;
0149 
0150     /**
0151      *  @brief  Initialize reclustering operations, preparing lists and metadata accordingly
0152      * 
0153      *  @param  pAlgorithm address of the algorithm controlling reclustering
0154      *  @param  clusterList the input cluster list
0155      *  @param  originalReclusterListName the list name/key for the original recluster candidates
0156      */
0157     StatusCode InitializeReclustering(const Algorithm *const pAlgorithm, const TrackList &trackList,
0158         const std::string &originalReclusterListName);
0159 
0160     typedef std::unordered_map<Uid, const Track *> UidToTrackMap;
0161     typedef std::unordered_multimap<Uid, Uid> TrackRelationMap;
0162 
0163     UidToTrackMap                   m_uidToTrackMap;                    ///< The uid to track map
0164     TrackRelationMap                m_parentDaughterRelationMap;        ///< The track parent-daughter relation map
0165     TrackRelationMap                m_siblingRelationMap;               ///< The track sibling relation map
0166 
0167     friend class PandoraApiImpl;
0168     friend class PandoraContentApiImpl;
0169     friend class PandoraImpl;
0170 };
0171 
0172 } // namespace pandora
0173 
0174 #endif // #ifndef PANDORA_TRACK_MANAGER_H