Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-24 02:22:16

0001 #ifndef RecoLocalTracker_SiPixelRecHits_PixelCPEFast_h
0002 #define RecoLocalTracker_SiPixelRecHits_PixelCPEFast_h
0003 
0004 #include <utility>
0005 
0006 #include "CondFormats/SiPixelTransient/interface/SiPixelGenError.h"
0007 #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
0008 #include "HeterogeneousCore/CUDACore/interface/ESProduct.h"
0009 #include "HeterogeneousCore/CUDAUtilities/interface/HostAllocator.h"
0010 #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericBase.h"
0011 #include "RecoLocalTracker/SiPixelRecHits/interface/pixelCPEforGPU.h"
0012 
0013 class MagneticField;
0014 class PixelCPEFast final : public PixelCPEGenericBase {
0015 public:
0016   PixelCPEFast(edm::ParameterSet const &conf,
0017                const MagneticField *,
0018                const TrackerGeometry &,
0019                const TrackerTopology &,
0020                const SiPixelLorentzAngle *,
0021                const SiPixelGenErrorDBObject *,
0022                const SiPixelLorentzAngle *);
0023 
0024   ~PixelCPEFast() override = default;
0025 
0026   static void fillPSetDescription(edm::ParameterSetDescription &desc);
0027 
0028   // The return value can only be used safely in kernels launched on
0029   // the same cudaStream, or after cudaStreamSynchronize.
0030   const pixelCPEforGPU::ParamsOnGPU *getGPUProductAsync(cudaStream_t cudaStream) const;
0031 
0032   pixelCPEforGPU::ParamsOnGPU const &getCPUProduct() const { return cpuData_; }
0033 
0034   bool isPhase2() const { return isPhase2_; };
0035 
0036 private:
0037   LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override;
0038   LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override;
0039 
0040   void errorFromTemplates(DetParam const &theDetParam, ClusterParamGeneric &theClusterParam, float qclus) const;
0041 
0042   //--- DB Error Parametrization object, new light templates
0043   std::vector<SiPixelGenErrorStore> thePixelGenError_;
0044 
0045   // allocate this with posix malloc to be compatible with the cpu workflow
0046   std::vector<pixelCPEforGPU::DetParams> detParamsGPU_;
0047   pixelCPEforGPU::CommonParams commonParamsGPU_;
0048   pixelCPEforGPU::LayerGeometry layerGeometry_;
0049   pixelCPEforGPU::AverageGeometry averageGeometry_;
0050   pixelCPEforGPU::ParamsOnGPU cpuData_;
0051 
0052   bool isPhase2_;
0053 
0054   struct GPUData {
0055     ~GPUData();
0056     // not needed if not used on CPU...
0057     pixelCPEforGPU::ParamsOnGPU paramsOnGPU_h;
0058     pixelCPEforGPU::ParamsOnGPU *paramsOnGPU_d = nullptr;  // copy of the above on the Device
0059   };
0060   cms::cuda::ESProduct<GPUData> gpuData_;
0061 
0062   void fillParamsForGpu();
0063 };
0064 
0065 #endif  // RecoLocalTracker_SiPixelRecHits_PixelCPEFast_h