Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:14:59

0001 /**
0002  *  @file   LCContent/include/LCClustering/ForcedClusteringAlgorithm.h
0003  *
0004  *  @brief  Header file for the forced clustering algorithm class.
0005  *
0006  *  $Log: $
0007  */
0008 #ifndef LC_FORCED_CLUSTERING_ALGORITHM_H
0009 #define LC_FORCED_CLUSTERING_ALGORITHM_H 1
0010 
0011 #include "Pandora/Algorithm.h"
0012 
0013 #include "Objects/CartesianVector.h"
0014 
0015 namespace lc_content {
0016 
0017 /**
0018  *  @brief  ForcedClusteringAlgorithm class
0019  */
0020 class ForcedClusteringAlgorithm : public pandora::Algorithm {
0021 public:
0022   /**
0023    *  @brief Default constructor
0024    */
0025   ForcedClusteringAlgorithm();
0026 
0027 private:
0028   pandora::StatusCode Run();
0029   pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
0030 
0031   /**
0032    *  @brief  Remove any empty clusters at the end of the algorithm
0033    */
0034   pandora::StatusCode RemoveEmptyClusters() const;
0035 
0036   /**
0037    *  @brief  TrackDistanceInfo class
0038    */
0039   class TrackDistanceInfo {
0040   public:
0041     /**
0042      *  @brief  Constructor
0043      *
0044      *  @param  pCaloHit address of calo hit
0045      *  @param  pCluster address of cluster seeded by track
0046      *  @param  trackEnergy energy of track, measured at dca
0047      *  @param  trackDistance distance from calo hit to track
0048      */
0049     TrackDistanceInfo(const pandora::CaloHit* const pCaloHit, const pandora::Cluster* const pCluster, float trackEnergy,
0050                       float trackDistance);
0051 
0052     /**
0053      *  @brief  Get the address of the calo hit
0054      *
0055      *  @return The address of the calo hit
0056      */
0057     const pandora::CaloHit* GetCaloHit() const;
0058 
0059     /**
0060      *  @brief  Get the address of the cluster seeded by track
0061      *
0062      *  @return The address of the cluster seeded by track
0063      */
0064     const pandora::Cluster* GetCluster() const;
0065 
0066     /**
0067      *  @brief  Get the energy of the track, measured at dca
0068      *
0069      *  @return The energy of the track, measured at dca
0070      */
0071     float GetTrackEnergy() const;
0072 
0073     /**
0074      *  @brief  Get the distance from calo hit to track
0075      *
0076      *  @return The distance from calo hit to track
0077      */
0078     float GetTrackDistance() const;
0079 
0080   private:
0081     const pandora::CaloHit* m_pCaloHit; ///< Address of calo hit
0082     const pandora::Cluster* m_pCluster; ///< Address of cluster seeded by track
0083     float m_trackEnergy;                ///< Energy of track, measured at dca
0084     float m_trackDistance;              ///< Distance from calo hit to track
0085   };
0086 
0087   typedef std::vector<TrackDistanceInfo> TrackDistanceInfoVector;
0088 
0089   /**
0090    *  @brief  Sort TrackDistanceInfo objects by increasing distance from track
0091    *
0092    *  @param  lhs the first calo hit distance pair
0093    *  @param  rhs the second calo hit distance pair
0094    */
0095   static bool SortByDistanceToTrack(const TrackDistanceInfo& lhs, const TrackDistanceInfo& rhs);
0096 
0097   bool m_shouldRunStandardClusteringAlgorithm;   ///< Whether to run standard clustering algorithm to deal with remnants
0098   std::string m_standardClusteringAlgorithmName; ///< The name of standard clustering algorithm to run
0099 
0100   bool m_shouldClusterIsolatedHits;   ///< Whether to directly include isolated hits in newly formed clusters
0101   bool m_shouldAssociateIsolatedHits; ///< Whether to associate isolated hits to newly formed clusters
0102   std::string m_isolatedHitAssociationAlgorithmName; ///< The name of isolated hit association algorithm
0103 };
0104 
0105 //------------------------------------------------------------------------------------------------------------------------------------------
0106 
0107 inline bool ForcedClusteringAlgorithm::SortByDistanceToTrack(const TrackDistanceInfo& lhs,
0108                                                              const TrackDistanceInfo& rhs) {
0109   return (lhs.GetTrackDistance() < rhs.GetTrackDistance());
0110 }
0111 
0112 //------------------------------------------------------------------------------------------------------------------------------------------
0113 //------------------------------------------------------------------------------------------------------------------------------------------
0114 
0115 inline ForcedClusteringAlgorithm::TrackDistanceInfo::TrackDistanceInfo(const pandora::CaloHit* const pCaloHit,
0116                                                                        const pandora::Cluster* const pCluster,
0117                                                                        float trackEnergy, float trackDistance)
0118     : m_pCaloHit(pCaloHit), m_pCluster(pCluster), m_trackEnergy(trackEnergy), m_trackDistance(trackDistance) {}
0119 
0120 //------------------------------------------------------------------------------------------------------------------------------------------
0121 
0122 inline const pandora::CaloHit* ForcedClusteringAlgorithm::TrackDistanceInfo::GetCaloHit() const { return m_pCaloHit; }
0123 
0124 //------------------------------------------------------------------------------------------------------------------------------------------
0125 
0126 inline const pandora::Cluster* ForcedClusteringAlgorithm::TrackDistanceInfo::GetCluster() const { return m_pCluster; }
0127 
0128 //------------------------------------------------------------------------------------------------------------------------------------------
0129 
0130 inline float ForcedClusteringAlgorithm::TrackDistanceInfo::GetTrackEnergy() const { return m_trackEnergy; }
0131 
0132 //------------------------------------------------------------------------------------------------------------------------------------------
0133 
0134 inline float ForcedClusteringAlgorithm::TrackDistanceInfo::GetTrackDistance() const { return m_trackDistance; }
0135 
0136 } // namespace lc_content
0137 
0138 #endif // #ifndef LC_FORCED_CLUSTERING_ALGORITHM_H