Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-12 23:30:06

0001 #ifndef RecoTracker_LSTCore_interface_Common_h
0002 #define RecoTracker_LSTCore_interface_Common_h
0003 
0004 #include "DataFormats/Common/interface/StdArray.h"
0005 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0006 
0007 #if defined(FP16_Base)
0008 #if defined ALPAKA_ACC_GPU_CUDA_ENABLED
0009 #include <cuda_fp16.h>
0010 #elif defined ALPAKA_ACC_GPU_HIP_ENABLED
0011 #include <hip/hip_fp16.h>
0012 #endif
0013 #endif
0014 
0015 namespace lst {
0016 
0017   // Named constants for pixelTypes
0018   enum PixelType : int8_t { kInvalid = -1, kHighPt = 0, kLowPtPosCurv = 1, kLowPtNegCurv = 2 };
0019 
0020   // Named types for LST objects
0021   enum LSTObjType { T5 = 4, pT3 = 5, pT5 = 7, pLS = 8 };
0022 
0023   constexpr unsigned int max_blocks = 80;
0024   constexpr unsigned int max_connected_modules = 40;
0025 
0026   constexpr unsigned int n_max_pixel_segments_per_module = 500000;
0027 
0028   constexpr unsigned int n_max_pixel_md_per_modules = 2 * n_max_pixel_segments_per_module;
0029 
0030   constexpr unsigned int n_max_pixel_triplets = 5000;
0031   constexpr unsigned int n_max_pixel_quintuplets = 15000;
0032 
0033   constexpr unsigned int n_max_pixel_track_candidates = 300000;
0034   constexpr unsigned int n_max_nonpixel_track_candidates = 10000;
0035 
0036   constexpr unsigned int size_superbins = 45000;
0037 
0038 // Half precision wrapper functions.
0039 #if defined(FP16_Base)
0040 #define __F2H __float2half
0041 #define __H2F __half2float
0042   typedef __half FPX;
0043 #else
0044 #define __F2H
0045 #define __H2F
0046   typedef float FPX;
0047 #endif
0048 
0049   // Defining the constant host device variables right up here
0050   // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4) and 4 hits. To be potentially handled better in the future.
0051   struct Params_Modules {
0052     using ArrayU16xMaxConnected = edm::StdArray<uint16_t, max_connected_modules>;
0053   };
0054   struct Params_pLS {
0055     static constexpr int kLayers = 2, kHits = 4;
0056     static constexpr int kEmbed = 6;
0057     using ArrayUxHits = edm::StdArray<unsigned int, kHits>;
0058     using ArrayFxEmbed = edm::StdArray<float, kEmbed>;
0059   };
0060   struct Params_LS {
0061     static constexpr int kLayers = 2, kHits = 4;
0062     using ArrayUxLayers = edm::StdArray<unsigned int, kLayers>;
0063   };
0064   struct Params_T3 {
0065     static constexpr int kLayers = 3, kHits = 6;
0066     using ArrayU8xLayers = edm::StdArray<uint8_t, kLayers>;
0067     using ArrayU16xLayers = edm::StdArray<uint16_t, kLayers>;
0068     using ArrayUxHits = edm::StdArray<unsigned int, kHits>;
0069   };
0070   struct Params_pT3 {
0071     static constexpr int kLayers = 5, kHits = 10;
0072     using ArrayU8xLayers = edm::StdArray<uint8_t, kLayers>;
0073     using ArrayU16xLayers = edm::StdArray<uint16_t, kLayers>;
0074     using ArrayUxHits = edm::StdArray<unsigned int, kHits>;
0075   };
0076   struct Params_T5 {
0077     static constexpr int kLayers = 5, kHits = 10;
0078     static constexpr int kEmbed = 6;
0079     using ArrayU8xLayers = edm::StdArray<uint8_t, kLayers>;
0080     using ArrayU16xLayers = edm::StdArray<uint16_t, kLayers>;
0081     using ArrayUxHits = edm::StdArray<unsigned int, kHits>;
0082     using ArrayFxEmbed = edm::StdArray<float, kEmbed>;
0083   };
0084   struct Params_pT5 {
0085     static constexpr int kLayers = 7, kHits = 14;
0086     using ArrayU8xLayers = edm::StdArray<uint8_t, kLayers>;
0087     using ArrayU16xLayers = edm::StdArray<uint16_t, kLayers>;
0088     using ArrayUxHits = edm::StdArray<unsigned int, kHits>;
0089   };
0090 
0091   using ArrayIx2 = edm::StdArray<int, 2>;
0092   using ArrayUx2 = edm::StdArray<unsigned int, 2>;
0093 
0094 }  //namespace lst
0095 
0096 #endif