Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:10

0001 #ifndef TRACKBASE_RAWHITSET_H
0002 #define TRACKBASE_RAWHITSET_H
0003 /**
0004  * @file trackbase/RawHitSet.h
0005  * @author D. McGlinchey, H. PEREIRA DA COSTA
0006  * @date 4 June 2018
0007  * @brief Base Class Container for storing RawHit's
0008  */
0009 
0010 #include "TrkrDefs.h"
0011 
0012 #include <phool/PHObject.h>
0013 
0014 #include <iostream>
0015 #include <map>
0016 #include <utility>  // for pair
0017 
0018 //! forward declaration
0019 class RawHit;
0020 class RawHitTpc;
0021 
0022 /**
0023  * @brief Container for storing RawHit's
0024  *
0025  * Container object which stores a set of RawHit objects.
0026  * A single RawHitSet is meant to represent a geometric detector object
0027  * which bounds clustering. Therefore, a RawHitSet should contain all
0028  * RawHits which could belong the the same cluster.
0029  */
0030 class RawHitSet : public PHObject
0031 {
0032  public:
0033   // iterator typedef
0034   using Vector = std::vector<RawHit*>;
0035   using VectorTpc2D = std::vector<std::vector<uint8_t>>;
0036   using ConstIterator = Vector::const_iterator;
0037   using ConstRange = std::pair<ConstIterator, ConstIterator>;
0038   using ConstVecIterator = std::vector<std::vector<uint8_t>>::iterator;
0039 
0040   //! TObject functions
0041   void identify(std::ostream& /*os*/ = std::cout) const override
0042   {
0043   }
0044 
0045   void Reset() override
0046   {
0047   }
0048 
0049   /**
0050    * @brief Set the key for this object
0051    * @param key
0052    */
0053   virtual void setHitSetKey(const TrkrDefs::hitsetkey)
0054   {
0055   }
0056 
0057   /**
0058    * @brief Get the key for this object
0059    * @param[out] object key
0060    */
0061   virtual TrkrDefs::hitsetkey getHitSetKey() const
0062   {
0063     return TrkrDefs::HITSETKEYMAX;
0064   }
0065 
0066   /**
0067    * @brief Add a hit to this container using a specific key.
0068    * @param[in] key Hit key
0069    * @param[in] hit Hit to be added.
0070    *
0071    * NOTE: This RawHitSet takes ownership of the passed RawHit pointer
0072    * and will delete it in the Reset() method.
0073    */
0074   virtual void addHit(RawHit*);
0075   //  virtual void addTpcHit(unsigned short phibin,RawHit*);
0076   virtual void setTpcPhiBins(unsigned short phibins);
0077   /**
0078    * @brief Remove a hit using its key
0079    * @param[in] key to be removed
0080    */
0081   /* virtual void removeHit(TrkrDefs::hitkey)
0082   {
0083   }
0084   */
0085   /**
0086    * @brief Get a specific hit based on its index.
0087    * @param key of the desired hit
0088    * @param[out] Pointer to the desired hit. nullptr if no hit.
0089    *
0090    * Get a desired hit based on its key.
0091    */
0092   /*  virtual RawHit* getHit(const TrkrDefs::hitkey) const
0093   {
0094     return nullptr;
0095   }
0096   */
0097 
0098   virtual ConstVecIterator getHits(int phibin);
0099 
0100   virtual unsigned int size(int /*phibin*/) const { return 0; }
0101 
0102   /**
0103    * @brief Get all hits
0104    * @param[out] Pair of iterator to vector begin and end
0105    */
0106   virtual ConstRange getHits() const;
0107   //  virtual ConstRange getTpcHits(unsigned short phibin) const;
0108   /**
0109    * @brief Get the number of hits stored
0110    * @param[out] number of hits
0111    */
0112   // Get number of hits
0113   virtual unsigned int size() const
0114   {
0115     return 0;
0116   }
0117   virtual unsigned int tpcphibins() const
0118   {
0119     return 0;
0120   }
0121 
0122  protected:
0123   //! ctor, not to be called
0124   RawHitSet() = default;
0125 
0126  private:
0127   ClassDefOverride(RawHitSet, 1);
0128 };
0129 
0130 #endif  // TRACKBASE_RAWHITSET_H