Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-26 23:26:38

0001 #ifndef DataFormats_PortableTestObjects_interface_TestSoA_h
0002 #define DataFormats_PortableTestObjects_interface_TestSoA_h
0003 
0004 #include <array>
0005 
0006 #include <Eigen/Core>
0007 #include <Eigen/Dense>
0008 
0009 #include "DataFormats/Common/interface/StdArray.h"
0010 #include "DataFormats/SoATemplate/interface/SoACommon.h"
0011 #include "DataFormats/SoATemplate/interface/SoALayout.h"
0012 
0013 namespace portabletest {
0014 
0015   // the type aliases are needed because commas confuse macros
0016   using Array = edm::StdArray<short, 4>;
0017   //using Array = std::array<short, 4>;
0018   using Matrix = Eigen::Matrix<double, 3, 6>;
0019 
0020   // SoA layout with x, y, z, id fields
0021   GENERATE_SOA_LAYOUT(TestSoALayout,
0022                       // columns: one value per element
0023                       SOA_COLUMN(double, x),
0024                       SOA_COLUMN(double, y),
0025                       SOA_COLUMN(double, z),
0026                       SOA_COLUMN(int32_t, id),
0027                       // scalars: one value for the whole structure
0028                       SOA_SCALAR(double, r),
0029                       // column of arrays: one fixed-size array per element
0030                       SOA_COLUMN(Array, flags),
0031                       // Eigen columns: each matrix element is stored in a separate column
0032                       SOA_EIGEN_COLUMN(Matrix, m))
0033 
0034   using TestSoA = TestSoALayout<>;
0035 
0036   GENERATE_SOA_LAYOUT(TestSoALayout2,
0037                       // columns: one value per element
0038                       SOA_COLUMN(double, x2),
0039                       SOA_COLUMN(double, y2),
0040                       SOA_COLUMN(double, z2),
0041                       SOA_COLUMN(int32_t, id2),
0042                       // scalars: one value for the whole structure
0043                       SOA_SCALAR(double, r2),
0044                       // Eigen columns
0045                       // the typedef is needed because commas confuse macros
0046                       SOA_EIGEN_COLUMN(Matrix, m2))
0047 
0048   using TestSoA2 = TestSoALayout2<>;
0049 
0050   GENERATE_SOA_LAYOUT(TestSoALayout3,
0051                       // columns: one value per element
0052                       SOA_COLUMN(double, x3),
0053                       SOA_COLUMN(double, y3),
0054                       SOA_COLUMN(double, z3),
0055                       SOA_COLUMN(int32_t, id3),
0056                       // scalars: one value for the whole structure
0057                       SOA_SCALAR(double, r3),
0058                       // Eigen columns
0059                       // the typedef is needed because commas confuse macros
0060                       SOA_EIGEN_COLUMN(Matrix, m3))
0061 
0062   using TestSoA3 = TestSoALayout3<>;
0063 
0064 }  // namespace portabletest
0065 
0066 #endif  // DataFormats_PortableTestObjects_interface_TestSoA_h