Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002  *  @file   LCContent/include/LCParticleId/MuonReconstructionAlgorithm.h
0003  *
0004  *  @brief  Header file for the muon reconstruction algorithm class.
0005  *
0006  *  $Log: $
0007  */
0008 #ifndef LC_MUON_RECONSTRUCTION_ALGORITHM_H
0009 #define LC_MUON_RECONSTRUCTION_ALGORITHM_H 1
0010 
0011 #include "Pandora/Algorithm.h"
0012 
0013 namespace lc_content {
0014 
0015 /**
0016  *  @brief  MuonReconstructionAlgorithm class
0017  */
0018 class MuonReconstructionAlgorithm : public pandora::Algorithm {
0019 public:
0020   /**
0021    *  @brief Default constructor
0022    */
0023   MuonReconstructionAlgorithm();
0024 
0025 private:
0026   typedef const void* Uid;
0027 
0028   pandora::StatusCode Run();
0029   pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
0030 
0031   /**
0032    *  @brief  Associate muon clusters with appropriate tracks
0033    *
0034    *  @param  pMuonClusterList address of the muon cluster list
0035    */
0036   pandora::StatusCode AssociateMuonTracks(const pandora::ClusterList* const pMuonClusterList) const;
0037 
0038   /**
0039    *  @brief  Get the coordinates of the point at which a helix enters the muon detectors
0040    *
0041    *  @param  helix the helix
0042    *  @param  isPositiveZ whether to project the helix to the muon endcap with positive or negative z coordiante
0043    *  @param  muonEntryPoint to receive the muon entry point
0044    */
0045   pandora::StatusCode GetMuonEntryPoint(const pandora::Helix& helix, const bool isPositiveZ,
0046                                         pandora::CartesianVector& muonEntryPoint) const;
0047 
0048   /**
0049    *  @brief  Add appropriate calo hits in the ecal/hcal to the muon clusters
0050    *
0051    *  @param  pMuonClusterList address of the muon cluster list
0052    */
0053   pandora::StatusCode AddCaloHits(const pandora::ClusterList* const pMuonClusterList) const;
0054 
0055   /**
0056    *  @brief  Create the muon pfos
0057    *
0058    *  @param  pMuonClusterList address of the muon cluster list
0059    */
0060   pandora::StatusCode CreateMuonPfos(const pandora::ClusterList* const pMuonClusterList) const;
0061 
0062   /**
0063    *  @brief  Tidy all relevant pandora lists, saving the muon clusters and saving muon-removed track and calo hit lists
0064    */
0065   pandora::StatusCode TidyLists() const;
0066 
0067   typedef std::pair<const pandora::CaloHit*, float> TrackDistanceInfo;
0068   typedef std::vector<TrackDistanceInfo> TrackDistanceInfoVector;
0069 
0070   /**
0071    *  @brief  Sort TrackDistanceInfo objects by increasing distance from track
0072    *
0073    *  @param  lhs the first calo hit distance pair
0074    *  @param  rhs the second calo hit distance pair
0075    */
0076   static bool SortByDistanceToTrack(const TrackDistanceInfo& lhs, const TrackDistanceInfo& rhs);
0077 
0078   /**
0079    *  @brief  Get lists of the components used to build pfos
0080    *
0081    *  @param  pfoTrackList to receive the list of tracks in pfos
0082    *  @param  pfoCaloHitList to receive the list of calo hits in pfos
0083    *  @param  pfoClusterList to receive the list of clusters in pfos
0084    */
0085   pandora::StatusCode GetPfoComponents(pandora::TrackList& pfoTrackList, pandora::CaloHitList& pfoCaloHitList,
0086                                        pandora::ClusterList& pfoClusterList) const;
0087 
0088   std::string m_inputTrackListName;       ///< The name of the input track list
0089   std::string m_inputCaloHitListName;     ///< The name of the input calo hit list containing ecal and hcal hits
0090   std::string m_inputMuonCaloHitListName; ///< The name of the input calo hit list containing muon yoke hits
0091   std::string m_muonClusteringAlgName;    ///< The name of the muon clustering algorithm to run
0092 
0093   bool m_shouldClusterIsolatedHits; ///< Whether to directly include isolated hits in newly formed clusters
0094 
0095   unsigned int m_maxClusterCaloHits;       ///< The maximum number of calo hits in a muon cluster
0096   unsigned int m_minClusterOccupiedLayers; ///< The minimum number of occupied layers in a muon cluster
0097   unsigned int m_minClusterLayerSpan;      ///< The minimum layer span for a muon cluster
0098   unsigned int m_nClusterLayersToFit;      ///< The number of layers to use in the fit to the muon cluster
0099   float m_maxClusterFitChi2;               ///< The maximum fit chi2 for a muon cluster
0100 
0101   float m_maxDistanceToTrack;      ///< The maximum distance from track helix to muon cluster
0102   float m_minTrackCandidateEnergy; ///< The minimum energy for a muon candidate track
0103   float m_minHelixClusterCosAngle; ///< The minimum cosine of the angle between muon candidate cluster and helix
0104 
0105   unsigned int m_nExpectedTracksPerCluster; ///< Expected number of tracks associated to each muon cluster
0106   unsigned int m_nExpectedParentTracks;     ///< Expected number of parent tracks for muon-associated track
0107 
0108   float m_minHelixCaloHitCosAngle; ///< The minimum cosine of the angle between muon candidate ecal/hcal hits and helix
0109   float m_region1GenericDistance;  ///< Generic distance (helix->hit distance / pad-width) value to define region 1
0110   float m_region2GenericDistance;  ///< Generic distance (helix->hit distance / pad-width) value to define region 2
0111   unsigned int m_isolatedMinRegion1Hits; ///< Min number of hits in region 1 for an isolated muon
0112   unsigned int m_isolatedMaxRegion2Hits; ///< Max number of hits in region 2 for an isolated muon
0113   float m_maxGenericDistance;            ///< Max generic distance to add ecal/hcal hit to muon
0114   float m_isolatedMaxGenericDistance;    ///< Max generic distance to add ecal/hcal hit to isolated muon
0115 
0116   std::string m_outputTrackListName;   ///< The name of the output muon-removed track list
0117   std::string m_outputCaloHitListName; ///< The name of the output muon-removed calo hit list
0118   std::string
0119       m_outputMuonCaloHitListName; ///< The name of the output muon calo hit list, after removal of hits in muon pfos
0120   std::string m_outputMuonClusterListName; ///< The name of the output muon cluster list
0121   std::string m_outputMuonPfoListName;     ///< The name of the output muon pfo list
0122 
0123   std::string m_replacementTrackListName;   ///< The replacement track list name
0124   std::string m_replacementCaloHitListName; ///< The replacement calo hit list name
0125   bool m_replaceCurrentClusterList;         ///< Whether to subsequently use the new cluster list as the "current" list
0126   bool m_replaceCurrentPfoList;             ///< Whether to subsequently use the new pfo list as the "current" list
0127 };
0128 
0129 //------------------------------------------------------------------------------------------------------------------------------------------
0130 
0131 inline bool MuonReconstructionAlgorithm::SortByDistanceToTrack(const TrackDistanceInfo& lhs,
0132                                                                const TrackDistanceInfo& rhs) {
0133   return (lhs.second < rhs.second);
0134 }
0135 
0136 } // namespace lc_content
0137 
0138 #endif // #ifndef LC_MUON_RECONSTRUCTION_ALGORITHM_H