Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:51

0001 #ifndef RecoLocalCalo_HcalRecProducers_src_DeclsForKernels_h
0002 #define RecoLocalCalo_HcalRecProducers_src_DeclsForKernels_h
0003 
0004 #include <functional>
0005 #include <optional>
0006 
0007 #include "CondFormats/HcalObjects/interface/HcalChannelStatus.h"
0008 #include "CUDADataFormats/HcalDigi/interface/DigiCollection.h"
0009 #include "CUDADataFormats/HcalRecHitSoA/interface/RecHitCollection.h"
0010 #include "CalibCalorimetry/HcalAlgos/interface/HcalTimeSlew.h"
0011 #include "CondFormats/HcalObjects/interface/HcalConvertedEffectivePedestalWidthsGPU.h"
0012 #include "CondFormats/HcalObjects/interface/HcalConvertedEffectivePedestalsGPU.h"
0013 #include "CondFormats/HcalObjects/interface/HcalGainWidthsGPU.h"
0014 #include "CondFormats/HcalObjects/interface/HcalGainsGPU.h"
0015 #include "CondFormats/HcalObjects/interface/HcalLUTCorrsGPU.h"
0016 #include "CondFormats/HcalObjects/interface/HcalQIECodersGPU.h"
0017 #include "CondFormats/HcalObjects/interface/HcalQIETypesGPU.h"
0018 #include "CondFormats/HcalObjects/interface/HcalRecoParamsGPU.h"
0019 #include "CondFormats/HcalObjects/interface/HcalRespCorrsGPU.h"
0020 #include "CondFormats/HcalObjects/interface/HcalSiPMCharacteristicsGPU.h"
0021 #include "CondFormats/HcalObjects/interface/HcalSiPMParametersGPU.h"
0022 #include "CondFormats/HcalObjects/interface/HcalTimeCorrsGPU.h"
0023 #include "CondFormats/HcalObjects/interface/HcalChannelQualityGPU.h"
0024 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0025 #include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h"
0026 #include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h"
0027 #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
0028 #include "HeterogeneousCore/CUDAUtilities/interface/host_unique_ptr.h"
0029 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalMahiPulseOffsetsGPU.h"
0030 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalRecoParamsWithPulseShapesGPU.h"
0031 
0032 namespace hcal {
0033   namespace reconstruction {
0034 
0035     struct ConditionsProducts {
0036       HcalGainWidthsGPU::Product const& gainWidths;
0037       HcalGainsGPU::Product const& gains;
0038       HcalLUTCorrsGPU::Product const& lutCorrs;
0039       HcalConvertedPedestalWidthsGPU::Product const& pedestalWidths;
0040       HcalConvertedEffectivePedestalWidthsGPU::Product const& effectivePedestalWidths;
0041       HcalConvertedPedestalsGPU::Product const& pedestals;
0042       HcalQIECodersGPU::Product const& qieCoders;
0043       HcalChannelQualityGPU::Product const& channelQuality;
0044       HcalRecoParamsWithPulseShapesGPU::Product const& recoParams;
0045       HcalRespCorrsGPU::Product const& respCorrs;
0046       HcalTimeCorrsGPU::Product const& timeCorrs;
0047       HcalQIETypesGPU::Product const& qieTypes;
0048       HcalSiPMParametersGPU::Product const& sipmParameters;
0049       HcalSiPMCharacteristicsGPU::Product const& sipmCharacteristics;
0050       HcalConvertedPedestalsGPU::Product const* convertedEffectivePedestals;
0051       HcalTopology const* topology;
0052       HcalDDDRecConstants const* recConstants;
0053       uint32_t offsetForHashes;
0054       HcalMahiPulseOffsetsGPU::Product const& pulseOffsets;
0055       std::vector<int, cms::cuda::HostAllocator<int>> const& pulseOffsetsHost;
0056     };
0057 
0058     struct ConfigParameters {
0059       uint32_t maxTimeSamples;
0060       uint32_t kprep1dChannelsPerBlock;
0061       int sipmQTSShift;
0062       int sipmQNTStoSum;
0063       int firstSampleShift;
0064       bool useEffectivePedestals;
0065 
0066       float meanTime;
0067       float timeSigmaSiPM, timeSigmaHPD;
0068       float ts4Thresh;
0069 
0070       std::array<uint32_t, 3> kernelMinimizeThreads;
0071 
0072       // FIXME:
0073       //   - add "getters" to HcalTimeSlew calib formats
0074       //   - add ES Producer to consume what is produced above not to replicate.
0075       //   which ones to use is hardcoded, therefore no need to send those to the device
0076       bool applyTimeSlew;
0077       float tzeroTimeSlew, slopeTimeSlew, tmaxTimeSlew;
0078     };
0079 
0080     struct OutputDataGPU {
0081       RecHitCollection<::calo::common::DevStoragePolicy> recHits;
0082 
0083       void allocate(ConfigParameters const& config, uint32_t size, cudaStream_t cudaStream) {
0084         recHits.energy = cms::cuda::make_device_unique<float[]>(size, cudaStream);
0085         recHits.chi2 = cms::cuda::make_device_unique<float[]>(size, cudaStream);
0086         recHits.energyM0 = cms::cuda::make_device_unique<float[]>(size, cudaStream);
0087         recHits.timeM0 = cms::cuda::make_device_unique<float[]>(size, cudaStream);
0088         recHits.did = cms::cuda::make_device_unique<uint32_t[]>(size, cudaStream);
0089       }
0090     };
0091 
0092     struct ScratchDataGPU {
0093       cms::cuda::device::unique_ptr<float[]> amplitudes, noiseTerms, electronicNoiseTerms, pulseMatrices,
0094           pulseMatricesM, pulseMatricesP;
0095       cms::cuda::device::unique_ptr<int8_t[]> soiSamples;
0096     };
0097 
0098     struct InputDataGPU {
0099       DigiCollection<Flavor1, ::calo::common::DevStoragePolicy> const& f01HEDigis;
0100       DigiCollection<Flavor5, ::calo::common::DevStoragePolicy> const& f5HBDigis;
0101       DigiCollection<Flavor3, ::calo::common::DevStoragePolicy> const& f3HBDigis;
0102     };
0103 
0104   }  // namespace reconstruction
0105 }  // namespace hcal
0106 
0107 #endif  // RecoLocalCalo_HcalRecProducers_src_DeclsForKernels_h