From a2ead18e5e219e0e4dd7612cb883f11dbfeb1bdb Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 29 Nov 2019 12:10:12 +0100 Subject: [PATCH] Apply code checks and code formatting --- .../interface/TrackingRecHit2DHeterogeneous.h | 4 ++-- DataFormats/Math/test/testAtan2.cpp | 4 +--- .../CUDAUtilities/interface/HistoContainer.h | 8 ++++---- .../plugins/PixelCPEFastESProducer.cc | 2 +- .../plugins/SiPixelRecHitSoAFromLegacy.cc | 2 +- .../SiPixelRecHits/src/PixelCPEFast.cc | 3 +-- .../PixelTriplets/plugins/CAConstants.h | 2 +- .../plugins/CAHitNtupletGeneratorKernelsImpl.h | 2 +- .../plugins/gpuPixelDoubletsAlgos.h | 16 ++++++++++------ 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h index 1b27558efe3ee..aa551f21b4aad 100644 --- a/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h +++ b/CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DHeterogeneous.h @@ -91,7 +91,7 @@ TrackingRecHit2DHeterogeneous::TrackingRecHit2DHeterogeneous(uint32_t nH (std::is_same::value) { cudautils::copyAsync(m_view, view, stream); } else { - m_view.reset(view.release()); + m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version } return; } @@ -138,7 +138,7 @@ TrackingRecHit2DHeterogeneous::TrackingRecHit2DHeterogeneous(uint32_t nH (std::is_same::value) { cudautils::copyAsync(m_view, view, stream); } else { - m_view.reset(view.release()); + m_view.reset(view.release()); // NOLINT: std::move() breaks CUDA version } } diff --git a/DataFormats/Math/test/testAtan2.cpp b/DataFormats/Math/test/testAtan2.cpp index ecb7dac1e5d0c..11c951fc2e06b 100644 --- a/DataFormats/Math/test/testAtan2.cpp +++ b/DataFormats/Math/test/testAtan2.cpp @@ -195,11 +195,9 @@ void testIntPhi() { } int main() { - constexpr float p2i = ((int)(std::numeric_limits::max()) + 1) / M_PI; constexpr float i2p = M_PI / ((int)(std::numeric_limits::max()) + 1); - std::cout << std::hexfloat << "p2i i2p " << p2i <<" "<< i2p << std::defaultfloat << std::endl; - + std::cout << std::hexfloat << "p2i i2p " << p2i << " " << i2p << std::defaultfloat << std::endl; std::cout << unsafe_atan2f<5>(0.f, 0.f) << " " << std::atan2(0., 0.) << std::endl; std::cout << unsafe_atan2f<5>(0.5f, 0.5f) << " " << std::atan2(0.5, 0.5) << std::endl; diff --git a/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h b/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h index ca7053740f6f7..6fbaced1858dd 100644 --- a/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h +++ b/HeterogeneousCore/CUDAUtilities/interface/HistoContainer.h @@ -57,7 +57,7 @@ namespace cudautils { inline void launchZero(Histo *__restrict__ h, cudaStream_t stream #ifndef __CUDACC__ - = 0 + = cudaStreamDefault #endif ) { uint32_t *off = (uint32_t *)((char *)(h) + offsetof(Histo, off)); @@ -72,12 +72,12 @@ namespace cudautils { inline void launchFinalize(Histo *__restrict__ h, uint8_t *__restrict__ ws #ifndef __CUDACC__ - = nullptr + = cudaStreamDefault #endif , cudaStream_t stream #ifndef __CUDACC__ - = 0 + = cudaStreamDefault #endif ) { #ifdef __CUDACC__ @@ -101,7 +101,7 @@ namespace cudautils { int nthreads, cudaStream_t stream #ifndef __CUDACC__ - = 0 + = cudaStreamDefault #endif ) { launchZero(h, stream); diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc index 96e4a568e2bf3..8b6cba9a9232b 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEFastESProducer.cc @@ -87,7 +87,7 @@ void PixelCPEFastESProducer::fillDescriptions(edm::ConfigurationDescriptions& de desc.add("LoadTemplatesFromDB", true); desc.add("UseErrorsFromTemplates", true); desc.add("EdgeClusterErrorX", 50.0); - desc.add("MagneticFieldRecord", edm::ESInputTag("","")); + desc.add("MagneticFieldRecord", edm::ESInputTag()); desc.add("useLAWidthFromDB", true); desc.add("TruncatePixelCharge", true); desc.add("ClusterProbComputationFlag", 0); diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc index f58d81faaeea1..7900cf8b2289a 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromLegacy.cc @@ -252,7 +252,7 @@ void SiPixelRecHitSoAFromLegacy::produce(edm::StreamID streamID, edm::Event& iEv output->hitsLayerStart()[i] = hitsModuleStart[cpeView.layerGeometry().layerStart[i]]; } cudautils::fillManyFromVector( - output->phiBinner(), nullptr, 10, output->iphi(), output->hitsLayerStart(), numberOfHits, 256, 0); + output->phiBinner(), nullptr, 10, output->iphi(), output->hitsLayerStart(), numberOfHits, 256, nullptr); // std::cout << "created HitSoa for " << numberOfClusters << " clusters in " << numberOfDetUnits << " Dets" << std::endl; iEvent.put(std::move(output)); diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc index 133afca6d3ddd..b652458811d45 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEFast.cc @@ -582,5 +582,4 @@ LocalError PixelCPEFast::localError(DetParam const& theDetParam, ClusterParam& t return LocalError(xerr_sq, 0, yerr_sq); } -void PixelCPEFast::fillPSetDescription(edm::ParameterSetDescription& desc) { -} +void PixelCPEFast::fillPSetDescription(edm::ParameterSetDescription& desc) {} diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h index 1170550032068..a9028edf98a6b 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAConstants.h @@ -34,7 +34,7 @@ namespace CAConstants { constexpr uint32_t maxCellsPerHit() { return 128 / 2; } #endif #else - constexpr uint32_t maxNumberOfDoublets() { return 2*1024 * 1024; } + constexpr uint32_t maxNumberOfDoublets() { return 2 * 1024 * 1024; } constexpr uint32_t maxCellsPerHit() { return 8 * 128; } #endif constexpr uint32_t maxNumOfActiveDoublets() { return maxNumberOfDoublets() / 4; } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h index c180ca25bfa61..6888e6725bc39 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletGeneratorKernelsImpl.h @@ -286,7 +286,7 @@ __global__ void kernel_find_ntuplets(GPUCACell::Hits const *__restrict__ hhp, GPUCACell::TmpTuple stack; stack.reset(); thisCell.find_ntuplets(hh, cells, *cellTracks, *foundNtuplets, *apc, quality, stack, minHitsPerNtuplet, pid < 3); - assert(stack.size() == 0); + assert(stack.empty()); // printf("in %d found quadruplets: %d\n", cellIndex, apc->get()); } } diff --git a/RecoPixelVertexing/PixelTriplets/plugins/gpuPixelDoubletsAlgos.h b/RecoPixelVertexing/PixelTriplets/plugins/gpuPixelDoubletsAlgos.h index ae722471e3ab7..8af3bd821c714 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/gpuPixelDoubletsAlgos.h +++ b/RecoPixelVertexing/PixelTriplets/plugins/gpuPixelDoubletsAlgos.h @@ -203,16 +203,20 @@ namespace gpuPixelDoubletsAlgos { auto mo = hh.detectorIndex(oi); if (mo > 2000) continue; // invalid - - if (doZ0Cut && z0cutoff(oi)) continue; + + if (doZ0Cut && z0cutoff(oi)) + continue; auto mop = hh.iphi(oi); uint16_t idphi = std::min(std::abs(int16_t(mop - mep)), std::abs(int16_t(mep - mop))); - if (idphi > iphicut) continue; + if (idphi > iphicut) + continue; + + if (doClusterCut && zsizeCut(oi)) + continue; + if (doPtCut && ptcut(oi, idphi)) + continue; - if (doClusterCut && zsizeCut(oi)) continue; - if (doPtCut && ptcut(oi, idphi)) continue; - auto ind = atomicAdd(nCells, 1); if (ind >= maxNumOfDoublets) { atomicSub(nCells, 1);