Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002  *  @file   PandoraSDK/include/Managers/CaloHitManager.h
0003  * 
0004  *  @brief  Header file for the calo hit manager class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_CALO_HIT_MANAGER_H
0009 #define PANDORA_CALO_HIT_MANAGER_H 1
0010 
0011 #include "Managers/InputObjectManager.h"
0012 #include "Managers/Metadata.h"
0013 
0014 #include "Pandora/ObjectCreation.h"
0015 #include "Pandora/PandoraInternal.h"
0016 
0017 namespace pandora
0018 {
0019 
0020 /**
0021  *  @brief  CaloHitManager class
0022  */
0023 class CaloHitManager : public InputObjectManager<CaloHit>
0024 {
0025 public:
0026     /**
0027      *  @brief  Constructor
0028      * 
0029      *  @param  pPandora address of the associated pandora object
0030      */
0031     CaloHitManager(const Pandora *const pPandora);
0032 
0033      /**
0034      *  @brief  Destructor
0035      */
0036     ~CaloHitManager();
0037 
0038 private:
0039     /**
0040      *  @brief  Create calo hit
0041      * 
0042      *  @param  parameters the calo hit parameters
0043      *  @param  pCaloHit to receive the address of the calo hit
0044      *  @param  factory the factory that performs the object allocation
0045      */
0046     StatusCode Create(const object_creation::CaloHit::Parameters &parameters, const CaloHit *&pCaloHit,
0047         const ObjectFactory<object_creation::CaloHit::Parameters, object_creation::CaloHit::Object> &factory);
0048 
0049     /**
0050      *  @brief  Alter the metadata information stored in a calo hit
0051      * 
0052      *  @param  pCaloHit address of the calo hit to modify
0053      *  @param  metaData the metadata (only populated metadata fields will be propagated to the object)
0054      */
0055     StatusCode AlterMetadata(const CaloHit *const pCaloHit, const object_creation::CaloHit::Metadata &metadata) const;
0056 
0057     /**
0058      *  @brief  Is a calo hit, or a list of calo hits, available to add to a cluster
0059      * 
0060      *  @param  pT address of the object or object list
0061      * 
0062      *  @return boolean
0063      */
0064     template <typename T>
0065     bool IsAvailable(const T *const pT) const;
0066 
0067     /**
0068      *  @brief  Set availability of a calo hit, or a list of calo hits, to be added to a cluster
0069      * 
0070      *  @param  pT the address of the object or object list
0071      *  @param  isAvailable the availability
0072      */
0073     template <typename T>
0074     StatusCode SetAvailability(const T *const pT, bool isAvailable);
0075 
0076     using InputObjectManager<CaloHit>::CreateTemporaryListAndSetCurrent;
0077 
0078     /**
0079      *  @brief  Change the current calo hit list to the constituent hits of a cluster list
0080      * 
0081      *  @param  pAlgorithm address of the algorithm changing the current calo hit list
0082      *  @param  clusterList the cluster list containing the hits
0083      *  @param  temporaryListName to receive the name of the temporary list
0084      */
0085     StatusCode CreateTemporaryListAndSetCurrent(const Algorithm *const pAlgorithm, const ClusterList &clusterList, std::string &temporaryListName);
0086 
0087     /**
0088      *  @brief  Erase all calo hit manager content
0089      */
0090     StatusCode EraseAllContent();
0091 
0092     /**
0093      *  @brief  Match calo hits to their correct mc particles for particle flow
0094      * 
0095      *  @param  caloHitToPfoTargetsMap the calo hit uid to mc pfo target map
0096      */
0097     StatusCode MatchCaloHitsToMCPfoTargets(const UidToMCParticleWeightMap &caloHitToPfoTargetsMap);
0098 
0099     /**
0100      *  @brief  Remove all mc particle associations that have been registered with calo hits
0101      */
0102     StatusCode RemoveAllMCParticleRelationships();
0103 
0104     /**
0105      *  @brief  Fragment a calo hit into two daughter calo hits, with a specified energy division
0106      *
0107      *  @param  pOriginalCaloHit address of the original calo hit, which will be deleted
0108      *  @param  fraction1 the fraction of energy to be assigned to daughter fragment 1
0109      *  @param  pDaughterCaloHit1 to receive the address of daughter fragment 1
0110      *  @param  pDaughterCaloHit2 to receive the address of daughter fragment 2
0111      *  @param  factory to create the calo hit fragments
0112      */
0113     StatusCode FragmentCaloHit(const CaloHit *const pOriginalCaloHit, const float fraction1, const CaloHit *&pDaughterCaloHit1,
0114         const CaloHit *&pDaughterCaloHit2, const ObjectFactory<object_creation::CaloHitFragment::Parameters, object_creation::CaloHitFragment::Object> &factory);
0115 
0116     /**
0117      *  @brief  Merge two calo hit fragments, originally from the same parent hit, to form a new calo hit
0118      *
0119      *  @param  pFragmentCaloHit1 address of calo hit fragment 1, which will be deleted
0120      *  @param  pFragmentCaloHit2 address of calo hit fragment 2, which will be deleted
0121      *  @param  pMergedCaloHit to receive the address of the merged calo hit
0122      *  @param  factory to create the merged calo hit
0123      */
0124     StatusCode MergeCaloHitFragments(const CaloHit *const pFragmentCaloHit1, const CaloHit *const pFragmentCaloHit2,
0125         const CaloHit *&pMergedCaloHit, const ObjectFactory<object_creation::CaloHitFragment::Parameters, object_creation::CaloHitFragment::Object> &factory);
0126 
0127     /**
0128      *  @brief  Whether a calo hit can be fragmented into two daughter calo hits with the specified energy division
0129      * 
0130      *  @param  pOriginalCaloHit address of the original calo hit
0131      *  @param  fraction1 the fraction of energy to be assigned to daughter fragment 1
0132      * 
0133      *  @return boolean
0134      */
0135     bool CanFragmentCaloHit(const CaloHit *const pOriginalCaloHit, const float fraction1) const;
0136 
0137     /**
0138      *  @brief  Whether two candidate calo hit fragments can be merged
0139      * 
0140      *  @param  pFragmentCaloHit1 address of first candidate calo hit fragment
0141      *  @param  pFragmentCaloHit2 address of second candidate calo hit fragment
0142      * 
0143      *  @return boolean
0144      */
0145     bool CanMergeCaloHitFragments(const CaloHit *const pFragmentCaloHit1, const CaloHit *const pFragmentCaloHit2) const;
0146 
0147     /**
0148      *  @brief  Initialize reclustering operations, preparing lists and metadata accordingly
0149      * 
0150      *  @param  pAlgorithm address of the algorithm controlling reclustering
0151      *  @param  clusterList the input cluster list
0152      *  @param  originalReclusterListName the list name/key for the original recluster candidates
0153      */
0154     StatusCode InitializeReclustering(const Algorithm *const pAlgorithm, const ClusterList &clusterList,
0155         const std::string &originalReclusterListName);
0156 
0157     /**
0158      *  @brief  Prepare metadata to allow for construction of new recluster candidates
0159      * 
0160      *  @param  pAlgorithm address of the algorithm controlling reclustering
0161      *  @param  newReclusterListName the list name/key for the new recluster candidates
0162      */
0163     StatusCode PrepareForClustering(const Algorithm *const pAlgorithm, const std::string &newReclusterListName);
0164 
0165     /**
0166      *  @brief  End reclustering operations and update calo hit lists accordingly
0167      * 
0168      *  @param  pAlgorithm address of the algorithm controlling reclustering
0169      *  @param  selectedReclusterListName the list name/key for the chosen recluster candidates
0170      */
0171     StatusCode EndReclustering(const Algorithm *const pAlgorithm, const std::string &selectedReclusterListName);
0172 
0173     /**
0174      *  @brief  Update all calo hit lists to account for changes by daughter recluster processes
0175      * 
0176      *  @param  caloHitMetadata description of the changes made by daughter reclustering processes
0177      */
0178     StatusCode Update(const CaloHitMetadata &caloHitMetadata);
0179 
0180     /**
0181      *  @brief  Update all calo hit lists to account for a specific calo hit replacement
0182      * 
0183      *  @param  caloHitReplacement the calo hit replacement
0184      */
0185     StatusCode Update(const CaloHitReplacement &caloHitReplacement);
0186 
0187     /**
0188      *  @brief  Update a calo hit list to account for a specific calo hit replacement
0189      * 
0190      *  @param  pCaloHitList address of the calo hit list
0191      *  @param  caloHitReplacement the calo hit replacement
0192      */
0193     StatusCode Update(CaloHitList *const pCaloHitList, const CaloHitReplacement &caloHitReplacement);
0194 
0195     unsigned int                    m_nReclusteringProcesses;           ///< The number of reclustering algorithms currently in operation
0196     ReclusterMetadata              *m_pCurrentReclusterMetadata;        ///< Address of the current recluster metadata
0197     ReclusterMetadataList           m_reclusterMetadataList;            ///< The recluster metadata list
0198 
0199     friend class PandoraApiImpl;
0200     friend class PandoraContentApiImpl;
0201     friend class PandoraImpl;
0202 };
0203 
0204 } // namespace pandora
0205 
0206 #endif // #ifndef PANDORA_CALO_HIT_MANAGER_H