From da70a360f0df060f9db253f4f5188fc010f1573d Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 10 Jun 2024 16:04:38 -0400 Subject: [PATCH 01/14] Move to 0.6 Maps + Add pT Runtime Toggle --- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 4 + .../LSTCore/interface/alpaka/Constants.h | 6 -- RecoTracker/LSTCore/interface/alpaka/LST.h | 4 +- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 21 +++-- RecoTracker/LSTCore/src/alpaka/Event.h | 7 +- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 13 +-- .../LSTCore/src/alpaka/LSTESData.dev.cc | 10 +-- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 30 ++++--- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 53 ++++++++---- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 86 +++++++++++-------- RecoTracker/LSTCore/src/alpaka/Segment.h | 30 ++++--- RecoTracker/LSTCore/src/alpaka/Triplet.h | 69 ++++++++------- RecoTracker/LSTCore/standalone/.gitignore | 1 + RecoTracker/LSTCore/standalone/Makefile | 17 ++-- RecoTracker/LSTCore/standalone/SDL/Makefile | 7 +- RecoTracker/LSTCore/standalone/bin/sdl.cc | 8 +- .../standalone/bin/sdl_make_tracklooper | 14 +-- .../standalone/code/core/AnalysisConfig.h | 3 + .../LSTCore/standalone/code/core/trkCore.cc | 8 +- 19 files changed, 230 insertions(+), 161 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 4aca0528539ef..28a49fceb6d4e 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -31,6 +31,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { consumes(config.getParameter("phase2OTHitsInput"))}, lstESToken_{esConsumes()}, verbose_(config.getParameter("verbose")), + ptCut_(config.getParameter("ptCut")), lstOutputToken_{produces()} {} void acquire(device::Event const& event, device::EventSetup const& setup) override { @@ -42,6 +43,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { lst_.run(event.queue(), verbose_, + ptCut_, &lstESDeviceData, pixelSeeds.px(), pixelSeeds.py(), @@ -77,6 +79,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { desc.add("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"}); desc.add("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"}); desc.add("verbose", 0); + desc.add("ptCut", 0.8); descriptions.addWithDefaultLabel(desc); } @@ -85,6 +88,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { edm::EDGetTokenT lstPhase2OTHitsInputToken_; device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; const int verbose_; + const float ptCut_; edm::EDPutTokenT lstOutputToken_; SDL::LST lst_; diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index d4f023631af1d..1262e86afcb00 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -99,11 +99,6 @@ namespace SDL { return WorkDiv(adjustedBlocks, adjustedThreads, elementsPerThreadArg); } -// If a compile time flag does not define PT_CUT, default to 0.8 (GeV) -#ifndef PT_CUT - constexpr float PT_CUT = 0.8f; -#endif - const unsigned int MAX_BLOCKS = 80; const unsigned int MAX_CONNECTED_MODULES = 40; @@ -129,7 +124,6 @@ namespace SDL { ALPAKA_STATIC_ACC_MEM_GLOBAL const float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2; ALPAKA_STATIC_ACC_MEM_GLOBAL const float kR1GeVf = 1. / (2.99792458e-3 * 3.8); ALPAKA_STATIC_ACC_MEM_GLOBAL const float sinAlphaMax = 0.95; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float ptCut = PT_CUT; ALPAKA_STATIC_ACC_MEM_GLOBAL const float deltaZLum = 15.0; ALPAKA_STATIC_ACC_MEM_GLOBAL const float pixelPSZpitch = 0.15; ALPAKA_STATIC_ACC_MEM_GLOBAL const float strip2SZpitch = 5.0; diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index 7d9d11745ab3c..b7a1d8be67456 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -28,6 +28,7 @@ namespace SDL { void run(QueueAcc& queue, bool verbose, + float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, @@ -72,7 +73,8 @@ namespace SDL { const std::vector ph2_detId, const std::vector ph2_x, const std::vector ph2_y, - const std::vector ph2_z); + const std::vector ph2_z, + const float ptCut); void getOutput(SDL::Event& event); std::vector getHitIdxs(const short trackCandidateType, diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index d539a02b80bf5..420f8ab5e97a0 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1,7 +1,8 @@ #include "Event.h" -void SDL::Event::init(bool verbose) { +void SDL::Event::init(bool verbose, float pt_cut) { addObjects = verbose; + ptCut = pt_cut; hitsInGPU = nullptr; mdsInGPU = nullptr; segmentsInGPU = nullptr; @@ -440,7 +441,8 @@ void SDL::Event::createMiniDoublets() { *modulesBuffers_->data(), *hitsInGPU, *mdsInGPU, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createMiniDoubletsInGPUv2Task); @@ -485,7 +487,8 @@ void SDL::Event::createSegmentsWithModuleMap() { *modulesBuffers_->data(), *mdsInGPU, *segmentsInGPU, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createSegmentsInGPUv2Task); @@ -593,7 +596,8 @@ void SDL::Event::createTriplets() { *tripletsInGPU, *rangesInGPU, alpaka::getPtrNative(index_gpu_buf), - nonZeroModules)); + nonZeroModules, + ptCut)); alpaka::enqueue(queue, createTripletsInGPUv2Task); @@ -871,7 +875,8 @@ void SDL::Event::createPixelTriplets() { *pixelTripletsInGPU, alpaka::getPtrNative(connectedPixelSize_dev_buf), alpaka::getPtrNative(connectedPixelIndex_dev_buf), - nInnerSegments)); + nInnerSegments, + ptCut)); alpaka::enqueue(queue, createPixelTripletsInGPUFromMapv2Task); alpaka::wait(queue); @@ -950,7 +955,8 @@ void SDL::Event::createQuintuplets() { *tripletsInGPU, *quintupletsInGPU, *rangesInGPU, - nEligibleT5Modules)); + nEligibleT5Modules, + ptCut)); alpaka::enqueue(queue, createQuintupletsInGPUv2Task); @@ -1101,7 +1107,8 @@ void SDL::Event::createPixelQuintuplets() { alpaka::getPtrNative(connectedPixelSize_dev_buf), alpaka::getPtrNative(connectedPixelIndex_dev_buf), nInnerSegments, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createPixelQuintupletsInGPUFromMapv2Task); diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 3d301c2c65069..5cbcc51d3fdfb 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -34,6 +34,7 @@ namespace SDL { Dev devAcc; DevHost devHost; bool addObjects; + float ptCut; std::array n_hits_by_layer_barrel_; std::array n_hits_by_layer_endcap_; @@ -81,7 +82,7 @@ namespace SDL { pixelTripletsBuffer* pixelTripletsInCPU; pixelQuintupletsBuffer* pixelQuintupletsInCPU; - void init(bool verbose); + void init(bool verbose, float pt_cut); int* superbinCPU; int8_t* pixelTypeCPU; @@ -97,7 +98,7 @@ namespace SDL { public: // Constructor used for CMSSW integration. Uses an external queue. template - Event(bool verbose, TQueue const& q, const LSTESDeviceData* deviceESData) + Event(bool verbose, float pt_cut, TQueue const& q, const LSTESDeviceData* deviceESData) : queue(q), devAcc(alpaka::getDev(q)), devHost(cms::alpakatools::host()), @@ -107,7 +108,7 @@ namespace SDL { modulesBuffers_(deviceESData->modulesBuffers), pixelMapping_(deviceESData->pixelMapping), endcapGeometry_(deviceESData->endcapGeometry) { - init(verbose); + init(verbose, pt_cut); } void resetEvent(); diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 9eb11503123df..af30057b10258 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -11,6 +11,7 @@ using XYZVector = ROOT::Math::XYZVector; void SDL::LST::run(SDL::QueueAcc& queue, bool verbose, + float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, @@ -31,7 +32,7 @@ void SDL::LST::run(SDL::QueueAcc& queue, const std::vector ph2_x, const std::vector ph2_y, const std::vector ph2_z) { - auto event = SDL::Event(verbose, queue, deviceESData); + auto event = SDL::Event(verbose, ptCut, queue, deviceESData); prepareInput(see_px, see_py, see_pz, @@ -50,7 +51,8 @@ void SDL::LST::run(SDL::QueueAcc& queue, ph2_detId, ph2_x, ph2_y, - ph2_z); + ph2_z, + ptCut); event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_); event.addPixelSegmentToEvent(in_hitIndices_vec0_, @@ -190,7 +192,8 @@ void SDL::LST::prepareInput(const std::vector see_px, const std::vector ph2_detId, const std::vector ph2_x, const std::vector ph2_y, - const std::vector ph2_z) { + const std::vector ph2_z, + const float ptCut) { unsigned int count = 0; auto n_see = see_stateTrajGlbPx.size(); std::vector px_vec; @@ -242,7 +245,7 @@ void SDL::LST::prepareInput(const std::vector see_px, float eta = p3LH.eta(); float ptErr = see_ptErr[iSeed]; - if ((ptIn > 0.8 - 2 * ptErr)) { + if ((ptIn > ptCut - 2 * ptErr)) { XYZVector r3LH(see_stateTrajGlbX[iSeed], see_stateTrajGlbY[iSeed], see_stateTrajGlbZ[iSeed]); XYZVector p3PCA(see_px[iSeed], see_py[iSeed], see_pz[iSeed]); XYZVector r3PCA(calculateR3FromPCA(p3PCA, see_dxy[iSeed], see_dz[iSeed])); @@ -258,7 +261,7 @@ void SDL::LST::prepareInput(const std::vector see_px, if (ptIn >= 2.0) pixtype = 0; - else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) { + else if (ptIn >= (ptCut - 2 * ptErr) and ptIn < 2.0) { if (pixelSegmentDeltaPhiChange >= 0) pixtype = 1; else diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 616c6f4bf3894..09fab534a5d7b 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -49,18 +49,18 @@ namespace { std::shared_ptr> moduleConnectionMap) { // Module orientation information (DrDz or phi angles) auto endcap_geom = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin"); + get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/endcap_orientation.bin"); auto tilted_geom = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.8/tilted_barrel_orientation.bin"); + trackLooperDir() + "/data/OT800_IT615_pt0.6/tilted_barrel_orientation.bin"); // Module connection map (for line segment building) auto mappath = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.8/module_connection_tracing_merged.bin"); + trackLooperDir() + "/data/OT800_IT615_pt0.6/module_connection_tracing_merged.bin"); endcapGeometry->load(endcap_geom); tiltedGeometry->load(tilted_geom); moduleConnectionMap->load(mappath); - auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.8/pixelmap/pLS_map"; + auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.6/pixelmap/pLS_map"; const std::array connects{ {"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"}}; std::string path; @@ -102,7 +102,7 @@ std::unique_ptr> SDL::loadAndFillESDevice(SDL::Qu auto moduleConnectionMap = hostData->moduleConnectionMap; auto path = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); + get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/sensor_centroids.bin"); SDL::loadModulesFromFile(queue, hostData->mapPLStoLayer.get(), path.c_str(), diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index aa63d51345a7f..aef55c8fb519c 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -341,6 +341,7 @@ namespace SDL { float rt, struct SDL::modules& modulesInGPU, uint16_t& moduleIndex, + float& ptCut, float dPhi = 0, float dz = 0) { // ================================================================= @@ -589,7 +590,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + float& ptCut) { if (modulesInGPU.subdets[lowerModuleIndex] == SDL::Barrel) { return runMiniDoubletDefaultAlgoBarrel(acc, modulesInGPU, @@ -613,7 +615,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); } else { return runMiniDoubletDefaultAlgoEndcap(acc, modulesInGPU, @@ -637,7 +640,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); } }; @@ -664,7 +668,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + float& ptCut) { bool pass = true; dz = zLower - zUpper; const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; @@ -679,8 +684,8 @@ namespace SDL { float miniCut = 0; miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel - ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex) - : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex); + ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut) + : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut); // Cut #2: dphi difference // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3085 @@ -798,7 +803,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + float& ptCut) { bool pass = true; // There are series of cuts that applies to mini-doublet in a "endcap" region @@ -875,8 +881,8 @@ namespace SDL { float miniCut = 0; miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel - ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, dPhi, dz) - : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, dPhi, dz); + ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz) + : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz); pass = pass && (alpaka::math::abs(acc, dPhi) < miniCut); if (not pass) @@ -899,7 +905,8 @@ namespace SDL { struct SDL::modules modulesInGPU, struct SDL::hits hitsInGPU, struct SDL::miniDoublets mdsInGPU, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -955,7 +962,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); if (success) { int totOccupancyMDs = alpaka::atomicOp(acc, &mdsInGPU.totOccupancyMDs[lowerModuleIndex], 1u); diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index bd048f9c819a2..27c1fb3ae98df 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -230,7 +230,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + float& ptCut) { zLo = -999; zHi = -999; rtLo = -999; @@ -278,7 +279,8 @@ namespace SDL { zHiPointed, sdlCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runTripletDefaultAlgoPPEE(acc, modulesInGPU, @@ -308,7 +310,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } return false; }; @@ -839,6 +842,7 @@ namespace SDL { float& rzChiSquared, float& rPhiChiSquared, float& rPhiChiSquaredInwards, + float& ptCut, bool runChiSquaredCuts = true) { bool pass = true; @@ -882,7 +886,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -914,7 +919,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; } @@ -1034,7 +1040,8 @@ namespace SDL { struct SDL::pixelTriplets pixelTripletsInGPU, unsigned int* connectedPixelSize, unsigned int* connectedPixelIndex, - unsigned int nPixelSegments) const { + unsigned int nPixelSegments, + float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -1111,7 +1118,8 @@ namespace SDL { centerY, rzChiSquared, rPhiChiSquared, - rPhiChiSquaredInwards); + rPhiChiSquaredInwards, + ptCut); if (success) { float phi = @@ -1288,7 +1296,8 @@ namespace SDL { float& zHiPointed, float& sdlCut, float& betaOutCut, - float& deltaBetaCut) // pixel to BB and BE segments + float& deltaBetaCut, + float& ptCut) // pixel to BB and BE segments { bool pass = true; @@ -1580,7 +1589,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) // pixel to EE segments + float& kZ, + float& ptCut) // pixel to EE segments { bool pass = true; bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2493,7 +2503,8 @@ namespace SDL { float& quintupletRadius, float& centerX, float& centerY, - unsigned int pixelSegmentArrayIndex) { + unsigned int pixelSegmentArrayIndex, + float& ptCut) { bool pass = true; unsigned int T5InnerT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex]; @@ -2518,6 +2529,7 @@ namespace SDL { rzChiSquaredTemp, rPhiChiSquaredTemp, rPhiChiSquaredInwardsTemp, + ptCut, false); if (not pass) return false; @@ -2557,9 +2569,15 @@ namespace SDL { mdsInGPU.anchorRt[fourthMDIndex], mdsInGPU.anchorRt[fifthMDIndex]}; - rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); + rzChiSquared = 0; + + //get the appropriate radii and centers + centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; + centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; + pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - if (/*pixelRadius*/ 0 < 5.0f * kR1GeVf) { // FIXME: pixelRadius is not defined yet + if (pixelRadius < 5.0f * kR1GeVf) { //only apply r-z chi2 cuts for <5GeV tracks + rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); pass = pass and passPT5RZChiSquaredCuts(modulesInGPU, lowerModuleIndex1, lowerModuleIndex2, @@ -2583,11 +2601,6 @@ namespace SDL { mdsInGPU.anchorY[fourthMDIndex], mdsInGPU.anchorY[fifthMDIndex]}; - //get the appropriate radii and centers - centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; - centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; - pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - float T5CenterX = quintupletsInGPU.regressionG[quintupletIndex]; float T5CenterY = quintupletsInGPU.regressionF[quintupletIndex]; quintupletRadius = quintupletsInGPU.regressionRadius[quintupletIndex]; @@ -2687,7 +2700,8 @@ namespace SDL { unsigned int* connectedPixelSize, unsigned int* connectedPixelIndex, unsigned int nPixelSegments, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -2741,7 +2755,8 @@ namespace SDL { quintupletRadius, centerX, centerY, - static_cast(i_pLS)); + static_cast(i_pLS), + ptCut); if (success) { unsigned int totOccupancyPixelQuintuplets = alpaka::atomicOp(acc, pixelQuintupletsInGPU.totOccupancyPixelQuintuplets, 1u); diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index cc17012019d6d..202e7aadbc530 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -1492,7 +1492,8 @@ namespace SDL { float& sdlCut, float& betaInCut, float& betaOutCut, - float& deltaBetaCut) { + float& deltaBetaCut, + float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -1507,7 +1508,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -1539,7 +1540,7 @@ namespace SDL { float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * alpaka::math::sqrt(acc, r3_InLo / rt_InLo); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; // will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? dzErr += sdlMuls * sdlMuls * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; //sloppy dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1547,7 +1548,7 @@ namespace SDL { const float dzMean = dz_InSeg / drt_InSeg * drt_OutLo_InLo; const float zWindow = dzErr / drt_InSeg * drt_OutLo_InLo + - (zpitch_InLo + zpitch_OutLo); //FIXME for SDL::ptCut lower than ~0.8 need to add curv path correction + (zpitch_InLo + zpitch_OutLo); //FIXME for ptCut lower than ~0.8 need to add curv path correction zLoPointed = z_InLo + dzMean * (z_InLo > 0.f ? 1.f : dzDrtScale) - zWindow; zHiPointed = z_InLo + dzMean * (z_InLo < 0.f ? 1.f : dzDrtScale) + zWindow; @@ -1652,11 +1653,11 @@ namespace SDL { (mdsInGPU.anchorX[secondMDIndex] - mdsInGPU.anchorX[firstMDIndex]) + (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex]) * (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex])); - betaInCut = alpaka::math::asin( - acc, - alpaka::math::min( - acc, (-rt_InSeg * corrF + drt_tl_axis) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / drt_InSeg); + betaInCut = + alpaka::math::asin( + acc, + alpaka::math::min(acc, (-rt_InSeg * corrF + drt_tl_axis) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / drt_InSeg); //Cut #5: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -1722,7 +1723,7 @@ namespace SDL { //FIXME: need faster version betaOutCut = - alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -1773,7 +1774,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -1787,7 +1789,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -1843,7 +1845,7 @@ namespace SDL { zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * alpaka::math::sqrt(acc, rIn / rt_InLo); - const float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? drtErr += sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls drtErr = alpaka::math::sqrt(acc, drtErr); @@ -1936,10 +1938,9 @@ namespace SDL { float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); const float corrF = 1.f; - betaInCut = - alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = alpaka::math::asin( + acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #6: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -2005,7 +2006,7 @@ namespace SDL { const float dBetaROut2 = dBetaROut * dBetaROut; //FIXME: need faster version - betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -2056,7 +2057,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -2071,7 +2073,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -2123,7 +2125,7 @@ namespace SDL { kZ = (z_OutLo - z_InLo) / dzSDIn; float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? float drtErr = alpaka::math::sqrt( acc, @@ -2215,10 +2217,9 @@ namespace SDL { float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); const float corrF = 1.f; - betaInCut = - alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = alpaka::math::asin( + acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #6: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -2272,7 +2273,7 @@ namespace SDL { float dBetaROut2 = 0; //TODO-RH //FIXME: need faster version - betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -2327,7 +2328,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + float& ptCut) { bool pass = false; zLo = -999; @@ -2374,7 +2376,8 @@ namespace SDL { sdlCut, betaInCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Barrel and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBEE(acc, @@ -2405,7 +2408,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Barrel and outerInnerLowerModuleSubdet == SDL::Barrel and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBBB(acc, @@ -2436,7 +2440,8 @@ namespace SDL { sdlCut, betaInCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Endcap and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBEE(acc, @@ -2467,7 +2472,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Endcap and innerOuterLowerModuleSubdet == SDL::Endcap and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoEEEE(acc, @@ -2498,7 +2504,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } return pass; @@ -2526,7 +2533,8 @@ namespace SDL { float& rzChiSquared, float& chiSquared, float& nonAnchorChiSquared, - bool& TightCutFlag) { + bool& TightCutFlag, + float& ptCut) { bool pass = true; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex]; unsigned int secondSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; @@ -2583,7 +2591,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -2618,7 +2627,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -2994,7 +3004,8 @@ namespace SDL { struct SDL::triplets tripletsInGPU, struct SDL::quintuplets quintupletsInGPU, struct SDL::objectRanges rangesInGPU, - uint16_t nEligibleT5Modules) const { + uint16_t nEligibleT5Modules, + float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -3049,7 +3060,8 @@ namespace SDL { rzChiSquared, chiSquared, nonAnchorChiSquared, - TightCutFlag); + TightCutFlag, + ptCut); if (success) { int totOccupancyQuintuplets = diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 61e91eef18a47..9b26d6265f981 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -276,7 +276,8 @@ namespace SDL { uint16_t& innerLowerModuleIndex, uint16_t& outerLowerModuleIndex, unsigned int& innerMDIndex, - unsigned int& outerMDIndex) { + unsigned int& outerMDIndex, + float& ptCut) { float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) ? miniMulsPtScaleBarrel[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut : miniMulsPtScaleEndcap[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut; @@ -477,7 +478,8 @@ namespace SDL { float& sdCut, float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, - float& dAlphaInnerMDOuterMDThreshold) { + float& dAlphaInnerMDOuterMDThreshold, + float& ptCut) { bool pass = true; float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) @@ -540,7 +542,8 @@ namespace SDL { innerLowerModuleIndex, outerLowerModuleIndex, innerMDIndex, - outerMDIndex); + outerMDIndex, + ptCut); float innerMDAlpha = mdsInGPU.dphichanges[innerMDIndex]; float outerMDAlpha = mdsInGPU.dphichanges[outerMDIndex]; @@ -589,7 +592,8 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - float& dAlphaInnerMDOuterMD) { + float& dAlphaInnerMDOuterMD, + float& ptCut) { bool pass = true; float xIn, yIn; @@ -680,7 +684,8 @@ namespace SDL { innerLowerModuleIndex, outerLowerModuleIndex, innerMDIndex, - outerMDIndex); + outerMDIndex, + ptCut); dAlphaInnerMDSegmentThreshold = dAlphaThresholdValues[0]; dAlphaOuterMDSegmentThreshold = dAlphaThresholdValues[1]; @@ -731,7 +736,8 @@ namespace SDL { float& sdCut, float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, - float& dAlphaInnerMDOuterMDThreshold) { + float& dAlphaInnerMDOuterMDThreshold, + float& ptCut) { zLo = -999.f; zHi = -999.f; rtLo = -999.f; @@ -764,7 +770,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); } else { return runSegmentDefaultAlgoEndcap(acc, modulesInGPU, @@ -791,7 +798,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); } }; @@ -801,7 +809,8 @@ namespace SDL { struct SDL::modules modulesInGPU, struct SDL::miniDoublets mdsInGPU, struct SDL::segments segmentsInGPU, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const blockThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -873,7 +882,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); if (pass) { unsigned int totOccupancySegments = alpaka::atomicOp( diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 1d21815ef2717..3986e67d1682d 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -312,7 +312,8 @@ namespace SDL { float& rtOut, unsigned int& innerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + float& ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -326,7 +327,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeVOut = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutIn = rtOut / rtIn; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = alpaka::math::tan(acc, alpha1GeVOut) / alpha1GeVOut; // The track can bend in r-z plane slightly @@ -349,22 +350,21 @@ namespace SDL { float drt_InSeg = rtMid - rtIn; float dz_InSeg = zMid - zIn; float dr3_InSeg = - alpaka::math::sqrt(acc, rtMid * rtMid + zMid * zMid) - alpaka::math::sqrt(acc, rtIn * rtIn + zIn + zIn); + alpaka::math::sqrt(acc, rtMid * rtMid + zMid * zMid) - alpaka::math::sqrt(acc, rtIn * rtIn + zIn * zIn); float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f; float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rtOut - rtIn) / 50.f) * alpaka::math::sqrt(acc, r3In / rtIn); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; // will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? dzErr += sdlMuls * sdlMuls * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; //sloppy dzErr = alpaka::math::sqrt(acc, dzErr); // Constructing upper and lower bound const float dzMean = dz_InSeg / drt_InSeg * drt_OutIn; - const float zWindow = - dzErr / drt_InSeg * drt_OutIn + - (zpitchIn + zpitchOut); //FIXME for SDL::ptCut lower than ~0.8 need to add curv path correction + const float zWindow = dzErr / drt_InSeg * drt_OutIn + + (zpitchIn + zpitchOut); //FIXME for ptCut lower than ~0.8 need to add curv path correction const float zLoPointed = zIn + dzMean * (zIn > 0.f ? 1.f : dzDrtScale) - zWindow; const float zHiPointed = zIn + dzMean * (zIn < 0.f ? 1.f : dzDrtScale) + zWindow; @@ -391,7 +391,7 @@ namespace SDL { (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex])); betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-rt_InSeg + drt_tl_axis) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + acc, alpaka::math::min(acc, (-rt_InSeg + drt_tl_axis) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / drt_InSeg); //Cut #3: first beta cut @@ -417,7 +417,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + float& ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -432,7 +433,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float dzDrtScale = alpaka::math::tan(acc, alpha1GeV_OutLo) / alpha1GeV_OutLo; // The track can bend in r-z plane slightly @@ -480,7 +481,7 @@ namespace SDL { zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2 * (rtOut - rtIn) / 50.f) * alpaka::math::sqrt(acc, rIn / rtIn); - const float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? drtErr += sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls drtErr = alpaka::math::sqrt(acc, drtErr); @@ -518,9 +519,9 @@ namespace SDL { float sdIn_d = rt_InOut - rt_InLo; float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); - betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = + alpaka::math::asin(acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #4: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -543,7 +544,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + float& ptCut) { bool pass = true; float rtIn = mdsInGPU.anchorRt[firstMDIndex]; @@ -555,7 +557,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_Out = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float dzDrtScale = alpaka::math::tan(acc, alpha1GeV_Out) / alpha1GeV_Out; // The track can bend in r-z plane slightly @@ -596,7 +598,7 @@ namespace SDL { float kZ = (zOut - zIn) / dzSDIn; float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rtOut - rtIn) / 50.f); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? float drtErr = alpaka::math::sqrt( acc, @@ -645,9 +647,9 @@ namespace SDL { float sdIn_d = rt_InOut - rt_InLo; float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); - betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = + alpaka::math::asin(acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #4: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -671,7 +673,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + float& ptCut) { short innerInnerLowerModuleSubdet = modulesInGPU.subdets[innerInnerLowerModuleIndex]; short middleLowerModuleSubdet = modulesInGPU.subdets[middleLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; @@ -692,7 +695,8 @@ namespace SDL { rtOut, innerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and middleLowerModuleSubdet == SDL::Barrel and outerOuterLowerModuleSubdet == SDL::Endcap) { return passPointingConstraintBBE(acc, @@ -711,7 +715,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and middleLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return passPointingConstraintBBE(acc, @@ -730,7 +735,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } @@ -751,7 +757,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } return false; // failsafe }; @@ -816,7 +823,8 @@ namespace SDL { float& zLoPointed, float& zHiPointed, float& sdlCut, - float& betaInCut) { + float& betaInCut, + float& ptCut) { bool pass = true; //this cut reduces the number of candidates by a factor of 4, i.e., 3 out of 4 warps can end right here! if (segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1] != segmentsInGPU.mdIndices[2 * outerSegmentIndex]) @@ -854,7 +862,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut)); + betaInCut, + ptCut)); if (not pass) return pass; @@ -878,7 +887,8 @@ namespace SDL { struct SDL::triplets tripletsInGPU, struct SDL::objectRanges rangesInGPU, uint16_t* index_gpu, - uint16_t nonZeroModules) const { + uint16_t nonZeroModules, + float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -936,7 +946,8 @@ namespace SDL { zLoPointed, zHiPointed, sdlCut, - betaInCut); + betaInCut, + ptCut); if (success) { unsigned int totOccupancyTriplets = alpaka::atomicOp( diff --git a/RecoTracker/LSTCore/standalone/.gitignore b/RecoTracker/LSTCore/standalone/.gitignore index aae6f2984e8cc..6411d674967ac 100644 --- a/RecoTracker/LSTCore/standalone/.gitignore +++ b/RecoTracker/LSTCore/standalone/.gitignore @@ -9,6 +9,7 @@ plots_*/ scripts/moduleconnection*.txt *.root .make.log* +performance* bin/doAnalysis bin/sdl bin/sdl_cuda diff --git a/RecoTracker/LSTCore/standalone/Makefile b/RecoTracker/LSTCore/standalone/Makefile index 5fe8f4c6dcfcd..ac5ad326fb748 100644 --- a/RecoTracker/LSTCore/standalone/Makefile +++ b/RecoTracker/LSTCore/standalone/Makefile @@ -9,8 +9,8 @@ OBJECTS_ROCM=$(SOURCES:.cc=_rocm.o) OBJECTS=$(OBJECTS_CPU) $(OBJECTS_CUDA) $(OBJECTS_ROCM) CXX = g++ -CXXFLAGS = -g -O2 -Wall -fPIC -Wshadow -Woverloaded-virtual -Wno-unused-function -fno-var-tracking -std=c++17 -DLST_IS_CMSSW_PACKAGE -INCLUDEFLAGS= -ISDL -I$(shell pwd) -Icode -Icode/core -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include $(shell rooutil-config --include) -I$(shell root-config --incdir) -I${TRACKLOOPERDIR}/../../../ -I${CMSSW_BASE}/src -I../interface/alpaka/ -I../src/alpaka/ +CXXFLAGS = -g -O2 -Wall -fPIC -Wshadow -Woverloaded-virtual -Wno-unused-function -fno-var-tracking -std=c++17 +INCLUDEFLAGS= -ISDL -I$(shell pwd) -Icode -Icode/core -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include $(shell rooutil-config --include) -I$(shell root-config --incdir) -I${CMSSW_BASE}/src ifdef CMSSW_RELEASE_BASE INCLUDEFLAGS:= ${INCLUDEFLAGS} -I${CMSSW_RELEASE_BASE}/src endif @@ -25,7 +25,6 @@ ALPAKA_CUDA = -DALPAKA_ACC_GPU_CUDA_ENABLED -DALPAKA_HOST_ONLY ALPAKA_ROCM = -DALPAKA_ACC_GPU_HIP_ENABLED -DALPAKA_HOST_ONLY -DALPAKA_DISABLE_VENDOR_RNG -D__HIP_PLATFORM_HCC__ -D__HIP_PLATFORM_AMD__ EXTRAFLAGS = -ITMultiDrawTreePlayer -Wunused-variable -lTMVA -lEG -lGenVector -lXMLIO -lMLP -lTreePlayer -fopenmp DOQUINTUPLET = -PTCUTFLAG = CUTVALUEFLAG = CUTVALUEFLAG_FLAGS = -DCUT_VALUE_DEBUG @@ -47,20 +46,20 @@ cutvalue_primitive: rooutil efficiency $(EXES) bin/sdl_cpu: SDLLIB=-lsdl_cpu bin/sdl_cpu: bin/sdl_cpu.o $(OBJECTS_CPU) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) -o $@ bin/sdl_cuda: SDLLIB=-lsdl_cuda bin/sdl_cuda: bin/sdl_cuda.o $(OBJECTS_CUDA) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(LDFLAGS_CUDA) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(LDFLAGS_CUDA) -o $@ bin/sdl_rocm: SDLLIB=-lsdl_rocm bin/sdl_rocm: bin/sdl_rocm.o $(OBJECTS_ROCM) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(LDFLAGS_ROCM) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(LDFLAGS_ROCM) -o $@ %_cpu.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) $< -c -o $@ %_cuda.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(CUDAINCLUDE) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(CUDAINCLUDE) $< -c -o $@ %_rocm.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(ROCMINCLUDE) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(ROCMINCLUDE) $< -c -o $@ rooutil: $(MAKE) -C code/rooutil/ diff --git a/RecoTracker/LSTCore/standalone/SDL/Makefile b/RecoTracker/LSTCore/standalone/SDL/Makefile index 688e868d1b999..0c9ccb2907c05 100644 --- a/RecoTracker/LSTCore/standalone/SDL/Makefile +++ b/RecoTracker/LSTCore/standalone/SDL/Makefile @@ -59,7 +59,6 @@ ROOTCFLAGS = -pthread -m64 $(ROOTINCLUDE) PRINTFLAG = -DT4FromT3 DUPLICATES = -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 #-DFP16_Base CACHEFLAG = -PTCUTFLAG = LSTWARNINGSFLAG = CMSSW_WERRORS_CPU = -Werror=pointer-arith -Werror=overlength-strings -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label \ -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing \ @@ -91,13 +90,13 @@ CUTVALUEFLAG = CUTVALUEFLAG_FLAGS = -DCUT_VALUE_DEBUG %_cpu.o: ../../src/alpaka/%.dev.cc - $(COMPILE_CMD_CPU) $(CXXFLAGS_CPU) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CPU) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CPU) $< -o $@ + $(COMPILE_CMD_CPU) $(CXXFLAGS_CPU) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CPU) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CPU) $< -o $@ %_cuda.o: ../../src/alpaka/%.dev.cc - $(COMPILE_CMD_CUDA) $(CXXFLAGS_CUDA) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CUDA) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CUDA) $< -o $@ + $(COMPILE_CMD_CUDA) $(CXXFLAGS_CUDA) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CUDA) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CUDA) $< -o $@ %_rocm.o: ../../src/alpaka/%.dev.cc - $(COMPILE_CMD_ROCM) $(CXXFLAGS_ROCM) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_ROCM) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_ROCM) $< -o $@ + $(COMPILE_CMD_ROCM) $(CXXFLAGS_ROCM) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_ROCM) $(T5CUTFLAGS) $(NOPLSDUPCLEANFLAG) $(TCPLSTRIPLETSFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_ROCM) $< -o $@ $(LIB_CPU): $(CCOBJECTS_CPU) $(LSTOBJECTS_CPU) $(LD_CPU) $(SOFLAGS_CPU) $^ -o $@ diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 3aed3e3c4d3b7..6c8f3f396cac9 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -50,6 +50,7 @@ int main(int argc, char **argv) { cxxopts::value()->default_value("trackingNtuple/tree"))( "o,output", "Output file name", cxxopts::value())( "N,nmatch", "N match for MTV-like matching", cxxopts::value()->default_value("9"))( + "p,ptCut", "Min pT Cut In GeV, Default is 0.8.", cxxopts::value()->default_value("0.8"))( "n,nevents", "N events to loop over", cxxopts::value()->default_value("-1"))( "x,event_index", "specific event index to process", cxxopts::value()->default_value("-1"))( "g,pdg_id", "The simhit pdgId match option (default = 0)", cxxopts::value()->default_value("0"))( @@ -141,6 +142,10 @@ int main(int argc, char **argv) { } } + //_______________________________________________________________________________ + // --ptCut + ana.ptCut = result["ptCut"].as(); + //_______________________________________________________________________________ // --nmatch ana.nmatch_threshold = result["nmatch"].as(); @@ -257,6 +262,7 @@ int main(int argc, char **argv) { std::cout << " ana.mode: " << ana.mode << std::endl; std::cout << " ana.streams: " << ana.streams << std::endl; std::cout << " ana.verbose: " << ana.verbose << std::endl; + std::cout << " ana.ptCut: " << ana.ptCut << std::endl; std::cout << " ana.nmatch_threshold: " << ana.nmatch_threshold << std::endl; std::cout << "=========================================================" << std::endl; @@ -373,7 +379,7 @@ void run_sdl() { full_timer.Start(); std::vector *> events; for (int s = 0; s < ana.streams; s++) { - SDL::Event *event = new SDL::Event(ana.verbose >= 2, queues[s], deviceESData.get()); + SDL::Event *event = new SDL::Event(ana.verbose >= 2, ana.ptCut, queues[s], deviceESData.get()); events.push_back(event); } float timeForEventCreation = full_timer.RealTime() * 1000; diff --git a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper index 6c34156550c50..1e95e85088b19 100755 --- a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper +++ b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper @@ -30,7 +30,6 @@ usage() echo " -G GPU (CUDA) backend (Compile for CUDA)" echo " -R ROCm backend (Compile for ROCm)" echo " -A All backends (Compile for all backends, including ROCm)" - echo " -P PT Cut Value (In GeV, Default is 0.8, Works only for standalone version of code)" echo " -w Warning mode (Print extra warning outputs)" echo " -2 no pLS duplicate cleaning (Don't perform the pLS duplicate cleaning step)" echo @@ -53,7 +52,6 @@ while getopts ":cxgsmdp3NCGRA2ehwP:" OPTION; do A) ALLBACKENDS=true;; 2) NOPLSDUPCLEAN=true;; w) PRINTWARNINGS=true;; - P) PTCUTVALUE=$OPTARG;; h) usage;; :) usage;; esac @@ -73,7 +71,6 @@ if [ -z ${ROCMBACKEND} ]; then ROCMBACKEND=false; fi if [ -z ${ALLBACKENDS} ]; then ALLBACKENDS=false; fi if [ -z ${NOPLSDUPCLEAN} ]; then NOPLSDUPCLEAN=false; fi if [ -z ${PRINTWARNINGS} ]; then PRINTWARNINGS=false; fi -if [ -z ${PTCUTVALUE} ]; then PTCUTVALUE=0.8; fi # Default to only CPU and CUDA backends if [ "${CPUBACKEND}" == false ] && [ "${CUDABACKEND}" == false ] && [ "${ROCMBACKEND}" == false ]; then @@ -114,7 +111,6 @@ echo " CUDABACKEND : ${CUDABACKEND}" | tee -a ${LOG} echo " ROCMBACKEND : ${ROCMBACKEND}" | tee -a ${LOG} echo " NOPLSDUPCLEAN : ${NOPLSDUPCLEAN}" | tee -a ${LOG} echo " PRINTWARNINGS : ${PRINTWARNINGS}" | tee -a ${LOG} -echo " PTCUTVALUE : ${PTCUTVALUE} GeV" | tee -a ${LOG} echo "" | tee -a ${LOG} echo " (cf. Run > sh $(basename $0) -h to see all options)" | tee -a ${LOG} echo "" | tee -a ${LOG} @@ -191,8 +187,6 @@ if $PRINTWARNINGS; then PRINTWARNINGSOPT="LSTWARNINGSFLAG=-DWarnings" fi -PTCUTOPT="PTCUTFLAG=-DPT_CUT=${PTCUTVALUE}" - ### ### ### Making Line Segment Tracking Library @@ -205,9 +199,9 @@ echo "-------------------------------------------------------------------------- echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 if $SHOWLOG; then - (cd SDL && make clean && make ${TCPLSTRIPLETSOPT} ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${NOPLSDUPCLEANOPT} ${PTCUTOPT} -j 32 ${MAKETARGET} && cd -) 2>&1 | tee -a ${LOG} + (cd SDL && make clean && make ${TCPLSTRIPLETSOPT} ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${NOPLSDUPCLEANOPT} -j 32 ${MAKETARGET} && cd -) 2>&1 | tee -a ${LOG} else - (cd SDL && make clean && make ${TCPLSTRIPLETSOPT} ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${NOPLSDUPCLEANOPT} ${PTCUTOPT} -j 32 ${MAKETARGET} && cd -) >> ${LOG} 2>&1 + (cd SDL && make clean && make ${TCPLSTRIPLETSOPT} ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${NOPLSDUPCLEANOPT} -j 32 ${MAKETARGET} && cd -) >> ${LOG} 2>&1 fi if ([[ "$BACKENDOPT" == *"all"* ]] || [[ "$BACKENDOPT" == *"cpu"* ]]) && [ ! -f SDL/libsdl_cpu.so ]; then @@ -242,9 +236,9 @@ echo "-------------------------------------------------------------------------- echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 if $SHOWLOG; then - make EXES="${EXES}" ${TRACKLOOPERTARGET} ${PTCUTOPT} -j 2>&1 | tee -a ${LOG} + make EXES="${EXES}" ${TRACKLOOPERTARGET} -j 2>&1 | tee -a ${LOG} else - make EXES="${EXES}" ${TRACKLOOPERTARGET} ${PTCUTOPT} -j >> ${LOG} 2>&1 + make EXES="${EXES}" ${TRACKLOOPERTARGET} -j >> ${LOG} 2>&1 fi if ([[ "$BACKENDOPT" == *"all"* ]] || [[ "$BACKENDOPT" == *"cpu"* ]]) && [ ! -f bin/sdl_cpu ]; then diff --git a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h index 9040b327ed011..6952b7d6fb83f 100644 --- a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h +++ b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h @@ -46,6 +46,9 @@ class AnalysisConfig { // pt binning options int ptbound_mode; + // pt Cut + float ptCut; + // pdg id of the particles to compute efficincies on int pdg_id; diff --git a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc index d33a0c28c08c7..9819ba5abaf05 100644 --- a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc +++ b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc @@ -693,7 +693,7 @@ void addInputsToLineSegmentTrackingPreLoad(std::vector> &out_ float eta = p3LH.Eta(); float ptErr = trk.see_ptErr()[iSeed]; - if ((ptIn > PT_CUT - 2 * ptErr)) { + if ((ptIn > ana.ptCut - 2 * ptErr)) { TVector3 r3LH(trk.see_stateTrajGlbX()[iSeed], trk.see_stateTrajGlbY()[iSeed], trk.see_stateTrajGlbZ()[iSeed]); TVector3 p3PCA(trk.see_px()[iSeed], trk.see_py()[iSeed], trk.see_pz()[iSeed]); TVector3 r3PCA(calculateR3FromPCA(p3PCA, trk.see_dxy()[iSeed], trk.see_dz()[iSeed])); @@ -715,7 +715,7 @@ void addInputsToLineSegmentTrackingPreLoad(std::vector> &out_ int pixtype = -1; if (ptIn >= 2.0) { /*ptbin = 1;*/ pixtype = 0; - } else if (ptIn >= (PT_CUT - 2 * ptErr) and ptIn < 2.0) { + } else if (ptIn >= (ana.ptCut - 2 * ptErr) and ptIn < 2.0) { // ptbin = 0; if (pixelSegmentDeltaPhiChange >= 0) { pixtype = 1; @@ -1193,7 +1193,7 @@ void writeMetaData() { float ptErr = trk.see_ptErr()[iSeed]; float eta = p3LH.Eta(); - if ((ptIn > 0.8 - 2 * ptErr)) { + if ((ptIn > ana.ptCut - 2 * ptErr)) { TVector3 r3LH(trk.see_stateTrajGlbX()[iSeed], trk.see_stateTrajGlbY()[iSeed], trk.see_stateTrajGlbZ()[iSeed]); TVector3 p3PCA(trk.see_px()[iSeed], trk.see_py()[iSeed], trk.see_pz()[iSeed]); TVector3 r3PCA(calculateR3FromPCA(p3PCA, trk.see_dxy()[iSeed], trk.see_dz()[iSeed])); @@ -1218,7 +1218,7 @@ void writeMetaData() { int pixtype = -1; if (ptIn >= 2.0) { /*ptbin = 1;*/ pixtype = 0; - } else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) { + } else if (ptIn >= (ana.ptCut - 2 * ptErr) and ptIn < 2.0) { // ptbin = 0; if (pixelSegmentDeltaPhiChange >= 0) { pixtype = 1; From 6873c97aa92115d4d363a815e6fa2fd90e08192a Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 10 Jun 2024 16:50:54 -0400 Subject: [PATCH 02/14] remove pt_cut flag + ptcut to float fix --- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 2 +- RecoTracker/LSTCore/BuildFile.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 28a49fceb6d4e..fcbc84521bf6c 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -31,7 +31,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { consumes(config.getParameter("phase2OTHitsInput"))}, lstESToken_{esConsumes()}, verbose_(config.getParameter("verbose")), - ptCut_(config.getParameter("ptCut")), + ptCut_(config.getParameter("ptCut")), lstOutputToken_{produces()} {} void acquire(device::Event const& event, device::EventSetup const& setup) override { diff --git a/RecoTracker/LSTCore/BuildFile.xml b/RecoTracker/LSTCore/BuildFile.xml index 69c03f883986e..c2fc513d4bff3 100644 --- a/RecoTracker/LSTCore/BuildFile.xml +++ b/RecoTracker/LSTCore/BuildFile.xml @@ -2,7 +2,7 @@ - + From 2a387f8720001749932f939ef57fc3dbcaa4527d Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 10 Jun 2024 17:34:38 -0400 Subject: [PATCH 03/14] makefile fix --- RecoTracker/LSTCore/standalone/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoTracker/LSTCore/standalone/Makefile b/RecoTracker/LSTCore/standalone/Makefile index ac5ad326fb748..ce0aae4afcc7a 100644 --- a/RecoTracker/LSTCore/standalone/Makefile +++ b/RecoTracker/LSTCore/standalone/Makefile @@ -9,8 +9,8 @@ OBJECTS_ROCM=$(SOURCES:.cc=_rocm.o) OBJECTS=$(OBJECTS_CPU) $(OBJECTS_CUDA) $(OBJECTS_ROCM) CXX = g++ -CXXFLAGS = -g -O2 -Wall -fPIC -Wshadow -Woverloaded-virtual -Wno-unused-function -fno-var-tracking -std=c++17 -INCLUDEFLAGS= -ISDL -I$(shell pwd) -Icode -Icode/core -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include $(shell rooutil-config --include) -I$(shell root-config --incdir) -I${CMSSW_BASE}/src +CXXFLAGS = -g -O2 -Wall -fPIC -Wshadow -Woverloaded-virtual -Wno-unused-function -fno-var-tracking -std=c++17 -DLST_IS_CMSSW_PACKAGE +INCLUDEFLAGS= -ISDL -I$(shell pwd) -Icode -Icode/core -I${ALPAKA_ROOT}/include -I/${BOOST_ROOT}/include $(shell rooutil-config --include) -I$(shell root-config --incdir) -I${TRACKLOOPERDIR}/../../../ -I${CMSSW_BASE}/src -I../interface/alpaka/ -I../src/alpaka/ ifdef CMSSW_RELEASE_BASE INCLUDEFLAGS:= ${INCLUDEFLAGS} -I${CMSSW_RELEASE_BASE}/src endif From 3527a424188b303f44361bba734b22396ee26ba9 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 10 Jun 2024 21:39:58 -0400 Subject: [PATCH 04/14] fix initialization order bug and float bug --- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 7b872351365a1..874283015f69e 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -31,7 +31,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { consumes(config.getParameter("phase2OTHitsInput"))}, lstESToken_{esConsumes()}, verbose_(config.getParameter("verbose")), - ptCut_(config.getParameter("ptCut")), + ptCut_(config.getParameter("ptCut")), nopLSDupClean_(config.getParameter("nopLSDupClean")), tcpLSTriplets_(config.getParameter("tcpLSTriplets")), lstOutputToken_{produces()} {} @@ -83,7 +83,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { desc.add("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"}); desc.add("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"}); desc.add("verbose", false); - desc.add("ptCut", 0.8); + desc.add("ptCut", 0.8); desc.add("nopLSDupClean", false); desc.add("tcpLSTriplets", false); descriptions.addWithDefaultLabel(desc); @@ -93,8 +93,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { edm::EDGetTokenT lstPixelSeedInputToken_; edm::EDGetTokenT lstPhase2OTHitsInputToken_; device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; - const bool verbose_, nopLSDupClean_, tcpLSTriplets_; - const float ptCut_; + const bool verbose_; + const double ptCut_; + const bool nopLSDupClean_; + const bool tcpLSTriplets_; edm::EDPutTokenT lstOutputToken_; SDL::LST lst_; From 2ed7b7cb9a01ee40780a063bbb74bbeff40dc20d Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Tue, 11 Jun 2024 15:25:38 -0400 Subject: [PATCH 05/14] throw error if pT cut < .6 GeV --- RecoTracker/LSTCore/standalone/bin/sdl.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index d75887adf34a3..1fe4265005bc2 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -147,6 +147,12 @@ int main(int argc, char **argv) { // --ptCut ana.ptCut = result["ptCut"].as(); + // Throw an error if pT cut is below 0.6 GeV + if (ana.ptCut < 0.6) { + std::cout << "ERROR: Minimum pT cut should not be below 0.6 GeV. You provided: " << ana.ptCut << " GeV" << std::endl; + exit(1); + } + //_______________________________________________________________________________ // --nmatch ana.nmatch_threshold = result["nmatch"].as(); From c3b821e5aac81545d42b63a33fbeb74097c20aa9 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Wed, 12 Jun 2024 09:31:55 -0400 Subject: [PATCH 06/14] fix Pix Triplet conflict --- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 27c1fb3ae98df..a261ce857db62 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -2569,15 +2569,9 @@ namespace SDL { mdsInGPU.anchorRt[fourthMDIndex], mdsInGPU.anchorRt[fifthMDIndex]}; - rzChiSquared = 0; + rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); - //get the appropriate radii and centers - centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; - centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; - pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - - if (pixelRadius < 5.0f * kR1GeVf) { //only apply r-z chi2 cuts for <5GeV tracks - rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); + if (/*pixelRadius*/ 0 < 5.0f * kR1GeVf) { // FIXME: pixelRadius is not defined yet pass = pass and passPT5RZChiSquaredCuts(modulesInGPU, lowerModuleIndex1, lowerModuleIndex2, @@ -2601,6 +2595,11 @@ namespace SDL { mdsInGPU.anchorY[fourthMDIndex], mdsInGPU.anchorY[fifthMDIndex]}; + //get the appropriate radii and centers + centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; + centerY = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; + pixelRadius = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; + float T5CenterX = quintupletsInGPU.regressionG[quintupletIndex]; float T5CenterY = quintupletsInGPU.regressionF[quintupletIndex]; quintupletRadius = quintupletsInGPU.regressionRadius[quintupletIndex]; From 54304f0ee7235aa45660853fec0f575cd7a2c8ca Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Wed, 12 Jun 2024 16:10:02 -0400 Subject: [PATCH 07/14] fix Triplet conflict + move all ptCut to const --- RecoTracker/LSTCore/interface/alpaka/LST.h | 2 +- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 3 +-- RecoTracker/LSTCore/src/alpaka/Event.h | 9 +++++---- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 2 +- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 10 +++++----- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 14 +++++++------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 12 ++++++------ RecoTracker/LSTCore/src/alpaka/Segment.h | 10 +++++----- RecoTracker/LSTCore/src/alpaka/Triplet.h | 14 +++++++------- RecoTracker/LSTCore/standalone/bin/sdl.cc | 5 +++-- 10 files changed, 41 insertions(+), 40 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index dcfab986574ef..62793db9a56b9 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -28,7 +28,7 @@ namespace SDL { void run(QueueAcc& queue, bool verbose, - float ptCut, + const float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 70a9b0f942fca..e4aaceaba8435 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1,8 +1,7 @@ #include "Event.h" -void SDL::Event::init(bool verbose, float pt_cut) { +void SDL::Event::init(bool verbose) { addObjects = verbose; - ptCut = pt_cut; hitsInGPU = nullptr; mdsInGPU = nullptr; segmentsInGPU = nullptr; diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index c195752c19354..147cc3e15cdeb 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -31,10 +31,10 @@ namespace SDL { class Event { private: QueueAcc queue; + const float ptCut; Dev devAcc; DevHost devHost; bool addObjects; - float ptCut; std::array n_hits_by_layer_barrel_; std::array n_hits_by_layer_endcap_; @@ -82,7 +82,7 @@ namespace SDL { pixelTripletsBuffer* pixelTripletsInCPU; pixelQuintupletsBuffer* pixelQuintupletsInCPU; - void init(bool verbose, float pt_cut); + void init(bool verbose); int* superbinCPU; int8_t* pixelTypeCPU; @@ -98,8 +98,9 @@ namespace SDL { public: // Constructor used for CMSSW integration. Uses an external queue. template - Event(bool verbose, float pt_cut, TQueue const& q, const LSTESDeviceData* deviceESData) + Event(bool verbose, const float pt_cut, TQueue const& q, const LSTESDeviceData* deviceESData) : queue(q), + ptCut(pt_cut), devAcc(alpaka::getDev(q)), devHost(cms::alpakatools::host()), nModules_(deviceESData->nModules), @@ -108,7 +109,7 @@ namespace SDL { modulesBuffers_(deviceESData->modulesBuffers), pixelMapping_(deviceESData->pixelMapping), endcapGeometry_(deviceESData->endcapGeometry) { - init(verbose, pt_cut); + init(verbose); } void resetEvent(); diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 43c5c4a650901..5f5a7f8c7d4a4 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -11,7 +11,7 @@ using XYZVector = ROOT::Math::XYZVector; void SDL::LST::run(SDL::QueueAcc& queue, bool verbose, - float ptCut, + const float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index aef55c8fb519c..1a736deb11a01 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -341,7 +341,7 @@ namespace SDL { float rt, struct SDL::modules& modulesInGPU, uint16_t& moduleIndex, - float& ptCut, + const float& ptCut, float dPhi = 0, float dz = 0) { // ================================================================= @@ -591,7 +591,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - float& ptCut) { + const float& ptCut) { if (modulesInGPU.subdets[lowerModuleIndex] == SDL::Barrel) { return runMiniDoubletDefaultAlgoBarrel(acc, modulesInGPU, @@ -669,7 +669,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - float& ptCut) { + const float& ptCut) { bool pass = true; dz = zLower - zUpper; const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; @@ -804,7 +804,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - float& ptCut) { + const float& ptCut) { bool pass = true; // There are series of cuts that applies to mini-doublet in a "endcap" region @@ -906,7 +906,7 @@ namespace SDL { struct SDL::hits hitsInGPU, struct SDL::miniDoublets mdsInGPU, struct SDL::objectRanges rangesInGPU, - float ptCut) const { + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index a261ce857db62..e6504d47fc537 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -231,7 +231,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - float& ptCut) { + const float& ptCut) { zLo = -999; zHi = -999; rtLo = -999; @@ -842,7 +842,7 @@ namespace SDL { float& rzChiSquared, float& rPhiChiSquared, float& rPhiChiSquaredInwards, - float& ptCut, + const float& ptCut, bool runChiSquaredCuts = true) { bool pass = true; @@ -1041,7 +1041,7 @@ namespace SDL { unsigned int* connectedPixelSize, unsigned int* connectedPixelIndex, unsigned int nPixelSegments, - float ptCut) const { + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -1297,7 +1297,7 @@ namespace SDL { float& sdlCut, float& betaOutCut, float& deltaBetaCut, - float& ptCut) // pixel to BB and BE segments + const float& ptCut) // pixel to BB and BE segments { bool pass = true; @@ -1590,7 +1590,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - float& ptCut) // pixel to EE segments + const float& ptCut) // pixel to EE segments { bool pass = true; bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2504,7 +2504,7 @@ namespace SDL { float& centerX, float& centerY, unsigned int pixelSegmentArrayIndex, - float& ptCut) { + const float& ptCut) { bool pass = true; unsigned int T5InnerT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex]; @@ -2700,7 +2700,7 @@ namespace SDL { unsigned int* connectedPixelIndex, unsigned int nPixelSegments, struct SDL::objectRanges rangesInGPU, - float ptCut) const { + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 202e7aadbc530..2eaae035edf6e 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -1493,7 +1493,7 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& ptCut) { + const float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -1775,7 +1775,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - float& ptCut) { + const float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2058,7 +2058,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - float& ptCut) { + const float& ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -2329,7 +2329,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - float& ptCut) { + const float& ptCut) { bool pass = false; zLo = -999; @@ -2534,7 +2534,7 @@ namespace SDL { float& chiSquared, float& nonAnchorChiSquared, bool& TightCutFlag, - float& ptCut) { + const float& ptCut) { bool pass = true; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex]; unsigned int secondSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; @@ -3005,7 +3005,7 @@ namespace SDL { struct SDL::quintuplets quintupletsInGPU, struct SDL::objectRanges rangesInGPU, uint16_t nEligibleT5Modules, - float ptCut) const { + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 9b26d6265f981..eafd51f1c66a2 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -277,7 +277,7 @@ namespace SDL { uint16_t& outerLowerModuleIndex, unsigned int& innerMDIndex, unsigned int& outerMDIndex, - float& ptCut) { + const float& ptCut) { float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) ? miniMulsPtScaleBarrel[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut : miniMulsPtScaleEndcap[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut; @@ -479,7 +479,7 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - float& ptCut) { + const float& ptCut) { bool pass = true; float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) @@ -593,7 +593,7 @@ namespace SDL { float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, float& dAlphaInnerMDOuterMD, - float& ptCut) { + const float& ptCut) { bool pass = true; float xIn, yIn; @@ -737,7 +737,7 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - float& ptCut) { + const float& ptCut) { zLo = -999.f; zHi = -999.f; rtLo = -999.f; @@ -810,7 +810,7 @@ namespace SDL { struct SDL::miniDoublets mdsInGPU, struct SDL::segments segmentsInGPU, struct SDL::objectRanges rangesInGPU, - float ptCut) const { + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const blockThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 3986e67d1682d..6f35dd4af91cc 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -313,7 +313,7 @@ namespace SDL { unsigned int& innerSegmentIndex, float& betaIn, float& betaInCut, - float& ptCut) { + const float& ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -350,7 +350,7 @@ namespace SDL { float drt_InSeg = rtMid - rtIn; float dz_InSeg = zMid - zIn; float dr3_InSeg = - alpaka::math::sqrt(acc, rtMid * rtMid + zMid * zMid) - alpaka::math::sqrt(acc, rtIn * rtIn + zIn * zIn); + alpaka::math::sqrt(acc, rtMid * rtMid + zMid * zMid) - alpaka::math::sqrt(acc, rtIn * rtIn + zIn + zIn); float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f; @@ -418,7 +418,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - float& ptCut) { + const float& ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -545,7 +545,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - float& ptCut) { + const float& ptCut) { bool pass = true; float rtIn = mdsInGPU.anchorRt[firstMDIndex]; @@ -674,7 +674,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - float& ptCut) { + const float& ptCut) { short innerInnerLowerModuleSubdet = modulesInGPU.subdets[innerInnerLowerModuleIndex]; short middleLowerModuleSubdet = modulesInGPU.subdets[middleLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; @@ -824,7 +824,7 @@ namespace SDL { float& zHiPointed, float& sdlCut, float& betaInCut, - float& ptCut) { + const float& ptCut) { bool pass = true; //this cut reduces the number of candidates by a factor of 4, i.e., 3 out of 4 warps can end right here! if (segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1] != segmentsInGPU.mdIndices[2 * outerSegmentIndex]) @@ -888,7 +888,7 @@ namespace SDL { struct SDL::objectRanges rangesInGPU, uint16_t* index_gpu, uint16_t nonZeroModules, - float ptCut) const { + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 1fe4265005bc2..410d2019493bb 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -50,7 +50,7 @@ int main(int argc, char **argv) { cxxopts::value()->default_value("trackingNtuple/tree"))( "o,output", "Output file name", cxxopts::value())( "N,nmatch", "N match for MTV-like matching", cxxopts::value()->default_value("9"))( - "p,ptCut", "Min pT Cut In GeV, Default is 0.8.", cxxopts::value()->default_value("0.8"))( + "p,ptCut", "Min pT cut In GeV", cxxopts::value()->default_value("0.8"))( "n,nevents", "N events to loop over", cxxopts::value()->default_value("-1"))( "x,event_index", "specific event index to process", cxxopts::value()->default_value("-1"))( "g,pdg_id", "The simhit pdgId match option", cxxopts::value()->default_value("0"))( @@ -149,7 +149,8 @@ int main(int argc, char **argv) { // Throw an error if pT cut is below 0.6 GeV if (ana.ptCut < 0.6) { - std::cout << "ERROR: Minimum pT cut should not be below 0.6 GeV. You provided: " << ana.ptCut << " GeV" << std::endl; + std::cout << "ERROR: Minimum pT cut should not be below 0.6 GeV. You provided: " << ana.ptCut << " GeV" + << std::endl; exit(1); } From 884ec938a0a9807e3d35c018757f8bb09e851f36 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Thu, 13 Jun 2024 14:17:46 -0400 Subject: [PATCH 08/14] static cast ptCut to float --- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 874283015f69e..677b0010c3117 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -45,7 +45,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { lst_.run(event.queue(), verbose_, - ptCut_, + static_cast(ptCut_), &lstESDeviceData, pixelSeeds.px(), pixelSeeds.py(), From bc4044f07fe5718980173291ab32e4474355238f Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 24 Jun 2024 09:53:29 -0400 Subject: [PATCH 09/14] move pt cut warning to Event.h --- RecoTracker/LSTCore/src/alpaka/Event.h | 4 ++++ RecoTracker/LSTCore/standalone/bin/sdl.cc | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 147cc3e15cdeb..26f1a977044b5 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -109,6 +109,10 @@ namespace SDL { modulesBuffers_(deviceESData->modulesBuffers), pixelMapping_(deviceESData->pixelMapping), endcapGeometry_(deviceESData->endcapGeometry) { + if (pt_cut < 0.6f) { + throw std::invalid_argument("Minimum pT cut must be at least 0.6 GeV. Provided value: " + + std::to_string(pt_cut)); + } init(verbose); } void resetEvent(); diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 410d2019493bb..bba3fb083dd15 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -147,13 +147,6 @@ int main(int argc, char **argv) { // --ptCut ana.ptCut = result["ptCut"].as(); - // Throw an error if pT cut is below 0.6 GeV - if (ana.ptCut < 0.6) { - std::cout << "ERROR: Minimum pT cut should not be below 0.6 GeV. You provided: " << ana.ptCut << " GeV" - << std::endl; - exit(1); - } - //_______________________________________________________________________________ // --nmatch ana.nmatch_threshold = result["nmatch"].as(); From 4febe1028b110abb18aea705f7bf150c41520172 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 24 Jun 2024 12:16:50 -0400 Subject: [PATCH 10/14] Add pt cut label to ES producer --- .../plugins/alpaka/LSTModulesDevESProducer.cc | 10 +++++-- .../LSTCore/interface/alpaka/LSTESData.h | 6 ++-- .../LSTCore/src/alpaka/LSTESData.dev.cc | 28 ++++++++++--------- RecoTracker/LSTCore/standalone/bin/sdl.cc | 6 ++-- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index e6b3c42b7ed10..323f1b4f28570 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -1,4 +1,5 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/EDMException.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h" @@ -25,9 +26,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { private: edm::ESGetToken, TrackerRecoGeometryRecord> lstESHostToken_; + std::string ptCutLabel_; }; - LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig) { + LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) + : ESProducer(iConfig), ptCutLabel_(iConfig.getParameter("ptCutLabel")) { setWhatProduced(this, &LSTModulesDevESProducer::produceHost); auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice); lstESHostToken_ = cc.consumes(); @@ -35,19 +38,20 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("ptCutLabel", "0.8"); descriptions.addWithDefaultLabel(desc); } std::unique_ptr> LSTModulesDevESProducer::produceHost( TrackerRecoGeometryRecord const& iRecord) { - return SDL::loadAndFillESHost(); + return SDL::loadAndFillESHost(ptCutLabel_); } std::unique_ptr> LSTModulesDevESProducer::produceDevice( device::Record const& iRecord) { auto const& lstESHostData = iRecord.get(lstESHostToken_); SDL::QueueAcc& queue = iRecord.queue(); - return SDL::loadAndFillESDevice(queue, &lstESHostData); + return SDL::loadAndFillESDevice(queue, &lstESHostData, ptCutLabel_); } } // namespace ALPAKA_ACCELERATOR_NAMESPACE diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 29ae19a5484e8..ac6797d0ebf95 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -76,8 +76,10 @@ namespace SDL { pixelMapping(pixelMappingIn) {} }; - std::unique_ptr> loadAndFillESHost(); - std::unique_ptr> loadAndFillESDevice(SDL::QueueAcc& queue, const LSTESHostData* hostData); + std::unique_ptr> loadAndFillESHost(std::string& ptCutLabel); + std::unique_ptr> loadAndFillESDevice(SDL::QueueAcc& queue, + const LSTESHostData* hostData, + std::string& ptCutLabel); } // namespace SDL diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 09fab534a5d7b..29e435508339b 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -46,21 +46,22 @@ namespace { void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer, std::shared_ptr> endcapGeometry, std::shared_ptr> tiltedGeometry, - std::shared_ptr> moduleConnectionMap) { + std::shared_ptr> moduleConnectionMap, + std::string& ptCutLabel) { // Module orientation information (DrDz or phi angles) - auto endcap_geom = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/endcap_orientation.bin"); - auto tilted_geom = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.6/tilted_barrel_orientation.bin"); + auto endcap_geom = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + + ptCutLabel + "/endcap_orientation.bin"); + auto tilted_geom = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + + ptCutLabel + "/tilted_barrel_orientation.bin"); // Module connection map (for line segment building) - auto mappath = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.6/module_connection_tracing_merged.bin"); + auto mappath = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + + "/module_connection_tracing_merged.bin"); endcapGeometry->load(endcap_geom); tiltedGeometry->load(tilted_geom); moduleConnectionMap->load(mappath); - auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.6/pixelmap/pLS_map"; + auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + "/pixelmap/pLS_map"; const std::array connects{ {"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"}}; std::string path; @@ -81,17 +82,18 @@ namespace { } } // namespace -std::unique_ptr> SDL::loadAndFillESHost() { +std::unique_ptr> SDL::loadAndFillESHost(std::string& ptCutLabel) { auto pLStoLayer = std::make_shared(); auto endcapGeometry = std::make_shared>(); auto tiltedGeometry = std::make_shared>(); auto moduleConnectionMap = std::make_shared>(); - ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); + ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap, ptCutLabel); return std::make_unique>(pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); } std::unique_ptr> SDL::loadAndFillESDevice(SDL::QueueAcc& queue, - const LSTESHostData* hostData) { + const LSTESHostData* hostData, + std::string& ptCutLabel) { SDL::Dev const& devAccIn = alpaka::getDev(queue); uint16_t nModules; uint16_t nLowerModules; @@ -101,8 +103,8 @@ std::unique_ptr> SDL::loadAndFillESDevice(SDL::Qu auto pixelMapping = std::make_shared(); auto moduleConnectionMap = hostData->moduleConnectionMap; - auto path = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/sensor_centroids.bin"); + auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + + "/sensor_centroids.bin"); SDL::loadModulesFromFile(queue, hostData->mapPLStoLayer.get(), path.c_str(), diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index bba3fb083dd15..1823d683be03c 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -311,8 +311,10 @@ void run_sdl() { // Load various maps used in the SDL reconstruction TStopwatch full_timer; full_timer.Start(); - auto hostESData = SDL::loadAndFillESHost(); - auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get()); + // Determine which maps to use based on given pt Cut for standalone. + std::string ptCutString = (ana.ptCut >= 0.8) ? "0.8" : "0.6"; + auto hostESData = SDL::loadAndFillESHost(ptCutString); + auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get(), ptCutString); float timeForMapLoading = full_timer.RealTime() * 1000; if (ana.do_write_ntuple) { From 959da5931a55392918d974ac385282fe20981233 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Mon, 24 Jun 2024 13:46:23 -0400 Subject: [PATCH 11/14] small formatting fixes --- RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc | 1 - RecoTracker/LSTCore/standalone/bin/sdl.cc | 2 +- RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index 323f1b4f28570..8d093257c0458 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -1,5 +1,4 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/EDMException.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h" #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h" diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 1823d683be03c..bdba8f9d5e44f 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -311,7 +311,7 @@ void run_sdl() { // Load various maps used in the SDL reconstruction TStopwatch full_timer; full_timer.Start(); - // Determine which maps to use based on given pt Cut for standalone. + // Determine which maps to use based on given pt cut for standalone. std::string ptCutString = (ana.ptCut >= 0.8) ? "0.8" : "0.6"; auto hostESData = SDL::loadAndFillESHost(ptCutString); auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get(), ptCutString); diff --git a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h index a6bc895b366ad..50ef9a1ff5a71 100644 --- a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h +++ b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h @@ -46,7 +46,7 @@ class AnalysisConfig { // pt binning options int ptbound_mode; - // pt Cut + // pt cut float ptCut; // pdg id of the particles to compute efficincies on From 0c5c484afd6215420e3486eed8a14ac67f597b34 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Wed, 26 Jun 2024 08:16:58 -0400 Subject: [PATCH 12/14] Add configurable pT cut label to LSTProducer --- RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc | 4 ++-- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 3 ++- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index 8d093257c0458..0c42d128d266b 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -30,8 +30,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig), ptCutLabel_(iConfig.getParameter("ptCutLabel")) { - setWhatProduced(this, &LSTModulesDevESProducer::produceHost); - auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice); + setWhatProduced(this, &LSTModulesDevESProducer::produceHost, ptCutLabel_); + auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice, ptCutLabel_); lstESHostToken_ = cc.consumes(); } diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 677b0010c3117..27be5e4b944cf 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -29,7 +29,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { : lstPixelSeedInputToken_{consumes(config.getParameter("pixelSeedInput"))}, lstPhase2OTHitsInputToken_{ consumes(config.getParameter("phase2OTHitsInput"))}, - lstESToken_{esConsumes()}, + lstESToken_{esConsumes(edm::ESInputTag("", config.getParameter("ptCutLabel")))}, verbose_(config.getParameter("verbose")), ptCut_(config.getParameter("ptCut")), nopLSDupClean_(config.getParameter("nopLSDupClean")), @@ -84,6 +84,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { desc.add("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"}); desc.add("verbose", false); desc.add("ptCut", 0.8); + desc.add("ptCutLabel", "0.8"); desc.add("nopLSDupClean", false); desc.add("tcpLSTriplets", false); descriptions.addWithDefaultLabel(desc); diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index bddd6bb0b755c..c48c47941e202 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -336,7 +336,7 @@ namespace SDL { float rt, struct SDL::modules& modulesInGPU, uint16_t& moduleIndex, - const float& ptCut, + const float ptCut, float dPhi = 0, float dz = 0) { // ================================================================= From c1ab78bee5f5812252a11ce1534eeeb056fb4b1a Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Wed, 26 Jun 2024 10:07:54 -0400 Subject: [PATCH 13/14] add cut label to consumes --- RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index 0c42d128d266b..8a594565a6139 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -32,7 +32,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { : ESProducer(iConfig), ptCutLabel_(iConfig.getParameter("ptCutLabel")) { setWhatProduced(this, &LSTModulesDevESProducer::produceHost, ptCutLabel_); auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice, ptCutLabel_); - lstESHostToken_ = cc.consumes(); + lstESHostToken_ = cc.consumes(edm::ESInputTag("", ptCutLabel_)); } void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { From 7f3fe16b8e38313ef9395eac6eb667aedebb3884 Mon Sep 17 00:00:00 2001 From: GNiendorf Date: Thu, 27 Jun 2024 11:42:08 -0400 Subject: [PATCH 14/14] pass ptCut by value --- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 6 +++--- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 10 +++++----- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 10 +++++----- RecoTracker/LSTCore/src/alpaka/Segment.h | 8 ++++---- RecoTracker/LSTCore/src/alpaka/Triplet.h | 10 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index c48c47941e202..c07ed9501b6cc 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -586,7 +586,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - const float& ptCut) { + const float ptCut) { if (modulesInGPU.subdets[lowerModuleIndex] == SDL::Barrel) { return runMiniDoubletDefaultAlgoBarrel(acc, modulesInGPU, @@ -664,7 +664,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - const float& ptCut) { + const float ptCut) { bool pass = true; dz = zLower - zUpper; const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; @@ -799,7 +799,7 @@ namespace SDL { float yUpper, float zUpper, float rtUpper, - const float& ptCut) { + const float ptCut) { bool pass = true; // There are series of cuts that applies to mini-doublet in a "endcap" region diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 3c37ffe84b777..feddb405bf53b 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -226,7 +226,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - const float& ptCut) { + const float ptCut) { zLo = -999; zHi = -999; rtLo = -999; @@ -836,7 +836,7 @@ namespace SDL { float& rzChiSquared, float& rPhiChiSquared, float& rPhiChiSquaredInwards, - const float& ptCut, + const float ptCut, bool runChiSquaredCuts = true) { bool pass = true; @@ -1291,7 +1291,7 @@ namespace SDL { float& sdlCut, float& betaOutCut, float& deltaBetaCut, - const float& ptCut) // pixel to BB and BE segments + const float ptCut) // pixel to BB and BE segments { bool pass = true; @@ -1584,7 +1584,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - const float& ptCut) // pixel to EE segments + const float ptCut) // pixel to EE segments { bool pass = true; bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2491,7 +2491,7 @@ namespace SDL { float& centerX, float& centerY, unsigned int pixelSegmentArrayIndex, - const float& ptCut) { + const float ptCut) { bool pass = true; unsigned int T5InnerT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex]; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index b4e6c4d2670f1..666e7fb93b6f9 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -1488,7 +1488,7 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - const float& ptCut) { + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -1770,7 +1770,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - const float& ptCut) { + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2053,7 +2053,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - const float& ptCut) { + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -2324,7 +2324,7 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ, - const float& ptCut) { + const float ptCut) { bool pass = false; zLo = -999; @@ -2529,7 +2529,7 @@ namespace SDL { float& chiSquared, float& nonAnchorChiSquared, bool& TightCutFlag, - const float& ptCut) { + const float ptCut) { bool pass = true; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex]; unsigned int secondSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 63ab584ac0acf..e40fa2e946ae1 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -272,7 +272,7 @@ namespace SDL { uint16_t& outerLowerModuleIndex, unsigned int& innerMDIndex, unsigned int& outerMDIndex, - const float& ptCut) { + const float ptCut) { float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) ? miniMulsPtScaleBarrel[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut : miniMulsPtScaleEndcap[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut; @@ -474,7 +474,7 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - const float& ptCut) { + const float ptCut) { bool pass = true; float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) @@ -588,7 +588,7 @@ namespace SDL { float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, float& dAlphaInnerMDOuterMD, - const float& ptCut) { + const float ptCut) { bool pass = true; float xIn, yIn; @@ -732,7 +732,7 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - const float& ptCut) { + const float ptCut) { zLo = -999.f; zHi = -999.f; rtLo = -999.f; diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 9fe2ee7339e09..36fe437b889a0 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -308,7 +308,7 @@ namespace SDL { unsigned int& innerSegmentIndex, float& betaIn, float& betaInCut, - const float& ptCut) { + const float ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -413,7 +413,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - const float& ptCut) { + const float ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -540,7 +540,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - const float& ptCut) { + const float ptCut) { bool pass = true; float rtIn = mdsInGPU.anchorRt[firstMDIndex]; @@ -669,7 +669,7 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut, - const float& ptCut) { + const float ptCut) { short innerInnerLowerModuleSubdet = modulesInGPU.subdets[innerInnerLowerModuleIndex]; short middleLowerModuleSubdet = modulesInGPU.subdets[middleLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; @@ -819,7 +819,7 @@ namespace SDL { float& zHiPointed, float& sdlCut, float& betaInCut, - const float& ptCut) { + const float ptCut) { bool pass = true; //this cut reduces the number of candidates by a factor of 4, i.e., 3 out of 4 warps can end right here! if (segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1] != segmentsInGPU.mdIndices[2 * outerSegmentIndex])