Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002  *  @file   LCContent/include/LCHelpers/ReclusterHelper.h
0003  *
0004  *  @brief  Header file for the recluster helper class.
0005  *
0006  *  $Log: $
0007  */
0008 #ifndef LC_RECLUSTER_HELPER_H
0009 #define LC_RECLUSTER_HELPER_H 1
0010 
0011 #include "Pandora/PandoraInputTypes.h"
0012 #include "Pandora/PandoraInternal.h"
0013 
0014 namespace lc_content {
0015 
0016 /**
0017  *  @brief  ReclusterResult class
0018  */
0019 class ReclusterResult {
0020 public:
0021   /**
0022    *  @brief  Get the total chi value for the suitability of all track/cluster associations
0023    *
0024    *  @return the total chi value
0025    */
0026   float GetChi() const;
0027 
0028   /**
0029    *  @brief  Get the total chi2 value for the suitability of all track/cluster associations
0030    *
0031    *  @return the total chi2 value
0032    */
0033   float GetChi2() const;
0034 
0035   /**
0036    *  @brief  Get the chi per degree of freedom value for suitability of track/cluster associations
0037    *
0038    *  @return the chi per degree of freedom value
0039    */
0040   float GetChiPerDof() const;
0041 
0042   /**
0043    *  @brief  Get the chi2 per degree of freedom value for suitability of track/cluster associations
0044    *
0045    *  @return the chi2 per degree of freedom value
0046    */
0047   float GetChi2PerDof() const;
0048 
0049   /**
0050    *  @brief  Get the total hadronic energy in clusters that have no track associations
0051    *
0052    *  @return the total hadronic energy in clusters that have no track associations
0053    */
0054   float GetUnassociatedEnergy() const;
0055 
0056   /**
0057    *  @brief  Get the minimum energy of a cluster associated with a track
0058    *
0059    *  @return the minimum energy of a cluster associated with a track
0060    */
0061   float GetMinTrackAssociationEnergy() const;
0062 
0063   /**
0064    *  @brief  Get the number of excess track-cluster associations
0065    *
0066    *  @return the number of excess track-cluster associations
0067    */
0068   unsigned int GetNExcessTrackAssociations() const;
0069 
0070   /**
0071    *  @brief  Set the total chi value for the suitability of all track/cluster associations
0072    *
0073    *  @param  chi the total chi value
0074    */
0075   void SetChi(float chi);
0076 
0077   /**
0078    *  @brief  Set the total chi2 value for the suitability of all track/cluster associations
0079    *
0080    *  @param  chi the total chi2 value
0081    */
0082   void SetChi2(float chi2);
0083 
0084   /**
0085    *  @brief  Set the chi per degree of freedom value for suitability of track/cluster associations
0086    *
0087    *  @param  chiPerDof the chi per degree of freedom value
0088    */
0089   void SetChiPerDof(float chiPerDof);
0090 
0091   /**
0092    *  @brief  Set the chi2 per degree of freedom value for suitability of track/cluster associations
0093    *
0094    *  @param  chi2PerDof the chi2 per degree of freedom value
0095    */
0096   void SetChi2PerDof(float chi2PerDof);
0097 
0098   /**
0099    *  @brief  Set the total hadronic energy in clusters that have no track associations
0100    *
0101    *  @param  unassociatedEnergy the total hadronic energy in clusters that have no track associations
0102    */
0103   void SetUnassociatedEnergy(float unassociatedEnergy);
0104 
0105   /**
0106    *  @brief  Set the minimum energy of a cluster associated with a track
0107    *
0108    *  @param  minTrackAssociationEnergy the minimum energy of a cluster associated with a track
0109    */
0110   void SetMinTrackAssociationEnergy(float minTrackAssociationEnergy);
0111 
0112   /**
0113    *  @brief  Set the number of excess track-cluster associations
0114    *
0115    *  @param  nExcessTrackAssociations the number of excess track-cluster associations
0116    */
0117   void SetNExcessTrackAssociations(unsigned int nExcessTrackAssociations);
0118 
0119 private:
0120   pandora::InputFloat m_chi;        ///< Total chi value for the suitability of all track/cluster associations
0121   pandora::InputFloat m_chi2;       ///< Total chi2 value for the suitability of all track/cluster associations
0122   pandora::InputFloat m_chiPerDof;  ///< Chi per degree of freedom value for suitability of track/cluster associations
0123   pandora::InputFloat m_chi2PerDof; ///< Chi2 per degree of freedom value for suitability of track/cluster associations
0124   pandora::InputFloat m_unassociatedEnergy; ///< Total hadronic energy in clusters that have no track associations
0125   pandora::InputFloat m_minTrackAssociationEnergy; ///< Minimum energy of a cluster associated with a track
0126   pandora::InputUInt m_nExcessTrackAssociations;   ///< Number of excess track-cluster associations
0127 };
0128 
0129 //------------------------------------------------------------------------------------------------------------------------------------------
0130 
0131 /**
0132  *  @brief  ReclusterHelper class
0133  */
0134 class ReclusterHelper {
0135 public:
0136   /**
0137    *  @brief  Evaluate the compatibility of a cluster with its associated tracks. Reclustering can be used to split up a
0138    *          cluster and produce more favourable track/cluster matches.
0139    *
0140    *  @param  pandora the associated pandora instance
0141    *  @param  pCluster address of the cluster
0142    *  @param  trackList address of the list of tracks associated with the cluster
0143    *
0144    *  @return the chi value for the suitability of the track/cluster associations
0145    */
0146   static float GetTrackClusterCompatibility(const pandora::Pandora& pandora, const pandora::Cluster* const pCluster,
0147                                             const pandora::TrackList& trackList);
0148 
0149   /**
0150    *  @brief  Evaluate the compatibility of a cluster with its associated tracks. Reclustering can be used to split up a
0151    *          cluster and produce more favourable track/cluster matches.
0152    *
0153    *  @param  pandora the associated pandora instance
0154    *  @param  clusterEnergy the cluster energy
0155    *  @param  trackEnergy the sum of the energies of the associated tracks
0156    *
0157    *  @return the chi value for the suitability of the track/cluster associations
0158    */
0159   static float GetTrackClusterCompatibility(const pandora::Pandora& pandora, const float clusterEnergy,
0160                                             const float trackEnergy);
0161 
0162   /**
0163    *  @brief  Extract recluster results, indicating suitability of recluster candidates as a replacement for the
0164    * original clusters
0165    *
0166    *  @param  pandora the associated pandora instance
0167    *  @param  pReclusterCandidatesList address of the recluster candidates list
0168    *  @param  reclusterResult to receive the recluster results
0169    */
0170   static pandora::StatusCode ExtractReclusterResults(const pandora::Pandora& pandora,
0171                                                      const pandora::ClusterList* const pReclusterCandidatesList,
0172                                                      ReclusterResult& reclusterResult);
0173 };
0174 
0175 //------------------------------------------------------------------------------------------------------------------------------------------
0176 //------------------------------------------------------------------------------------------------------------------------------------------
0177 
0178 inline float ReclusterResult::GetChi() const { return m_chi.Get(); }
0179 
0180 //------------------------------------------------------------------------------------------------------------------------------------------
0181 
0182 inline float ReclusterResult::GetChi2() const { return m_chi2.Get(); }
0183 
0184 //------------------------------------------------------------------------------------------------------------------------------------------
0185 
0186 inline float ReclusterResult::GetChiPerDof() const { return m_chiPerDof.Get(); }
0187 
0188 //------------------------------------------------------------------------------------------------------------------------------------------
0189 
0190 inline float ReclusterResult::GetChi2PerDof() const { return m_chi2PerDof.Get(); }
0191 
0192 //------------------------------------------------------------------------------------------------------------------------------------------
0193 
0194 inline float ReclusterResult::GetUnassociatedEnergy() const { return m_unassociatedEnergy.Get(); }
0195 
0196 //------------------------------------------------------------------------------------------------------------------------------------------
0197 
0198 inline float ReclusterResult::GetMinTrackAssociationEnergy() const { return m_minTrackAssociationEnergy.Get(); }
0199 
0200 //------------------------------------------------------------------------------------------------------------------------------------------
0201 
0202 inline unsigned int ReclusterResult::GetNExcessTrackAssociations() const { return m_nExcessTrackAssociations.Get(); }
0203 
0204 //------------------------------------------------------------------------------------------------------------------------------------------
0205 
0206 inline void ReclusterResult::SetChi(float chi) {
0207   m_chi = chi;
0208   if (!m_chi.IsInitialized())
0209     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0210 }
0211 
0212 //------------------------------------------------------------------------------------------------------------------------------------------
0213 
0214 inline void ReclusterResult::SetChi2(float chi2) {
0215   m_chi2 = chi2;
0216   if (!m_chi2.IsInitialized())
0217     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0218 }
0219 
0220 //------------------------------------------------------------------------------------------------------------------------------------------
0221 
0222 inline void ReclusterResult::SetChiPerDof(float chiPerDof) {
0223   m_chiPerDof = chiPerDof;
0224   if (!m_chiPerDof.IsInitialized())
0225     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0226 }
0227 
0228 //------------------------------------------------------------------------------------------------------------------------------------------
0229 
0230 inline void ReclusterResult::SetChi2PerDof(float chi2PerDof) {
0231   m_chi2PerDof = chi2PerDof;
0232   if (!m_chi2PerDof.IsInitialized())
0233     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0234 }
0235 
0236 //------------------------------------------------------------------------------------------------------------------------------------------
0237 
0238 inline void ReclusterResult::SetUnassociatedEnergy(float unassociatedEnergy) {
0239   m_unassociatedEnergy = unassociatedEnergy;
0240   if (!m_unassociatedEnergy.IsInitialized())
0241     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0242 }
0243 
0244 //------------------------------------------------------------------------------------------------------------------------------------------
0245 
0246 inline void ReclusterResult::SetMinTrackAssociationEnergy(float minTrackAssociationEnergy) {
0247   m_minTrackAssociationEnergy = minTrackAssociationEnergy;
0248   if (!m_minTrackAssociationEnergy.IsInitialized())
0249     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0250 }
0251 
0252 //------------------------------------------------------------------------------------------------------------------------------------------
0253 
0254 inline void ReclusterResult::SetNExcessTrackAssociations(unsigned int nExcessTrackAssociations) {
0255   m_nExcessTrackAssociations = nExcessTrackAssociations;
0256   if (!m_nExcessTrackAssociations.IsInitialized())
0257     throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
0258 }
0259 
0260 } // namespace lc_content
0261 
0262 #endif // #ifndef LC_RECLUSTER_HELPER_H