Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:54

0001 /*!
0002  * \file MvtxHitMap.h
0003  * \brief Holds pixel hit info until processing
0004  * \author Tanner Mengel <tmengel@bnl.gov>
0005  * \version $Version: 2.0.1 $
0006  * \date $Date: 05/23/2025.
0007  */
0008 
0009 #ifndef MVTX_MVTXHITMAP_H
0010 #define MVTX_MVTXHITMAP_H
0011 
0012 #include "MvtxPixelDefs.h"
0013 
0014 #include <cstdint>
0015 #include <utility>
0016 #include <vector>
0017 
0018 class MvtxRawHit;
0019 class MvtxHitMap
0020 {
0021  public:
0022   MvtxHitMap() = default;
0023   ~MvtxHitMap() { clear(); }
0024 
0025   typedef std::pair<MvtxPixelDefs::pixelkey, uint32_t> pixel_hits_pair_t;
0026   typedef std::vector<MvtxHitMap::pixel_hits_pair_t> pixel_hit_vector_t;
0027 
0028   void add_hit(MvtxPixelDefs::pixelkey key, uint32_t nhits = 1);
0029   void clear()
0030   {
0031     m_pixel_hit_vector.clear();
0032     is_sorted = false;
0033   }
0034 
0035   int npixels() const { return m_pixel_hit_vector.size(); }
0036 
0037   uint32_t get_nhits(MvtxPixelDefs::pixelkey key) const;
0038   const MvtxHitMap::pixel_hit_vector_t &get_pixel_hit_vector() const { return m_pixel_hit_vector; }
0039   MvtxPixelDefs::pixelkey get_most_significant_pixel();
0040 
0041   uint32_t sum_hits(unsigned int nmasked = 0);
0042 
0043  private:
0044   MvtxHitMap::pixel_hit_vector_t m_pixel_hit_vector{};
0045 
0046   void sort_by_hits();
0047   bool is_sorted{false};
0048 };
0049 
0050 #endif  // MVTX_MVTXHITMAP_H