Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:28

0001 #ifndef TPCCALIB_TPCSPACECHARGEMATRIXCONTAINERV1_H
0002 #define TPCCALIB_TPCSPACECHARGEMATRIXCONTAINERV1_H
0003 
0004 /**
0005  * @file tpccalib/TpcSpaceChargeMatrixContainer.h
0006  * @author Hugo Pereira Da Costa
0007  * @date June 2018
0008  * @brief Contains matrices needed for space charge trackbase reconstruction
0009  */
0010 
0011 #include "TpcSpaceChargeMatrixContainer.h"
0012 
0013 #include <array>
0014 
0015 /**
0016  * @brief Cluster container object
0017  */
0018 class TpcSpaceChargeMatrixContainerv1 : public TpcSpaceChargeMatrixContainer
0019 {
0020  public:
0021   /// constructor
0022   TpcSpaceChargeMatrixContainerv1();
0023 
0024   /// destructor
0025   ~TpcSpaceChargeMatrixContainerv1() override = default;
0026 
0027   ///@name accessors
0028   //@{
0029 
0030   /// identify object
0031   void identify(std::ostream& os = std::cout) const override;
0032 
0033   /// get grid dimensions
0034   void get_grid_dimensions(int& phibins, int& rbins, int& zbins) const override;
0035 
0036   /// get grid size
0037   int get_grid_size() const override;
0038 
0039   /// get grid index for given sub-indexes
0040   int get_cell_index(int iphibin, int irbin, int izbin) const override;
0041 
0042   /// get entries for a given cell
0043   int get_entries(int cell_index) const override;
0044 
0045   /// get left hand side
0046   float get_lhs(int cell_index, int i, int j) const override;
0047 
0048   /// get right hand side
0049   float get_rhs(int cell_index, int i) const override;
0050 
0051   //@}
0052 
0053   ///@name modifiers
0054   //@{
0055 
0056   /// reset method
0057   void Reset() override;
0058 
0059   /// set grid dimensions
0060   /**
0061   \param phibins the number of bins in the azimuth direction
0062   \param zbins the number of bins along z
0063   */
0064   void set_grid_dimensions(int phibins, int rbins, int zbins) override;
0065 
0066   /// increment cell entries
0067   void add_to_entries(int cell_index) override
0068   {
0069     add_to_entries(cell_index, 1);
0070   }
0071 
0072   /// increment cell entries
0073   void add_to_entries(int cell_index, int value) override;
0074 
0075   /// increment left hand side matrix
0076   void add_to_lhs(int cell_index, int i, int j, float value) override;
0077 
0078   /// increment right hand side column
0079   void add_to_rhs(int cell_index, int i, float value) override;
0080 
0081   /// add content from other container
0082   bool add(const TpcSpaceChargeMatrixContainer& other) override;
0083 
0084   //@}
0085 
0086  private:
0087   /// boundary check
0088   bool bound_check(int cell_index) const;
0089 
0090   /// boundary check
0091   bool bound_check(int cell_index, int i) const;
0092 
0093   /// boundary check
0094   bool bound_check(int cell_index, int i, int j) const;
0095 
0096   /// map matrix index to flat array
0097   int get_flat_index(int i, int j) const;
0098 
0099   ///@name grid size
0100   //@{
0101   int m_phibins = 36;
0102   int m_rbins = 16;
0103   int m_zbins = 80;
0104   //@}
0105 
0106   //! number of coordinates
0107   static constexpr int m_ncoord = 3;
0108 
0109   /// internal matrix representation
0110   /**
0111    * Since matrices are symetric, one just needs to store ncoords*(ncoords+1)/2 values
0112    */
0113   using matrix_t = std::array<float, m_ncoord * m_ncoord>;
0114   using column_t = std::array<float, m_ncoord>;
0115 
0116   /// left hand side matrices for distortion inversions
0117   std::vector<matrix_t> m_lhs;
0118 
0119   /// right hand side matrices for distortion inversions
0120   std::vector<column_t> m_rhs;
0121 
0122   /// keep track of how many entries are used per cells
0123   std::vector<int> m_entries;
0124 
0125   ClassDefOverride(TpcSpaceChargeMatrixContainerv1, 1)
0126 };
0127 
0128 #endif