Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:02

0001 /**
0002  * @file trackbase/TrkrClusterHitAssoc.h
0003  * @author D. McGlinchey
0004  * @date June 2018
0005  * @brief Base class for associating clusters to the hits that went into them
0006  */
0007 #ifndef TRACKBASE_TRKRCLUSTERHITASSOC_H
0008 #define TRACKBASE_TRKRCLUSTERHITASSOC_H
0009 
0010 #include "TrkrDefs.h"
0011 
0012 #include <phool/PHObject.h>
0013 
0014 #include <climits>
0015 #include <iostream>  // for cout, ostream
0016 #include <map>
0017 #include <utility>  // for pair
0018 
0019 /**
0020  * @brief Base class for associating clusters to the hits that went into them
0021  *
0022  * Store the associations between clusters and the hits that went into them.
0023  */
0024 class TrkrClusterHitAssoc : public PHObject
0025 {
0026  public:
0027   using Map = std::multimap<TrkrDefs::cluskey, TrkrDefs::hitkey>;
0028   using ConstIterator = Map::const_iterator;
0029   using ConstRange = std::pair<Map::const_iterator, Map::const_iterator>;
0030 
0031   void Reset() override;
0032 
0033   //! remove all associations matching a given hitsetkey
0034   virtual void removeAssocs(TrkrDefs::hitsetkey)
0035   {}
0036 
0037   /**
0038    * @brief Add association between cluster and hit
0039    * @param[in] ckey Cluster key
0040    * @param[in] hidx Index of the hit in TrkrHitSet
0041    */
0042   virtual void addAssoc(TrkrDefs::cluskey ckey, unsigned int hidx) = 0;
0043 
0044   //! get pointer to cluster-to-hit map corresponding to a given hitset id
0045   virtual Map* getClusterMap(TrkrDefs::hitsetkey) { return nullptr; }
0046 
0047   /**
0048    * @brief Get all the hits associated with a cluster by key
0049    * @param[in] ckey Cluster key
0050    * @param[out] Range over hits associated with @c ckey
0051    */
0052 
0053   virtual ConstRange getHits(TrkrDefs::cluskey) = 0;
0054 
0055   virtual unsigned int size() const { return 0; }
0056 
0057  protected:
0058   TrkrClusterHitAssoc() = default;
0059 
0060  private:
0061   ClassDefOverride(TrkrClusterHitAssoc, 1);
0062 };
0063 
0064 #endif  // TRACKBASE_TRKRCLUSTERHITASSOC_H