From 4747b417dae2c7ff210bf56c86687f65de8c5800 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Fri, 7 Jun 2024 16:53:38 -0700 Subject: [PATCH 01/18] Make compilation flags for duplicate cleaning and triplet pLSs into runtime flags (TrackLooper PR#408 + cmssw PR#31) --- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 14 ++++-- RecoTracker/LSTCore/interface/alpaka/LST.h | 4 +- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 49 ++++++++++--------- RecoTracker/LSTCore/src/alpaka/Event.h | 4 +- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 8 +-- .../LSTCore/src/alpaka/TrackCandidate.h | 9 ++-- RecoTracker/LSTCore/standalone/SDL/Makefile | 6 +-- RecoTracker/LSTCore/standalone/bin/sdl.cc | 23 +++++++-- RecoTracker/LSTCore/standalone/bin/sdl.h | 4 -- .../standalone/bin/sdl_make_tracklooper | 22 +-------- RecoTracker/LSTCore/standalone/bin/sdl_run | 8 ++- .../standalone/code/core/AnalysisConfig.h | 6 +++ .../LSTCore/standalone/code/core/trkCore.cc | 11 ++--- .../LSTCore/standalone/code/core/trkCore.h | 5 +- 14 files changed, 89 insertions(+), 84 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 4aca0528539ef..e9c9bc0883be4 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -30,7 +30,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { lstPhase2OTHitsInputToken_{ consumes(config.getParameter("phase2OTHitsInput"))}, lstESToken_{esConsumes()}, - verbose_(config.getParameter("verbose")), + verbose_(config.getParameter("verbose")), + nopLSDupClean_(config.getParameter("nopLSDupClean")), + tcpLSTriplets_(config.getParameter("tcpLSTriplets")), lstOutputToken_{produces()} {} void acquire(device::Event const& event, device::EventSetup const& setup) override { @@ -61,7 +63,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { phase2OTHits.detId(), phase2OTHits.x(), phase2OTHits.y(), - phase2OTHits.z()); + phase2OTHits.z(), + nopLSDupClean_, + tcpLSTriplets_); } void produce(device::Event& event, device::EventSetup const&) override { @@ -76,7 +80,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { edm::ParameterSetDescription desc; desc.add("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"}); desc.add("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"}); - desc.add("verbose", 0); + desc.add("verbose", false); + desc.add("nopLSDupClean", false); + desc.add("tcpLSTriplets", false); descriptions.addWithDefaultLabel(desc); } @@ -84,7 +90,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { edm::EDGetTokenT lstPixelSeedInputToken_; edm::EDGetTokenT lstPhase2OTHitsInputToken_; device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; - const int verbose_; + const bool verbose_, nopLSDupClean_, tcpLSTriplets_; edm::EDPutTokenT lstOutputToken_; SDL::LST lst_; diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index 7d9d11745ab3c..a95f9343daf89 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -47,7 +47,9 @@ 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, + bool no_pls_dupclean, + bool tc_pls_triplets); std::vector> hits() { return out_tc_hitIdxs_; } std::vector len() { return out_tc_len_; } std::vector seedIdx() { return out_tc_seedIdx_; } diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index d539a02b80bf5..785cd3e35be01 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -617,7 +617,7 @@ void SDL::Event::createTriplets() { } } -void SDL::Event::createTrackCandidates() { +void SDL::Event::createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets) { if (trackCandidatesInGPU == nullptr) { trackCandidatesInGPU = new SDL::trackCandidates(); trackCandidatesBuffers = new SDL::trackCandidatesBuffer( @@ -709,18 +709,18 @@ void SDL::Event::createTrackCandidates() { alpaka::enqueue(queue, addT5asTrackCandidateInGPUTask); -#ifndef NOPLSDUPCLEAN - Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); - Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); - WorkDiv const checkHitspLS_workDiv = - createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); + if (!no_pls_dupclean) { + Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); + Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); + WorkDiv const checkHitspLS_workDiv = + createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); - SDL::checkHitspLS checkHitspLS_kernel; - auto const checkHitspLSTask(alpaka::createTaskKernel( - checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, true)); + SDL::checkHitspLS checkHitspLS_kernel; + auto const checkHitspLSTask(alpaka::createTaskKernel( + checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, true)); - alpaka::enqueue(queue, checkHitspLSTask); -#endif + alpaka::enqueue(queue, checkHitspLSTask); + } Vec const threadsPerBlock_crossCleanpLS = createVec(1, 16, 32); Vec const blocksPerGrid_crossCleanpLS = createVec(1, 4, 20); @@ -751,7 +751,8 @@ void SDL::Event::createTrackCandidates() { addpLSasTrackCandidateInGPU_kernel, nLowerModules_, *trackCandidatesInGPU, - *segmentsInGPU)); + *segmentsInGPU, + tc_pls_triplets)); alpaka::enqueue(queue, addpLSasTrackCandidateInGPUTask); @@ -990,20 +991,20 @@ void SDL::Event::createQuintuplets() { } } -void SDL::Event::pixelLineSegmentCleaning() { -#ifndef NOPLSDUPCLEAN - Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); - Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); - WorkDiv const checkHitspLS_workDiv = - createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); +void SDL::Event::pixelLineSegmentCleaning(bool no_pls_dupclean) { + if (!no_pls_dupclean) { + Vec const threadsPerBlockCheckHitspLS = createVec(1, 16, 16); + Vec const blocksPerGridCheckHitspLS = createVec(1, MAX_BLOCKS * 4, MAX_BLOCKS / 4); + WorkDiv const checkHitspLS_workDiv = + createWorkDiv(blocksPerGridCheckHitspLS, threadsPerBlockCheckHitspLS, elementsPerThread); - SDL::checkHitspLS checkHitspLS_kernel; - auto const checkHitspLSTask(alpaka::createTaskKernel( - checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, false)); + SDL::checkHitspLS checkHitspLS_kernel; + auto const checkHitspLSTask(alpaka::createTaskKernel( + checkHitspLS_workDiv, checkHitspLS_kernel, *modulesBuffers_->data(), *segmentsInGPU, false)); - alpaka::enqueue(queue, checkHitspLSTask); - alpaka::wait(queue); -#endif + alpaka::enqueue(queue, checkHitspLSTask); + alpaka::wait(queue); + } } void SDL::Event::createPixelQuintuplets() { diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 3d301c2c65069..2b02efe6e5485 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -148,12 +148,12 @@ namespace SDL { void createTriplets(); void createPixelTracklets(); void createPixelTrackletsWithMap(); - void createTrackCandidates(); + void createTrackCandidates(bool no_pls_dupclean, bool tc_pls_triplets); void createExtendedTracks(); void createQuintuplets(); void createPixelTriplets(); void createPixelQuintuplets(); - void pixelLineSegmentCleaning(); + void pixelLineSegmentCleaning(bool no_pls_dupclean); unsigned int getNumberOfHits(); unsigned int getNumberOfHitsByLayer(unsigned int layer); diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 9eb11503123df..cf2e73c25b410 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -30,7 +30,9 @@ void SDL::LST::run(SDL::QueueAcc& queue, 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, + bool no_pls_dupclean, + bool tc_pls_triplets) { auto event = SDL::Event(verbose, queue, deviceESData); prepareInput(see_px, see_py, @@ -135,7 +137,7 @@ void SDL::LST::run(SDL::QueueAcc& queue, printf("# of Quintuplets produced endcap layer 5: %d\n", event.getNumberOfQuintupletsByLayerEndcap(4)); } - event.pixelLineSegmentCleaning(); + event.pixelLineSegmentCleaning(no_pls_dupclean); event.createPixelQuintuplets(); if (verbose) @@ -145,7 +147,7 @@ void SDL::LST::run(SDL::QueueAcc& queue, if (verbose) printf("# of Pixel T3s produced: %d\n", event.getNumberOfPixelTriplets()); - event.createTrackCandidates(); + event.createTrackCandidates(no_pls_dupclean, tc_pls_triplets); if (verbose) { printf("# of TrackCandidates produced: %d\n", event.getNumberOfTrackCandidates()); printf(" # of Pixel TrackCandidates produced: %d\n", event.getNumberOfPixelTrackCandidates()); diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index d65464944ab52..60cefedc751f9 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -491,18 +491,15 @@ namespace SDL { ALPAKA_FN_ACC void operator()(TAcc const& acc, uint16_t nLowerModules, struct SDL::trackCandidates trackCandidatesInGPU, - struct SDL::segments segmentsInGPU) const { + struct SDL::segments segmentsInGPU, + bool tc_pls_triplets) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); unsigned int nPixels = segmentsInGPU.nSegments[nLowerModules]; for (unsigned int pixelArrayIndex = globalThreadIdx[2]; pixelArrayIndex < nPixels; pixelArrayIndex += gridThreadExtent[2]) { -#ifdef TC_PLS_TRIPLETS - if (segmentsInGPU.isDup[pixelArrayIndex]) -#else - if ((!segmentsInGPU.isQuad[pixelArrayIndex]) || (segmentsInGPU.isDup[pixelArrayIndex])) -#endif + if ((tc_pls_triplets ? 0 : !segmentsInGPU.isQuad[pixelArrayIndex]) || (segmentsInGPU.isDup[pixelArrayIndex])) continue; unsigned int trackCandidateIdx = diff --git a/RecoTracker/LSTCore/standalone/SDL/Makefile b/RecoTracker/LSTCore/standalone/SDL/Makefile index 688e868d1b999..6160ec6c80136 100644 --- a/RecoTracker/LSTCore/standalone/SDL/Makefile +++ b/RecoTracker/LSTCore/standalone/SDL/Makefile @@ -91,13 +91,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) $(PTCUTFLAG) $(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) $(PTCUTFLAG) $(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) $(PTCUTFLAG) $(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..30fc128644ce6 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -52,18 +52,21 @@ int main(int argc, char **argv) { "N,nmatch", "N match for MTV-like matching", cxxopts::value()->default_value("9"))( "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"))( + "g,pdg_id", "The simhit pdgId match option", cxxopts::value()->default_value("0"))( "v,verbose", "Verbose mode (0: no print, 1: only final timing, 2: object multiplitcity", cxxopts::value()->default_value("0"))( "w,write_ntuple", "Write Ntuple", cxxopts::value()->default_value("1"))( - "s,streams", "Set number of streams (default=1)", cxxopts::value()->default_value("1"))( + "s,streams", "Set number of streams", cxxopts::value()->default_value("1"))( "d,debug", "Run debug job. i.e. overrides output option to 'debug.root' and 'recreate's the file.")( "l,lower_level", "write lower level objects ntuple results")("G,gnn_ntuple", "write gnn input variable ntuple")( "j,nsplit_jobs", "Enable splitting jobs by N blocks (--job_index must be set)", cxxopts::value())( "I,job_index", "job_index of split jobs (--nsplit_jobs must be set. index starts from 0. i.e. 0, 1, 2, 3, etc...)", - cxxopts::value())("h,help", "Print help"); + cxxopts::value())( + "3,tc_pls_triplets" , "Allow triplet pLSs in TC collection")( + "2,no_pls_dupclean" , "Disable pLS duplicate cleaning (both steps)")( + "h,help", "Print help"); auto result = options.parse(argc, argv); @@ -242,6 +245,14 @@ int main(int argc, char **argv) { ana.gnn_ntuple = false; } + //_______________________________________________________________________________ + // --tc_pls_triplets + ana.tc_pls_triplets = result["tc_pls_triplets"].as(); + + //_______________________________________________________________________________ + // --no_pls_dupclean + ana.no_pls_dupclean = result["no_pls_dupclean"].as(); + // Printing out the option settings overview std::cout << "=========================================================" << std::endl; std::cout << " Running for Acc = " << alpaka::getAccName() << std::endl; @@ -258,6 +269,8 @@ int main(int argc, char **argv) { std::cout << " ana.streams: " << ana.streams << std::endl; std::cout << " ana.verbose: " << ana.verbose << std::endl; std::cout << " ana.nmatch_threshold: " << ana.nmatch_threshold << std::endl; + std::cout << " ana.tc_pls_triplets: " << ana.tc_pls_triplets << std::endl; + std::cout << " ana.no_pls_dupclean: " << ana.no_pls_dupclean << std::endl; std::cout << "=========================================================" << std::endl; // Create the TChain that holds the TTree's of the baby ntuples @@ -430,10 +443,10 @@ void run_sdl() { timing_LS = runSegment(events.at(omp_get_thread_num())); timing_T3 = runT3(events.at(omp_get_thread_num())); timing_T5 = runQuintuplet(events.at(omp_get_thread_num())); - timing_pLS = runPixelLineSegment(events.at(omp_get_thread_num())); + timing_pLS = runPixelLineSegment(events.at(omp_get_thread_num()),ana.no_pls_dupclean); timing_pT5 = runPixelQuintuplet(events.at(omp_get_thread_num())); timing_pT3 = runpT3(events.at(omp_get_thread_num())); - timing_TC = runTrackCandidate(events.at(omp_get_thread_num())); + timing_TC = runTrackCandidate(events.at(omp_get_thread_num()),ana.no_pls_dupclean,ana.tc_pls_triplets); if (ana.verbose == 4) { #pragma omp critical diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.h b/RecoTracker/LSTCore/standalone/bin/sdl.h index 23be7ee4418cc..78545c3f55269 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.h +++ b/RecoTracker/LSTCore/standalone/bin/sdl.h @@ -14,10 +14,6 @@ #include "rooutil.h" #include "cxxopts.h" -#include "Event.h" // SDL::Event -#include "Module.h" // SDL::Module -#include "EndcapGeometry.h" // SDL::EndcapGeometr -#include "ModuleConnectionMap.h" // SDL::ModuleConnectionMap #include "Event.h" #include "LST.h" diff --git a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper index 6c34156550c50..ae4678ec18892 100755 --- a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper +++ b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper @@ -24,7 +24,6 @@ usage() echo " -m make clean binaries (Make clean binaries before remake. e.g. when header files changed in SDL/*.h)" echo " -d cut value ntuple (With extra variables in a debug ntuple file)" echo " -p primitive object ntuple (With extra variables related to primitive objects)" - echo " -3 TC pLS triplets (Allow triplet pLSs in TC collection)" echo " -N neural networks (Toggle LST neural networks)" echo " -C CPU serial backend (Compile for CPU)" echo " -G GPU (CUDA) backend (Compile for CUDA)" @@ -32,7 +31,6 @@ usage() 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 exit } @@ -45,13 +43,11 @@ while getopts ":cxgsmdp3NCGRA2ehwP:" OPTION; do m) MAKECLEANBINARIES=true;; d) MAKECUTVALUES=true;; p) PRIMITIVE=true;; - 3) TCPLSTRIPLETS=true;; N) DONTUSENN=true;; G) CUDABACKEND=true;; C) CPUBACKEND=true;; R) ROCMBACKEND=true;; A) ALLBACKENDS=true;; - 2) NOPLSDUPCLEAN=true;; w) PRINTWARNINGS=true;; P) PTCUTVALUE=$OPTARG;; h) usage;; @@ -65,13 +61,11 @@ if [ -z ${SHOWLOG} ]; then SHOWLOG=false; fi if [ -z ${MAKECLEANBINARIES} ]; then MAKECLEANBINARIES=false; fi if [ -z ${MAKECUTVALUES} ]; then MAKECUTVALUES=false; fi if [ -z ${PRIMITIVE} ]; then PRIMITIVE=false; fi -if [ -z ${TCPLSTRIPLETS} ]; then TCPLSTRIPLETS=false; fi if [ -z ${DONTUSENN} ]; then DONTUSENN=false; fi if [ -z ${CPUBACKEND} ]; then CPUBACKEND=false; fi if [ -z ${CUDABACKEND} ]; then CUDABACKEND=false; fi 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 @@ -107,12 +101,10 @@ echo " SHOWLOG : ${SHOWLOG}" | tee -a ${LOG} echo " MAKECLEANBINARIES : ${MAKECLEANBINARIES}" | tee -a ${LOG} echo " MAKECUTVALUES : ${MAKECUTVALUES}" | tee -a ${LOG} echo " PRIMITIVE : ${PRIMITIVE}" | tee -a ${LOG} -echo " TCPLSTRIPLETS : ${TCPLSTRIPLETS}" | tee -a ${LOG} echo " DONTUSENN : ${DONTUSENN}" | tee -a ${LOG} echo " CPUBACKEND : ${CPUBACKEND}" | tee -a ${LOG} 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} @@ -149,11 +141,6 @@ if $PRIMITIVE; then echo "debug : MAKETARGET=${MAKETARGET}" fi -TCPLSTRIPLETSOPT= -if $TCPLSTRIPLETS; then - TCPLSTRIPLETSOPT="TCPLSTRIPLETSFLAG=-DTC_PLS_TRIPLETS" -fi - T5CUTOPT= if $DONTUSENN; then T5CUTOPT="T5RZCHI2FLAG=-DUSE_RZCHI2 T5RPHICHI2FLAG=-DUSE_RPHICHI2" @@ -181,11 +168,6 @@ else fi fi -NOPLSDUPCLEANOPT= -if $NOPLSDUPCLEAN; then - NOPLSDUPCLEANOPT="NOPLSDUPCLEANFLAG=-DNOPLSDUPCLEAN" -fi - PRINTWARNINGSOPT= if $PRINTWARNINGS; then PRINTWARNINGSOPT="LSTWARNINGSFLAG=-DWarnings" @@ -205,9 +187,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 ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${PTCUTOPT} -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 ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${PTCUTOPT} -j 32 ${MAKETARGET} && cd -) >> ${LOG} 2>&1 fi if ([[ "$BACKENDOPT" == *"all"* ]] || [[ "$BACKENDOPT" == *"cpu"* ]]) && [ ! -f SDL/libsdl_cpu.so ]; then diff --git a/RecoTracker/LSTCore/standalone/bin/sdl_run b/RecoTracker/LSTCore/standalone/bin/sdl_run index 32a1cc6f62701..2ed9c20fb7949 100755 --- a/RecoTracker/LSTCore/standalone/bin/sdl_run +++ b/RecoTracker/LSTCore/standalone/bin/sdl_run @@ -25,6 +25,7 @@ usage() echo " -t tag for this run (Tag for this run)" echo " -d delete previous output (Delete the previous outputs and re-run)" echo " -b backend (Select a backend: cuda or cpu; default cuda)" + echo " -a arguments (Add command line arguments to the sdl command)" echo exit } @@ -32,13 +33,14 @@ usage() DELETE=false # Parsing command-line opts -while getopts ":f:s:n:t:b:dh" OPTION; do +while getopts ":f:s:n:t:b:a:dh" OPTION; do case $OPTION in f) FLAGS=${OPTARG};; s) SAMPLE=${OPTARG};; n) NEVENTS=${OPTARG};; t) TAG=${OPTARG};; b) BACKEND=${OPTARG};; + a) ARGUMENTS=${OPTARG};; d) DELETE=true;; h) usage;; :) usage;; @@ -51,6 +53,7 @@ if [ -z ${SAMPLE} ]; then usage; fi if [ -z ${NEVENTS} ]; then NEVENTS=-1; fi if [ -z ${TAG} ]; then usage; fi if [ -z ${BACKEND} ]; then BACKEND="default"; fi +if [ -z ${ARGUMENTS} ]; then ARGUMENTS=""; fi # Check that the FLAGS start with "-" character if [[ ${PRECOMPILED} == true ]] || [[ ${FLAGS:0:1} == "-" ]]; then @@ -85,6 +88,7 @@ echo " NEVENTS : ${NEVENTS}" echo " TAG : ${TAG}" echo " DELETE : ${DELETE}" echo " BACKEND : ${BACKEND}" +echo " ARGUMENTS : ${ARGUMENTS}" echo "" echo " (cf. Run > sh $(basename $0) -h to see all options)" echo "" @@ -162,7 +166,7 @@ else fi echo "Running LST code..." -sdl -i ${SAMPLE} -o ${LSTOUTPUTDIR}/${JOBTAG}__LSTNtuple.root -n ${NEVENTS} >> ${LSTOUTPUTDIR}/${JOBTAG}__LSTRun.log 2>&1 || { echo 'ERROR: sdl command failed!' ; exit 1; } +sdl -i ${SAMPLE} -o ${LSTOUTPUTDIR}/${JOBTAG}__LSTNtuple.root -n ${NEVENTS} ${ARGUMENTS} >> ${LSTOUTPUTDIR}/${JOBTAG}__LSTRun.log 2>&1 || { echo 'ERROR: sdl command failed!' ; exit 1; } echo "Creating performance histograms..." createPerfNumDenHists -i ${LSTOUTPUTDIR}/${JOBTAG}__LSTNtuple.root -o ${LSTOUTPUTDIR}/${JOBTAG}__LSTNumDen.root >> ${LSTOUTPUTDIR}/${JOBTAG}__LSTRun.log 2>&1 || { echo 'ERROR: createPerfNumDenHists command failed!' ; exit 1; } echo "Creating plots..." diff --git a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h index 9040b327ed011..14b3df631c6c8 100644 --- a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h +++ b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h @@ -122,6 +122,12 @@ class AnalysisConfig { // Path to the TrackLooper code directory TString full_cmd_line; + + // Boolean to allow pLS triplets to be included in the TCs + bool tc_pls_triplets; + + // Boolean to disable pLS duplicate cleaning + bool no_pls_dupclean; }; extern AnalysisConfig ana; diff --git a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc index d33a0c28c08c7..d16394cc06f98 100644 --- a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc +++ b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc @@ -165,9 +165,6 @@ float runpT3(SDL::Event *event) { return pt3_elapsed; } -//___________________________________________________________________________________________________________________________________________________________________________________________ -float runTrackCandidate(SDL::Event *event) { return runTrackCandidateTest_v2(event); } - //___________________________________________________________________________________________________________________________________________________________________________________________ float runQuintuplet(SDL::Event *event) { TStopwatch my_timer; @@ -214,12 +211,12 @@ float runQuintuplet(SDL::Event *event) { } //___________________________________________________________________________________________________________________________________________________________________________________________ -float runPixelLineSegment(SDL::Event *event) { +float runPixelLineSegment(SDL::Event *event, bool no_pls_dupclean) { TStopwatch my_timer; if (ana.verbose >= 2) std::cout << "Reco Pixel Line Segment start" << std::endl; my_timer.Start(); - event->pixelLineSegmentCleaning(); + event->pixelLineSegmentCleaning(no_pls_dupclean); float pls_elapsed = my_timer.RealTime(); if (ana.verbose >= 2) std::cout << "Reco Pixel Line Segment processing time: " << pls_elapsed << " secs" << std::endl; @@ -244,12 +241,12 @@ float runPixelQuintuplet(SDL::Event *event) { } //___________________________________________________________________________________________________________________________________________________________________________________________ -float runTrackCandidateTest_v2(SDL::Event *event) { +float runTrackCandidate(SDL::Event *event, bool no_pls_dupclean, bool tc_pls_triplets) { TStopwatch my_timer; if (ana.verbose >= 2) std::cout << "Reco TrackCandidate start" << std::endl; my_timer.Start(); - event->createTrackCandidates(); + event->createTrackCandidates(no_pls_dupclean, tc_pls_triplets); float tc_elapsed = my_timer.RealTime(); if (ana.verbose >= 2) std::cout << "Reco TrackCandidate processing time: " << tc_elapsed << " secs" << std::endl; diff --git a/RecoTracker/LSTCore/standalone/code/core/trkCore.h b/RecoTracker/LSTCore/standalone/code/core/trkCore.h index 73d006975be4a..a407f303cf1a6 100644 --- a/RecoTracker/LSTCore/standalone/code/core/trkCore.h +++ b/RecoTracker/LSTCore/standalone/code/core/trkCore.h @@ -20,11 +20,10 @@ float runT4(SDL::Event *event); float runT4x(SDL::Event *event); float runpT4(SDL::Event *event); float runT3(SDL::Event *event); -float runTrackCandidate(SDL::Event *event); -float runTrackCandidateTest_v2(SDL::Event *event); +float runTrackCandidate(SDL::Event *event, bool no_pls_dupclean, bool tc_pls_triplets); float runQuintuplet(SDL::Event *event); float runPixelQuintuplet(SDL::Event *event); -float runPixelLineSegment(SDL::Event *event); +float runPixelLineSegment(SDL::Event *event, bool no_pls_dupclean); float runpT3(SDL::Event *event); // --------------------- ======================== --------------------- From 0829926db96e0d74c17a57c1e5f6e2299138dc48 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Fri, 7 Jun 2024 18:36:46 -0700 Subject: [PATCH 02/18] Code checks and format --- RecoTracker/LSTCore/standalone/bin/sdl.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 30fc128644ce6..ce1b0f12461ed 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -63,10 +63,8 @@ int main(int argc, char **argv) { "j,nsplit_jobs", "Enable splitting jobs by N blocks (--job_index must be set)", cxxopts::value())( "I,job_index", "job_index of split jobs (--nsplit_jobs must be set. index starts from 0. i.e. 0, 1, 2, 3, etc...)", - cxxopts::value())( - "3,tc_pls_triplets" , "Allow triplet pLSs in TC collection")( - "2,no_pls_dupclean" , "Disable pLS duplicate cleaning (both steps)")( - "h,help", "Print help"); + cxxopts::value())("3,tc_pls_triplets", "Allow triplet pLSs in TC collection")( + "2,no_pls_dupclean", "Disable pLS duplicate cleaning (both steps)")("h,help", "Print help"); auto result = options.parse(argc, argv); @@ -443,10 +441,10 @@ void run_sdl() { timing_LS = runSegment(events.at(omp_get_thread_num())); timing_T3 = runT3(events.at(omp_get_thread_num())); timing_T5 = runQuintuplet(events.at(omp_get_thread_num())); - timing_pLS = runPixelLineSegment(events.at(omp_get_thread_num()),ana.no_pls_dupclean); + timing_pLS = runPixelLineSegment(events.at(omp_get_thread_num()), ana.no_pls_dupclean); timing_pT5 = runPixelQuintuplet(events.at(omp_get_thread_num())); timing_pT3 = runpT3(events.at(omp_get_thread_num())); - timing_TC = runTrackCandidate(events.at(omp_get_thread_num()),ana.no_pls_dupclean,ana.tc_pls_triplets); + timing_TC = runTrackCandidate(events.at(omp_get_thread_num()), ana.no_pls_dupclean, ana.tc_pls_triplets); if (ana.verbose == 4) { #pragma omp critical From f4bd702980596133915a66f4373b6567bc9fb94e Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Wed, 12 Jun 2024 06:28:40 -0700 Subject: [PATCH 03/18] Fix typo in T3 code --- RecoTracker/LSTCore/src/alpaka/Triplet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 1d21815ef2717..84fa04f77a4f0 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -349,7 +349,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; From dc13ac526b32b4c3ad1b391fb7b97511ce7802ea Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Fri, 14 Jun 2024 16:53:31 -0400 Subject: [PATCH 04/18] Removed LST_IS_CMSSW_PACKAGE flag --- RecoTracker/LSTCore/BuildFile.xml | 2 +- RecoTracker/LSTCore/interface/alpaka/LST.h | 5 ----- RecoTracker/LSTCore/interface/alpaka/LSTESData.h | 4 ---- RecoTracker/LSTCore/interface/alpaka/Module.h | 4 ---- RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h | 4 ---- RecoTracker/LSTCore/src/alpaka/Event.h | 6 ------ RecoTracker/LSTCore/src/alpaka/Hit.h | 5 ----- RecoTracker/LSTCore/src/alpaka/Kernels.h | 5 ----- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 4 ---- RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc | 4 ---- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 5 ----- RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h | 4 ---- RecoTracker/LSTCore/src/alpaka/ModuleMethods.h | 5 ----- RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h | 5 ----- RecoTracker/LSTCore/src/alpaka/PixelMap.h | 4 ---- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 10 ---------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 5 ----- RecoTracker/LSTCore/src/alpaka/Segment.h | 5 ----- RecoTracker/LSTCore/src/alpaka/TiltedGeometry.h | 4 ---- RecoTracker/LSTCore/src/alpaka/TrackCandidate.h | 5 ----- RecoTracker/LSTCore/src/alpaka/Triplet.h | 5 ----- RecoTracker/LSTCore/standalone/Makefile | 2 +- RecoTracker/LSTCore/standalone/SDL/Makefile | 2 +- 23 files changed, 3 insertions(+), 101 deletions(-) diff --git a/RecoTracker/LSTCore/BuildFile.xml b/RecoTracker/LSTCore/BuildFile.xml index 69c03f883986e..2aa254e0c0f6c 100644 --- a/RecoTracker/LSTCore/BuildFile.xml +++ b/RecoTracker/LSTCore/BuildFile.xml @@ -2,7 +2,7 @@ - + diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index a95f9343daf89..16f3e87361489 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -1,13 +1,8 @@ #ifndef LST_H #define LST_H -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h" -#else -#include "Constants.h" -#include "LSTESData.h" -#endif #include #include diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 29ae19a5484e8..12b39135766ba 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -1,11 +1,7 @@ #ifndef LSTESData_H #define LSTESData_H -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif #include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h" diff --git a/RecoTracker/LSTCore/interface/alpaka/Module.h b/RecoTracker/LSTCore/interface/alpaka/Module.h index 0a269eaa6e16a..145aca7604bd7 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Module.h +++ b/RecoTracker/LSTCore/interface/alpaka/Module.h @@ -3,11 +3,7 @@ #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif namespace SDL { enum SubDet { InnerPixel = 0, Barrel = 5, Endcap = 4 }; diff --git a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h index 93da945c00b33..8b343a70a9be8 100644 --- a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h +++ b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h @@ -9,11 +9,7 @@ #include #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif #include "HeterogeneousCore/AlpakaInterface/interface/host.h" diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 2b02efe6e5485..11f1fe6c68898 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -1,15 +1,9 @@ #ifndef Event_cuh #define Event_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" #include "RecoTracker/LSTCore/interface/alpaka/LST.h" -#else -#include "Constants.h" -#include "Module.h" -#include "LST.h" -#endif #include "Hit.h" #include "ModuleMethods.h" diff --git a/RecoTracker/LSTCore/src/alpaka/Hit.h b/RecoTracker/LSTCore/src/alpaka/Hit.h index dfe9c4c56ef95..beecee9763033 100644 --- a/RecoTracker/LSTCore/src/alpaka/Hit.h +++ b/RecoTracker/LSTCore/src/alpaka/Hit.h @@ -1,13 +1,8 @@ #ifndef Hit_cuh #define Hit_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif namespace SDL { struct hits { diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 334c8e1a9eb8a..4c8e1e2910ee8 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -1,13 +1,8 @@ #ifndef Kernels_cuh #define Kernels_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "Hit.h" #include "MiniDoublet.h" diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index cf2e73c25b410..47c2b9c6546be 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -1,8 +1,4 @@ -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/LST.h" -#else -#include "LST.h" -#endif #include "Event.h" diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 616c6f4bf3894..4bbcf27de877e 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -1,8 +1,4 @@ -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h" -#else -#include "LSTESData.h" -#endif #include "EndcapGeometry.h" #include "ModuleConnectionMap.h" diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index aa63d51345a7f..c91d6d825b618 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -1,13 +1,8 @@ #ifndef MiniDoublet_cuh #define MiniDoublet_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "EndcapGeometry.h" #include "Hit.h" diff --git a/RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h b/RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h index 45d629a74e00e..aea59aa5c4ff0 100644 --- a/RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h +++ b/RecoTracker/LSTCore/src/alpaka/ModuleConnectionMap.h @@ -8,11 +8,7 @@ #include #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif namespace SDL { //FIXME: move to non-alpaka single arch build diff --git a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h index dc0eb0fc1f3b8..d3d2fb1ae7fd7 100644 --- a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h +++ b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h @@ -4,13 +4,8 @@ #include #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "TiltedGeometry.h" #include "EndcapGeometry.h" diff --git a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h index a786e249eb664..7d7838f3752d4 100644 --- a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h +++ b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h @@ -1,13 +1,8 @@ #ifndef NeuralNetwork_cuh #define NeuralNetwork_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "NeuralNetworkWeights.h" #include "Segment.h" diff --git a/RecoTracker/LSTCore/src/alpaka/PixelMap.h b/RecoTracker/LSTCore/src/alpaka/PixelMap.h index d6cbdffebe096..f81e58860af90 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelMap.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelMap.h @@ -4,11 +4,7 @@ #include #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif namespace SDL { // PixelMap is never allocated on the device. diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index bd048f9c819a2..c3945238ce06f 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -1,13 +1,8 @@ #ifndef PixelTriplet_cuh #define PixelTriplet_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "Triplet.h" #include "Segment.h" @@ -1852,13 +1847,8 @@ namespace SDL { #ifndef PixelQuintuplet_cuh #define PixelQuintuplet_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "Segment.h" #include "MiniDoublet.h" diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index cc17012019d6d..e0bbb5c6adf9f 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -1,13 +1,8 @@ #ifndef Quintuplet_cuh #define Quintuplet_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "NeuralNetwork.h" #include "EndcapGeometry.h" diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 61e91eef18a47..c3d795bd8cc5f 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -1,13 +1,8 @@ #ifndef Segment_cuh #define Segment_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "EndcapGeometry.h" #include "MiniDoublet.h" diff --git a/RecoTracker/LSTCore/src/alpaka/TiltedGeometry.h b/RecoTracker/LSTCore/src/alpaka/TiltedGeometry.h index 51481762c5184..258e9333c17a3 100644 --- a/RecoTracker/LSTCore/src/alpaka/TiltedGeometry.h +++ b/RecoTracker/LSTCore/src/alpaka/TiltedGeometry.h @@ -9,11 +9,7 @@ #include #include -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif namespace SDL { template diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index 60cefedc751f9..57919d13705f8 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -1,13 +1,8 @@ #ifndef TrackCandidate_cuh #define TrackCandidate_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "Triplet.h" #include "Segment.h" diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 84fa04f77a4f0..1dfdbd5e9a900 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -1,13 +1,8 @@ #ifndef Triplet_cuh #define Triplet_cuh -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/Module.h" -#else -#include "Constants.h" -#include "Module.h" -#endif #include "Segment.h" #include "MiniDoublet.h" diff --git a/RecoTracker/LSTCore/standalone/Makefile b/RecoTracker/LSTCore/standalone/Makefile index 5fe8f4c6dcfcd..4e8071b3e7a80 100644 --- a/RecoTracker/LSTCore/standalone/Makefile +++ b/RecoTracker/LSTCore/standalone/Makefile @@ -9,7 +9,7 @@ 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 +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${TRACKLOOPERDIR}/../../../ -I${CMSSW_BASE}/src -I../interface/alpaka/ -I../src/alpaka/ ifdef CMSSW_RELEASE_BASE INCLUDEFLAGS:= ${INCLUDEFLAGS} -I${CMSSW_RELEASE_BASE}/src diff --git a/RecoTracker/LSTCore/standalone/SDL/Makefile b/RecoTracker/LSTCore/standalone/SDL/Makefile index 6160ec6c80136..df2fbb6d9f8af 100644 --- a/RecoTracker/LSTCore/standalone/SDL/Makefile +++ b/RecoTracker/LSTCore/standalone/SDL/Makefile @@ -46,7 +46,7 @@ CXX = g++ CXXFLAGS_CPU = -march=native -mtune=native -Ofast -fno-reciprocal-math -fopenmp-simd -g -Wall -Wshadow -Woverloaded-virtual -fPIC -fopenmp -I.. CXXFLAGS_CUDA = -O3 -g --compiler-options -Wall --compiler-options -Wshadow --compiler-options -Woverloaded-virtual --compiler-options -fPIC --compiler-options -fopenmp -dc -lineinfo --ptxas-options=-v --cudart shared $(GENCODE_CUDA) --use_fast_math --default-stream per-thread -I.. CXXFLAGS_ROCM = -O3 -g -Wall -Wshadow -Woverloaded-virtual -fPIC -I${ROCM_ROOT}/include -I.. -CMSSWINCLUDE := -I${TRACKLOOPERDIR}/../../../ -I${CMSSW_BASE}/src -DLST_IS_CMSSW_PACKAGE +CMSSWINCLUDE := -I${TRACKLOOPERDIR}/../../../ -I${CMSSW_BASE}/src ifdef CMSSW_RELEASE_BASE CMSSWINCLUDE := ${CMSSWINCLUDE} -I${CMSSW_RELEASE_BASE}/src endif From e0acfa56fd37bb85b32ae1973720be32806af0d0 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Tue, 18 Jun 2024 10:40:38 -0700 Subject: [PATCH 05/18] Addressed ESProducer comments --- .../plugins/alpaka/LSTModulesDevESProducer.cc | 39 +++---------- RecoTracker/LST/plugins/alpaka/LSTProducer.cc | 2 +- RecoTracker/LST/src/alpaka/ES_ModulesDev.cc | 7 +-- RecoTracker/LSTCore/interface/alpaka/LST.h | 2 +- .../LSTCore/interface/alpaka/LSTESData.h | 54 ++++------------- .../LSTCore/src/alpaka/EndcapGeometry.dev.cc | 58 ++++++++++--------- .../LSTCore/src/alpaka/EndcapGeometry.h | 38 ++++-------- RecoTracker/LSTCore/src/alpaka/Event.h | 2 +- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 2 +- .../LSTCore/src/alpaka/LSTESData.dev.cc | 53 ++++++++++------- .../LSTCore/src/alpaka/ModuleMethods.h | 32 +++++----- RecoTracker/LSTCore/standalone/bin/sdl.cc | 4 +- 12 files changed, 118 insertions(+), 175 deletions(-) diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index e6b3c42b7ed10..6e7b14d4f0c88 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -15,41 +15,18 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { class LSTModulesDevESProducer : public ESProducer { public: - LSTModulesDevESProducer(const edm::ParameterSet& iConfig); + LSTModulesDevESProducer(edm::ParameterSet const& iConfig) : ESProducer(iConfig) { setWhatProduced(this); } - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + descriptions.addWithDefaultLabel(desc); + } - std::unique_ptr> produceHost(TrackerRecoGeometryRecord const& iRecord); - std::unique_ptr> produceDevice( - device::Record const& iRecord); - - private: - edm::ESGetToken, TrackerRecoGeometryRecord> lstESHostToken_; + std::unique_ptr> produce(TrackerRecoGeometryRecord const& iRecord) { + return SDL::loadAndFillESHost(); + } }; - LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig) { - setWhatProduced(this, &LSTModulesDevESProducer::produceHost); - auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice); - lstESHostToken_ = cc.consumes(); - } - - void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - descriptions.addWithDefaultLabel(desc); - } - - std::unique_ptr> LSTModulesDevESProducer::produceHost( - TrackerRecoGeometryRecord const& iRecord) { - return SDL::loadAndFillESHost(); - } - - 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); - } - } // namespace ALPAKA_ACCELERATOR_NAMESPACE DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(LSTModulesDevESProducer); diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index 0875eebe9f620..79896ad11e3f6 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -81,7 +81,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { private: edm::EDGetTokenT lstPixelSeedInputToken_; edm::EDGetTokenT lstPhase2OTHitsInputToken_; - device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; + device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; const int verbose_; edm::EDPutTokenT lstOutputToken_; diff --git a/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc b/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc index 9c66dda420db0..3964d050f924b 100644 --- a/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc +++ b/RecoTracker/LST/src/alpaka/ES_ModulesDev.cc @@ -3,8 +3,5 @@ // Temporary hack: The DevHost instantiation is needed in both CPU and GPU plugins, // whereas the (non-host-)Device instantiation only in the GPU plugin -TYPELOOKUP_DATA_REG(SDL::LSTESHostData); -TYPELOOKUP_DATA_REG(SDL::LSTESDeviceData); -TYPELOOKUP_DATA_REG(ALPAKA_ACCELERATOR_NAMESPACE::ESDeviceProduct>>); -TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESHostData); -TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESDeviceData); +TYPELOOKUP_DATA_REG(SDL::LSTESData); +TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESData); diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index 7d9d11745ab3c..9846e400d93f6 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, - const LSTESDeviceData* deviceESData, + const LSTESData* deviceESData, const std::vector see_px, const std::vector see_py, const std::vector see_pz, diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 29ae19a5484e8..d48d2e5c6e78c 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -16,45 +16,14 @@ namespace SDL { struct pixelMap; - template - class TiltedGeometry; - - template - class ModuleConnectionMap; - using MapPLStoLayer = std::array, 4>, 3>; - template struct modulesBuffer; - template - class EndcapGeometryHost; - template class EndcapGeometry; template - struct LSTESHostData; - - // FIXME: This shouldn't be a templated struct - template <> - struct LSTESHostData { - std::shared_ptr mapPLStoLayer; - std::shared_ptr> endcapGeometry; - std::shared_ptr> tiltedGeometry; - std::shared_ptr> moduleConnectionMap; - - LSTESHostData(std::shared_ptr mapPLStoLayerIn, - std::shared_ptr> endcapGeometryIn, - std::shared_ptr> tiltedGeometryIn, - std::shared_ptr> moduleConnectionMapIn) - : mapPLStoLayer(mapPLStoLayerIn), - endcapGeometry(endcapGeometryIn), - tiltedGeometry(tiltedGeometryIn), - moduleConnectionMap(moduleConnectionMapIn) {} - }; - - template - struct LSTESDeviceData { + struct LSTESData { uint16_t nModules; uint16_t nLowerModules; unsigned int nPixels; @@ -62,12 +31,12 @@ namespace SDL { std::shared_ptr> endcapGeometry; std::shared_ptr pixelMapping; - LSTESDeviceData(uint16_t nModulesIn, - uint16_t nLowerModulesIn, - unsigned int nPixelsIn, - std::shared_ptr> modulesBuffersIn, - std::shared_ptr> endcapGeometryIn, - std::shared_ptr pixelMappingIn) + LSTESData(uint16_t const& nModulesIn, + uint16_t const& nLowerModulesIn, + unsigned int const& nPixelsIn, + std::shared_ptr> const& modulesBuffersIn, + std::shared_ptr> const& endcapGeometryIn, + std::shared_ptr const& pixelMappingIn) : nModules(nModulesIn), nLowerModules(nLowerModulesIn), nPixels(nPixelsIn), @@ -76,18 +45,15 @@ namespace SDL { pixelMapping(pixelMappingIn) {} }; - std::unique_ptr> loadAndFillESHost(); - std::unique_ptr> loadAndFillESDevice(SDL::QueueAcc& queue, const LSTESHostData* hostData); + std::unique_ptr> loadAndFillESHost(); } // namespace SDL namespace cms::alpakatools { template <> - struct CopyToDevice> { + struct CopyToDevice> { template - static auto copyAsync(TQueue& queue, SDL::LSTESHostData const& hostData) { - return std::make_unique>(hostData); - } + static SDL::LSTESData> copyAsync(TQueue& queue, SDL::LSTESData const& srcData); }; } // namespace cms::alpakatools diff --git a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc index 2b5be62ec94bc..b2dbacaa0244d 100644 --- a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc @@ -1,16 +1,23 @@ #include "EndcapGeometry.h" -SDL::EndcapGeometry::EndcapGeometry(SDL::Dev const& devAccIn, - SDL::QueueAcc& queue, - SDL::EndcapGeometryHost const& endcapGeometryIn) - : geoMapDetId_buf(allocBufWrapper(devAccIn, endcapGeometryIn.centroid_phis_.size())), - geoMapPhi_buf(allocBufWrapper(devAccIn, endcapGeometryIn.centroid_phis_.size())) { - dxdy_slope_ = endcapGeometryIn.dxdy_slope_; - centroid_phis_ = endcapGeometryIn.centroid_phis_; - fillGeoMapArraysExplicit(queue); +template +SDL::EndcapGeometry::EndcapGeometry(TDev const& devAccIn) + : geoMapDetId_buf(allocBufWrapper(devAccIn, 0)), geoMapPhi_buf(allocBufWrapper(devAccIn, 0)) {} + +template +template +SDL::EndcapGeometry::EndcapGeometry(TQueue& queue, SDL::EndcapGeometry const& endcapGeometrySrc) + : dxdy_slope_(endcapGeometrySrc.dxdy_slope_), + centroid_phis_(endcapGeometrySrc.centroid_phis_), + geoMapDetId_buf(allocBufWrapper(alpaka::getDev(queue), endcapGeometrySrc.nEndCapMap)), + geoMapPhi_buf(allocBufWrapper(alpaka::getDev(queue), endcapGeometrySrc.nEndCapMap)), + nEndCapMap(endcapGeometrySrc.nEndCapMap) { + alpaka::memcpy(queue, geoMapPhi_buf, endcapGeometrySrc.geoMapPhi_buf); + alpaka::memcpy(queue, geoMapDetId_buf, endcapGeometrySrc.geoMapDetId_buf); } -void SDL::EndcapGeometryHost::load(std::string filename) { +template +void SDL::EndcapGeometry::load(std::string filename) { dxdy_slope_.clear(); centroid_phis_.clear(); @@ -38,19 +45,22 @@ void SDL::EndcapGeometryHost::load(std::string filename) { } } } + + fillGeoMapArraysExplicitHost(); } -void SDL::EndcapGeometry::fillGeoMapArraysExplicit(SDL::QueueAcc& queue) { +template +void SDL::EndcapGeometry::fillGeoMapArraysExplicitHost() { unsigned int phi_size = centroid_phis_.size(); // Allocate buffers on host SDL::DevHost const& devHost = cms::alpakatools::host(); - auto mapPhi_host_buf = allocBufWrapper(devHost, phi_size); - auto mapDetId_host_buf = allocBufWrapper(devHost, phi_size); + geoMapPhi_buf = allocBufWrapper(devHost, phi_size); + geoMapDetId_buf = allocBufWrapper(devHost, phi_size); // Access the raw pointers of the buffers - float* mapPhi = alpaka::getPtrNative(mapPhi_host_buf); - unsigned int* mapDetId = alpaka::getPtrNative(mapDetId_host_buf); + float* mapPhi = alpaka::getPtrNative(geoMapPhi_buf); + unsigned int* mapDetId = alpaka::getPtrNative(geoMapDetId_buf); unsigned int counter = 0; for (auto it = centroid_phis_.begin(); it != centroid_phis_.end(); ++it) { @@ -62,24 +72,18 @@ void SDL::EndcapGeometry::fillGeoMapArraysExplicit(SDL::QueueAcc& queu } nEndCapMap = counter; - - // Copy data from host to device buffers - alpaka::memcpy(queue, geoMapPhi_buf, mapPhi_host_buf); - alpaka::memcpy(queue, geoMapDetId_buf, mapDetId_host_buf); - alpaka::wait(queue); } -float SDL::EndcapGeometry::getdxdy_slope(unsigned int detid) const { - if (dxdy_slope_.find(detid) != dxdy_slope_.end()) { - return dxdy_slope_.at(detid); - } else { - return 0; - } -} -float SDL::EndcapGeometryHost::getdxdy_slope(unsigned int detid) const { +template +float SDL::EndcapGeometry::getdxdy_slope(unsigned int detid) const { if (dxdy_slope_.find(detid) != dxdy_slope_.end()) { return dxdy_slope_.at(detid); } else { return 0; } } + +// We need to instantiate these to ensure that the compiler generates them +template class SDL::EndcapGeometry; +template SDL::EndcapGeometry::EndcapGeometry(SDL::QueueAcc& queue, + SDL::EndcapGeometry const& endcapGeometrySrc); \ No newline at end of file diff --git a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h index 93da945c00b33..3caaa4c152627 100644 --- a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h +++ b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h @@ -19,43 +19,29 @@ namespace SDL { - // FIXME: Need to separate this better into host and device classes - // This is only needed for host, but we template it to avoid symbol conflicts template - class EndcapGeometryHost; - - template <> - class EndcapGeometryHost { - public: - std::map dxdy_slope_; // dx/dy slope - std::map centroid_phis_; // centroid phi - - EndcapGeometryHost() = default; - ~EndcapGeometryHost() = default; - - void load(std::string); - float getdxdy_slope(unsigned int detid) const; - }; - - template - class EndcapGeometry; - - template <> - class EndcapGeometry { + class EndcapGeometry { private: std::map dxdy_slope_; // dx/dy slope std::map centroid_phis_; // centroid phi + // Friend all other instantiations of this template + template + friend class EndcapGeometry; + public: - Buf geoMapDetId_buf; - Buf geoMapPhi_buf; + Buf geoMapDetId_buf; + Buf geoMapPhi_buf; unsigned int nEndCapMap; - EndcapGeometry(Dev const& devAccIn, QueueAcc& queue, SDL::EndcapGeometryHost const& endcapGeometryIn); + EndcapGeometry(TDev const& devAccIn); + template + EndcapGeometry(TQueue& queue, EndcapGeometry const& endcapGeometrySrc); ~EndcapGeometry() = default; - void fillGeoMapArraysExplicit(QueueAcc& queue); + void load(std::string); + void fillGeoMapArraysExplicitHost(); float getdxdy_slope(unsigned int detid) const; }; } // namespace SDL diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 3d301c2c65069..7cb957f0e893d 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -97,7 +97,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, TQueue const& q, const LSTESData* deviceESData) : queue(q), devAcc(alpaka::getDev(q)), devHost(cms::alpakatools::host()), diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 9eb11503123df..ec00bf1c7b3b9 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, - const LSTESDeviceData* deviceESData, + const LSTESData* deviceESData, const std::vector see_px, const std::vector see_py, const std::vector see_pz, diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 616c6f4bf3894..505807d301f89 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -44,7 +44,7 @@ namespace { } void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer, - std::shared_ptr> endcapGeometry, + std::shared_ptr> endcapGeometry, std::shared_ptr> tiltedGeometry, std::shared_ptr> moduleConnectionMap) { // Module orientation information (DrDz or phi angles) @@ -81,30 +81,21 @@ namespace { } } // namespace -std::unique_ptr> SDL::loadAndFillESHost() { - 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); - return std::make_unique>(pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); -} - -std::unique_ptr> SDL::loadAndFillESDevice(SDL::QueueAcc& queue, - const LSTESHostData* hostData) { - SDL::Dev const& devAccIn = alpaka::getDev(queue); +std::unique_ptr> SDL::loadAndFillESHost() { uint16_t nModules; uint16_t nLowerModules; unsigned int nPixels; - std::shared_ptr> modulesBuffers = nullptr; - auto endcapGeometry = std::make_shared>(devAccIn, queue, *hostData->endcapGeometry); + std::shared_ptr> modulesBuffers = nullptr; + auto pLStoLayer = std::make_shared(); + auto endcapGeometry = std::make_shared>(cms::alpakatools::host()); + auto tiltedGeometry = std::make_shared>(); auto pixelMapping = std::make_shared(); - auto moduleConnectionMap = hostData->moduleConnectionMap; + auto moduleConnectionMap = std::make_shared>(); + ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); - SDL::loadModulesFromFile(queue, - hostData->mapPLStoLayer.get(), + SDL::loadModulesFromFile(pLStoLayer.get(), path.c_str(), nModules, nLowerModules, @@ -112,8 +103,30 @@ std::unique_ptr> SDL::loadAndFillESDevice(SDL::Qu modulesBuffers, pixelMapping.get(), endcapGeometry.get(), - hostData->tiltedGeometry.get(), + tiltedGeometry.get(), moduleConnectionMap.get()); - return std::make_unique>( + return std::make_unique>( nModules, nLowerModules, nPixels, modulesBuffers, endcapGeometry, pixelMapping); } + +template +SDL::LSTESData> cms::alpakatools::CopyToDevice>::copyAsync( + TQueue& queue, SDL::LSTESData const& srcData) { + auto deviceModulesBuffers = std::make_shared>>( + alpaka::getDev(queue), srcData.nModules, srcData.nPixels); + deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); + auto deviceEndcapGeometry = + std::make_shared>>(queue, *srcData.endcapGeometry); + + return SDL::LSTESData>(srcData.nModules, + srcData.nLowerModules, + srcData.nPixels, + deviceModulesBuffers, + deviceEndcapGeometry, + srcData.pixelMapping); +} + +// Make sure it is compiled +template struct cms::alpakatools::CopyToDevice>; +template SDL::LSTESData> cms::alpakatools::CopyToDevice< + SDL::LSTESData>::copyAsync(SDL::QueueAcc&, SDL::LSTESData const&); diff --git a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h index dc0eb0fc1f3b8..75b3ff08fe039 100644 --- a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h +++ b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h @@ -30,7 +30,7 @@ namespace SDL { }; template - inline void fillPixelMap(std::shared_ptr>& modulesBuf, + inline void fillPixelMap(std::shared_ptr>& modulesBuf, uint16_t nModules, unsigned int& nPixels, pixelMap& pixelMapping, @@ -88,12 +88,11 @@ namespace SDL { nPixels = connectedPix_size; // Now we can initialize modulesBuf + DevHost const& devHost = cms::alpakatools::host(); if (modulesBuf == nullptr) { - SDL::Dev const& devAcc = alpaka::getDev(queue); - modulesBuf = std::make_shared>(devAcc, nModules, nPixels); + modulesBuf = std::make_shared>(devHost, nModules, nPixels); } - DevHost const& devHost = cms::alpakatools::host(); auto connectedPixels_buf = allocBufWrapper(devHost, connectedPix_size); unsigned int* connectedPixels = alpaka::getPtrNative(connectedPixels_buf); @@ -225,18 +224,16 @@ namespace SDL { nModules = counter; }; - template - void loadModulesFromFile(TQueue& queue, - const MapPLStoLayer* pLStoLayer, - const char* moduleMetaDataFilePath, - uint16_t& nModules, - uint16_t& nLowerModules, - unsigned int& nPixels, - std::shared_ptr>& modulesBuf, - pixelMap* pixelMapping, - const EndcapGeometry* endcapGeometry, - const TiltedGeometry* tiltedGeometry, - const ModuleConnectionMap* moduleConnectionMap) { + inline void loadModulesFromFile(const MapPLStoLayer* pLStoLayer, + const char* moduleMetaDataFilePath, + uint16_t& nModules, + uint16_t& nLowerModules, + unsigned int& nPixels, + std::shared_ptr>& modulesBuf, + pixelMap* pixelMapping, + const EndcapGeometry* endcapGeometry, + const TiltedGeometry* tiltedGeometry, + const ModuleConnectionMap* moduleConnectionMap) { ModuleMetaData mmd; loadCentroidsFromFile(moduleMetaDataFilePath, mmd, nModules); @@ -381,6 +378,9 @@ namespace SDL { } } + // TODO: We don't need a queue, but this code needs to be refactored + alpaka::QueueCpuBlocking queue(cms::alpakatools::host()); + // modulesBuf is initialized in fillPixelMap since both nModules and nPix will be known fillPixelMap(modulesBuf, nModules, nPixels, *pixelMapping, queue, *pLStoLayer, mmd); diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 3aed3e3c4d3b7..6f3f7e29d9a49 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -295,7 +295,7 @@ void run_sdl() { TStopwatch full_timer; full_timer.Start(); auto hostESData = SDL::loadAndFillESHost(); - auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get()); + auto deviceESData = cms::alpakatools::CopyToDevice>::copyAsync(queues[0], *hostESData.get()); float timeForMapLoading = full_timer.RealTime() * 1000; if (ana.do_write_ntuple) { @@ -373,7 +373,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, queues[s], &deviceESData); events.push_back(event); } float timeForEventCreation = full_timer.RealTime() * 1000; From ef48f7427d3d08b8c92f6554883a5b5f4b72f220 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Mon, 24 Jun 2024 02:21:11 -0700 Subject: [PATCH 06/18] Removal of gpu modifier from LST workflows --- Configuration/PyReleaseValidation/README.md | 2 ++ .../PyReleaseValidation/python/upgradeWorkflowComponents.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Configuration/PyReleaseValidation/README.md b/Configuration/PyReleaseValidation/README.md index cb04a44c6764f..cb831bff1beb7 100644 --- a/Configuration/PyReleaseValidation/README.md +++ b/Configuration/PyReleaseValidation/README.md @@ -61,6 +61,8 @@ The offsets currently in use are: * 0.7: trackingMkFit modifier * 0.701: DisplacedRegionalStep tracking iteration for Run-3 * 0.702: trackingMkFit modifier for Phase-2 (initialStep only) +* 0.703: LST tracking, initialStep+HighPtTripletStep only, on CPU +* 0.704: LST tracking, initialStep+HighPtTripletStep only, on GPU * 0.78: Complete L1 workflow * 0.8: BPH Parking (Run-2) * 0.81: Running also HeavyFlavor DQM diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index ea85c945609ba..1bf692607f1ab 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -504,7 +504,8 @@ def condition_(self, fragment, stepList, key, hasHarvest): offset = 0.703, ) upgradeWFs['lstOnCPUIters01TrackingOnly'].step3 = upgradeWFs['trackingOnly'].step3 | { - '--procModifiers': 'trackingIters01,trackingLST' + '--procModifiers': 'trackingIters01,trackingLST', + '--accelerators' : 'cpu' } # LST on GPU, initialStep+highPtTripletStep-only tracking-only @@ -536,7 +537,8 @@ def condition_(self, fragment, stepList, key, hasHarvest): offset = 0.704, ) upgradeWFs['lstOnGPUIters01TrackingOnly'].step3 = upgradeWFs['trackingOnly'].step3 | { - '--procModifiers': 'gpu,trackingIters01,trackingLST' + '--procModifiers': 'trackingIters01,trackingLST', + '--accelerators' : 'gpu-nvidia' } #DeepCore seeding for JetCore iteration workflow From a3f65dacbb686313574fb36be5f4d421e3333284 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 24 Jun 2024 11:00:13 -0700 Subject: [PATCH 07/18] Separated EndcapGeometry into host-only and buffers struct --- .../interface/alpaka/EndcapGeometryBuffer.h | 56 +++++++++++++++++++ .../LSTCore/interface/alpaka/LSTESData.h | 39 ++++++++----- .../LSTCore/src/alpaka/EndcapGeometry.dev.cc | 52 ++++------------- .../LSTCore/src/alpaka/EndcapGeometry.h | 24 +++----- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 6 +- RecoTracker/LSTCore/src/alpaka/Event.h | 6 +- .../LSTCore/src/alpaka/LSTESData.dev.cc | 34 +++-------- .../LSTCore/src/alpaka/ModuleMethods.h | 2 +- 8 files changed, 117 insertions(+), 102 deletions(-) create mode 100644 RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h new file mode 100644 index 0000000000000..76849b3f2d206 --- /dev/null +++ b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h @@ -0,0 +1,56 @@ +#ifndef EndcapGeometryBuffers_h +#define EndcapGeometryBuffers_h + +#include +#include +#include +#include +#include +#include +#include + +#include "HeterogeneousCore/AlpakaInterface/interface/host.h" + +#include "RecoTracker/LSTCore/interface/alpaka/Constants.h" + +namespace SDL { + + struct endcapGeom { + const unsigned int* geoMapDetId; + const float* geoMapPhi; + + template + void setData(const TBuff& endcapgeombuf) { + geoMapDetId = alpaka::getPtrNative(endcapgeombuf.geoMapDetId_buf); + geoMapPhi = alpaka::getPtrNative(endcapgeombuf.geoMapPhi_buf); + } + }; + + template + struct endcapGeometryBuffer : endcapGeom { + Buf geoMapDetId_buf; + Buf geoMapPhi_buf; + + endcapGeometryBuffer(TDev const& dev, unsigned int nEndCapMap) + : geoMapDetId_buf(allocBufWrapper(dev, nEndCapMap)), + geoMapPhi_buf(allocBufWrapper(dev, nEndCapMap)) { + setData(*this); + } + + template + inline void copyFromSrc(TQueue queue, const endcapGeometryBuffer& src) { + alpaka::memcpy(queue, geoMapDetId_buf, src.geoMapDetId_buf); + alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf); + } + + template + endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) { + copyFromSrc(queue, src); + } + + inline SDL::endcapGeom const* data() const { return this; } + }; + +} // namespace SDL + +#endif diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index d48d2e5c6e78c..39509f963028b 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -1,11 +1,9 @@ #ifndef LSTESData_H #define LSTESData_H -#ifdef LST_IS_CMSSW_PACKAGE #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" -#else -#include "Constants.h" -#endif +#include "RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h" +#include "RecoTracker/LSTCore/interface/alpaka/Module.h" #include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h" @@ -16,32 +14,29 @@ namespace SDL { struct pixelMap; - template - struct modulesBuffer; - - template - class EndcapGeometry; - template struct LSTESData { uint16_t nModules; uint16_t nLowerModules; unsigned int nPixels; + unsigned int nEndCapMap; std::shared_ptr> modulesBuffers; - std::shared_ptr> endcapGeometry; + std::shared_ptr> endcapGeometryBuffers; std::shared_ptr pixelMapping; LSTESData(uint16_t const& nModulesIn, uint16_t const& nLowerModulesIn, unsigned int const& nPixelsIn, + unsigned int const& nEndCapMapIn, std::shared_ptr> const& modulesBuffersIn, - std::shared_ptr> const& endcapGeometryIn, + std::shared_ptr> const& endcapGeometryBuffersIn, std::shared_ptr const& pixelMappingIn) : nModules(nModulesIn), nLowerModules(nLowerModulesIn), nPixels(nPixelsIn), + nEndCapMap(nEndCapMapIn), modulesBuffers(modulesBuffersIn), - endcapGeometry(endcapGeometryIn), + endcapGeometryBuffers(endcapGeometryBuffersIn), pixelMapping(pixelMappingIn) {} }; @@ -53,7 +48,23 @@ namespace cms::alpakatools { template <> struct CopyToDevice> { template - static SDL::LSTESData> copyAsync(TQueue& queue, SDL::LSTESData const& srcData); + static SDL::LSTESData> copyAsync( + TQueue& queue, SDL::LSTESData const& srcData) { + auto deviceModulesBuffers = std::make_shared>>( + alpaka::getDev(queue), srcData.nModules, srcData.nPixels); + deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); + auto deviceEndcapGeometryBuffers = + std::make_shared>>(alpaka::getDev(queue), srcData.nEndCapMap); + deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers); + + return SDL::LSTESData>(srcData.nModules, + srcData.nLowerModules, + srcData.nPixels, + srcData.nEndCapMap, + deviceModulesBuffers, + deviceEndcapGeometryBuffers, + srcData.pixelMapping); + } }; } // namespace cms::alpakatools diff --git a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc index b2dbacaa0244d..6e185abda5973 100644 --- a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.dev.cc @@ -1,23 +1,8 @@ #include "EndcapGeometry.h" -template -SDL::EndcapGeometry::EndcapGeometry(TDev const& devAccIn) - : geoMapDetId_buf(allocBufWrapper(devAccIn, 0)), geoMapPhi_buf(allocBufWrapper(devAccIn, 0)) {} +SDL::EndcapGeometry::EndcapGeometry(std::string filename) { load(filename); } -template -template -SDL::EndcapGeometry::EndcapGeometry(TQueue& queue, SDL::EndcapGeometry const& endcapGeometrySrc) - : dxdy_slope_(endcapGeometrySrc.dxdy_slope_), - centroid_phis_(endcapGeometrySrc.centroid_phis_), - geoMapDetId_buf(allocBufWrapper(alpaka::getDev(queue), endcapGeometrySrc.nEndCapMap)), - geoMapPhi_buf(allocBufWrapper(alpaka::getDev(queue), endcapGeometrySrc.nEndCapMap)), - nEndCapMap(endcapGeometrySrc.nEndCapMap) { - alpaka::memcpy(queue, geoMapPhi_buf, endcapGeometrySrc.geoMapPhi_buf); - alpaka::memcpy(queue, geoMapDetId_buf, endcapGeometrySrc.geoMapDetId_buf); -} - -template -void SDL::EndcapGeometry::load(std::string filename) { +void SDL::EndcapGeometry::load(std::string filename) { dxdy_slope_.clear(); centroid_phis_.clear(); @@ -46,44 +31,27 @@ void SDL::EndcapGeometry::load(std::string filename) { } } - fillGeoMapArraysExplicitHost(); + fillGeoMapArraysExplicit(); } -template -void SDL::EndcapGeometry::fillGeoMapArraysExplicitHost() { - unsigned int phi_size = centroid_phis_.size(); - - // Allocate buffers on host - SDL::DevHost const& devHost = cms::alpakatools::host(); - geoMapPhi_buf = allocBufWrapper(devHost, phi_size); - geoMapDetId_buf = allocBufWrapper(devHost, phi_size); +void SDL::EndcapGeometry::fillGeoMapArraysExplicit() { + nEndCapMap = centroid_phis_.size(); - // Access the raw pointers of the buffers - float* mapPhi = alpaka::getPtrNative(geoMapPhi_buf); - unsigned int* mapDetId = alpaka::getPtrNative(geoMapDetId_buf); + geoMapDetId_buf.reserve(nEndCapMap); + geoMapPhi_buf.reserve(nEndCapMap); - unsigned int counter = 0; for (auto it = centroid_phis_.begin(); it != centroid_phis_.end(); ++it) { unsigned int detId = it->first; float Phi = it->second; - mapPhi[counter] = Phi; - mapDetId[counter] = detId; - counter++; + geoMapPhi_buf.push_back(Phi); + geoMapDetId_buf.push_back(detId); } - - nEndCapMap = counter; } -template -float SDL::EndcapGeometry::getdxdy_slope(unsigned int detid) const { +float SDL::EndcapGeometry::getdxdy_slope(unsigned int detid) const { if (dxdy_slope_.find(detid) != dxdy_slope_.end()) { return dxdy_slope_.at(detid); } else { return 0; } } - -// We need to instantiate these to ensure that the compiler generates them -template class SDL::EndcapGeometry; -template SDL::EndcapGeometry::EndcapGeometry(SDL::QueueAcc& queue, - SDL::EndcapGeometry const& endcapGeometrySrc); \ No newline at end of file diff --git a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h index 3caaa4c152627..994b197a198db 100644 --- a/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h +++ b/RecoTracker/LSTCore/src/alpaka/EndcapGeometry.h @@ -15,33 +15,27 @@ #include "Constants.h" #endif -#include "HeterogeneousCore/AlpakaInterface/interface/host.h" - namespace SDL { - - template - class EndcapGeometry { + template + class EndcapGeometry; + template <> + class EndcapGeometry { private: std::map dxdy_slope_; // dx/dy slope std::map centroid_phis_; // centroid phi - // Friend all other instantiations of this template - template - friend class EndcapGeometry; - public: - Buf geoMapDetId_buf; - Buf geoMapPhi_buf; + std::vector geoMapDetId_buf; + std::vector geoMapPhi_buf; unsigned int nEndCapMap; - EndcapGeometry(TDev const& devAccIn); - template - EndcapGeometry(TQueue& queue, EndcapGeometry const& endcapGeometrySrc); + EndcapGeometry() = default; + EndcapGeometry(std::string filename); ~EndcapGeometry() = default; void load(std::string); - void fillGeoMapArraysExplicitHost(); + void fillGeoMapArraysExplicit(); float getdxdy_slope(unsigned int detid) const; }; } // namespace SDL diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index d539a02b80bf5..e287abca41b35 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -191,9 +191,9 @@ void SDL::Event::addHitToEvent(std::vector x, Endcap, TwoS, nModules_, - endcapGeometry_->nEndCapMap, - alpaka::getPtrNative(endcapGeometry_->geoMapDetId_buf), - alpaka::getPtrNative(endcapGeometry_->geoMapPhi_buf), + nEndCapMap_, + alpaka::getPtrNative(endcapGeometryBuffers_->geoMapDetId_buf), + alpaka::getPtrNative(endcapGeometryBuffers_->geoMapPhi_buf), *modulesBuffers_->data(), *hitsInGPU, nHits)); diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 7cb957f0e893d..3005f587d7446 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -90,9 +90,10 @@ namespace SDL { const uint16_t nModules_; const uint16_t nLowerModules_; const unsigned int nPixels_; + const unsigned int nEndCapMap_; const std::shared_ptr> modulesBuffers_; const std::shared_ptr pixelMapping_; - const std::shared_ptr> endcapGeometry_; + const std::shared_ptr> endcapGeometryBuffers_; public: // Constructor used for CMSSW integration. Uses an external queue. @@ -104,9 +105,10 @@ namespace SDL { nModules_(deviceESData->nModules), nLowerModules_(deviceESData->nLowerModules), nPixels_(deviceESData->nPixels), + nEndCapMap_(deviceESData->nEndCapMap), modulesBuffers_(deviceESData->modulesBuffers), pixelMapping_(deviceESData->pixelMapping), - endcapGeometry_(deviceESData->endcapGeometry) { + endcapGeometryBuffers_(deviceESData->endcapGeometryBuffers) { init(verbose); } void resetEvent(); diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 505807d301f89..c091eb2e0a64f 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -44,7 +44,7 @@ namespace { } void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer, - std::shared_ptr> endcapGeometry, + std::shared_ptr> endcapGeometry, std::shared_ptr> tiltedGeometry, std::shared_ptr> moduleConnectionMap) { // Module orientation information (DrDz or phi angles) @@ -87,12 +87,18 @@ std::unique_ptr> SDL::loadAndFillESHost() { unsigned int nPixels; std::shared_ptr> modulesBuffers = nullptr; auto pLStoLayer = std::make_shared(); - auto endcapGeometry = std::make_shared>(cms::alpakatools::host()); + auto endcapGeometry = std::make_shared>(); auto tiltedGeometry = std::make_shared>(); auto pixelMapping = std::make_shared(); auto moduleConnectionMap = std::make_shared>(); ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); + auto endcapGeometryBuffers = std::make_shared>(cms::alpakatools::host(), + endcapGeometry->nEndCapMap); + alpaka::QueueCpuBlocking queue(cms::alpakatools::host()); + alpaka::memcpy(queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); + alpaka::memcpy(queue, endcapGeometryBuffers->geoMapPhi_buf, endcapGeometry->geoMapPhi_buf, endcapGeometry->nEndCapMap); + auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); SDL::loadModulesFromFile(pLStoLayer.get(), @@ -106,27 +112,5 @@ std::unique_ptr> SDL::loadAndFillESHost() { tiltedGeometry.get(), moduleConnectionMap.get()); return std::make_unique>( - nModules, nLowerModules, nPixels, modulesBuffers, endcapGeometry, pixelMapping); + nModules, nLowerModules, nPixels, endcapGeometry->nEndCapMap, modulesBuffers, endcapGeometryBuffers, pixelMapping); } - -template -SDL::LSTESData> cms::alpakatools::CopyToDevice>::copyAsync( - TQueue& queue, SDL::LSTESData const& srcData) { - auto deviceModulesBuffers = std::make_shared>>( - alpaka::getDev(queue), srcData.nModules, srcData.nPixels); - deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); - auto deviceEndcapGeometry = - std::make_shared>>(queue, *srcData.endcapGeometry); - - return SDL::LSTESData>(srcData.nModules, - srcData.nLowerModules, - srcData.nPixels, - deviceModulesBuffers, - deviceEndcapGeometry, - srcData.pixelMapping); -} - -// Make sure it is compiled -template struct cms::alpakatools::CopyToDevice>; -template SDL::LSTESData> cms::alpakatools::CopyToDevice< - SDL::LSTESData>::copyAsync(SDL::QueueAcc&, SDL::LSTESData const&); diff --git a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h index 75b3ff08fe039..31422f5a3a734 100644 --- a/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h +++ b/RecoTracker/LSTCore/src/alpaka/ModuleMethods.h @@ -231,7 +231,7 @@ namespace SDL { unsigned int& nPixels, std::shared_ptr>& modulesBuf, pixelMap* pixelMapping, - const EndcapGeometry* endcapGeometry, + const EndcapGeometry* endcapGeometry, const TiltedGeometry* tiltedGeometry, const ModuleConnectionMap* moduleConnectionMap) { ModuleMetaData mmd; From eb5de05acde834fecafba919b609f6d416476c25 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 24 Jun 2024 11:30:45 -0700 Subject: [PATCH 08/18] Minor cleanup --- .../interface/alpaka/EndcapGeometryBuffer.h | 7 ++++--- .../LSTCore/interface/alpaka/LSTESData.h | 20 +++++++++---------- RecoTracker/LSTCore/interface/alpaka/Module.h | 4 ++-- .../LSTCore/src/alpaka/LSTESData.dev.cc | 10 ++++++---- RecoTracker/LSTCore/standalone/bin/sdl.cc | 3 ++- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h index 76849b3f2d206..97e755e57601c 100644 --- a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h +++ b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h @@ -43,14 +43,15 @@ namespace SDL { alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf); } - template - endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) { + template + endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) + : endcapGeometryBuffer(alpaka::getDev(queue), nEndCapMap) { copyFromSrc(queue, src); } inline SDL::endcapGeom const* data() const { return this; } }; - + } // namespace SDL #endif diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 39509f963028b..ea7e5a7fa647d 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -40,16 +40,16 @@ namespace SDL { pixelMapping(pixelMappingIn) {} }; - std::unique_ptr> loadAndFillESHost(); + std::unique_ptr> loadAndFillESHost(); } // namespace SDL namespace cms::alpakatools { template <> - struct CopyToDevice> { + struct CopyToDevice> { template - static SDL::LSTESData> copyAsync( - TQueue& queue, SDL::LSTESData const& srcData) { + static SDL::LSTESData> copyAsync(TQueue& queue, + SDL::LSTESData const& srcData) { auto deviceModulesBuffers = std::make_shared>>( alpaka::getDev(queue), srcData.nModules, srcData.nPixels); deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); @@ -58,12 +58,12 @@ namespace cms::alpakatools { deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers); return SDL::LSTESData>(srcData.nModules, - srcData.nLowerModules, - srcData.nPixels, - srcData.nEndCapMap, - deviceModulesBuffers, - deviceEndcapGeometryBuffers, - srcData.pixelMapping); + srcData.nLowerModules, + srcData.nPixels, + srcData.nEndCapMap, + deviceModulesBuffers, + deviceEndcapGeometryBuffers, + srcData.pixelMapping); } }; } // namespace cms::alpakatools diff --git a/RecoTracker/LSTCore/interface/alpaka/Module.h b/RecoTracker/LSTCore/interface/alpaka/Module.h index 0a269eaa6e16a..1f9cf2e148107 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Module.h +++ b/RecoTracker/LSTCore/interface/alpaka/Module.h @@ -359,8 +359,8 @@ namespace SDL { alpaka::wait(queue); } - template - modulesBuffer(TQueue queue, const modulesBuffer& src, unsigned int nMod, unsigned int nPixs) + template + modulesBuffer(TQueue queue, const modulesBuffer& src, unsigned int nMod, unsigned int nPixs) : modulesBuffer(alpaka::getDev(queue), nMod, nPixs) { copyFromSrc(queue, src); } diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index c091eb2e0a64f..3d64627e217f9 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -93,11 +93,13 @@ std::unique_ptr> SDL::loadAndFillESHost() { auto moduleConnectionMap = std::make_shared>(); ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); - auto endcapGeometryBuffers = std::make_shared>(cms::alpakatools::host(), - endcapGeometry->nEndCapMap); + auto endcapGeometryBuffers = + std::make_shared>(cms::alpakatools::host(), endcapGeometry->nEndCapMap); alpaka::QueueCpuBlocking queue(cms::alpakatools::host()); - alpaka::memcpy(queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); - alpaka::memcpy(queue, endcapGeometryBuffers->geoMapPhi_buf, endcapGeometry->geoMapPhi_buf, endcapGeometry->nEndCapMap); + alpaka::memcpy( + queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); + alpaka::memcpy( + queue, endcapGeometryBuffers->geoMapPhi_buf, endcapGeometry->geoMapPhi_buf, endcapGeometry->nEndCapMap); auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); diff --git a/RecoTracker/LSTCore/standalone/bin/sdl.cc b/RecoTracker/LSTCore/standalone/bin/sdl.cc index 6f3f7e29d9a49..c6734ca750c30 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -295,7 +295,8 @@ void run_sdl() { TStopwatch full_timer; full_timer.Start(); auto hostESData = SDL::loadAndFillESHost(); - auto deviceESData = cms::alpakatools::CopyToDevice>::copyAsync(queues[0], *hostESData.get()); + auto deviceESData = + cms::alpakatools::CopyToDevice>::copyAsync(queues[0], *hostESData.get()); float timeForMapLoading = full_timer.RealTime() * 1000; if (ana.do_write_ntuple) { From f46b6cb13c9c14df422fc16e7ed3cf7e0755a6bc Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 24 Jun 2024 12:52:12 -0700 Subject: [PATCH 09/18] Removed -Wshadow flag --- RecoTracker/LSTCore/BuildFile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoTracker/LSTCore/BuildFile.xml b/RecoTracker/LSTCore/BuildFile.xml index 69c03f883986e..a9045e50b6a77 100644 --- a/RecoTracker/LSTCore/BuildFile.xml +++ b/RecoTracker/LSTCore/BuildFile.xml @@ -2,7 +2,7 @@ - + From 149c628fc13ab77dbcde0cbde9e7880c38c560ee Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Fri, 28 Jun 2024 21:23:31 +0200 Subject: [PATCH 10/18] Resolve conflicts regarding workflows --- Configuration/PyReleaseValidation/python/relval_2026.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_2026.py b/Configuration/PyReleaseValidation/python/relval_2026.py index e40e863cfe97a..ab892ce2b2d3b 100644 --- a/Configuration/PyReleaseValidation/python/relval_2026.py +++ b/Configuration/PyReleaseValidation/python/relval_2026.py @@ -26,7 +26,6 @@ numWFIB.extend([24834.0,24834.911,24834.103]) #2026D98 DDD XML, DD4hep XML, aging numWFIB.extend([25061.97]) #2026D98 premixing stage1 (NuGun+PU) numWFIB.extend([24834.702]) #2026D98 mkFit tracking (initialStep) -numWFIB.extend([24834.703,24834.704]) #2026D98 LST tracking (initialStep+HighPtTripletStep only): CPU, GPU numWFIB.extend([24834.5,24834.9]) #2026D98 pixelTrackingOnly, vector hits numWFIB.extend([24834.501,24834.502]) #2026D98 Patatrack local reconstruction on CPU, Patatrack local reconstruction on GPU numWFIB.extend([25034.99,25034.999]) #2026D98 premixing combined stage1+stage2 (ttbar+PU200, ttbar+PU50 for PR test) @@ -55,5 +54,8 @@ # NuGun numWFIB.extend([24861.0]) #Nu Gun 2026D98 +# Temporary placement for LST workflow to workaround PR conflicts - to be formatted and placed in an upcoming PR +numWFIB.extend([24834.703,24834.704]) #2026D98 LST tracking (initialStep+HighPtTripletStep only): CPU, GPU + for numWF in numWFIB: workflows[numWF] = _upgrade_workflows[numWF] From 236ad8c9f19a9376f42f540779a4e6a4bb1b24ce Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Sat, 29 Jun 2024 02:43:48 -0700 Subject: [PATCH 11/18] Simplification of sqrt operations for pT3s --- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index bd048f9c819a2..d68e9ff85a469 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -1350,7 +1350,7 @@ namespace SDL { if (not pass) return pass; - const float coshEta = alpaka::math::sqrt(acc, ptIn * ptIn + pz * pz) / ptIn; + const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); const float drt_OutLo_InUp = (rt_OutLo - rt_InUp); @@ -1358,15 +1358,14 @@ namespace SDL { float drt_InSeg = rt_InOut - rt_InLo; - const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * - alpaka::math::sqrt(acc, r3_InUp / rt_InUp); - const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * + (r3_InUp / rt_InUp); + const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; - float dzErr = drt_OutLo_InUp * etaErr * coshEta; //FIXME: check with the calc in the endcap - dzErr *= dzErr; - dzErr += 0.03f * 0.03f; // pixel size x2. ... random for now - dzErr *= 9.f; //3 sigma - dzErr += sdlMuls * sdlMuls * drt_OutLo_InUp * drt_OutLo_InUp / 3.f * coshEta * coshEta; //sloppy + float dzErr = (drt_OutLo_InUp * drt_OutLo_InUp) * (etaErr * etaErr) * cosh2Eta; + dzErr += 0.03f * 0.03f; // pixel size x2. + dzErr *= 9.f; // 3 sigma + dzErr += sdlMuls2 * (drt_OutLo_InUp * drt_OutLo_InUp) / 3.f * cosh2Eta; dzErr += zGeom * zGeom; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1384,7 +1383,7 @@ namespace SDL { return pass; const float sdlPVoff = 0.1f / rt_OutLo; - sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls * sdlMuls + sdlPVoff * sdlPVoff); + sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); #ifdef CUT_VALUE_DEBUG dPhiPos = SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutUp, y_OutUp); @@ -1651,21 +1650,19 @@ namespace SDL { return pass; const float dzOutInAbs = alpaka::math::abs(acc, z_OutLo - z_InUp); - const float coshEta = alpaka::math::sqrt(acc, ptIn * ptIn + pz * pz) / ptIn; - const float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); + const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); + const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ( (cosh2Eta - 1.f) * (cosh2Eta - 1.f) ); const float r3_InUp = alpaka::math::sqrt(acc, z_InUp * z_InUp + rt_InUp * rt_InUp); - const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * - alpaka::math::sqrt(acc, r3_InUp / rt_InUp); - const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? - - float drtErr = etaErr * multDzDr; - drtErr *= drtErr; - drtErr += 0.03f * 0.03f; // pixel size x2. ... random for now - drtErr *= 9.f; //3 sigma - drtErr += - sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * + (r3_InUp / rt_InUp); + const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; + + float drtErr = (etaErr * etaErr) * multDzDr2; + drtErr += 0.03f * 0.03f; // pixel size x2. + drtErr *= 9.f; // 3 sigma + drtErr += sdlMuls2 * multDzDr2 / 3.f * cosh2Eta; drtErr = alpaka::math::sqrt(acc, drtErr); - const float drtDzIn = alpaka::math::abs(acc, ptIn / pz); //all tracks are out-going in endcaps? + const float drtDzIn = alpaka::math::abs(acc, ptIn / pz); const float drt_OutLo_InUp = (rt_OutLo - rt_InUp); // drOutIn @@ -1684,7 +1681,7 @@ namespace SDL { const float alpha1GeV_OutLo = alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * k2Rinv1GeVf / ptCut, sinAlphaMax)); const float sdlPVoff = 0.1f / rt_OutLo; - sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls * sdlMuls + sdlPVoff * sdlPVoff); + sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); deltaPhiPos = SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutUp, y_OutUp); From a97714a574a35371b982d6d80ff4deff8593c9bd Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Wed, 3 Jul 2024 07:16:19 -0700 Subject: [PATCH 12/18] Apply reco comments: Naming values and sqrt, loop, etc. simplifications --- .../LSTCore/interface/alpaka/Constants.h | 17 + RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 20 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 212 ++--- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 10 +- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 82 +- .../LSTCore/src/alpaka/NeuralNetwork.h | 13 +- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 665 +++++++------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 824 +++++++++--------- RecoTracker/LSTCore/src/alpaka/Segment.h | 171 ++-- .../LSTCore/src/alpaka/TrackCandidate.h | 50 +- RecoTracker/LSTCore/src/alpaka/Triplet.h | 176 ++-- 11 files changed, 1105 insertions(+), 1135 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index d4f023631af1d..df701f5c56fa0 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -120,6 +120,20 @@ namespace SDL { const unsigned int size_superbins = 45000; //defining the constant host device variables right up here + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pLS = 2; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_LS = 2; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_T3 = 3; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pT3 = 5; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_T5 = 5; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pT5 = 7; + + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pLS = 4; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_LS = 4; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_T3 = 6; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pT3 = 10; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_T5 = 10; + ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pT5 = 14; + ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniMulsPtScaleBarrel[6] = {0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034}; ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006}; ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniRminMeanBarrel[6] = { @@ -132,7 +146,10 @@ namespace SDL { 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 stripPSZpitch = 2.4; ALPAKA_STATIC_ACC_MEM_GLOBAL const float strip2SZpitch = 5.0; + ALPAKA_STATIC_ACC_MEM_GLOBAL const float width2S = 0.009; + ALPAKA_STATIC_ACC_MEM_GLOBAL const float widthPS = 0.01; ALPAKA_STATIC_ACC_MEM_GLOBAL const float pt_betaMax = 7.0; ALPAKA_STATIC_ACC_MEM_GLOBAL const float magnetic_field = 3.8112; // Since C++ can't represent infinity, SDL_INF = 123456789 was used to represent infinity in the data table diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index d539a02b80bf5..c967e139a809b 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1622,8 +1622,8 @@ SDL::tripletsBuffer* SDL::Event::getTriplets() { alpaka::memcpy(queue, tripletsInCPU->rtLo_buf, tripletsBuffers->rtLo_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->rtHi_buf, tripletsBuffers->rtHi_buf, nMemHost); #endif - alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, 6 * nMemHost); - alpaka::memcpy(queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, 3 * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, hits_T3 * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, layers_T3 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->segmentIndices_buf, tripletsBuffers->segmentIndices_buf, 2 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->betaIn_buf, tripletsBuffers->betaIn_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->circleRadius_buf, tripletsBuffers->circleRadius_buf, nMemHost); @@ -1650,8 +1650,10 @@ SDL::quintupletsBuffer* SDL::Event::getQuintuplets() { alpaka::memcpy( queue, quintupletsInCPU->totOccupancyQuintuplets_buf, quintupletsBuffers->totOccupancyQuintuplets_buf); alpaka::memcpy(queue, quintupletsInCPU->tripletIndices_buf, quintupletsBuffers->tripletIndices_buf, 2 * nMemHost); - alpaka::memcpy( - queue, quintupletsInCPU->lowerModuleIndices_buf, quintupletsBuffers->lowerModuleIndices_buf, 5 * nMemHost); + alpaka::memcpy(queue, + quintupletsInCPU->lowerModuleIndices_buf, + quintupletsBuffers->lowerModuleIndices_buf, + layers_T5 * nMemHost); alpaka::memcpy(queue, quintupletsInCPU->innerRadius_buf, quintupletsBuffers->innerRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->bridgeRadius_buf, quintupletsBuffers->bridgeRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->outerRadius_buf, quintupletsBuffers->outerRadius_buf, nMemHost); @@ -1757,11 +1759,13 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; alpaka::memcpy( - queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, 14 * nTrackCanHost); + queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, hits_pT5 * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); - alpaka::memcpy( - queue, trackCandidatesInCPU->logicalLayers_buf, trackCandidatesBuffers->logicalLayers_buf, 7 * nTrackCanHost); + alpaka::memcpy(queue, + trackCandidatesInCPU->logicalLayers_buf, + trackCandidatesBuffers->logicalLayers_buf, + layers_pT5 * nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->directObjectIndices_buf, trackCandidatesBuffers->directObjectIndices_buf, @@ -1791,7 +1795,7 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; alpaka::memcpy( - queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, 14 * nTrackCanHost); + queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, hits_pT5 * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 334c8e1a9eb8a..932cb5777f3c4 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -42,35 +42,35 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, unsigned int jx, struct SDL::quintuplets& quintupletsInGPU) { - unsigned int hits1[10]; - unsigned int hits2[10]; - - hits1[0] = quintupletsInGPU.hitIndices[10 * ix]; - hits1[1] = quintupletsInGPU.hitIndices[10 * ix + 1]; - hits1[2] = quintupletsInGPU.hitIndices[10 * ix + 2]; - hits1[3] = quintupletsInGPU.hitIndices[10 * ix + 3]; - hits1[4] = quintupletsInGPU.hitIndices[10 * ix + 4]; - hits1[5] = quintupletsInGPU.hitIndices[10 * ix + 5]; - hits1[6] = quintupletsInGPU.hitIndices[10 * ix + 6]; - hits1[7] = quintupletsInGPU.hitIndices[10 * ix + 7]; - hits1[8] = quintupletsInGPU.hitIndices[10 * ix + 8]; - hits1[9] = quintupletsInGPU.hitIndices[10 * ix + 9]; - - hits2[0] = quintupletsInGPU.hitIndices[10 * jx]; - hits2[1] = quintupletsInGPU.hitIndices[10 * jx + 1]; - hits2[2] = quintupletsInGPU.hitIndices[10 * jx + 2]; - hits2[3] = quintupletsInGPU.hitIndices[10 * jx + 3]; - hits2[4] = quintupletsInGPU.hitIndices[10 * jx + 4]; - hits2[5] = quintupletsInGPU.hitIndices[10 * jx + 5]; - hits2[6] = quintupletsInGPU.hitIndices[10 * jx + 6]; - hits2[7] = quintupletsInGPU.hitIndices[10 * jx + 7]; - hits2[8] = quintupletsInGPU.hitIndices[10 * jx + 8]; - hits2[9] = quintupletsInGPU.hitIndices[10 * jx + 9]; + unsigned int hits1[hits_T5]; + unsigned int hits2[hits_T5]; + + hits1[0] = quintupletsInGPU.hitIndices[hits_T5 * ix]; + hits1[1] = quintupletsInGPU.hitIndices[hits_T5 * ix + 1]; + hits1[2] = quintupletsInGPU.hitIndices[hits_T5 * ix + 2]; + hits1[3] = quintupletsInGPU.hitIndices[hits_T5 * ix + 3]; + hits1[4] = quintupletsInGPU.hitIndices[hits_T5 * ix + 4]; + hits1[5] = quintupletsInGPU.hitIndices[hits_T5 * ix + 5]; + hits1[6] = quintupletsInGPU.hitIndices[hits_T5 * ix + 6]; + hits1[7] = quintupletsInGPU.hitIndices[hits_T5 * ix + 7]; + hits1[8] = quintupletsInGPU.hitIndices[hits_T5 * ix + 8]; + hits1[9] = quintupletsInGPU.hitIndices[hits_T5 * ix + 9]; + + hits2[0] = quintupletsInGPU.hitIndices[hits_T5 * jx]; + hits2[1] = quintupletsInGPU.hitIndices[hits_T5 * jx + 1]; + hits2[2] = quintupletsInGPU.hitIndices[hits_T5 * jx + 2]; + hits2[3] = quintupletsInGPU.hitIndices[hits_T5 * jx + 3]; + hits2[4] = quintupletsInGPU.hitIndices[hits_T5 * jx + 4]; + hits2[5] = quintupletsInGPU.hitIndices[hits_T5 * jx + 5]; + hits2[6] = quintupletsInGPU.hitIndices[hits_T5 * jx + 6]; + hits2[7] = quintupletsInGPU.hitIndices[hits_T5 * jx + 7]; + hits2[8] = quintupletsInGPU.hitIndices[hits_T5 * jx + 8]; + hits2[9] = quintupletsInGPU.hitIndices[hits_T5 * jx + 9]; int nMatched = 0; - for (int i = 0; i < 10; i++) { + for (int i = 0; i < hits_T5; i++) { bool matched = false; - for (int j = 0; j < 10; j++) { + for (int j = 0; j < hits_T5; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -86,43 +86,43 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitspT5(unsigned int ix, unsigned int jx, struct SDL::pixelQuintuplets& pixelQuintupletsInGPU) { - unsigned int hits1[14]; - unsigned int hits2[14]; - - hits1[0] = pixelQuintupletsInGPU.hitIndices[14 * ix]; - hits1[1] = pixelQuintupletsInGPU.hitIndices[14 * ix + 1]; - hits1[2] = pixelQuintupletsInGPU.hitIndices[14 * ix + 2]; - hits1[3] = pixelQuintupletsInGPU.hitIndices[14 * ix + 3]; - hits1[4] = pixelQuintupletsInGPU.hitIndices[14 * ix + 4]; - hits1[5] = pixelQuintupletsInGPU.hitIndices[14 * ix + 5]; - hits1[6] = pixelQuintupletsInGPU.hitIndices[14 * ix + 6]; - hits1[7] = pixelQuintupletsInGPU.hitIndices[14 * ix + 7]; - hits1[8] = pixelQuintupletsInGPU.hitIndices[14 * ix + 8]; - hits1[9] = pixelQuintupletsInGPU.hitIndices[14 * ix + 9]; - hits1[10] = pixelQuintupletsInGPU.hitIndices[14 * ix + 10]; - hits1[11] = pixelQuintupletsInGPU.hitIndices[14 * ix + 11]; - hits1[12] = pixelQuintupletsInGPU.hitIndices[14 * ix + 12]; - hits1[13] = pixelQuintupletsInGPU.hitIndices[14 * ix + 13]; - - hits2[0] = pixelQuintupletsInGPU.hitIndices[14 * jx]; - hits2[1] = pixelQuintupletsInGPU.hitIndices[14 * jx + 1]; - hits2[2] = pixelQuintupletsInGPU.hitIndices[14 * jx + 2]; - hits2[3] = pixelQuintupletsInGPU.hitIndices[14 * jx + 3]; - hits2[4] = pixelQuintupletsInGPU.hitIndices[14 * jx + 4]; - hits2[5] = pixelQuintupletsInGPU.hitIndices[14 * jx + 5]; - hits2[6] = pixelQuintupletsInGPU.hitIndices[14 * jx + 6]; - hits2[7] = pixelQuintupletsInGPU.hitIndices[14 * jx + 7]; - hits2[8] = pixelQuintupletsInGPU.hitIndices[14 * jx + 8]; - hits2[9] = pixelQuintupletsInGPU.hitIndices[14 * jx + 9]; - hits2[10] = pixelQuintupletsInGPU.hitIndices[14 * jx + 10]; - hits2[11] = pixelQuintupletsInGPU.hitIndices[14 * jx + 11]; - hits2[12] = pixelQuintupletsInGPU.hitIndices[14 * jx + 12]; - hits2[13] = pixelQuintupletsInGPU.hitIndices[14 * jx + 13]; + unsigned int hits1[hits_pT5]; + unsigned int hits2[hits_pT5]; + + hits1[0] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix]; + hits1[1] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 1]; + hits1[2] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 2]; + hits1[3] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 3]; + hits1[4] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 4]; + hits1[5] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 5]; + hits1[6] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 6]; + hits1[7] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 7]; + hits1[8] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 8]; + hits1[9] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 9]; + hits1[10] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 10]; + hits1[11] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 11]; + hits1[12] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 12]; + hits1[13] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 13]; + + hits2[0] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx]; + hits2[1] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 1]; + hits2[2] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 2]; + hits2[3] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 3]; + hits2[4] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 4]; + hits2[5] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 5]; + hits2[6] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 6]; + hits2[7] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 7]; + hits2[8] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 8]; + hits2[9] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 9]; + hits2[10] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 10]; + hits2[11] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 11]; + hits2[12] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 12]; + hits2[13] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 13]; int nMatched = 0; - for (int i = 0; i < 14; i++) { + for (int i = 0; i < hits_pT5; i++) { bool matched = false; - for (int j = 0; j < 14; j++) { + for (int j = 0; j < hits_pT5; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -139,22 +139,22 @@ namespace SDL { unsigned int jx, struct SDL::pixelTriplets& pixelTripletsInGPU, int* matched) { - int phits1[4] = {-1, -1, -1, -1}; - int phits2[4] = {-1, -1, -1, -1}; - phits1[0] = pixelTripletsInGPU.hitIndices[10 * ix]; - phits1[1] = pixelTripletsInGPU.hitIndices[10 * ix + 1]; - phits1[2] = pixelTripletsInGPU.hitIndices[10 * ix + 2]; - phits1[3] = pixelTripletsInGPU.hitIndices[10 * ix + 3]; - - phits2[0] = pixelTripletsInGPU.hitIndices[10 * jx]; - phits2[1] = pixelTripletsInGPU.hitIndices[10 * jx + 1]; - phits2[2] = pixelTripletsInGPU.hitIndices[10 * jx + 2]; - phits2[3] = pixelTripletsInGPU.hitIndices[10 * jx + 3]; + int phits1[hits_pLS] = {-1, -1, -1, -1}; + int phits2[hits_pLS] = {-1, -1, -1, -1}; + phits1[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix]; + phits1[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 1]; + phits1[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 2]; + phits1[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 3]; + + phits2[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx]; + phits2[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 1]; + phits2[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 2]; + phits2[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 3]; int npMatched = 0; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < hits_pLS; i++) { bool pmatched = false; - for (int j = 0; j < 4; j++) { + for (int j = 0; j < hits_pLS; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -165,26 +165,26 @@ namespace SDL { } } - int hits1[6] = {-1, -1, -1, -1, -1, -1}; - int hits2[6] = {-1, -1, -1, -1, -1, -1}; - hits1[0] = pixelTripletsInGPU.hitIndices[10 * ix + 4]; - hits1[1] = pixelTripletsInGPU.hitIndices[10 * ix + 5]; - hits1[2] = pixelTripletsInGPU.hitIndices[10 * ix + 6]; - hits1[3] = pixelTripletsInGPU.hitIndices[10 * ix + 7]; - hits1[4] = pixelTripletsInGPU.hitIndices[10 * ix + 8]; - hits1[5] = pixelTripletsInGPU.hitIndices[10 * ix + 9]; - - hits2[0] = pixelTripletsInGPU.hitIndices[10 * jx + 4]; - hits2[1] = pixelTripletsInGPU.hitIndices[10 * jx + 5]; - hits2[2] = pixelTripletsInGPU.hitIndices[10 * jx + 6]; - hits2[3] = pixelTripletsInGPU.hitIndices[10 * jx + 7]; - hits2[4] = pixelTripletsInGPU.hitIndices[10 * jx + 8]; - hits2[5] = pixelTripletsInGPU.hitIndices[10 * jx + 9]; + int hits1[hits_T3] = {-1, -1, -1, -1, -1, -1}; + int hits2[hits_T3] = {-1, -1, -1, -1, -1, -1}; + hits1[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 4]; + hits1[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 5]; + hits1[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 6]; + hits1[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 7]; + hits1[4] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 8]; + hits1[5] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 9]; + + hits2[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 4]; + hits2[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 5]; + hits2[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 6]; + hits2[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 7]; + hits2[4] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 8]; + hits2[5] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 9]; int nMatched = 0; - for (int i = 0; i < 6; i++) { + for (int i = 0; i < hits_T3; i++) { bool tmatched = false; - for (int j = 0; j < 6; j++) { + for (int j = 0; j < hits_T3; j++) { if (hits1[i] == hits2[j]) { tmatched = true; break; @@ -235,7 +235,8 @@ namespace SDL { continue; int nMatched = checkHitsT5(ix, jx, quintupletsInGPU); - if (nMatched >= 7) { + const int minNHitsForDup_T5 = 7; + if (nMatched >= minNHitsForDup_T5) { if (score_rphisum1 >= score_rphisum2) { rmQuintupletFromMemory(quintupletsInGPU, ix); } else { @@ -306,7 +307,8 @@ namespace SDL { float dR2 = dEta * dEta + dPhi * dPhi; int nMatched = checkHitsT5(ix, jx, quintupletsInGPU); - if (dR2 < 0.001f || nMatched >= 5) { + const int minNHitsForDup_T5 = 5; + if (dR2 < 0.001f || nMatched >= minNHitsForDup_T5) { if (score_rphisum1 > score_rphisum2) { rmQuintupletFromMemory(quintupletsInGPU, ix, true); } else if (score_rphisum1 < score_rphisum2) { @@ -335,16 +337,20 @@ namespace SDL { int nMatched[2]; checkHitspT3(ix, jx, pixelTripletsInGPU, nMatched); - if ((nMatched[0] + nMatched[1]) >= 5) { + const int minNHitsForDup_pT3 = 5; + if ((nMatched[0] + nMatched[1]) >= minNHitsForDup_pT3) { // Check the layers - if (pixelTripletsInGPU.logicalLayers[5 * jx + 2] < pixelTripletsInGPU.logicalLayers[5 * ix + 2]) { + if (pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] < + pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2]) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[5 * ix + 2] == pixelTripletsInGPU.logicalLayers[5 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2] == + pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] && __H2F(pixelTripletsInGPU.score[ix]) > __H2F(pixelTripletsInGPU.score[jx])) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[5 * ix + 2] == pixelTripletsInGPU.logicalLayers[5 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2] == + pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] && (__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; @@ -370,7 +376,8 @@ namespace SDL { int nMatched = checkHitspT5(ix, jx, pixelQuintupletsInGPU); float score2 = __H2F(pixelQuintupletsInGPU.score[jx]); - if (nMatched >= 7) { + const int minNHitsForDup_pT5 = 7; + if (nMatched >= minNHitsForDup_pT5) { if (score1 > score2 or ((score1 == score2) and (ix > jx))) { rmPixelQuintupletFromMemory(pixelQuintupletsInGPU, ix); break; @@ -400,7 +407,7 @@ namespace SDL { if (secondpass && (!segmentsInGPU.isQuad[ix] || (segmentsInGPU.isDup[ix] & 1))) continue; - unsigned int phits1[4]; + unsigned int phits1[hits_pLS]; phits1[0] = segmentsInGPU.pLSHitsIdxs[ix].x; phits1[1] = segmentsInGPU.pLSHitsIdxs[ix].y; phits1[2] = segmentsInGPU.pLSHitsIdxs[ix].z; @@ -433,16 +440,16 @@ namespace SDL { else idxToRemove = ix; - unsigned int phits2[4]; + unsigned int phits2[hits_pLS]; phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x; phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y; phits2[2] = segmentsInGPU.pLSHitsIdxs[jx].z; phits2[3] = segmentsInGPU.pLSHitsIdxs[jx].w; int npMatched = 0; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < hits_pLS; i++) { bool pmatched = false; - for (int j = 0; j < 4; j++) { + for (int j = 0; j < hits_pLS; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -455,7 +462,8 @@ namespace SDL { break; } } - if (npMatched >= 3) { + const int minNHitsForDup_pLS = 3; + if (npMatched >= minNHitsForDup_pLS) { rmPixelSegmentFromMemory(segmentsInGPU, idxToRemove, secondpass); } if (secondpass) { diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 9eb11503123df..bdfb54330f342 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -399,16 +399,16 @@ std::vector SDL::LST::getHitIdxs(const short trackCandid unsigned int maxNHits = 0; if (trackCandidateType == 7) - maxNHits = 14; // pT5 + maxNHits = hits_pT5; // pT5 else if (trackCandidateType == 5) - maxNHits = 10; // pT3 + maxNHits = hits_pT3; // pT3 else if (trackCandidateType == 4) - maxNHits = 10; // T5 + maxNHits = hits_T5; // T5 else if (trackCandidateType == 8) - maxNHits = 4; // pLS + maxNHits = hits_pLS; // pLS for (unsigned int i = 0; i < maxNHits; i++) { - unsigned int hitIdxInGPU = TCHitIndices[14 * TCIdx + i]; + unsigned int hitIdxInGPU = TCHitIndices[hits_pT5 * TCIdx + i]; unsigned int hitIdx = (trackCandidateType == 8) ? hitIdxInGPU diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index aa63d51345a7f..5307b0c6986a3 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -275,13 +275,14 @@ namespace SDL { short side = modulesInGPU.sides[moduleIndex]; short rod = modulesInGPU.rods[moduleIndex]; - if ((subdet == Barrel and side != Center and layer == 3) or - (subdet == Barrel and side == NegZ and layer == 2 and rod > 5) or - (subdet == Barrel and side == PosZ and layer == 2 and rod < 8) or - (subdet == Barrel and side == NegZ and layer == 1 and rod > 9) or - (subdet == Barrel and side == PosZ and layer == 1 and rod < 4)) - return true; - else + if (subdet == Barrel) { + if ((side != Center and layer == 3) or (side == NegZ and layer == 2 and rod > 5) or + (side == PosZ and layer == 2 and rod < 8) or (side == NegZ and layer == 1 and rod > 9) or + (side == PosZ and layer == 1 and rod < 4)) + return true; + else + return false; + } else return false; }; @@ -372,9 +373,9 @@ namespace SDL { } else { drdz = 0; } - const float miniTilt = ((isTilted) ? 0.5f * pixelPSZpitch * drdz / alpaka::math::sqrt(acc, 1.f + drdz * drdz) / - moduleGapSize(modulesInGPU, moduleIndex) - : 0); + const float miniTilt2 = ((isTilted) ? (0.5f * 0.5f) * (pixelPSZpitch * pixelPSZpitch) * (drdz * drdz) / + (1.f + drdz * drdz) / moduleGapSize(modulesInGPU, moduleIndex) + : 0); // Compute luminous region requirement for endcap const float miniLum = alpaka::math::abs(acc, dPhi * deltaZLum / dz); // Balaji's new error @@ -391,8 +392,7 @@ namespace SDL { modulesInGPU.sides[moduleIndex] != Center) //all types of tilted modules { return miniSlope + - alpaka::math::sqrt( - acc, miniMuls * miniMuls + miniPVoff * miniPVoff + miniTilt * miniTilt * miniSlope * miniSlope); + alpaka::math::sqrt(acc, miniMuls * miniMuls + miniPVoff * miniPVoff + miniTilt2 * miniSlope * miniSlope); } // If not barrel, it is Endcap else { @@ -665,16 +665,14 @@ namespace SDL { float yUpper, float zUpper, float rtUpper) { - bool pass = true; dz = zLower - zUpper; const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; //const float sign = ((dz > 0) - (dz < 0)) * ((hitsInGPU.zs[lowerHitIndex] > 0) - (hitsInGPU.zs[lowerHitIndex] < 0)); const float sign = ((dz > 0) - (dz < 0)) * ((zLower > 0) - (zLower < 0)); const float invertedcrossercut = (alpaka::math::abs(acc, dz) > 2) * sign; - pass = pass and ((alpaka::math::abs(acc, dz) < dzCut) && (invertedcrossercut <= 0)); - if (not pass) - return pass; + if (not((alpaka::math::abs(acc, dz) < dzCut) && (invertedcrossercut <= 0))) + return false; float miniCut = 0; @@ -685,7 +683,7 @@ namespace SDL { // Cut #2: dphi difference // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3085 float xn = 0.f, yn = 0.f; // , zn = 0; - float shiftedRt; + float shiftedRt2; if (modulesInGPU.sides[lowerModuleIndex] != Center) // If barrel and not center it is tilted { // Shift the hits and calculate new xn, yn position @@ -713,7 +711,7 @@ namespace SDL { shiftedX = xn; shiftedY = yn; shiftedZ = zUpper; - shiftedRt = alpaka::math::sqrt(acc, xn * xn + yn * yn); + shiftedRt2 = xn * xn + yn * yn; dPhi = SDL::deltaPhi(acc, xLower, yLower, shiftedX, shiftedY); //function from Hit.cc noShiftedDphi = SDL::deltaPhi(acc, xLower, yLower, xUpper, yUpper); @@ -721,7 +719,7 @@ namespace SDL { shiftedX = xn; shiftedY = yn; shiftedZ = zLower; - shiftedRt = alpaka::math::sqrt(acc, xn * xn + yn * yn); + shiftedRt2 = xn * xn + yn * yn; dPhi = SDL::deltaPhi(acc, shiftedX, shiftedY, xUpper, yUpper); noShiftedDphi = SDL::deltaPhi(acc, xLower, yLower, xUpper, yUpper); } @@ -733,9 +731,8 @@ namespace SDL { noShiftedDphi = dPhi; } - pass = pass && (alpaka::math::abs(acc, dPhi) < miniCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) < miniCut)) + return false; // Cut #3: The dphi change going from lower Hit to upper Hit // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3076 @@ -749,8 +746,8 @@ namespace SDL { // But I still placed this check for safety. (TODO: After checking explicitly if not needed remove later?) // setdeltaPhiChange(lowerHit.rt() < upperHitMod.rt() ? lowerHit.deltaPhiChange(upperHitMod) : upperHitMod.deltaPhiChange(lowerHit)); - dPhiChange = (rtLower < shiftedRt) ? SDL::deltaPhiChange(acc, xLower, yLower, shiftedX, shiftedY) - : SDL::deltaPhiChange(acc, shiftedX, shiftedY, xLower, yLower); + dPhiChange = (rtLower * rtLower < shiftedRt2) ? SDL::deltaPhiChange(acc, xLower, yLower, shiftedX, shiftedY) + : SDL::deltaPhiChange(acc, shiftedX, shiftedY, xLower, yLower); noShiftedDphiChange = rtLower < rtUpper ? SDL::deltaPhiChange(acc, xLower, yLower, xUpper, yUpper) : SDL::deltaPhiChange(acc, xUpper, yUpper, xLower, yLower); } else { @@ -759,8 +756,8 @@ namespace SDL { // (i.e. the strip hit is shifted to be aligned in the line of sight from interaction point to pixel hit of PS module guaranteeing rt ordering) // But I still placed this check for safety. (TODO: After checking explicitly if not needed remove later?) - dPhiChange = (shiftedRt < rtUpper) ? SDL::deltaPhiChange(acc, shiftedX, shiftedY, xUpper, yUpper) - : SDL::deltaPhiChange(acc, xUpper, yUpper, shiftedX, shiftedY); + dPhiChange = (shiftedRt2 < rtUpper * rtUpper) ? SDL::deltaPhiChange(acc, shiftedX, shiftedY, xUpper, yUpper) + : SDL::deltaPhiChange(acc, xUpper, yUpper, shiftedX, shiftedY); noShiftedDphiChange = rtLower < rtUpper ? SDL::deltaPhiChange(acc, xLower, yLower, xUpper, yUpper) : SDL::deltaPhiChange(acc, xUpper, yUpper, xLower, yLower); } @@ -770,9 +767,10 @@ namespace SDL { noShiftedDphiChange = dPhiChange; } - pass = pass && (alpaka::math::abs(acc, dPhiChange) < miniCut); + if (not(alpaka::math::abs(acc, dPhiChange) < miniCut)) + return false; noShiftedDz = 0; // not used anywhere - return pass; + return true; }; template @@ -799,8 +797,6 @@ namespace SDL { float yUpper, float zUpper, float rtUpper) { - bool pass = true; - // There are series of cuts that applies to mini-doublet in a "endcap" region // Cut #1 : dz cut. The dz difference can't be larger than 1cm. (max separation is 4mm for modules in the endcap) // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3093 @@ -810,16 +806,14 @@ namespace SDL { const float dzCut = 1.f; - pass = pass && (alpaka::math::abs(acc, dz) < dzCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dz) < dzCut)) + return false; // Cut #2 : drt cut. The dz difference can't be larger than 1cm. (max separation is 4mm for modules in the endcap) // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3100 const float drtCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; drt = rtLower - rtUpper; - pass = pass && (alpaka::math::abs(acc, drt) < drtCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, drt) < drtCut)) + return false; // The new scheme shifts strip hits to be "aligned" along the line of sight from interaction point to the pixel hit (if it is PS modules) float xn = 0, yn = 0, zn = 0; @@ -878,9 +872,8 @@ namespace SDL { ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, dPhi, dz) : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, dPhi, dz); - pass = pass && (alpaka::math::abs(acc, dPhi) < miniCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) < miniCut)) + return false; // Cut #4: Another cut on the dphi after some modification // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3119-L3124 @@ -888,9 +881,10 @@ namespace SDL { float dzFrac = alpaka::math::abs(acc, dz) / alpaka::math::abs(acc, zLower); dPhiChange = dPhi / dzFrac * (1.f + dzFrac); noShiftedDphichange = noShiftedDphi / dzFrac * (1.f + dzFrac); - pass = pass && (alpaka::math::abs(acc, dPhiChange) < miniCut); + if (not(alpaka::math::abs(acc, dPhiChange) < miniCut)) + return false; noShiftedDz = 0; // not used anywhere - return pass; + return true; }; struct createMiniDoubletsInGPUv2 { @@ -1030,11 +1024,11 @@ namespace SDL { if (module_eta < 0.75) eta_number = 0; - else if (module_eta > 0.75 && module_eta < 1.5) + else if (module_eta < 1.5) eta_number = 1; - else if (module_eta > 1.5 && module_eta < 2.25) + else if (module_eta < 2.25) eta_number = 2; - else if (module_eta > 2.25 && module_eta < 3) + else if (module_eta < 3) eta_number = 3; else eta_number = -1; diff --git a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h index a786e249eb664..ad6c986e80dec 100644 --- a/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h +++ b/RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h @@ -104,13 +104,12 @@ namespace T5DNN { mdsInGPU.anchorZ[mdIndex5], // outer T3 anchor hit 5 z (t3_4_z) alpaka::math::sqrt(acc, x5 * x5 + y5 * y5), // outer T3 anchor hit 5 r (t3_4_r) float(modulesInGPU.layers[lowerModuleIndex5] + 6 * is_endcap5), // outer T3 anchor hit 5 layer (t3_4_layer) - SDL::temp_log10( - acc, (innerRadius + outerRadius) * SDL::magnetic_field * 1.602f / (2 * 100 * 5.39f)), // T5 pT (t5_pt) - mdsInGPU.anchorEta[md_idx_for_t5_eta_phi], // T5 eta (t5_eta) - mdsInGPU.anchorPhi[md_idx_for_t5_eta_phi], // T5 phi (t5_phi) - SDL::temp_log10(acc, innerRadius), // T5 inner radius (t5_innerRadius) - SDL::temp_log10(acc, bridgeRadius), // T5 bridge radius (t5_bridgeRadius) - SDL::temp_log10(acc, outerRadius) // T5 outer radius (t5_outerRadius) + SDL::temp_log10(acc, (innerRadius + outerRadius) * SDL::k2Rinv1GeVf), // T5 pT (t5_pt) + mdsInGPU.anchorEta[md_idx_for_t5_eta_phi], // T5 eta (t5_eta) + mdsInGPU.anchorPhi[md_idx_for_t5_eta_phi], // T5 phi (t5_phi) + SDL::temp_log10(acc, innerRadius), // T5 inner radius (t5_innerRadius) + SDL::temp_log10(acc, bridgeRadius), // T5 bridge radius (t5_bridgeRadius) + SDL::temp_log10(acc, outerRadius) // T5 outer radius (t5_outerRadius) }; // (0): Linear(in_features=38, out_features=32, bias=True) => x = x*W_T + b diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index d68e9ff85a469..72db118bacd33 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -115,9 +115,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), isDup_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), partOfPT5_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * 5, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * 10, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * 5, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * layers_pT3, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * hits_pT3, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * layers_pT3, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), centerY_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), pixelRadiusError_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), @@ -166,37 +166,45 @@ namespace SDL { pixelTripletsInGPU.centerX[pixelTripletIndex] = __F2H(centerX); pixelTripletsInGPU.centerY[pixelTripletIndex] = __F2H(centerY); - pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex] = 0; - pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex + 1] = 0; - pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex + 2] = tripletsInGPU.logicalLayers[tripletIndex * 3]; - pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex + 3] = tripletsInGPU.logicalLayers[tripletIndex * 3 + 1]; - pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex + 4] = tripletsInGPU.logicalLayers[tripletIndex * 3 + 2]; - - pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex] = + pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex] = 0; + pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 1] = 0; + pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 2] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3]; + pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 3] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 1]; + pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 4] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 2]; + + pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex + 1] = + pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex + 2] = - tripletsInGPU.lowerModuleIndices[3 * tripletIndex]; - pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex + 3] = - tripletsInGPU.lowerModuleIndices[3 * tripletIndex + 1]; - pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex + 4] = - tripletsInGPU.lowerModuleIndices[3 * tripletIndex + 2]; + pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 2] = + tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex]; + pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 3] = + tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 1]; + pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 4] = + tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 2]; unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 4] = tripletsInGPU.hitIndices[6 * tripletIndex]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 5] = tripletsInGPU.hitIndices[6 * tripletIndex + 1]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 6] = tripletsInGPU.hitIndices[6 * tripletIndex + 2]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 7] = tripletsInGPU.hitIndices[6 * tripletIndex + 3]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 8] = tripletsInGPU.hitIndices[6 * tripletIndex + 4]; - pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex + 9] = tripletsInGPU.hitIndices[6 * tripletIndex + 5]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 4] = tripletsInGPU.hitIndices[hits_T3 * tripletIndex]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 5] = + tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 1]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 6] = + tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 2]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 7] = + tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 3]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 8] = + tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 4]; + pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 9] = + tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 5]; pixelTripletsInGPU.rPhiChiSquared[pixelTripletIndex] = rPhiChiSquared; pixelTripletsInGPU.rPhiChiSquaredInwards[pixelTripletIndex] = rPhiChiSquaredInwards; pixelTripletsInGPU.rzChiSquared[pixelTripletIndex] = rzChiSquared; @@ -243,11 +251,11 @@ namespace SDL { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; - unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; + unsigned int firstMDIndex = segmentsInGPU.mdIndices[layers_LS * innerSegmentIndex]; + unsigned int secondMDIndex = segmentsInGPU.mdIndices[layers_LS * innerSegmentIndex + 1]; - unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex]; - unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; + unsigned int thirdMDIndex = segmentsInGPU.mdIndices[layers_LS * outerSegmentIndex]; + unsigned int fourthMDIndex = segmentsInGPU.mdIndices[layers_LS * outerSegmentIndex + 1]; if (outerInnerLowerModuleSubdet == SDL::Barrel and (outerOuterLowerModuleSubdet == SDL::Barrel or outerOuterLowerModuleSubdet == SDL::Endcap)) { @@ -383,7 +391,7 @@ namespace SDL { //compute chi squared float c = g * g + f * f - radius * radius; float chiSquared = 0.f; - float absArctanSlope, angleM, xPrime, yPrime, sigma; + float absArctanSlope, angleM, xPrime, yPrime, sigma2; for (size_t i = 0; i < nPoints; i++) { absArctanSlope = ((slopes[i] != SDL::SDL_INF) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) : 0.5f * float(M_PI)); @@ -406,10 +414,9 @@ namespace SDL { xPrime = xs[i]; yPrime = ys[i]; } - sigma = 2 * alpaka::math::sqrt( - acc, (xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); + sigma2 = 4 * ((xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); chiSquared += (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) * - (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / (sigma * sigma); + (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / sigma2; } return chiSquared; }; @@ -427,8 +434,8 @@ namespace SDL { float delta1[3]{}, delta2[3]{}, slopes[3]; bool isFlat[3]{}; float chiSquared = 0; - float inv1 = 0.01f / 0.009f; - float inv2 = 0.15f / 0.009f; + float inv1 = widthPS / width2S; + float inv2 = pixelPSZpitch / width2S; for (size_t i = 0; i < 3; i++) { ModuleType moduleType = modulesInGPU.moduleType[lowerModuleIndices[i]]; short moduleSubdet = modulesInGPU.subdets[lowerModuleIndices[i]]; @@ -750,7 +757,7 @@ namespace SDL { float pixelSegmentPz, int pixelSegmentCharge) { float residual = 0; - float error = 0; + float error2 = 0; float RMSE = 0; float Px = pixelSegmentPx, Py = pixelSegmentPy, Pz = pixelSegmentPz; @@ -760,10 +767,9 @@ namespace SDL { float z1 = zPix[1] / 100; float r1 = rtPix[1] / 100; - float Bz = SDL::magnetic_field; - float a = -0.299792 * Bz * charge; + float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units - for (size_t i = 0; i < 3; i++) { + for (size_t i = 0; i < layers_T3; i++) { float zsi = zs[i] / 100; float rtsi = rts[i] / 100; uint16_t lowerModuleIndex = lowerModuleIndices[i]; @@ -803,21 +809,21 @@ namespace SDL { //PS Modules if (moduleType == 0) { - error = 0.15f; + error2 = pixelPSZpitch * pixelPSZpitch; } else //2S modules { - error = 5.0f; + error2 = strip2SZpitch * strip2SZpitch; } //special dispensation to tilted PS modules! if (moduleType == 0 and moduleSubdet == SDL::Barrel and moduleSide != Center) { float drdz = modulesInGPU.drdzs[lowerModuleIndex]; - error /= alpaka::math::sqrt(acc, 1 + drdz * drdz); + error2 /= (1 + drdz * drdz); } - RMSE += (residual * residual) / (error * error); + RMSE += (residual * residual) / error2; } - RMSE = alpaka::math::sqrt(acc, 0.2f * RMSE); //the constant doesn't really matter.... + RMSE = alpaka::math::sqrt(acc, 0.2f * RMSE); // Divided by the degree of freedom 5. return RMSE; }; @@ -840,14 +846,12 @@ namespace SDL { float& rPhiChiSquared, float& rPhiChiSquaredInwards, bool runChiSquaredCuts = true) { - bool pass = true; - //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet uint16_t pixelModuleIndex = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[3 * tripletIndex]; - uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[3 * tripletIndex + 1]; - uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[3 * tripletIndex + 2]; + uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex]; + uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 1]; + uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 2]; { //placeholder @@ -855,68 +859,66 @@ namespace SDL { float zLo, zHi, rtLo, rtHi, zLoPointed, zHiPointed, sdlCut, betaInCut, betaOutCut, deltaBetaCut, kZ; // pixel segment vs inner segment of the triplet - pass = pass and runPixelTrackletDefaultAlgopT3(acc, - modulesInGPU, - rangesInGPU, - mdsInGPU, - segmentsInGPU, - pixelModuleIndex, - lowerModuleIndex, - middleModuleIndex, - pixelSegmentIndex, - tripletsInGPU.segmentIndices[2 * tripletIndex], - zOut, - rtOut, - deltaPhiPos, - deltaPhi, - betaIn, - betaOut, - pt_beta, - zLo, - zHi, - rtLo, - rtHi, - zLoPointed, - zHiPointed, - sdlCut, - betaInCut, - betaOutCut, - deltaBetaCut, - kZ); - if (not pass) - return pass; + if (not runPixelTrackletDefaultAlgopT3(acc, + modulesInGPU, + rangesInGPU, + mdsInGPU, + segmentsInGPU, + pixelModuleIndex, + lowerModuleIndex, + middleModuleIndex, + pixelSegmentIndex, + tripletsInGPU.segmentIndices[layers_LS * tripletIndex], + zOut, + rtOut, + deltaPhiPos, + deltaPhi, + betaIn, + betaOut, + pt_beta, + zLo, + zHi, + rtLo, + rtHi, + zLoPointed, + zHiPointed, + sdlCut, + betaInCut, + betaOutCut, + deltaBetaCut, + kZ)) + return false; //pixel segment vs outer segment of triplet - pass = pass and runPixelTrackletDefaultAlgopT3(acc, - modulesInGPU, - rangesInGPU, - mdsInGPU, - segmentsInGPU, - pixelModuleIndex, - middleModuleIndex, - upperModuleIndex, - pixelSegmentIndex, - tripletsInGPU.segmentIndices[2 * tripletIndex + 1], - zOut, - rtOut, - deltaPhiPos, - deltaPhi, - betaIn, - betaOut, - pt_beta, - zLo, - zHi, - rtLo, - rtHi, - zLoPointed, - zHiPointed, - sdlCut, - betaInCut, - betaOutCut, - deltaBetaCut, - kZ); - if (not pass) - return pass; + if (not runPixelTrackletDefaultAlgopT3(acc, + modulesInGPU, + rangesInGPU, + mdsInGPU, + segmentsInGPU, + pixelModuleIndex, + middleModuleIndex, + upperModuleIndex, + pixelSegmentIndex, + tripletsInGPU.segmentIndices[layers_LS * tripletIndex + 1], + zOut, + rtOut, + deltaPhiPos, + deltaPhi, + betaIn, + betaOut, + pt_beta, + zLo, + zHi, + rtLo, + rtHi, + zLoPointed, + zHiPointed, + sdlCut, + betaInCut, + betaOutCut, + deltaBetaCut, + kZ)) + return false; } //pt matching between the pixel ptin and the triplet circle pt @@ -932,8 +934,8 @@ namespace SDL { float pixelF = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; float pixelRadiusPCA = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; - unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; + unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[layers_pLS * pixelSegmentIndex]; + unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[layers_pLS * pixelSegmentIndex + 1]; pixelRadius = pixelSegmentPt * kR1GeVf; pixelRadiusError = pixelSegmentPtError * kR1GeVf; @@ -944,35 +946,37 @@ namespace SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * tripletInnerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * tripletOuterSegmentIndex + 1]; - float xs[3] = {mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; - float ys[3] = {mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; + float xs[layers_T3] = { + mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; + float ys[layers_T3] = { + mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; float g, f; tripletRadius = tripletsInGPU.circleRadius[tripletIndex]; g = tripletsInGPU.circleCenterX[tripletIndex]; f = tripletsInGPU.circleCenterY[tripletIndex]; - pass = pass and passRadiusCriterion(acc, - modulesInGPU, - pixelRadius, - pixelRadiusError, - tripletRadius, - lowerModuleIndex, - middleModuleIndex, - upperModuleIndex); - if (not pass) - return pass; + if (not passRadiusCriterion(acc, + modulesInGPU, + pixelRadius, + pixelRadiusError, + tripletRadius, + lowerModuleIndex, + middleModuleIndex, + upperModuleIndex)) + return false; - uint16_t lowerModuleIndices[3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; + uint16_t lowerModuleIndices[layers_T3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - float rts[3] = { + float rts[layers_T3] = { mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex]}; - float zs[3] = {mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; - float rtPix[2] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float xPix[2] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[2] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; - float zPix[2] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float zs[layers_T3] = { + mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; + float rtPix[layers_pLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float xPix[layers_pLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[layers_pLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float zPix[layers_pLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; rzChiSquared = computePT3RZChiSquared(acc, modulesInGPU, @@ -990,10 +994,9 @@ namespace SDL { pixelSegmentPy, pixelSegmentPz, pixelSegmentCharge); - pass = pass and - passPT3RZChiSquaredCuts(modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rzChiSquared); - if (not pass) - return pass; + if (not passPT3RZChiSquaredCuts( + modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rzChiSquared)) + return false; } else { rzChiSquared = -1; } @@ -1002,25 +1005,23 @@ namespace SDL { computePT3RPhiChiSquared(acc, modulesInGPU, lowerModuleIndices, pixelG, pixelF, pixelRadiusPCA, xs, ys); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - pass = pass and passPT3RPhiChiSquaredCuts( - modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rPhiChiSquared); - if (not pass) - return pass; + if (not passPT3RPhiChiSquaredCuts( + modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rPhiChiSquared)) + return false; } - float xPix[2] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[2] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float xPix[layers_pLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[layers_pLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; rPhiChiSquaredInwards = computePT3RPhiChiSquaredInwards(modulesInGPU, g, f, tripletRadius, xPix, yPix); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - pass = pass and passPT3RPhiChiSquaredInwardsCuts( - modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rPhiChiSquaredInwards); - if (not pass) - return pass; + if (not passPT3RPhiChiSquaredInwardsCuts( + modulesInGPU, lowerModuleIndex, middleModuleIndex, upperModuleIndex, rPhiChiSquaredInwards)) + return false; } centerX = 0; centerY = 0; - return pass; + return true; }; struct createPixelTripletsInGPUFromMapv2 { @@ -1290,8 +1291,6 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut) // pixel to BB and BE segments { - bool pass = true; - bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; @@ -1314,10 +1313,8 @@ namespace SDL { float rt_InOut = rt_InUp; - pass = - pass and (alpaka::math::abs(acc, SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutLo, y_OutLo)) <= 0.5f * float(M_PI)); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutLo, y_OutLo)) <= 0.5f * float(M_PI))) + return false; unsigned int pixelSegmentArrayIndex = innerSegmentIndex - rangesInGPU.segmentModuleIndices[pixelModuleIndex]; float ptIn = segmentsInGPU.ptIn[pixelSegmentArrayIndex]; @@ -1346,9 +1343,8 @@ namespace SDL { zLo = z_InUp + (z_InUp - deltaZLum) * (rtRatio_OutLoInOut - 1.f) * (z_InUp > 0.f ? 1.f : dzDrtScale) - (zpitch_InOut + zpitch_OutLo); //slope-correction only on outer end - pass = pass and ((z_OutLo >= zLo) && (z_OutLo <= zHi)); - if (not pass) - return pass; + if (not((z_OutLo >= zLo) && (z_OutLo <= zHi))) + return false; const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); @@ -1358,8 +1354,7 @@ namespace SDL { float drt_InSeg = rt_InOut - rt_InLo; - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * - (r3_InUp / rt_InUp); + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float dzErr = (drt_OutLo_InUp * drt_OutLo_InUp) * (etaErr * etaErr) * cosh2Eta; @@ -1378,9 +1373,8 @@ namespace SDL { zLoPointed = z_InUp + dzMean - zWindow; zHiPointed = z_InUp + dzMean + zWindow; - pass = pass and ((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed)); - if (not pass) - return pass; + if (not((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed))) + return false; const float sdlPVoff = 0.1f / rt_OutLo; sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); @@ -1398,9 +1392,8 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + return false; //lots of array accesses below this... @@ -1493,10 +1486,9 @@ namespace SDL { betaOutRHmin *= betaOutMMSF; betaOutRHmax *= betaOutMMSF; - const float dBetaMuls = - sdlThetaMulsF * 4.f / - alpaka::math::min( - acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + float min_ptBeta_ptBetaMax = alpaka::math::min( + acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + const float dBetaMuls2 = sdlThetaMulsF2 * 16.f / (min_ptBeta_ptBetaMax * min_ptBeta_ptBetaMax); const float alphaInAbsReg = alpaka::math::max(acc, alpaka::math::abs(acc, alpha_InLo), @@ -1528,15 +1520,14 @@ namespace SDL { //FIXME: need faster version betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * k2Rinv1GeVf / ptCut, sinAlphaMax)) + - (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - pass = pass and (alpaka::math::abs(acc, betaOut) < betaOutCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + return false; const float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, drt_InSeg); const float dBetaCut2 = - (dBetaRes * dBetaRes * 2.0f + dBetaMuls * dBetaMuls + dBetaLum2 + dBetaRIn2 + dBetaROut2 + + (dBetaRes * dBetaRes * 2.0f + dBetaMuls2 + dBetaLum2 + dBetaRIn2 + dBetaROut2 + 0.25f * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax)) * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax))); @@ -1545,9 +1536,10 @@ namespace SDL { #ifdef CUT_VALUE_DEBUG deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); #endif - pass = pass and (dBeta * dBeta <= dBetaCut2); + if (not(dBeta * dBeta <= dBetaCut2)) + return false; - return pass; + return true; }; template @@ -1581,15 +1573,13 @@ namespace SDL { float& deltaBetaCut, float& kZ) // pixel to EE segments { - bool pass = true; bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); float z_InUp = mdsInGPU.anchorZ[secondMDIndex]; float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; - pass = pass and (z_InUp * z_OutLo > 0); - if (not pass) - return pass; + if (not(z_InUp * z_OutLo > 0)) + return false; float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; float rt_InUp = mdsInGPU.anchorRt[secondMDIndex]; @@ -1645,16 +1635,14 @@ namespace SDL { rtHi = rt_InUp * (1.f + (z_OutLo - z_InUp + zGeom1) / zInForHi) + rtGeom1; // Cut #2: rt condition - pass = pass and ((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi)); - if (not pass) - return pass; + if (not((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi))) + return false; const float dzOutInAbs = alpaka::math::abs(acc, z_OutLo - z_InUp); const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); - const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ( (cosh2Eta - 1.f) * (cosh2Eta - 1.f) ); + const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ((cosh2Eta - 1.f) * (cosh2Eta - 1.f)); const float r3_InUp = alpaka::math::sqrt(acc, z_InUp * z_InUp + rt_InUp * rt_InUp); - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * - (r3_InUp / rt_InUp); + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float drtErr = (etaErr * etaErr) * multDzDr2; @@ -1674,9 +1662,8 @@ namespace SDL { const float rtHi_point = rt_InUp + drtMean + rtWindow; // Cut #3: rt-z pointed - pass = pass and ((rt_OutLo >= rtLo_point) && (rt_OutLo <= rtHi_point)); - if (not pass) - return pass; + if (not((rt_OutLo >= rtLo_point) && (rt_OutLo <= rtHi_point))) + return false; const float alpha1GeV_OutLo = alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * k2Rinv1GeVf / ptCut, sinAlphaMax)); @@ -1694,9 +1681,8 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + return false; float alpha_InLo = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); float alpha_OutLo = __H2F(segmentsInGPU.dPhiChanges[outerSegmentIndex]); @@ -1784,10 +1770,9 @@ namespace SDL { betaOutRHmin *= betaOutMMSF; betaOutRHmax *= betaOutMMSF; - const float dBetaMuls = - sdlThetaMulsF * 4.f / - alpaka::math::min( - acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + float min_ptBeta_ptBetaMax = alpaka::math::min( + acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + const float dBetaMuls2 = sdlThetaMulsF2 * 16.f / (min_ptBeta_ptBetaMax * min_ptBeta_ptBetaMax); const float alphaInAbsReg = alpaka::math::max(acc, @@ -1821,18 +1806,17 @@ namespace SDL { betaOutCut = alpaka::math::asin( acc, alpaka::math::min(acc, drt_tl_axis * k2Rinv1GeVf / ptCut, sinAlphaMax)) //FIXME: need faster version - + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); + + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - pass = pass and (alpaka::math::abs(acc, betaOut) < betaOutCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + return false; float drt_InSeg = rt_InUp - rt_InLo; const float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, drt_InSeg); const float dBetaCut2 = - (dBetaRes * dBetaRes * 2.0f + dBetaMuls * dBetaMuls + dBetaLum2 + dBetaRIn2 + dBetaROut2 + + (dBetaRes * dBetaRes * 2.0f + dBetaMuls2 + dBetaLum2 + dBetaRIn2 + dBetaROut2 + 0.25f * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax)) * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax))); @@ -1840,8 +1824,10 @@ namespace SDL { #ifdef CUT_VALUE_DEBUG deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); #endif - pass = pass and (dBeta * dBeta <= dBetaCut2); - return pass; + if (not(dBeta * dBeta <= dBetaCut2)) + return false; + + return true; }; } // namespace SDL #endif @@ -1939,9 +1925,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), eta_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), phi_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * 7, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * 14, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * 7, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * layers_pT5, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * hits_pT5, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * layers_pT5, queue)), pixelRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), quintupletRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), @@ -1985,47 +1971,62 @@ namespace SDL { pixelQuintupletsInGPU.centerX[pixelQuintupletIndex] = __F2H(centerX); pixelQuintupletsInGPU.centerY[pixelQuintupletIndex] = __F2H(centerY); - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex] = 0; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 1] = 0; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 2] = quintupletsInGPU.logicalLayers[T5Index * 5]; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 3] = quintupletsInGPU.logicalLayers[T5Index * 5 + 1]; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 4] = quintupletsInGPU.logicalLayers[T5Index * 5 + 2]; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 5] = quintupletsInGPU.logicalLayers[T5Index * 5 + 3]; - pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex + 6] = quintupletsInGPU.logicalLayers[T5Index * 5 + 4]; - - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex] = + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex] = 0; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 1] = 0; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 2] = + quintupletsInGPU.logicalLayers[T5Index * layers_T5]; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 3] = + quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 1]; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 2]; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 3]; + pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 4]; + + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 2] = - quintupletsInGPU.lowerModuleIndices[T5Index * 5]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 3] = - quintupletsInGPU.lowerModuleIndices[T5Index * 5 + 1]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 4] = - quintupletsInGPU.lowerModuleIndices[T5Index * 5 + 2]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 5] = - quintupletsInGPU.lowerModuleIndices[T5Index * 5 + 3]; - pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex + 6] = - quintupletsInGPU.lowerModuleIndices[T5Index * 5 + 4]; - - unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelIndex]; - unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelIndex + 1]; - - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 4] = quintupletsInGPU.hitIndices[10 * T5Index]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 5] = quintupletsInGPU.hitIndices[10 * T5Index + 1]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 6] = quintupletsInGPU.hitIndices[10 * T5Index + 2]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 7] = quintupletsInGPU.hitIndices[10 * T5Index + 3]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 8] = quintupletsInGPU.hitIndices[10 * T5Index + 4]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 9] = quintupletsInGPU.hitIndices[10 * T5Index + 5]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 10] = quintupletsInGPU.hitIndices[10 * T5Index + 6]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 11] = quintupletsInGPU.hitIndices[10 * T5Index + 7]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 12] = quintupletsInGPU.hitIndices[10 * T5Index + 8]; - pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex + 13] = quintupletsInGPU.hitIndices[10 * T5Index + 9]; + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 2] = + quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5]; + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 3] = + quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 1]; + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 2]; + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 3]; + pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 4]; + + unsigned int pixelInnerMD = segmentsInGPU.mdIndices[layers_pLS * pixelIndex]; + unsigned int pixelOuterMD = segmentsInGPU.mdIndices[layers_pLS * pixelIndex + 1]; + + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 1]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 2]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 7] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 3]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 8] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 4]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 9] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 5]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 10] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 6]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 11] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 7]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 12] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 8]; + pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 13] = + quintupletsInGPU.hitIndices[hits_T5 * T5Index + 9]; pixelQuintupletsInGPU.rzChiSquared[pixelQuintupletIndex] = rzChiSquared; pixelQuintupletsInGPU.rPhiChiSquared[pixelQuintupletIndex] = rPhiChiSquared; @@ -2229,7 +2230,7 @@ namespace SDL { */ float c = g * g + f * f - radius * radius; float chiSquared = 0.f; - float absArctanSlope, angleM, xPrime, yPrime, sigma; + float absArctanSlope, angleM, xPrime, yPrime, sigma2; for (size_t i = 0; i < nPoints; i++) { absArctanSlope = ((slopes[i] != SDL::SDL_INF) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) : 0.5f * float(M_PI)); @@ -2251,10 +2252,9 @@ namespace SDL { xPrime = xs[i]; yPrime = ys[i]; } - sigma = 2 * alpaka::math::sqrt( - acc, (xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); + sigma2 = 4 * ((xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); chiSquared += (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) * - (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / (sigma * sigma); + (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / (sigma2); } return chiSquared; }; @@ -2279,9 +2279,9 @@ namespace SDL { */ ModuleType moduleType; short moduleSubdet, moduleSide; - float inv1 = 0.01f / 0.009f; - float inv2 = 0.15f / 0.009f; - float inv3 = 2.4f / 0.009f; + float inv1 = widthPS / width2S; + float inv2 = pixelPSZpitch / width2S; + float inv3 = stripPSZpitch / width2S; for (size_t i = 0; i < nPoints; i++) { moduleType = modulesInGPU.moduleType[lowerModuleIndices[i]]; moduleSubdet = modulesInGPU.subdets[lowerModuleIndices[i]]; @@ -2491,32 +2491,29 @@ namespace SDL { float& centerX, float& centerY, unsigned int pixelSegmentArrayIndex) { - bool pass = true; - unsigned int T5InnerT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex]; unsigned int T5OuterT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1]; float pixelRadiusTemp, pixelRadiusError, tripletRadius, rPhiChiSquaredTemp, rzChiSquaredTemp, rPhiChiSquaredInwardsTemp, centerXTemp, centerYTemp; - pass = pass and runPixelTripletDefaultAlgo(acc, - modulesInGPU, - rangesInGPU, - mdsInGPU, - segmentsInGPU, - tripletsInGPU, - pixelSegmentIndex, - T5InnerT3Index, - pixelRadiusTemp, - pixelRadiusError, - tripletRadius, - centerXTemp, - centerYTemp, - rzChiSquaredTemp, - rPhiChiSquaredTemp, - rPhiChiSquaredInwardsTemp, - false); - if (not pass) + if (not runPixelTripletDefaultAlgo(acc, + modulesInGPU, + rangesInGPU, + mdsInGPU, + segmentsInGPU, + tripletsInGPU, + pixelSegmentIndex, + T5InnerT3Index, + pixelRadiusTemp, + pixelRadiusError, + tripletRadius, + centerXTemp, + centerYTemp, + rzChiSquaredTemp, + rPhiChiSquaredTemp, + rPhiChiSquaredInwardsTemp, + false)) return false; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * T5InnerT3Index]; @@ -2532,53 +2529,52 @@ namespace SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex]; - uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 1]; - uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 2]; - uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 3]; - uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 4]; + uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex]; + uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 1]; + uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 2]; + uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 3]; + uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 4]; - uint16_t lowerModuleIndices[5] = { + uint16_t lowerModuleIndices[layers_T5] = { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; - float zPix[2] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; - float rtPix[2] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float zs[5] = {mdsInGPU.anchorZ[firstMDIndex], - mdsInGPU.anchorZ[secondMDIndex], - mdsInGPU.anchorZ[thirdMDIndex], - mdsInGPU.anchorZ[fourthMDIndex], - mdsInGPU.anchorZ[fifthMDIndex]}; - float rts[5] = {mdsInGPU.anchorRt[firstMDIndex], - mdsInGPU.anchorRt[secondMDIndex], - mdsInGPU.anchorRt[thirdMDIndex], - mdsInGPU.anchorRt[fourthMDIndex], - mdsInGPU.anchorRt[fifthMDIndex]}; + float zPix[layers_pLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[layers_pLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float zs[layers_T5] = {mdsInGPU.anchorZ[firstMDIndex], + mdsInGPU.anchorZ[secondMDIndex], + mdsInGPU.anchorZ[thirdMDIndex], + mdsInGPU.anchorZ[fourthMDIndex], + mdsInGPU.anchorZ[fifthMDIndex]}; + float rts[layers_T5] = {mdsInGPU.anchorRt[firstMDIndex], + mdsInGPU.anchorRt[secondMDIndex], + mdsInGPU.anchorRt[thirdMDIndex], + mdsInGPU.anchorRt[fourthMDIndex], + mdsInGPU.anchorRt[fifthMDIndex]}; 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, - lowerModuleIndex3, - lowerModuleIndex4, - lowerModuleIndex5, - rzChiSquared); - if (not pass) - return pass; + if (not passPT5RZChiSquaredCuts(modulesInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + lowerModuleIndex5, + rzChiSquared)) + return false; } //outer T5 - float xs[5] = {mdsInGPU.anchorX[firstMDIndex], - mdsInGPU.anchorX[secondMDIndex], - mdsInGPU.anchorX[thirdMDIndex], - mdsInGPU.anchorX[fourthMDIndex], - mdsInGPU.anchorX[fifthMDIndex]}; - float ys[5] = {mdsInGPU.anchorY[firstMDIndex], - mdsInGPU.anchorY[secondMDIndex], - mdsInGPU.anchorY[thirdMDIndex], - mdsInGPU.anchorY[fourthMDIndex], - mdsInGPU.anchorY[fifthMDIndex]}; + float xs[layers_T5] = {mdsInGPU.anchorX[firstMDIndex], + mdsInGPU.anchorX[secondMDIndex], + mdsInGPU.anchorX[thirdMDIndex], + mdsInGPU.anchorX[fourthMDIndex], + mdsInGPU.anchorX[fifthMDIndex]}; + float ys[layers_T5] = {mdsInGPU.anchorY[firstMDIndex], + mdsInGPU.anchorY[secondMDIndex], + mdsInGPU.anchorY[thirdMDIndex], + mdsInGPU.anchorY[fourthMDIndex], + mdsInGPU.anchorY[fifthMDIndex]}; //get the appropriate radii and centers centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; @@ -2593,15 +2589,14 @@ namespace SDL { computePT5RPhiChiSquared(acc, modulesInGPU, lowerModuleIndices, centerX, centerY, pixelRadius, xs, ys); if (pixelRadius < 5.0f * kR1GeVf) { - pass = pass and passPT5RPhiChiSquaredCuts(modulesInGPU, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex3, - lowerModuleIndex4, - lowerModuleIndex5, - rPhiChiSquared); - if (not pass) - return pass; + if (not passPT5RPhiChiSquaredCuts(modulesInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + lowerModuleIndex5, + rPhiChiSquared)) + return false; } float xPix[] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; @@ -2610,22 +2605,20 @@ namespace SDL { computePT5RPhiChiSquaredInwards(modulesInGPU, T5CenterX, T5CenterY, quintupletRadius, xPix, yPix); if (quintupletsInGPU.regressionRadius[quintupletIndex] < 5.0f * kR1GeVf) { - pass = pass and passPT5RPhiChiSquaredInwardsCuts(modulesInGPU, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex3, - lowerModuleIndex4, - lowerModuleIndex5, - rPhiChiSquaredInwards); - if (not pass) - return pass; + if (not passPT5RPhiChiSquaredInwardsCuts(modulesInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + lowerModuleIndex5, + rPhiChiSquaredInwards)) + return false; } //trusting the T5 regression center to also be a good estimate.. centerX = (centerX + T5CenterX) / 2; centerY = (centerY + T5CenterY) / 2; - //other cuts will be filled here! - return pass; + return true; }; template @@ -2641,10 +2634,10 @@ namespace SDL { float slope = (zPix[1] - zPix[0]) / (rtPix[1] - rtPix[0]); float residual = 0; - float error = 0; + float error2 = 0; //hardcoded array indices!!! float RMSE = 0; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < layers_T5; i++) { uint16_t& lowerModuleIndex = lowerModuleIndices[i]; const int moduleType = modulesInGPU.moduleType[lowerModuleIndex]; const int moduleSide = modulesInGPU.sides[lowerModuleIndex]; @@ -2655,20 +2648,20 @@ namespace SDL { const float& drdz = modulesInGPU.drdzs[lowerModuleIndex]; //PS Modules if (moduleType == 0) { - error = 0.15f; + error2 = pixelPSZpitch * pixelPSZpitch; } else //2S modules { - error = 5.0f; + error2 = strip2SZpitch * strip2SZpitch; } //special dispensation to tilted PS modules! if (moduleType == 0 and moduleSubdet == SDL::Barrel and moduleSide != Center) { - error /= alpaka::math::sqrt(acc, 1.f + drdz * drdz); + error2 /= (1.f + drdz * drdz); } - RMSE += (residual * residual) / (error * error); + RMSE += (residual * residual) / error2; } - RMSE = alpaka::math::sqrt(acc, 0.2f * RMSE); + RMSE = alpaka::math::sqrt(acc, 0.2f * RMSE); // Divided by the degree of freedom 5. return RMSE; }; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index cc17012019d6d..b1e922ece7953 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -108,7 +108,7 @@ namespace SDL { template quintupletsBuffer(unsigned int nTotalQuintuplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : tripletIndices_buf(allocBufWrapper(devAccIn, 2 * nTotalQuintuplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, 5 * nTotalQuintuplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_T5 * nTotalQuintuplets, queue)), nQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), @@ -126,8 +126,8 @@ namespace SDL { regressionRadius_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionG_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionF_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, 5 * nTotalQuintuplets, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, 10 * nTotalQuintuplets, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, layers_T5 * nTotalQuintuplets, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, hits_T5 * nTotalQuintuplets, queue)), rzChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), chiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), nonAnchorChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)) { @@ -175,11 +175,11 @@ namespace SDL { quintupletsInGPU.tripletIndices[2 * quintupletIndex] = innerTripletIndex; quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1] = outerTripletIndex; - quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex] = lowerModule1; - quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 1] = lowerModule2; - quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 2] = lowerModule3; - quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 3] = lowerModule4; - quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex + 4] = lowerModule5; + quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex] = lowerModule1; + quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 1] = lowerModule2; + quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 2] = lowerModule3; + quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 3] = lowerModule4; + quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 4] = lowerModule5; quintupletsInGPU.innerRadius[quintupletIndex] = __F2H(innerRadius); quintupletsInGPU.outerRadius[quintupletIndex] = __F2H(outerRadius); quintupletsInGPU.pt[quintupletIndex] = __F2H(pt); @@ -192,22 +192,36 @@ namespace SDL { quintupletsInGPU.regressionRadius[quintupletIndex] = regressionRadius; quintupletsInGPU.regressionG[quintupletIndex] = regressionG; quintupletsInGPU.regressionF[quintupletIndex] = regressionF; - quintupletsInGPU.logicalLayers[5 * quintupletIndex] = tripletsInGPU.logicalLayers[3 * innerTripletIndex]; - quintupletsInGPU.logicalLayers[5 * quintupletIndex + 1] = tripletsInGPU.logicalLayers[3 * innerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[5 * quintupletIndex + 2] = tripletsInGPU.logicalLayers[3 * innerTripletIndex + 2]; - quintupletsInGPU.logicalLayers[5 * quintupletIndex + 3] = tripletsInGPU.logicalLayers[3 * outerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[5 * quintupletIndex + 4] = tripletsInGPU.logicalLayers[3 * outerTripletIndex + 2]; - - quintupletsInGPU.hitIndices[10 * quintupletIndex] = tripletsInGPU.hitIndices[6 * innerTripletIndex]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 1] = tripletsInGPU.hitIndices[6 * innerTripletIndex + 1]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 2] = tripletsInGPU.hitIndices[6 * innerTripletIndex + 2]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 3] = tripletsInGPU.hitIndices[6 * innerTripletIndex + 3]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 4] = tripletsInGPU.hitIndices[6 * innerTripletIndex + 4]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 5] = tripletsInGPU.hitIndices[6 * innerTripletIndex + 5]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 6] = tripletsInGPU.hitIndices[6 * outerTripletIndex + 2]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 7] = tripletsInGPU.hitIndices[6 * outerTripletIndex + 3]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 8] = tripletsInGPU.hitIndices[6 * outerTripletIndex + 4]; - quintupletsInGPU.hitIndices[10 * quintupletIndex + 9] = tripletsInGPU.hitIndices[6 * outerTripletIndex + 5]; + quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex] = + tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex]; + quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 1] = + tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 2] = + tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex + 2]; + quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 3] = + tripletsInGPU.logicalLayers[layers_T3 * outerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 4] = + tripletsInGPU.logicalLayers[layers_T3 * outerTripletIndex + 2]; + + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex] = tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 1] = + tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 1]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 2] = + tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 2]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 3] = + tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 3]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 4] = + tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 4]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 5] = + tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 5]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 6] = + tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 2]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 7] = + tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 3]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 8] = + tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 4]; + quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 9] = + tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 5]; quintupletsInGPU.bridgeRadius[quintupletIndex] = bridgeRadius; quintupletsInGPU.rzChiSquared[quintupletIndex] = rzChiSquared; quintupletsInGPU.chiSquared[quintupletIndex] = rPhiChiSquared; @@ -355,7 +369,7 @@ namespace SDL { const float& y4 = mdsInGPU.anchorY[fourthMDIndex] / 100; float residual = 0; - float error = 0; + float error2 = 0; float x_center = g / 100, y_center = f / 100; float x_init = mdsInGPU.anchorX[thirdMDIndex] / 100; float y_init = mdsInGPU.anchorY[thirdMDIndex] / 100; @@ -446,21 +460,21 @@ namespace SDL { if (moduleType3 == 0) { // 0 is ps if (x4 < x3 && x3 < x2) Px = -alpaka::math::abs(acc, Px); - if (x4 > x3 && x3 > x2) + else if (x4 > x3 && x3 > x2) Px = alpaka::math::abs(acc, Px); if (y4 < y3 && y3 < y2) Py = -alpaka::math::abs(acc, Py); - if (y4 > y3 && y3 > y2) + else if (y4 > y3 && y3 > y2) Py = alpaka::math::abs(acc, Py); } else if (moduleType3 == 1) // 1 is 2s { if (x3 < x2 && x2 < x1) Px = -alpaka::math::abs(acc, Px); - if (x3 > x2 && x2 > x1) + else if (x3 > x2 && x2 > x1) Px = alpaka::math::abs(acc, Px); if (y3 < y2 && y2 < y1) Py = -alpaka::math::abs(acc, Py); - if (y3 > y2 && y2 > y1) + else if (y3 > y2 && y2 > y1) Py = alpaka::math::abs(acc, Py); } @@ -468,15 +482,14 @@ namespace SDL { float AO = alpaka::math::sqrt(acc, (x1 - x_center) * (x1 - x_center) + (y1 - y_center) * (y1 - y_center)); float BO = alpaka::math::sqrt(acc, (x_init - x_center) * (x_init - x_center) + (y_init - y_center) * (y_init - y_center)); - float AB = alpaka::math::sqrt(acc, (x1 - x_init) * (x1 - x_init) + (y1 - y_init) * (y1 - y_init)); - float dPhi = alpaka::math::acos(acc, (AO * AO + BO * BO - AB * AB) / (2 * AO * BO)); + float AB2 = (x1 - x_init) * (x1 - x_init) + (y1 - y_init) * (y1 - y_init); + float dPhi = alpaka::math::acos(acc, (AO * AO + BO * BO - AB2) / (2 * AO * BO)); float ds = innerRadius / 100 * dPhi; float Pz = (z_init - z1) / ds * Pt; float p = alpaka::math::sqrt(acc, Px * Px + Py * Py + Pz * Pz); - float Bz = SDL::magnetic_field; - float a = -0.299792 * Bz * charge; + float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units float zsi, rtsi; int layeri, moduleTypei; @@ -550,10 +563,10 @@ namespace SDL { //PS Modules if (moduleTypei == 0) { - error = 0.15f; + error2 = pixelPSZpitch * pixelPSZpitch; } else //2S modules { - error = 5.0f; + error2 = strip2SZpitch * strip2SZpitch; } //check the tilted module, side: PosZ, NegZ, Center(for not tilted) @@ -571,18 +584,18 @@ namespace SDL { } if (i == 2 || i == 3) { residual = (layeri <= 6 && ((side == SDL::Center) or (drdz < 1))) ? diffz : diffr; - float projection_missing = 1; + float projection_missing2 = 1.f; if (drdz < 1) - projection_missing = ((subdets == SDL::Endcap) or (side == SDL::Center)) - ? 1.f - : 1 / alpaka::math::sqrt(acc, 1 + drdz * drdz); // cos(atan(drdz)), if dr/dz<1 + projection_missing2 = ((subdets == SDL::Endcap) or (side == SDL::Center)) + ? 1.f + : 1.f / (1 + drdz * drdz); // cos(atan(drdz)), if dr/dz<1 if (drdz > 1) - projection_missing = ((subdets == SDL::Endcap) or (side == SDL::Center)) - ? 1.f - : drdz / alpaka::math::sqrt(acc, 1 + drdz * drdz); //sin(atan(drdz)), if dr/dz>1 - error = error * projection_missing; + projection_missing2 = ((subdets == SDL::Endcap) or (side == SDL::Center)) + ? 1.f + : (drdz * drdz) / (1 + drdz * drdz); //sin(atan(drdz)), if dr/dz>1 + error2 = error2 * projection_missing2; } - rzChiSquared += 12 * (residual * residual) / (error * error); + rzChiSquared += 12 * (residual * residual) / error2; } // for set rzchi2 cut // if the 5 points are linear, helix calculation gives nan @@ -600,8 +613,8 @@ namespace SDL { // creating a chi squared type quantity // 0-> PS, 1->2S - residual4_linear = (moduleType4 == 0) ? residual4_linear / 0.15f : residual4_linear / 5.0f; - residual5_linear = (moduleType5 == 0) ? residual5_linear / 0.15f : residual5_linear / 5.0f; + residual4_linear = (moduleType4 == 0) ? residual4_linear / pixelPSZpitch : residual4_linear / strip2SZpitch; + residual5_linear = (moduleType5 == 0) ? residual5_linear / pixelPSZpitch : residual5_linear / strip2SZpitch; residual4_linear = residual4_linear * 100; residual5_linear = residual5_linear * 100; @@ -1153,9 +1166,9 @@ namespace SDL { ModuleType moduleType; short moduleSubdet, moduleSide; - float inv1 = 0.01f / 0.009f; - float inv2 = 0.15f / 0.009f; - float inv3 = 2.4f / 0.009f; + float inv1 = widthPS / width2S; + float inv2 = pixelPSZpitch / width2S; + float inv3 = stripPSZpitch / width2S; for (size_t i = 0; i < nPoints; i++) { moduleType = modulesInGPU.moduleType[lowerModuleIndices[i]]; moduleSubdet = modulesInGPU.subdets[lowerModuleIndices[i]]; @@ -1230,7 +1243,7 @@ namespace SDL { bool* isFlat, float& g, float& f, - float* sigmas, + float* sigmas2, float& chiSquared) { float radius = 0.f; @@ -1274,19 +1287,17 @@ namespace SDL { xPrime = xs[i]; yPrime = ys[i]; } - sigmas[i] = - 2 * alpaka::math::sqrt( - acc, (xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); - - sigmaX1Squared += (xs[i] * xs[i]) / (sigmas[i] * sigmas[i]); - sigmaX2Squared += (ys[i] * ys[i]) / (sigmas[i] * sigmas[i]); - sigmaX1X2 += (xs[i] * ys[i]) / (sigmas[i] * sigmas[i]); - sigmaX1y += (xs[i] * (xs[i] * xs[i] + ys[i] * ys[i])) / (sigmas[i] * sigmas[i]); - sigmaX2y += (ys[i] * (xs[i] * xs[i] + ys[i] * ys[i])) / (sigmas[i] * sigmas[i]); - sigmaY += (xs[i] * xs[i] + ys[i] * ys[i]) / (sigmas[i] * sigmas[i]); - sigmaX1 += xs[i] / (sigmas[i] * sigmas[i]); - sigmaX2 += ys[i] / (sigmas[i] * sigmas[i]); - sigmaOne += 1.0f / (sigmas[i] * sigmas[i]); + sigmas2[i] = 4 * ((xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); + + sigmaX1Squared += (xs[i] * xs[i]) / sigmas2[i]; + sigmaX2Squared += (ys[i] * ys[i]) / sigmas2[i]; + sigmaX1X2 += (xs[i] * ys[i]) / sigmas2[i]; + sigmaX1y += (xs[i] * (xs[i] * xs[i] + ys[i] * ys[i])) / sigmas2[i]; + sigmaX2y += (ys[i] * (xs[i] * xs[i] + ys[i] * ys[i])) / sigmas2[i]; + sigmaY += (xs[i] * xs[i] + ys[i] * ys[i]) / sigmas2[i]; + sigmaX1 += xs[i] / sigmas2[i]; + sigmaX2 += ys[i] / sigmas2[i]; + sigmaOne += 1.0f / sigmas2[i]; } float denominator = (sigmaX1X2 - sigmaX1 * sigmaX2) * (sigmaX1X2 - sigmaX1 * sigmaX2) - (sigmaX1Squared - sigmaX1 * sigmaX1) * (sigmaX2Squared - sigmaX2 * sigmaX2); @@ -1314,7 +1325,7 @@ namespace SDL { chiSquared = 0.f; for (size_t i = 0; i < nPoints; i++) { chiSquared += (xs[i] * xs[i] + ys[i] * ys[i] - twoG * xs[i] - twoF * ys[i] + c) * - (xs[i] * xs[i] + ys[i] * ys[i] - twoG * xs[i] - twoF * ys[i] + c) / (sigmas[i] * sigmas[i]); + (xs[i] * xs[i] + ys[i] * ys[i] - twoG * xs[i] - twoF * ys[i] + c) / sigmas2[i]; } return radius; }; @@ -1335,7 +1346,7 @@ namespace SDL { // compute chi squared float c = g * g + f * f - radius * radius; float chiSquared = 0.f; - float absArctanSlope, angleM, xPrime, yPrime, sigma; + float absArctanSlope, angleM, xPrime, yPrime, sigma2; for (size_t i = 0; i < nPoints; i++) { absArctanSlope = ((slopes[i] != SDL::SDL_INF) ? alpaka::math::abs(acc, alpaka::math::atan(acc, slopes[i])) : 0.5f * float(M_PI)); @@ -1358,10 +1369,9 @@ namespace SDL { xPrime = xs[i]; yPrime = ys[i]; } - sigma = 2 * alpaka::math::sqrt( - acc, (xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); + sigma2 = 4 * ((xPrime * delta1[i]) * (xPrime * delta1[i]) + (yPrime * delta2[i]) * (yPrime * delta2[i])); chiSquared += (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) * - (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / (sigma * sigma); + (xs[i] * xs[i] + ys[i] * ys[i] - 2 * g * xs[i] - 2 * f * ys[i] + c) / sigma2; } return chiSquared; }; @@ -1493,8 +1503,6 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut) { - bool pass = true; - bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -1523,9 +1531,8 @@ namespace SDL { //Cut 1 - z compatibility zOut = z_OutLo; rtOut = rt_OutLo; - pass = pass and ((z_OutLo >= zLo) && (z_OutLo <= zHi)); - if (not pass) - return pass; + if (not((z_OutLo >= zLo) && (z_OutLo <= zHi))) + return false; float drt_OutLo_InLo = (rt_OutLo - rt_InLo); float r3_InLo = alpaka::math::sqrt(acc, z_InLo * z_InLo + rt_InLo * rt_InLo); @@ -1537,10 +1544,9 @@ namespace SDL { float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitch_InLo + zpitch_OutLo) * (zpitch_InLo + zpitch_OutLo) * 2.f; - 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? - dzErr += sdlMuls * sdlMuls * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; //sloppy + float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); + float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; + dzErr += sdlMuls2 * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); // Constructing upper and lower bound @@ -1552,18 +1558,16 @@ namespace SDL { zHiPointed = z_InLo + dzMean * (z_InLo < 0.f ? 1.f : dzDrtScale) + zWindow; // Cut #2: Pointed Z (Inner segment two MD points to outer segment inner MD) - pass = pass and ((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed)); - if (not pass) - return pass; + if (not((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed))) + return false; float sdlPVoff = 0.1f / rt_OutLo; - sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls * sdlMuls + sdlPVoff * sdlPVoff); + sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); // Cut #3: FIXME:deltaPhiPos can be tighter - pass = pass and (alpaka::math::abs(acc, deltaPhiPos) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); float midPointY = 0.5f * (mdsInGPU.anchorY[firstMDIndex] + mdsInGPU.anchorY[thirdMDIndex]); @@ -1573,10 +1577,8 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #4: deltaPhiChange - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdlCut); - //lots of array accesses below. Cut here! - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + return false; // First obtaining the raw betaIn and betaOut values without any correction and just purely based on the mini-doublet hit positions @@ -1659,9 +1661,8 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #5: first beta cut - pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + return false; float betaAv = 0.5f * (betaIn + betaOut); pt_beta = drt_tl_axis * SDL::k2Rinv1GeVf / alpaka::math::sin(acc, betaAv); @@ -1687,10 +1688,9 @@ namespace SDL { betaOutRHmin *= betaOutMMSF; betaOutRHmax *= betaOutMMSF; - const float dBetaMuls = - sdlThetaMulsF * 4.f / - alpaka::math::min( - acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confimm the range-out value of 7 GeV + float min_ptBeta_maxPtBeta = alpaka::math::min( + acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confimm the range-out value of 7 GeV + const float dBetaMuls2 = sdlThetaMulsF2 * 16.f / (min_ptBeta_maxPtBeta * min_ptBeta_maxPtBeta); const float alphaInAbsReg = alpaka::math::max( acc, @@ -1723,25 +1723,25 @@ namespace SDL { //FIXME: need faster version betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - pass = pass and ((alpaka::math::abs(acc, betaOut) < betaOutCut)); - if (not pass) - return pass; + if (not((alpaka::math::abs(acc, betaOut) < betaOutCut))) + return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, drt_InSeg); float dBetaCut2 = - (dBetaRes * dBetaRes * 2.0f + dBetaMuls * dBetaMuls + dBetaLum2 + dBetaRIn2 + dBetaROut2 + + (dBetaRes * dBetaRes * 2.0f + dBetaMuls2 + dBetaLum2 + dBetaRIn2 + dBetaROut2 + 0.25f * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax)) * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax))); float dBeta = betaIn - betaOut; deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); - pass = pass and (dBeta * dBeta <= dBetaCut2); + if (not(dBeta * dBeta <= dBetaCut2)) + return false; - return pass; + return true; }; template @@ -1774,7 +1774,6 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ) { - bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -1799,9 +1798,8 @@ namespace SDL { zLo = z_InLo + (z_InLo - SDL::deltaZLum) * (rtRatio_OutLoInLo - 1.f) * (z_InLo > 0.f ? 1.f : dzDrtScale) - zGeom; // Cut #0: Preliminary (Only here in endcap case) - pass = pass and (z_InLo * z_OutLo > 0); - if (not pass) - return pass; + if (not(z_InLo * z_OutLo > 0)) + return false; float dLum = SDL::copysignf(SDL::deltaZLum, z_InLo); bool isOutSgInnerMDPS = modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS; @@ -1813,9 +1811,8 @@ namespace SDL { rtOut = rt_OutLo; //Cut #1: rt condition - pass = pass and (rtOut >= rtLo); - if (not pass) - return pass; + if (not(rtOut >= rtLo)) + return false; float zInForHi = z_InLo - zGeom1 - dLum; if (zInForHi * z_InLo < 0) { @@ -1824,9 +1821,8 @@ namespace SDL { rtHi = rt_InLo * (1.f + (z_OutLo - z_InLo + zGeom1) / zInForHi) + rtGeom1; //Cut #2: rt condition - pass = pass and ((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi)); - if (not pass) - return pass; + if (not((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi))) + return false; float rIn = alpaka::math::sqrt(acc, z_InLo * z_InLo + rt_InLo * rt_InLo); const float drtSDIn = rt_InOut - rt_InLo; @@ -1841,27 +1837,23 @@ namespace SDL { kZ = (z_OutLo - z_InLo) / dzSDIn; float drtErr = 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? - drtErr += - sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); + const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; + drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); //Cut #3: rt-z pointed - pass = pass and ((kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi)); - if (not pass) - return pass; + if (not((kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi))) + return false; const float sdlPVoff = 0.1f / rt_OutLo; - sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls * sdlMuls + sdlPVoff * sdlPVoff); + sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); //Cut #4: deltaPhiPos can be tighter - pass = pass and (alpaka::math::abs(acc, deltaPhiPos) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); float midPointY = 0.5f * (mdsInGPU.anchorY[firstMDIndex] + mdsInGPU.anchorY[thirdMDIndex]); @@ -1870,14 +1862,13 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + return false; float sdIn_alpha = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); float sdIn_alpha_min = __H2F(segmentsInGPU.dPhiChangeMins[innerSegmentIndex]); float sdIn_alpha_max = __H2F(segmentsInGPU.dPhiChangeMaxs[innerSegmentIndex]); - float sdOut_alpha = sdIn_alpha; //weird + float sdOut_alpha = sdIn_alpha; float sdOut_alphaOut = SDL::phi_mpi_pi(acc, SDL::phi(acc, @@ -1942,9 +1933,8 @@ namespace SDL { (0.02f / sdIn_d); //Cut #6: first beta cut - pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + return false; float betaAv = 0.5f * (betaIn + betaOut); pt_beta = dr * SDL::k2Rinv1GeVf / alpaka::math::sin(acc, betaAv); @@ -1972,10 +1962,9 @@ namespace SDL { betaOutRHmin *= betaOutMMSF; betaOutRHmax *= betaOutMMSF; - const float dBetaMuls = - sdlThetaMulsF * 4.f / - alpaka::math::min( - acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + float min_ptBeta_maxPtBeta = alpaka::math::min( + acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + const float dBetaMuls2 = sdlThetaMulsF2 * 16.f / (min_ptBeta_maxPtBeta * min_ptBeta_maxPtBeta); const float alphaInAbsReg = alpaka::math::max( acc, @@ -2006,25 +1995,25 @@ 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)) + - (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - pass = pass and (alpaka::math::abs(acc, betaOut) < betaOutCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, sdIn_d); float dBetaCut2 = - (dBetaRes * dBetaRes * 2.0f + dBetaMuls * dBetaMuls + dBetaLum2 + dBetaRIn2 + dBetaROut2 + + (dBetaRes * dBetaRes * 2.0f + dBetaMuls2 + dBetaLum2 + dBetaRIn2 + dBetaROut2 + 0.25f * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax)) * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax))); float dBeta = betaIn - betaOut; deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); //Cut #7: Cut on dBet - pass = pass and (dBeta * dBeta <= dBetaCut2); + if (not(dBeta * dBeta <= dBetaCut2)) + return false; - return pass; + return true; }; template @@ -2057,8 +2046,6 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ) { - bool pass = true; - bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2084,9 +2071,8 @@ namespace SDL { zGeom; //slope-correction only on outer end // Cut #0: Preliminary (Only here in endcap case) - pass = pass and ((z_InLo * z_OutLo) > 0); - if (not pass) - return pass; + if (not((z_InLo * z_OutLo) > 0)) + return false; float dLum = SDL::copysignf(SDL::deltaZLum, z_InLo); bool isOutSgInnerMDPS = modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS; @@ -2106,9 +2092,8 @@ namespace SDL { rtHi = rt_InLo * (1.f + dz / (z_InLo - dLum)) + rtGeom; - pass = pass and ((rtOut >= rtLo) && (rtOut <= rtHi)); - if (not pass) - return pass; + if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + return false; bool isInSgOuterMDPS = modulesInGPU.moduleType[innerOuterLowerModuleIndex] == SDL::PS; @@ -2121,14 +2106,14 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); 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 sdlThetaMulsF2 = (0.015f * 0.015f) * (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 sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; float drtErr = alpaka::math::sqrt( acc, SDL::pixelPSZpitch * SDL::pixelPSZpitch * 2.f / (dzSDIn * dzSDIn) * (dzOutInAbs * dzOutInAbs) + - sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta); + sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta); float drtMean = drtSDIn * dzOutInAbs / alpaka::math::abs(acc, dzSDIn); float rtWindow = drtErr + rtGeom; @@ -2140,19 +2125,17 @@ namespace SDL { if (isInSgInnerMDPS and isInSgOuterMDPS) // If both PS then we can point { - pass = pass and (kZ >= 0 and rtOut >= rtLo_point and rtOut <= rtHi_point); - if (not pass) - return pass; + if (not(kZ >= 0 and rtOut >= rtLo_point and rtOut <= rtHi_point)) + return false; } float sdlPVoff = 0.1f / rtOut; - sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls * sdlMuls + sdlPVoff * sdlPVoff); + sdlCut = alpha1GeV_OutLo + alpaka::math::sqrt(acc, sdlMuls2 + sdlPVoff * sdlPVoff); deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); - pass = pass and (alpaka::math::abs(acc, deltaPhiPos) <= sdlCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); float midPointY = 0.5f * (mdsInGPU.anchorY[firstMDIndex] + mdsInGPU.anchorY[thirdMDIndex]); @@ -2162,9 +2145,8 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - pass = pass and ((alpaka::math::abs(acc, dPhi) <= sdlCut)); - if (not pass) - return pass; + if (not((alpaka::math::abs(acc, dPhi) <= sdlCut))) + return false; float sdIn_alpha = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); float sdOut_alpha = sdIn_alpha; //weird @@ -2221,9 +2203,8 @@ namespace SDL { (0.02f / sdIn_d); //Cut #6: first beta cut - pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + return false; float betaAv = 0.5f * (betaIn + betaOut); pt_beta = dr * SDL::k2Rinv1GeVf / alpaka::math::sin(acc, betaAv); @@ -2251,10 +2232,9 @@ namespace SDL { betaOutRHmin *= betaOutMMSF; betaOutRHmax *= betaOutMMSF; - const float dBetaMuls = - sdlThetaMulsF * 4.f / - alpaka::math::min( - acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + float min_ptBeta_maxPtBeta = alpaka::math::min( + acc, alpaka::math::abs(acc, pt_beta), SDL::pt_betaMax); //need to confirm the range-out value of 7 GeV + const float dBetaMuls2 = sdlThetaMulsF2 * 16.f / (min_ptBeta_maxPtBeta * min_ptBeta_maxPtBeta); const float alphaInAbsReg = alpaka::math::max( acc, @@ -2273,16 +2253,15 @@ 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)) + - (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - pass = pass and (alpaka::math::abs(acc, betaOut) < betaOutCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, sdIn_d); float dBetaCut2 = - (dBetaRes * dBetaRes * 2.0f + dBetaMuls * dBetaMuls + dBetaLum2 + dBetaRIn2 + dBetaROut2 + + (dBetaRes * dBetaRes * 2.0f + dBetaMuls2 + dBetaLum2 + dBetaRIn2 + dBetaROut2 + 0.25f * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax)) * (alpaka::math::abs(acc, betaInRHmin - betaInRHmax) + alpaka::math::abs(acc, betaOutRHmin - betaOutRHmax))); @@ -2290,9 +2269,10 @@ namespace SDL { //Cut #7: Cut on dBeta deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); - pass = pass and (dBeta * dBeta <= dBetaCut2); + if (not(dBeta * dBeta <= dBetaCut2)) + return false; - return pass; + return true; }; template @@ -2328,8 +2308,6 @@ namespace SDL { float& betaOutCut, float& deltaBetaCut, float& kZ) { - bool pass = false; - zLo = -999; zHi = -999; rtLo = -999; @@ -2501,7 +2479,7 @@ namespace SDL { kZ); } - return pass; + return false; }; template @@ -2527,7 +2505,6 @@ namespace SDL { float& chiSquared, float& nonAnchorChiSquared, bool& TightCutFlag) { - bool pass = true; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex]; unsigned int secondSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; unsigned int thirdSegmentIndex = tripletsInGPU.segmentIndices[2 * outerTripletIndex]; @@ -2552,75 +2529,73 @@ namespace SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - pass = pass and runQuintupletAlgoSelector(acc, - modulesInGPU, - mdsInGPU, - segmentsInGPU, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex3, - lowerModuleIndex4, - firstSegmentIndex, - thirdSegmentIndex, - firstMDIndex, - secondMDIndex, - thirdMDIndex, - fourthMDIndex, - zOut, - rtOut, - deltaPhiPos, - deltaPhi, - betaIn, - betaOut, - pt_beta, - zLo, - zHi, - rtLo, - rtHi, - zLoPointed, - zHiPointed, - sdlCut, - betaInCut, - betaOutCut, - deltaBetaCut, - kZ); - if (not pass) - return pass; - - pass = pass and runQuintupletAlgoSelector(acc, - modulesInGPU, - mdsInGPU, - segmentsInGPU, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex4, - lowerModuleIndex5, - firstSegmentIndex, - fourthSegmentIndex, - firstMDIndex, - secondMDIndex, - fourthMDIndex, - fifthMDIndex, - zOut, - rtOut, - deltaPhiPos, - deltaPhi, - betaIn, - betaOut, - pt_beta, - zLo, - zHi, - rtLo, - rtHi, - zLoPointed, - zHiPointed, - sdlCut, - betaInCut, - betaOutCut, - deltaBetaCut, - kZ); - if (not pass) - return pass; + if (not runQuintupletAlgoSelector(acc, + modulesInGPU, + mdsInGPU, + segmentsInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + firstSegmentIndex, + thirdSegmentIndex, + firstMDIndex, + secondMDIndex, + thirdMDIndex, + fourthMDIndex, + zOut, + rtOut, + deltaPhiPos, + deltaPhi, + betaIn, + betaOut, + pt_beta, + zLo, + zHi, + rtLo, + rtHi, + zLoPointed, + zHiPointed, + sdlCut, + betaInCut, + betaOutCut, + deltaBetaCut, + kZ)) + return false; + + if (not runQuintupletAlgoSelector(acc, + modulesInGPU, + mdsInGPU, + segmentsInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex4, + lowerModuleIndex5, + firstSegmentIndex, + fourthSegmentIndex, + firstMDIndex, + secondMDIndex, + fourthMDIndex, + fifthMDIndex, + zOut, + rtOut, + deltaPhiPos, + deltaPhi, + betaIn, + betaOut, + pt_beta, + zLo, + zHi, + rtLo, + rtHi, + zLoPointed, + zHiPointed, + sdlCut, + betaInCut, + betaOutCut, + deltaBetaCut, + kZ)) + return false; float x1 = mdsInGPU.anchorX[firstMDIndex]; float x2 = mdsInGPU.anchorX[secondMDIndex]; @@ -2712,130 +2687,129 @@ namespace SDL { #ifdef USE_RZCHI2 float inner_pt = 2 * k2Rinv1GeVf * innerRadius; - bool passRZChi2 = passT5RZConstraint(acc, - modulesInGPU, - mdsInGPU, - firstMDIndex, - secondMDIndex, - thirdMDIndex, - fourthMDIndex, - fifthMDIndex, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex3, - lowerModuleIndex4, - lowerModuleIndex5, - rzChiSquared, - inner_pt, - innerRadius, - g, - f, - TightCutFlag); - pass = pass and passRZChi2; - if (not pass) - return pass; + if (not passT5RZConstraint(acc, + modulesInGPU, + mdsInGPU, + firstMDIndex, + secondMDIndex, + thirdMDIndex, + fourthMDIndex, + fifthMDIndex, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + lowerModuleIndex5, + rzChiSquared, + inner_pt, + innerRadius, + g, + f, + TightCutFlag)) + return false; #else rzChiSquared = -1; #endif - pass = pass && (innerRadius >= 0.95f * ptCut / (2.f * k2Rinv1GeVf)); + if (not(innerRadius >= 0.95f * ptCut / (2.f * k2Rinv1GeVf))) + return false; float innerInvRadiusMin, innerInvRadiusMax, bridgeInvRadiusMin, bridgeInvRadiusMax, outerInvRadiusMin, outerInvRadiusMax; //split by category - bool tempPass; + bool matchedRadii; if (modulesInGPU.subdets[lowerModuleIndex1] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex2] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex3] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex4] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex5] == SDL::Barrel) { - tempPass = matchRadiiBBBBB(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBBBB(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else if (modulesInGPU.subdets[lowerModuleIndex1] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex2] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex3] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex4] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex5] == SDL::Endcap) { - tempPass = matchRadiiBBBBE(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBBBE(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else if (modulesInGPU.subdets[lowerModuleIndex1] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex2] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex3] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex4] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex5] == SDL::Endcap) { if (modulesInGPU.layers[lowerModuleIndex1] == 1) { - tempPass = matchRadiiBBBEE12378(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBBEE12378(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else if (modulesInGPU.layers[lowerModuleIndex1] == 2) { - tempPass = matchRadiiBBBEE23478(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBBEE23478(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else { - tempPass = matchRadiiBBBEE34578(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBBEE34578(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } } @@ -2844,66 +2818,65 @@ namespace SDL { modulesInGPU.subdets[lowerModuleIndex3] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex4] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex5] == SDL::Endcap) { - tempPass = matchRadiiBBEEE(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBBEEE(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else if (modulesInGPU.subdets[lowerModuleIndex1] == SDL::Barrel and modulesInGPU.subdets[lowerModuleIndex2] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex3] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex4] == SDL::Endcap and modulesInGPU.subdets[lowerModuleIndex5] == SDL::Endcap) { - tempPass = matchRadiiBEEEE(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiBEEEE(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } else { - tempPass = matchRadiiEEEEE(acc, - innerRadius, - bridgeRadius, - outerRadius, - innerRadiusMin2S, - innerRadiusMax2S, - bridgeRadiusMin2S, - bridgeRadiusMax2S, - outerRadiusMin2S, - outerRadiusMax2S, - innerInvRadiusMin, - innerInvRadiusMax, - bridgeInvRadiusMin, - bridgeInvRadiusMax, - outerInvRadiusMin, - outerInvRadiusMax); + matchedRadii = matchRadiiEEEEE(acc, + innerRadius, + bridgeRadius, + outerRadius, + innerRadiusMin2S, + innerRadiusMax2S, + bridgeRadiusMin2S, + bridgeRadiusMax2S, + outerRadiusMin2S, + outerRadiusMax2S, + innerInvRadiusMin, + innerInvRadiusMax, + bridgeInvRadiusMin, + bridgeInvRadiusMax, + outerInvRadiusMin, + outerInvRadiusMax); } //compute regression radius right here - this computation is expensive!!! - pass = pass and tempPass; - if (not pass) - return pass; + if (not matchedRadii) + return false; float xVec[] = {x1, x2, x3, x4, x5}; float yVec[] = {y1, y2, y3, y4, y5}; @@ -2911,12 +2884,12 @@ namespace SDL { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; // 5 categories for sigmas - float sigmas[5], delta1[5], delta2[5], slopes[5]; + float sigmas2[5], delta1[5], delta2[5], slopes[5]; bool isFlat[5]; computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); regressionRadius = computeRadiusUsingRegression( - acc, 5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas, chiSquared); + acc, layers_T5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); #ifdef USE_T5_DNN unsigned int mdIndices[] = {firstMDIndex, secondMDIndex, thirdMDIndex, fourthMDIndex, fifthMDIndex}; @@ -2934,30 +2907,28 @@ namespace SDL { innerRadius, outerRadius, bridgeRadius); - pass = pass and (inference > T5DNN::LSTWP2); // T5-building cut TightCutFlag = TightCutFlag and (inference > T5DNN::LSTWP2); // T5-in-TC cut - if (not pass) - return pass; + if (not(inference > T5DNN::LSTWP2)) // T5-building cut + return false; #endif #ifdef USE_RPHICHI2 // extra chi squared cuts! if (regressionRadius < 5.0f / (2.f * k2Rinv1GeVf)) { - pass = pass and passChiSquaredConstraint(modulesInGPU, - lowerModuleIndex1, - lowerModuleIndex2, - lowerModuleIndex3, - lowerModuleIndex4, - lowerModuleIndex5, - chiSquared); - if (not pass) - return pass; + if (not passChiSquaredConstraint(modulesInGPU, + lowerModuleIndex1, + lowerModuleIndex2, + lowerModuleIndex3, + lowerModuleIndex4, + lowerModuleIndex5, + chiSquared)) + return false; } #endif //compute the other chisquared //non anchor is always shifted for tilted and endcap! - float nonAnchorDelta1[5], nonAnchorDelta2[5], nonAnchorSlopes[5]; + float nonAnchorDelta1[layers_T5], nonAnchorDelta2[layers_T5], nonAnchorSlopes[layers_T5]; float nonAnchorxs[] = {mdsInGPU.outerX[firstMDIndex], mdsInGPU.outerX[secondMDIndex], mdsInGPU.outerX[thirdMDIndex], @@ -2969,10 +2940,17 @@ namespace SDL { mdsInGPU.outerY[fourthMDIndex], mdsInGPU.outerY[fifthMDIndex]}; - computeSigmasForRegression( - acc, modulesInGPU, lowerModuleIndices, nonAnchorDelta1, nonAnchorDelta2, nonAnchorSlopes, isFlat, 5, false); + computeSigmasForRegression(acc, + modulesInGPU, + lowerModuleIndices, + nonAnchorDelta1, + nonAnchorDelta2, + nonAnchorSlopes, + isFlat, + layers_T5, + false); nonAnchorChiSquared = computeChiSquared(acc, - 5, + layers_T5, nonAnchorxs, nonAnchorys, nonAnchorDelta1, @@ -2982,7 +2960,7 @@ namespace SDL { regressionG, regressionF, regressionRadius); - return pass; + return true; }; struct createQuintupletsInGPUv2 { @@ -3015,14 +2993,14 @@ namespace SDL { for (unsigned int innerTripletArrayIndex = globalThreadIdx[1]; innerTripletArrayIndex < nInnerTriplets; innerTripletArrayIndex += gridThreadExtent[1]) { unsigned int innerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule1] + innerTripletArrayIndex; - uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[3 * innerTripletIndex + 1]; - uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[3 * innerTripletIndex + 2]; + uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[layers_T3 * innerTripletIndex + 1]; + uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[layers_T3 * innerTripletIndex + 2]; unsigned int nOuterTriplets = tripletsInGPU.nTriplets[lowerModule3]; for (unsigned int outerTripletArrayIndex = globalThreadIdx[2]; outerTripletArrayIndex < nOuterTriplets; outerTripletArrayIndex += gridThreadExtent[2]) { unsigned int outerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule3] + outerTripletArrayIndex; - uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[3 * outerTripletIndex + 1]; - uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[3 * outerTripletIndex + 2]; + uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[layers_T3 * outerTripletIndex + 1]; + uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[layers_T3 * outerTripletIndex + 2]; float innerRadius, outerRadius, bridgeRadius, regressionG, regressionF, regressionRadius, rzChiSquared, chiSquared, nonAnchorChiSquared; //required for making distributions @@ -3075,7 +3053,7 @@ namespace SDL { float eta = mdsInGPU.anchorEta[segmentsInGPU.mdIndices[2 * tripletsInGPU.segmentIndices[2 * innerTripletIndex + layer2_adjustment]]]; - float pt = (innerRadius + outerRadius) * 3.8f * 1.602f / (2 * 100 * 5.39f); + float pt = (innerRadius + outerRadius) * SDL::k2Rinv1GeVf; float scores = chiSquared + nonAnchorChiSquared; addQuintupletToMemory(tripletsInGPU, quintupletsInGPU, diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 61e91eef18a47..bb2dce3191c23 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -296,31 +296,33 @@ namespace SDL { const float& drdzOuter = modulesInGPU.drdzs[outerLowerModuleIndex]; float innerModuleGapSize = SDL::moduleGapSize_seg(modulesInGPU, innerLowerModuleIndex); float outerModuleGapSize = SDL::moduleGapSize_seg(modulesInGPU, outerLowerModuleIndex); - const float innerminiTilt = isInnerTilted - ? (0.5f * pixelPSZpitch * drdzInner / - alpaka::math::sqrt(acc, 1.f + drdzInner * drdzInner) / innerModuleGapSize) - : 0; + const float innerminiTilt2 = isInnerTilted + ? ((0.5f * 0.5f) * (pixelPSZpitch * pixelPSZpitch) * (drdzInner * drdzInner) / + (1.f + drdzInner * drdzInner) / (innerModuleGapSize * innerModuleGapSize)) + : 0; - const float outerminiTilt = isOuterTilted - ? (0.5f * pixelPSZpitch * drdzOuter / - alpaka::math::sqrt(acc, 1.f + drdzOuter * drdzOuter) / outerModuleGapSize) - : 0; + const float outerminiTilt2 = isOuterTilted + ? ((0.5f * 0.5f) * (pixelPSZpitch * pixelPSZpitch) * (drdzOuter * drdzOuter) / + (1.f + drdzOuter * drdzOuter) / (outerModuleGapSize * outerModuleGapSize)) + : 0; float miniDelta = innerModuleGapSize; - float sdLumForInnerMini; - float sdLumForOuterMini; + float sdLumForInnerMini2; + float sdLumForOuterMini2; if (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) { - sdLumForInnerMini = innerminiTilt * dAlpha_Bfield; + sdLumForInnerMini2 = innerminiTilt2 * (dAlpha_Bfield * dAlpha_Bfield); } else { - sdLumForInnerMini = mdsInGPU.dphis[innerMDIndex] * 15.0f / mdsInGPU.dzs[innerMDIndex]; + sdLumForInnerMini2 = (mdsInGPU.dphis[innerMDIndex] * mdsInGPU.dphis[innerMDIndex]) * (deltaZLum * deltaZLum) / + (mdsInGPU.dzs[innerMDIndex] * mdsInGPU.dzs[innerMDIndex]); } if (modulesInGPU.subdets[outerLowerModuleIndex] == SDL::Barrel) { - sdLumForOuterMini = outerminiTilt * dAlpha_Bfield; + sdLumForOuterMini2 = outerminiTilt2 * (dAlpha_Bfield * dAlpha_Bfield); } else { - sdLumForOuterMini = mdsInGPU.dphis[outerMDIndex] * 15.0f / mdsInGPU.dzs[outerMDIndex]; + sdLumForOuterMini2 = (mdsInGPU.dphis[outerMDIndex] * mdsInGPU.dphis[outerMDIndex]) * (deltaZLum * deltaZLum) / + (mdsInGPU.dzs[outerMDIndex] * mdsInGPU.dzs[outerMDIndex]); } // Unique stuff for the segment dudes alone @@ -338,8 +340,7 @@ namespace SDL { dAlphaThresholdValues[0] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls); } else { dAlphaThresholdValues[0] = - dAlpha_Bfield + - alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls + sdLumForInnerMini * sdLumForInnerMini); + dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls + sdLumForInnerMini2); } if (modulesInGPU.subdets[outerLowerModuleIndex] == SDL::Barrel and @@ -347,8 +348,7 @@ namespace SDL { dAlphaThresholdValues[1] = dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls); } else { dAlphaThresholdValues[1] = - dAlpha_Bfield + - alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls + sdLumForOuterMini * sdLumForOuterMini); + dAlpha_Bfield + alpaka::math::sqrt(acc, dAlpha_res * dAlpha_res + sdMuls * sdMuls + sdLumForOuterMini2); } //Inner to outer @@ -478,8 +478,6 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold) { - bool pass = true; - float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) ? miniMulsPtScaleBarrel[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut : miniMulsPtScaleEndcap[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut; @@ -506,23 +504,20 @@ namespace SDL { zGeom; //slope-correction only on outer end zHi = zIn + (zIn + deltaZLum) * (rtOut / rtIn - 1.f) * (zIn < 0.f ? 1.f : dzDrtScale) + zGeom; - pass = pass and ((zOut >= zLo) && (zOut <= zHi)); - if (not pass) - return pass; + if (not((zOut >= zLo) && (zOut <= zHi))) + return false; sdCut = sdSlope + alpaka::math::sqrt(acc, sdMuls * sdMuls + sdPVoff * sdPVoff); dPhi = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[outerMDIndex] - mdsInGPU.anchorPhi[innerMDIndex]); - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdCut)) + return false; dPhiChange = SDL::phi_mpi_pi(acc, SDL::phi(acc, xOut - xIn, yOut - yIn) - mdsInGPU.anchorPhi[innerMDIndex]); - pass = pass and (alpaka::math::abs(acc, dPhiChange) <= sdCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhiChange) <= sdCut)) + return false; float dAlphaThresholdValues[3]; dAlphaThreshold(acc, @@ -552,15 +547,14 @@ namespace SDL { dAlphaOuterMDSegmentThreshold = dAlphaThresholdValues[1]; dAlphaInnerMDOuterMDThreshold = dAlphaThresholdValues[2]; - pass = pass and (alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaInnerMDSegmentThreshold); - if (not pass) - return pass; - pass = pass and (alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaOuterMDSegmentThreshold); - if (not pass) - return pass; - pass = pass and (alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaInnerMDOuterMDThreshold); + if (not(alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaInnerMDSegmentThreshold)) + return false; + if (not(alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaOuterMDSegmentThreshold)) + return false; + if (not(alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaInnerMDOuterMDThreshold)) + return false; - return pass; + return true; }; template @@ -590,8 +584,6 @@ namespace SDL { float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, float& dAlphaInnerMDOuterMD) { - bool pass = true; - float xIn, yIn; float xOut, yOut; @@ -617,9 +609,8 @@ namespace SDL { : (2.f * strip2SZpitch))); //cut 0 - z compatibility - pass = pass and (zIn * zOut >= 0); - if (not pass) - return pass; + if (not(zIn * zOut >= 0)) + return false; float dz = zOut - zIn; // Alpaka: Needs to be moved over @@ -632,9 +623,8 @@ namespace SDL { rtGeom; //dLum for luminous; rGeom for measurement size; no tanTheta_loc(pt) correction // Completeness - pass = pass and ((rtOut >= rtLo) && (rtOut <= rtHi)); - if (not pass) - return pass; + if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + return false; dPhi = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[outerMDIndex] - mdsInGPU.anchorPhi[innerMDIndex]); @@ -651,18 +641,16 @@ namespace SDL { dPhiMax = dPhi; dPhiMin = dPhi; } - pass = pass and (alpaka::math::abs(acc, dPhi) <= sdCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhi) <= sdCut)) + return false; float dzFrac = dz / zIn; dPhiChange = dPhi / dzFrac * (1.f + dzFrac); dPhiChangeMin = dPhiMin / dzFrac * (1.f + dzFrac); dPhiChangeMax = dPhiMax / dzFrac * (1.f + dzFrac); - pass = pass and (alpaka::math::abs(acc, dPhiChange) <= sdCut); - if (not pass) - return pass; + if (not(alpaka::math::abs(acc, dPhiChange) <= sdCut)) + return false; float dAlphaThresholdValues[3]; dAlphaThreshold(acc, @@ -692,15 +680,14 @@ namespace SDL { dAlphaOuterMDSegment = outerMDAlpha - dPhiChange; dAlphaInnerMDOuterMD = innerMDAlpha - outerMDAlpha; - pass = pass and (alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaThresholdValues[0]); - if (not pass) - return pass; - pass = pass and (alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaThresholdValues[1]); - if (not pass) - return pass; - pass = pass and (alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2]); + if (not(alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaThresholdValues[0])) + return false; + if (not(alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaThresholdValues[1])) + return false; + if (not(alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2])) + return false; - return pass; + return true; }; template @@ -846,36 +833,34 @@ namespace SDL { dPhiChangeMax = 0; float zLo, zHi, rtLo, rtHi, sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, dAlphaInnerMDOuterMDThreshold; - bool pass = runSegmentDefaultAlgo(acc, - modulesInGPU, - mdsInGPU, - innerLowerModuleIndex, - outerLowerModuleIndex, - innerMDIndex, - outerMDIndex, - zIn, - zOut, - rtIn, - rtOut, - dPhi, - dPhiMin, - dPhiMax, - dPhiChange, - dPhiChangeMin, - dPhiChangeMax, - dAlphaInnerMDSegment, - dAlphaOuterMDSegment, - dAlphaInnerMDOuterMD, - zLo, - zHi, - rtLo, - rtHi, - sdCut, - dAlphaInnerMDSegmentThreshold, - dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); - - if (pass) { + if (runSegmentDefaultAlgo(acc, + modulesInGPU, + mdsInGPU, + innerLowerModuleIndex, + outerLowerModuleIndex, + innerMDIndex, + outerMDIndex, + zIn, + zOut, + rtIn, + rtOut, + dPhi, + dPhiMin, + dPhiMax, + dPhiChange, + dPhiChangeMin, + dPhiChangeMax, + dAlphaInnerMDSegment, + dAlphaOuterMDSegment, + dAlphaInnerMDOuterMD, + zLo, + zHi, + rtLo, + rtHi, + sdCut, + dAlphaInnerMDSegmentThreshold, + dAlphaOuterMDSegmentThreshold, + dAlphaInnerMDOuterMDThreshold)) { unsigned int totOccupancySegments = alpaka::atomicOp( acc, &segmentsInGPU.totOccupancySegments[innerLowerModuleIndex], 1u); if (static_cast(totOccupancySegments) >= rangesInGPU.segmentModuleOccupancy[innerLowerModuleIndex]) { @@ -955,11 +940,11 @@ namespace SDL { if (module_eta < 0.75) eta_number = 0; - else if (module_eta > 0.75 && module_eta < 1.5) + else if (module_eta < 1.5) eta_number = 1; - else if (module_eta > 1.5 && module_eta < 2.25) + else if (module_eta < 2.25) eta_number = 2; - else if (module_eta > 2.25 && module_eta < 3) + else if (module_eta < 3) eta_number = 3; else eta_number = -1; @@ -1094,7 +1079,7 @@ namespace SDL { (hitsInGPU.zs[mdsInGPU.anchorHitIndices[outerMDIndex]]); score_lsq = score_lsq * score_lsq; - unsigned int hits1[4]; + unsigned int hits1[hits_pLS]; hits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[innerMDIndex]]; hits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[outerMDIndex]]; hits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[innerMDIndex]]; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index d65464944ab52..b32073dcf5df7 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -88,10 +88,10 @@ namespace SDL { nTrackCandidatespT5_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatespLS_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatesT5_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, 7 * maxTrackCandidates, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, 14 * maxTrackCandidates, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, layers_pT5 * maxTrackCandidates, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, hits_pT5 * maxTrackCandidates, queue)), pixelSeedIndex_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, 7 * maxTrackCandidates, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_pT5 * maxTrackCandidates, queue)), centerX_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), centerY_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), radius_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)) { @@ -113,18 +113,18 @@ namespace SDL { unsigned int trackCandidateIndex, uint4 hitIndices, int pixelSeedIndex) { - trackCandidatesInGPU.trackCandidateType[trackCandidateIndex] = 8; + trackCandidatesInGPU.trackCandidateType[trackCandidateIndex] = 8; // type for pLS trackCandidatesInGPU.directObjectIndices[trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.pixelSeedIndex[trackCandidateIndex] = pixelSeedIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = trackletIndex; - trackCandidatesInGPU.hitIndices[14 * trackCandidateIndex + 0] = + trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 0] = hitIndices.x; // Order explanation in https://github.com/SegmentLinking/TrackLooper/issues/267 - trackCandidatesInGPU.hitIndices[14 * trackCandidateIndex + 1] = hitIndices.z; - trackCandidatesInGPU.hitIndices[14 * trackCandidateIndex + 2] = hitIndices.y; - trackCandidatesInGPU.hitIndices[14 * trackCandidateIndex + 3] = hitIndices.w; + trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 1] = hitIndices.z; + trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 2] = hitIndices.y; + trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 3] = hitIndices.w; }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTrackCandidateToMemory(struct SDL::trackCandidates& trackCandidatesInGPU, @@ -147,15 +147,15 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; - size_t limits = trackCandidateType == 7 ? 7 : 5; + size_t limits = trackCandidateType == 7 ? layers_pT5 : layers_pT3; // 7 means pT5, layers_pT3 = layers_T5 = 5 //send the starting pointer to the logicalLayer and hitIndices for (size_t i = 0; i < limits; i++) { - trackCandidatesInGPU.logicalLayers[7 * trackCandidateIndex + i] = logicalLayerIndices[i]; - trackCandidatesInGPU.lowerModuleIndices[7 * trackCandidateIndex + i] = lowerModuleIndices[i]; + trackCandidatesInGPU.logicalLayers[layers_pT5 * trackCandidateIndex + i] = logicalLayerIndices[i]; + trackCandidatesInGPU.lowerModuleIndices[layers_pT5 * trackCandidateIndex + i] = lowerModuleIndices[i]; } for (size_t i = 0; i < 2 * limits; i++) { - trackCandidatesInGPU.hitIndices[14 * trackCandidateIndex + i] = hitIndices[i]; + trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + i] = hitIndices[i]; } trackCandidatesInGPU.centerX[trackCandidateIndex] = __F2H(centerX); trackCandidatesInGPU.centerY[trackCandidateIndex] = __F2H(centerY); @@ -167,8 +167,8 @@ namespace SDL { struct SDL::miniDoublets& mdsInGPU, struct SDL::segments& segmentsInGPU, struct SDL::hits& hitsInGPU) { - int phits1[4] = {-1, -1, -1, -1}; - int phits2[4] = {-1, -1, -1, -1}; + int phits1[hits_pLS] = {-1, -1, -1, -1}; + int phits2[hits_pLS] = {-1, -1, -1, -1}; phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix + 1]]]; phits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; @@ -181,12 +181,12 @@ namespace SDL { int npMatched = 0; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < hits_pLS; i++) { bool pmatched = false; if (phits1[i] == -1) continue; - for (int j = 0; j < 4; j++) { + for (int j = 0; j < hits_pLS; j++) { if (phits2[j] == -1) continue; @@ -418,9 +418,9 @@ namespace SDL { 5 /*track candidate type pT3=5*/, pixelTripletIndex, pixelTripletIndex, - &pixelTripletsInGPU.logicalLayers[5 * pixelTripletIndex], - &pixelTripletsInGPU.lowerModuleIndices[5 * pixelTripletIndex], - &pixelTripletsInGPU.hitIndices[10 * pixelTripletIndex], + &pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex], + &pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex], + &pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex], segmentsInGPU.seedIdx[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), @@ -471,9 +471,9 @@ namespace SDL { 4 /*track candidate type T5=4*/, quintupletIndex, quintupletIndex, - &quintupletsInGPU.logicalLayers[5 * quintupletIndex], - &quintupletsInGPU.lowerModuleIndices[5 * quintupletIndex], - &quintupletsInGPU.hitIndices[10 * quintupletIndex], + &quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex], + &quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex], + &quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex], -1 /*no pixel seed index for T5s*/, quintupletsInGPU.regressionG[quintupletIndex], quintupletsInGPU.regressionF[quintupletIndex], @@ -566,9 +566,9 @@ namespace SDL { 7 /*track candidate type pT5=7*/, pT5PixelIndex, pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[7 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[7 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[14 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex], segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 1d21815ef2717..f43cc0b76d8b2 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -113,12 +113,12 @@ namespace SDL { template tripletsBuffer(unsigned int maxTriplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : segmentIndices_buf(allocBufWrapper(devAccIn, 2 * maxTriplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, 3 * maxTriplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_T3 * maxTriplets, queue)), nTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * 3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * 6, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * layers_T3, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * hits_T3, queue)), betaIn_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleRadius_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleCenterX_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), @@ -196,31 +196,31 @@ namespace SDL { { tripletsInGPU.segmentIndices[tripletIndex * 2] = innerSegmentIndex; tripletsInGPU.segmentIndices[tripletIndex * 2 + 1] = outerSegmentIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * 3] = innerInnerLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * 3 + 1] = middleLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * 3 + 2] = outerOuterLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3] = innerInnerLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3 + 1] = middleLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3 + 2] = outerOuterLowerModuleIndex; tripletsInGPU.betaIn[tripletIndex] = __F2H(betaIn); tripletsInGPU.circleRadius[tripletIndex] = circleRadius; tripletsInGPU.circleCenterX[tripletIndex] = circleCenterX; tripletsInGPU.circleCenterY[tripletIndex] = circleCenterY; - tripletsInGPU.logicalLayers[tripletIndex * 3] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3] = modulesInGPU.layers[innerInnerLowerModuleIndex] + (modulesInGPU.subdets[innerInnerLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * 3 + 1] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 1] = modulesInGPU.layers[middleLowerModuleIndex] + (modulesInGPU.subdets[middleLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * 3 + 2] = + tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - tripletsInGPU.hitIndices[tripletIndex * 6] = mdsInGPU.anchorHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * 6 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * 6 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * 6 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * 6 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * 6 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3] = mdsInGPU.anchorHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; #ifdef CUT_VALUE_DEBUG tripletsInGPU.zOut[tripletIndex] = zOut; tripletsInGPU.rtOut[tripletIndex] = rtOut; @@ -313,7 +313,6 @@ namespace SDL { unsigned int& innerSegmentIndex, float& betaIn, float& betaInCut) { - bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -339,9 +338,8 @@ namespace SDL { (zpitchIn + zpitchOut); //slope-correction only on outer end //Cut 1 - z compatibility - pass = pass and ((zOut >= zLo) && (zOut <= zHi)); - if (not pass) - return pass; + if (not((zOut >= zLo) && (zOut <= zHi))) + return false; float drt_OutIn = (rtOut - rtIn); @@ -354,10 +352,9 @@ namespace SDL { 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? - dzErr += sdlMuls * sdlMuls * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; //sloppy + float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); + float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; + dzErr += sdlMuls2 * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); // Constructing upper and lower bound @@ -371,7 +368,8 @@ namespace SDL { // Constructing upper and lower bound // Cut #2: Pointed Z (Inner segment two MD points to outer segment inner MD) - pass = pass and ((zOut >= zLoPointed) && (zOut <= zHiPointed)); + if (not((zOut >= zLoPointed) && (zOut <= zHiPointed))) + return false; // raw betaIn value without any correction, based on the mini-doublet hit positions float alpha_InLo = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); @@ -395,9 +393,10 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #3: first beta cut - pass = pass and (alpaka::math::abs(acc, betaIn) < betaInCut); + if (not(alpaka::math::abs(acc, betaIn) < betaInCut)) + return false; - return pass; + return true; }; template @@ -418,8 +417,6 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut) { - bool pass = true; - bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -441,9 +438,8 @@ namespace SDL { float zGeom = zpitchIn + zpitchOut; // Cut #0: Preliminary (Only here in endcap case) - pass = pass and (zIn * zOut > 0); - if (not pass) - return pass; + if (not(zIn * zOut > 0)) + return false; float dLum = SDL::copysignf(SDL::deltaZLum, zIn); bool isOutSgInnerMDPS = modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS; @@ -460,9 +456,8 @@ namespace SDL { float rtHi = rtIn * (1.f + (zOut - zIn + zGeom1) / zInForHi) + rtGeom1; //Cut #2: rt condition - pass = pass and ((rtOut >= rtLo) && (rtOut <= rtHi)); - if (not pass) - return pass; + if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + return false; float rIn = alpaka::math::sqrt(acc, zIn * zIn + rtIn * rtIn); @@ -478,16 +473,15 @@ namespace SDL { const float kZ = (zOut - zIn) / dzSDIn; float drtErr = 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? - drtErr += - sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls + const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); + const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; + drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); //Cut #3: rt-z pointed - pass = pass and (kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi); + if (not((kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi))) + return false; float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; float rt_InOut = mdsInGPU.anchorRt[secondMDIndex]; @@ -523,8 +517,10 @@ namespace SDL { (0.02f / sdIn_d); //Cut #4: first beta cut - pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); - return pass; + if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + return false; + + return true; }; template @@ -544,8 +540,6 @@ namespace SDL { unsigned int& outerSegmentIndex, float& betaIn, float& betaInCut) { - bool pass = true; - float rtIn = mdsInGPU.anchorRt[firstMDIndex]; float rtMid = mdsInGPU.anchorRt[secondMDIndex]; rtOut = mdsInGPU.anchorRt[thirdMDIndex]; @@ -561,9 +555,8 @@ namespace SDL { alpaka::math::tan(acc, alpha1GeV_Out) / alpha1GeV_Out; // The track can bend in r-z plane slightly // Cut #0: Preliminary (Only here in endcap case) - pass = pass and (zIn * zOut > 0); - if (not pass) - return pass; + if (not(zIn * zOut > 0)) + return false; float dLum = SDL::copysignf(SDL::deltaZLum, zIn); bool isOutSgOuterMDPS = modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS; @@ -578,9 +571,8 @@ namespace SDL { const float rtHi = rtIn * (1.f + dz / (zIn - dLum)) + rtGeom; //Cut #1: rt condition - pass = pass and ((rtOut >= rtLo) && (rtOut <= rtHi)); - if (not pass) - return pass; + if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + return false; bool isInSgOuterMDPS = modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS; @@ -594,14 +586,14 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); float kZ = (zOut - zIn) / dzSDIn; - float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rtOut - rtIn) / 50.f); + float sdlThetaMulsF2 = (0.015f * 0.015f) * (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 sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; float drtErr = alpaka::math::sqrt( acc, SDL::pixelPSZpitch * SDL::pixelPSZpitch * 2.f / (dzSDIn * dzSDIn) * (dzOutInAbs * dzOutInAbs) + - sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta); + sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta); float drtMean = drtSDIn * dzOutInAbs / alpaka::math::abs(acc, dzSDIn); float rtWindow = drtErr + rtGeom; @@ -613,7 +605,8 @@ namespace SDL { if (isInSgInnerMDPS and isInSgOuterMDPS) // If both PS then we can point { - pass = pass and ((kZ >= 0) && (rtOut >= rtLo_point) && (rtOut <= rtHi_point)); + if (not((kZ >= 0) && (rtOut >= rtLo_point) && (rtOut <= rtHi_point))) + return false; } float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; @@ -650,8 +643,10 @@ namespace SDL { (0.02f / sdIn_d); //Cut #4: first beta cut - pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); - return pass; + if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + return false; + + return true; }; template @@ -817,7 +812,6 @@ namespace SDL { float& zHiPointed, float& sdlCut, float& betaInCut) { - 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]) return false; @@ -826,37 +820,35 @@ namespace SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - pass = pass and (passRZConstraint(acc, - modulesInGPU, - mdsInGPU, - segmentsInGPU, - innerInnerLowerModuleIndex, - middleLowerModuleIndex, - outerOuterLowerModuleIndex, - firstMDIndex, - secondMDIndex, - thirdMDIndex)); - if (not pass) - return pass; - pass = pass and (passPointingConstraint(acc, - modulesInGPU, - mdsInGPU, - segmentsInGPU, - innerInnerLowerModuleIndex, - middleLowerModuleIndex, - outerOuterLowerModuleIndex, - firstMDIndex, - secondMDIndex, - thirdMDIndex, - zOut, - rtOut, - middleLowerModuleIndex, - innerSegmentIndex, - outerSegmentIndex, - betaIn, - betaInCut)); - if (not pass) - return pass; + if (not(passRZConstraint(acc, + modulesInGPU, + mdsInGPU, + segmentsInGPU, + innerInnerLowerModuleIndex, + middleLowerModuleIndex, + outerOuterLowerModuleIndex, + firstMDIndex, + secondMDIndex, + thirdMDIndex))) + return false; + if (not(passPointingConstraint(acc, + modulesInGPU, + mdsInGPU, + segmentsInGPU, + innerInnerLowerModuleIndex, + middleLowerModuleIndex, + outerOuterLowerModuleIndex, + firstMDIndex, + secondMDIndex, + thirdMDIndex, + zOut, + rtOut, + middleLowerModuleIndex, + innerSegmentIndex, + outerSegmentIndex, + betaIn, + betaInCut))) + return false; float x1 = mdsInGPU.anchorX[firstMDIndex]; float x2 = mdsInGPU.anchorX[secondMDIndex]; @@ -866,7 +858,7 @@ namespace SDL { float y3 = mdsInGPU.anchorY[thirdMDIndex]; circleRadius = computeRadiusFromThreeAnchorHits(acc, x1, y1, x2, y2, x3, y3, circleCenterX, circleCenterY); - return pass; + return true; }; struct createTripletsInGPUv2 { @@ -1048,11 +1040,11 @@ namespace SDL { if (module_eta < 0.75) eta_number = 0; - else if (module_eta > 0.75 && module_eta < 1.5) + else if (module_eta < 1.5) eta_number = 1; - else if (module_eta > 1.5 && module_eta < 2.25) + else if (module_eta < 2.25) eta_number = 2; - else if (module_eta > 2.25 && module_eta < 3) + else if (module_eta < 3) eta_number = 3; else eta_number = -1; From c563eb04a71057bd169d0997e406e3d8b57417e9 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Mon, 8 Jul 2024 07:39:49 -0700 Subject: [PATCH 13/18] Further work on naming values and sqrt, loop, etc. simplifications --- .../LSTCore/interface/alpaka/Constants.h | 111 +++--- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 21 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 146 +++----- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 10 +- RecoTracker/LSTCore/src/alpaka/MiniDoublet.h | 28 +- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 332 +++++++++--------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 174 +++++---- RecoTracker/LSTCore/src/alpaka/Segment.h | 42 +-- .../LSTCore/src/alpaka/TrackCandidate.h | 50 +-- RecoTracker/LSTCore/src/alpaka/Triplet.h | 77 ++-- 10 files changed, 464 insertions(+), 527 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index df701f5c56fa0..aa6898b814f57 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -104,71 +104,80 @@ namespace SDL { constexpr float PT_CUT = 0.8f; #endif - const unsigned int MAX_BLOCKS = 80; - const unsigned int MAX_CONNECTED_MODULES = 40; + constexpr unsigned int MAX_BLOCKS = 80; + constexpr unsigned int MAX_CONNECTED_MODULES = 40; - const unsigned int N_MAX_PIXEL_SEGMENTS_PER_MODULE = 50000; + constexpr unsigned int N_MAX_PIXEL_SEGMENTS_PER_MODULE = 50000; - const unsigned int N_MAX_PIXEL_MD_PER_MODULES = 2 * N_MAX_PIXEL_SEGMENTS_PER_MODULE; + constexpr unsigned int N_MAX_PIXEL_MD_PER_MODULES = 2 * N_MAX_PIXEL_SEGMENTS_PER_MODULE; - const unsigned int N_MAX_PIXEL_TRIPLETS = 5000; - const unsigned int N_MAX_PIXEL_QUINTUPLETS = 15000; + constexpr unsigned int N_MAX_PIXEL_TRIPLETS = 5000; + constexpr unsigned int N_MAX_PIXEL_QUINTUPLETS = 15000; - const unsigned int N_MAX_PIXEL_TRACK_CANDIDATES = 30000; - const unsigned int N_MAX_NONPIXEL_TRACK_CANDIDATES = 1000; + constexpr unsigned int N_MAX_PIXEL_TRACK_CANDIDATES = 30000; + constexpr unsigned int N_MAX_NONPIXEL_TRACK_CANDIDATES = 1000; - const unsigned int size_superbins = 45000; + constexpr unsigned int size_superbins = 45000; //defining the constant host device variables right up here - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pLS = 2; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_LS = 2; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_T3 = 3; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pT3 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_T5 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int layers_pT5 = 7; - - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pLS = 4; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_LS = 4; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_T3 = 6; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pT3 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_T5 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL const int hits_pT5 = 14; - - ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniMulsPtScaleBarrel[6] = {0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034}; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006}; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniRminMeanBarrel[6] = { + namespace objLayers { + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = + 2; // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4). To be potentially handled better in the future. + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 2; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 3; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 5; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 5; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 7; + } // namespace objLayers + + namespace objHits { + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = + 4; // Currently pixel tracks treated as LSs with 4 hits. To be potentially handled better in the future. + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 4; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 6; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 10; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 10; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 14; + } // namespace objHits + + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGev2 = + 0.015; // 15 MeV constant from the approximate Bethe-Bloch formula + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleBarrel[6] = { + 0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034}; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006}; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniRminMeanBarrel[6] = { 25.007152356, 37.2186993757, 52.3104270826, 68.6658656666, 85.9770373007, 108.301772384}; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniRminMeanEndcap[5] = { + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniRminMeanEndcap[5] = { 130.992832231, 154.813883559, 185.352604327, 221.635123002, 265.022076742}; - 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 stripPSZpitch = 2.4; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float strip2SZpitch = 5.0; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float width2S = 0.009; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float widthPS = 0.01; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float pt_betaMax = 7.0; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float magnetic_field = 3.8112; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kR1GeVf = 1. / (2.99792458e-3 * 3.8); + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float sinAlphaMax = 0.95; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float ptCut = PT_CUT; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float deltaZLum = 15.0; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float pixelPSZpitch = 0.15; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float stripPSZpitch = 2.4; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float strip2SZpitch = 5.0; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float width2S = 0.009; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float widthPS = 0.01; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float pt_betaMax = 7.0; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float magnetic_field = 3.8112; // Since C++ can't represent infinity, SDL_INF = 123456789 was used to represent infinity in the data table - ALPAKA_STATIC_ACC_MEM_GLOBAL const float SDL_INF = 123456789.0; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float SDL_INF = 123456789.0; } //namespace SDL namespace T5DNN { // Working points matching LST fake rate (43.9%) or signal acceptance (82.0%) - ALPAKA_STATIC_ACC_MEM_GLOBAL const float LSTWP1 = 0.3418833f; // 94.0% TPR, 43.9% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float LSTWP2 = 0.6177366f; // 82.0% TPR, 20.0% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float LSTWP1 = 0.3418833f; // 94.0% TPR, 43.9% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float LSTWP2 = 0.6177366f; // 82.0% TPR, 20.0% FPR // Other working points - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP70 = 0.7776195f; // 70.0% TPR, 10.0% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP75 = 0.7181118f; // 75.0% TPR, 13.5% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP80 = 0.6492643f; // 80.0% TPR, 17.9% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP85 = 0.5655319f; // 85.0% TPR, 23.8% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP90 = 0.4592205f; // 90.0% TPR, 32.6% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP95 = 0.3073708f; // 95.0% TPR, 47.7% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP97p5 = 0.2001348f; // 97.5% TPR, 61.2% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP99 = 0.1120605f; // 99.0% TPR, 75.9% FPR - ALPAKA_STATIC_ACC_MEM_GLOBAL const float WP99p9 = 0.0218196f; // 99.9% TPR, 95.4% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP70 = 0.7776195f; // 70.0% TPR, 10.0% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP75 = 0.7181118f; // 75.0% TPR, 13.5% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP80 = 0.6492643f; // 80.0% TPR, 17.9% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP85 = 0.5655319f; // 85.0% TPR, 23.8% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP90 = 0.4592205f; // 90.0% TPR, 32.6% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP95 = 0.3073708f; // 95.0% TPR, 47.7% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP97p5 = 0.2001348f; // 97.5% TPR, 61.2% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP99 = 0.1120605f; // 99.0% TPR, 75.9% FPR + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float WP99p9 = 0.0218196f; // 99.9% TPR, 95.4% FPR } // namespace T5DNN #endif diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 416361c42868e..1cc547e505442 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1623,8 +1623,9 @@ SDL::tripletsBuffer* SDL::Event::getTriplets() { alpaka::memcpy(queue, tripletsInCPU->rtLo_buf, tripletsBuffers->rtLo_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->rtHi_buf, tripletsBuffers->rtHi_buf, nMemHost); #endif - alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, hits_T3 * nMemHost); - alpaka::memcpy(queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, layers_T3 * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, objHits::kT3 * nMemHost); + alpaka::memcpy( + queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, objLayers::kT3 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->segmentIndices_buf, tripletsBuffers->segmentIndices_buf, 2 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->betaIn_buf, tripletsBuffers->betaIn_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->circleRadius_buf, tripletsBuffers->circleRadius_buf, nMemHost); @@ -1654,7 +1655,7 @@ SDL::quintupletsBuffer* SDL::Event::getQuintuplets() { alpaka::memcpy(queue, quintupletsInCPU->lowerModuleIndices_buf, quintupletsBuffers->lowerModuleIndices_buf, - layers_T5 * nMemHost); + objLayers::kT5 * nMemHost); alpaka::memcpy(queue, quintupletsInCPU->innerRadius_buf, quintupletsBuffers->innerRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->bridgeRadius_buf, quintupletsBuffers->bridgeRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->outerRadius_buf, quintupletsBuffers->outerRadius_buf, nMemHost); @@ -1759,14 +1760,16 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid trackCandidatesInCPU->setData(*trackCandidatesInCPU); *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; - alpaka::memcpy( - queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, hits_pT5 * nTrackCanHost); + alpaka::memcpy(queue, + trackCandidatesInCPU->hitIndices_buf, + trackCandidatesBuffers->hitIndices_buf, + objHits::kpT5 * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->logicalLayers_buf, trackCandidatesBuffers->logicalLayers_buf, - layers_pT5 * nTrackCanHost); + objLayers::kpT5 * nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->directObjectIndices_buf, trackCandidatesBuffers->directObjectIndices_buf, @@ -1795,8 +1798,10 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid trackCandidatesInCPU->setData(*trackCandidatesInCPU); *alpaka::getPtrNative(trackCandidatesInCPU->nTrackCandidates_buf) = nTrackCanHost; - alpaka::memcpy( - queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, hits_pT5 * nTrackCanHost); + alpaka::memcpy(queue, + trackCandidatesInCPU->hitIndices_buf, + trackCandidatesBuffers->hitIndices_buf, + objHits::kpT5 * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 2535141ccd746..9edafaa7d1520 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -37,35 +37,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, unsigned int jx, struct SDL::quintuplets& quintupletsInGPU) { - unsigned int hits1[hits_T5]; - unsigned int hits2[hits_T5]; - - hits1[0] = quintupletsInGPU.hitIndices[hits_T5 * ix]; - hits1[1] = quintupletsInGPU.hitIndices[hits_T5 * ix + 1]; - hits1[2] = quintupletsInGPU.hitIndices[hits_T5 * ix + 2]; - hits1[3] = quintupletsInGPU.hitIndices[hits_T5 * ix + 3]; - hits1[4] = quintupletsInGPU.hitIndices[hits_T5 * ix + 4]; - hits1[5] = quintupletsInGPU.hitIndices[hits_T5 * ix + 5]; - hits1[6] = quintupletsInGPU.hitIndices[hits_T5 * ix + 6]; - hits1[7] = quintupletsInGPU.hitIndices[hits_T5 * ix + 7]; - hits1[8] = quintupletsInGPU.hitIndices[hits_T5 * ix + 8]; - hits1[9] = quintupletsInGPU.hitIndices[hits_T5 * ix + 9]; - - hits2[0] = quintupletsInGPU.hitIndices[hits_T5 * jx]; - hits2[1] = quintupletsInGPU.hitIndices[hits_T5 * jx + 1]; - hits2[2] = quintupletsInGPU.hitIndices[hits_T5 * jx + 2]; - hits2[3] = quintupletsInGPU.hitIndices[hits_T5 * jx + 3]; - hits2[4] = quintupletsInGPU.hitIndices[hits_T5 * jx + 4]; - hits2[5] = quintupletsInGPU.hitIndices[hits_T5 * jx + 5]; - hits2[6] = quintupletsInGPU.hitIndices[hits_T5 * jx + 6]; - hits2[7] = quintupletsInGPU.hitIndices[hits_T5 * jx + 7]; - hits2[8] = quintupletsInGPU.hitIndices[hits_T5 * jx + 8]; - hits2[9] = quintupletsInGPU.hitIndices[hits_T5 * jx + 9]; + unsigned int hits1[objHits::kT5]; + unsigned int hits2[objHits::kT5]; + + for (int i = 0; i < objHits::kT5; i++) { + hits1[i] = quintupletsInGPU.hitIndices[objHits::kT5 * ix + i]; + hits2[i] = quintupletsInGPU.hitIndices[objHits::kT5 * jx + i]; + } int nMatched = 0; - for (int i = 0; i < hits_T5; i++) { + for (int i = 0; i < objHits::kT5; i++) { bool matched = false; - for (int j = 0; j < hits_T5; j++) { + for (int j = 0; j < objHits::kT5; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -81,43 +64,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitspT5(unsigned int ix, unsigned int jx, struct SDL::pixelQuintuplets& pixelQuintupletsInGPU) { - unsigned int hits1[hits_pT5]; - unsigned int hits2[hits_pT5]; - - hits1[0] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix]; - hits1[1] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 1]; - hits1[2] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 2]; - hits1[3] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 3]; - hits1[4] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 4]; - hits1[5] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 5]; - hits1[6] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 6]; - hits1[7] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 7]; - hits1[8] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 8]; - hits1[9] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 9]; - hits1[10] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 10]; - hits1[11] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 11]; - hits1[12] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 12]; - hits1[13] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * ix + 13]; - - hits2[0] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx]; - hits2[1] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 1]; - hits2[2] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 2]; - hits2[3] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 3]; - hits2[4] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 4]; - hits2[5] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 5]; - hits2[6] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 6]; - hits2[7] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 7]; - hits2[8] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 8]; - hits2[9] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 9]; - hits2[10] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 10]; - hits2[11] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 11]; - hits2[12] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 12]; - hits2[13] = pixelQuintupletsInGPU.hitIndices[hits_pT5 * jx + 13]; + unsigned int hits1[objHits::kpT5]; + unsigned int hits2[objHits::kpT5]; + + for (int i = 0; i < objHits::kpT5; i++) { + hits1[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * ix + i]; + hits2[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * jx + i]; + } int nMatched = 0; - for (int i = 0; i < hits_pT5; i++) { + for (int i = 0; i < objHits::kpT5; i++) { bool matched = false; - for (int j = 0; j < hits_pT5; j++) { + for (int j = 0; j < objHits::kpT5; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -134,22 +92,18 @@ namespace SDL { unsigned int jx, struct SDL::pixelTriplets& pixelTripletsInGPU, int* matched) { - int phits1[hits_pLS] = {-1, -1, -1, -1}; - int phits2[hits_pLS] = {-1, -1, -1, -1}; - phits1[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix]; - phits1[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 1]; - phits1[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 2]; - phits1[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 3]; - - phits2[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx]; - phits2[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 1]; - phits2[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 2]; - phits2[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 3]; + int phits1[objHits::kpLS]; + int phits2[objHits::kpLS]; + + for (int i = 0; i < objHits::kpLS; i++) { + phits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i]; + phits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i]; + } int npMatched = 0; - for (int i = 0; i < hits_pLS; i++) { + for (int i = 0; i < objHits::kpLS; i++) { bool pmatched = false; - for (int j = 0; j < hits_pLS; j++) { + for (int j = 0; j < objHits::kpLS; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -160,26 +114,18 @@ namespace SDL { } } - int hits1[hits_T3] = {-1, -1, -1, -1, -1, -1}; - int hits2[hits_T3] = {-1, -1, -1, -1, -1, -1}; - hits1[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 4]; - hits1[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 5]; - hits1[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 6]; - hits1[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 7]; - hits1[4] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 8]; - hits1[5] = pixelTripletsInGPU.hitIndices[hits_pT3 * ix + 9]; - - hits2[0] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 4]; - hits2[1] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 5]; - hits2[2] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 6]; - hits2[3] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 7]; - hits2[4] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 8]; - hits2[5] = pixelTripletsInGPU.hitIndices[hits_pT3 * jx + 9]; + int hits1[objHits::kT3]; + int hits2[objHits::kT3]; + + for (int i = 0; i < objHits::kpLS; i++) { + hits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i + 4]; // Omitting the pLS hits + hits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i + 4]; // Omitting the pLS hits + } int nMatched = 0; - for (int i = 0; i < hits_T3; i++) { + for (int i = 0; i < objHits::kT3; i++) { bool tmatched = false; - for (int j = 0; j < hits_T3; j++) { + for (int j = 0; j < objHits::kT3; j++) { if (hits1[i] == hits2[j]) { tmatched = true; break; @@ -335,17 +281,17 @@ namespace SDL { const int minNHitsForDup_pT3 = 5; if ((nMatched[0] + nMatched[1]) >= minNHitsForDup_pT3) { // Check the layers - if (pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] < - pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2]) { + if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] < + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2]) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && __H2F(pixelTripletsInGPU.score[ix]) > __H2F(pixelTripletsInGPU.score[jx])) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[layers_pT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[layers_pT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && (__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; @@ -402,7 +348,7 @@ namespace SDL { if (secondpass && (!segmentsInGPU.isQuad[ix] || (segmentsInGPU.isDup[ix] & 1))) continue; - unsigned int phits1[hits_pLS]; + unsigned int phits1[objHits::kpLS]; phits1[0] = segmentsInGPU.pLSHitsIdxs[ix].x; phits1[1] = segmentsInGPU.pLSHitsIdxs[ix].y; phits1[2] = segmentsInGPU.pLSHitsIdxs[ix].z; @@ -435,16 +381,16 @@ namespace SDL { else idxToRemove = ix; - unsigned int phits2[hits_pLS]; + unsigned int phits2[objHits::kpLS]; phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x; phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y; phits2[2] = segmentsInGPU.pLSHitsIdxs[jx].z; phits2[3] = segmentsInGPU.pLSHitsIdxs[jx].w; int npMatched = 0; - for (int i = 0; i < hits_pLS; i++) { + for (int i = 0; i < objHits::kpLS; i++) { bool pmatched = false; - for (int j = 0; j < hits_pLS; j++) { + for (int j = 0; j < objHits::kpLS; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 0280d50d83e23..b42095df156b6 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -397,16 +397,16 @@ std::vector SDL::LST::getHitIdxs(const short trackCandid unsigned int maxNHits = 0; if (trackCandidateType == 7) - maxNHits = hits_pT5; // pT5 + maxNHits = objHits::kpT5; // pT5 else if (trackCandidateType == 5) - maxNHits = hits_pT3; // pT3 + maxNHits = objHits::kpT3; // pT3 else if (trackCandidateType == 4) - maxNHits = hits_T5; // T5 + maxNHits = objHits::kT5; // T5 else if (trackCandidateType == 8) - maxNHits = hits_pLS; // pLS + maxNHits = objHits::kpLS; // pLS for (unsigned int i = 0; i < maxNHits; i++) { - unsigned int hitIdxInGPU = TCHitIndices[hits_pT5 * TCIdx + i]; + unsigned int hitIdxInGPU = TCHitIndices[objHits::kpT5 * TCIdx + i]; unsigned int hitIdx = (trackCandidateType == 8) ? hitIdxInGPU diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index a59851bdf185f..f6d15e6216010 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -666,7 +666,7 @@ namespace SDL { const float sign = ((dz > 0) - (dz < 0)) * ((zLower > 0) - (zLower < 0)); const float invertedcrossercut = (alpaka::math::abs(acc, dz) > 2) * sign; - if (not((alpaka::math::abs(acc, dz) < dzCut) && (invertedcrossercut <= 0))) + if ((alpaka::math::abs(acc, dz) >= dzCut) || (invertedcrossercut > 0)) return false; float miniCut = 0; @@ -726,7 +726,7 @@ namespace SDL { noShiftedDphi = dPhi; } - if (not(alpaka::math::abs(acc, dPhi) < miniCut)) + if (alpaka::math::abs(acc, dPhi) >= miniCut) return false; // Cut #3: The dphi change going from lower Hit to upper Hit @@ -762,10 +762,9 @@ namespace SDL { noShiftedDphiChange = dPhiChange; } - if (not(alpaka::math::abs(acc, dPhiChange) < miniCut)) - return false; noShiftedDz = 0; // not used anywhere - return true; + + return alpaka::math::abs(acc, dPhiChange) < miniCut; }; template @@ -801,13 +800,13 @@ namespace SDL { const float dzCut = 1.f; - if (not(alpaka::math::abs(acc, dz) < dzCut)) + if (alpaka::math::abs(acc, dz) >= dzCut) return false; // Cut #2 : drt cut. The dz difference can't be larger than 1cm. (max separation is 4mm for modules in the endcap) // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3100 const float drtCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; drt = rtLower - rtUpper; - if (not(alpaka::math::abs(acc, drt) < drtCut)) + if (alpaka::math::abs(acc, drt) >= drtCut) return false; // The new scheme shifts strip hits to be "aligned" along the line of sight from interaction point to the pixel hit (if it is PS modules) float xn = 0, yn = 0, zn = 0; @@ -867,7 +866,7 @@ namespace SDL { ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, dPhi, dz) : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, dPhi, dz); - if (not(alpaka::math::abs(acc, dPhi) < miniCut)) + if (alpaka::math::abs(acc, dPhi) >= miniCut) return false; // Cut #4: Another cut on the dphi after some modification @@ -876,10 +875,9 @@ namespace SDL { float dzFrac = alpaka::math::abs(acc, dz) / alpaka::math::abs(acc, zLower); dPhiChange = dPhi / dzFrac * (1.f + dzFrac); noShiftedDphichange = noShiftedDphi / dzFrac * (1.f + dzFrac); - if (not(alpaka::math::abs(acc, dPhiChange) < miniCut)) - return false; noShiftedDz = 0; // not used anywhere - return true; + + return alpaka::math::abs(acc, dPhiChange) < miniCut; }; struct createMiniDoubletsInGPUv2 { @@ -1017,13 +1015,13 @@ namespace SDL { else category_number = -1; - if (module_eta < 0.75) + if (module_eta < 0.75f) eta_number = 0; - else if (module_eta < 1.5) + else if (module_eta < 1.5f) eta_number = 1; - else if (module_eta < 2.25) + else if (module_eta < 2.25f) eta_number = 2; - else if (module_eta < 3) + else if (module_eta < 3.0f) eta_number = 3; else eta_number = -1; diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 4dc1c934f299e..9b2bcaaed841e 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -110,9 +110,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), isDup_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), partOfPT5_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * layers_pT3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * hits_pT3, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * layers_pT3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objHits::kpT3, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), centerY_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), pixelRadiusError_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), @@ -161,45 +161,46 @@ namespace SDL { pixelTripletsInGPU.centerX[pixelTripletIndex] = __F2H(centerX); pixelTripletsInGPU.centerY[pixelTripletIndex] = __F2H(centerY); - pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex] = 0; - pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 1] = 0; - pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 2] = - tripletsInGPU.logicalLayers[tripletIndex * layers_T3]; - pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 3] = - tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 1]; - pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex + 4] = - tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 2]; - - pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex] = + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex] = 0; + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 1] = 0; + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 2] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3]; + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 3] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1]; + pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 4] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2]; + + pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 1] = + pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 2] = - tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex]; - pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 3] = - tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 1]; - pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex + 4] = - tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 2]; + pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 2] = + tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; + pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 3] = + tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; + pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 4] = + tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 4] = tripletsInGPU.hitIndices[hits_T3 * tripletIndex]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 5] = - tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 1]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 6] = - tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 2]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 7] = - tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 3]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 8] = - tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 4]; - pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex + 9] = - tripletsInGPU.hitIndices[hits_T3 * tripletIndex + 5]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 4] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 5] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 1]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 6] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 2]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 7] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 3]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 8] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 4]; + pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 9] = + tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 5]; pixelTripletsInGPU.rPhiChiSquared[pixelTripletIndex] = rPhiChiSquared; pixelTripletsInGPU.rPhiChiSquaredInwards[pixelTripletIndex] = rPhiChiSquaredInwards; pixelTripletsInGPU.rzChiSquared[pixelTripletIndex] = rzChiSquared; @@ -246,11 +247,11 @@ namespace SDL { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segmentsInGPU.mdIndices[layers_LS * innerSegmentIndex]; - unsigned int secondMDIndex = segmentsInGPU.mdIndices[layers_LS * innerSegmentIndex + 1]; + unsigned int firstMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex]; + unsigned int secondMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex + 1]; - unsigned int thirdMDIndex = segmentsInGPU.mdIndices[layers_LS * outerSegmentIndex]; - unsigned int fourthMDIndex = segmentsInGPU.mdIndices[layers_LS * outerSegmentIndex + 1]; + unsigned int thirdMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex]; + unsigned int fourthMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex + 1]; if (outerInnerLowerModuleSubdet == SDL::Barrel and (outerOuterLowerModuleSubdet == SDL::Barrel or outerOuterLowerModuleSubdet == SDL::Endcap)) { @@ -764,7 +765,7 @@ namespace SDL { float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units - for (size_t i = 0; i < layers_T3; i++) { + for (size_t i = 0; i < objLayers::kT3; i++) { float zsi = zs[i] / 100; float rtsi = rts[i] / 100; uint16_t lowerModuleIndex = lowerModuleIndices[i]; @@ -844,9 +845,9 @@ namespace SDL { //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet uint16_t pixelModuleIndex = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex]; - uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 1]; - uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[layers_T3 * tripletIndex + 2]; + uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; + uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; + uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; { //placeholder @@ -863,7 +864,7 @@ namespace SDL { lowerModuleIndex, middleModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[layers_LS * tripletIndex], + tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex], zOut, rtOut, deltaPhiPos, @@ -894,7 +895,7 @@ namespace SDL { middleModuleIndex, upperModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[layers_LS * tripletIndex + 1], + tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex + 1], zOut, rtOut, deltaPhiPos, @@ -929,8 +930,8 @@ namespace SDL { float pixelF = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; float pixelRadiusPCA = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[layers_pLS * pixelSegmentIndex]; - unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[layers_pLS * pixelSegmentIndex + 1]; + unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex]; + unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex + 1]; pixelRadius = pixelSegmentPt * kR1GeVf; pixelRadiusError = pixelSegmentPtError * kR1GeVf; @@ -941,9 +942,9 @@ namespace SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * tripletInnerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * tripletOuterSegmentIndex + 1]; - float xs[layers_T3] = { + float xs[objLayers::kT3] = { mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; - float ys[layers_T3] = { + float ys[objLayers::kT3] = { mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; float g, f; @@ -961,17 +962,17 @@ namespace SDL { upperModuleIndex)) return false; - uint16_t lowerModuleIndices[layers_T3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; + uint16_t lowerModuleIndices[objLayers::kT3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - float rts[layers_T3] = { + float rts[objLayers::kT3] = { mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex]}; - float zs[layers_T3] = { + float zs[objLayers::kT3] = { mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; - float rtPix[layers_pLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float xPix[layers_pLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[layers_pLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; - float zPix[layers_pLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; rzChiSquared = computePT3RZChiSquared(acc, modulesInGPU, @@ -1005,8 +1006,8 @@ namespace SDL { return false; } - float xPix[layers_pLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[layers_pLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; rPhiChiSquaredInwards = computePT3RPhiChiSquaredInwards(modulesInGPU, g, f, tripletRadius, xPix, yPix); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { @@ -1308,7 +1309,7 @@ namespace SDL { float rt_InOut = rt_InUp; - if (not(alpaka::math::abs(acc, SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutLo, y_OutLo)) <= 0.5f * float(M_PI))) + if (alpaka::math::abs(acc, SDL::deltaPhi(acc, x_InUp, y_InUp, x_OutLo, y_OutLo)) > 0.5f * float(M_PI)) return false; unsigned int pixelSegmentArrayIndex = innerSegmentIndex - rangesInGPU.segmentModuleIndices[pixelModuleIndex]; @@ -1338,7 +1339,7 @@ namespace SDL { zLo = z_InUp + (z_InUp - deltaZLum) * (rtRatio_OutLoInOut - 1.f) * (z_InUp > 0.f ? 1.f : dzDrtScale) - (zpitch_InOut + zpitch_OutLo); //slope-correction only on outer end - if (not((z_OutLo >= zLo) && (z_OutLo <= zHi))) + if ((z_OutLo < zLo) || (z_OutLo > zHi)) return false; const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); @@ -1349,11 +1350,12 @@ namespace SDL { float drt_InSeg = rt_InOut - rt_InLo; - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + const float sdlThetaMulsF2 = + (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float dzErr = (drt_OutLo_InUp * drt_OutLo_InUp) * (etaErr * etaErr) * cosh2Eta; - dzErr += 0.03f * 0.03f; // pixel size x2. + dzErr += 0.03f * 0.03f; // Approximately account for IT module size dzErr *= 9.f; // 3 sigma dzErr += sdlMuls2 * (drt_OutLo_InUp * drt_OutLo_InUp) / 3.f * cosh2Eta; dzErr += zGeom * zGeom; @@ -1368,7 +1370,7 @@ namespace SDL { zLoPointed = z_InUp + dzMean - zWindow; zHiPointed = z_InUp + dzMean + zWindow; - if (not((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed))) + if ((z_OutLo < zLoPointed) || (z_OutLo > zHiPointed)) return false; const float sdlPVoff = 0.1f / rt_OutLo; @@ -1387,7 +1389,7 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); - if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + if (alpaka::math::abs(acc, dPhi) > sdlCut) return false; //lots of array accesses below this... @@ -1518,7 +1520,7 @@ namespace SDL { (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + if (alpaka::math::abs(acc, betaOut) >= betaOutCut) return false; const float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, drt_InSeg); const float dBetaCut2 = @@ -1531,10 +1533,7 @@ namespace SDL { #ifdef CUT_VALUE_DEBUG deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); #endif - if (not(dBeta * dBeta <= dBetaCut2)) - return false; - - return true; + return dBeta * dBeta <= dBetaCut2; }; template @@ -1573,7 +1572,7 @@ namespace SDL { float z_InUp = mdsInGPU.anchorZ[secondMDIndex]; float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; - if (not(z_InUp * z_OutLo > 0)) + if (z_InUp * z_OutLo <= 0) return false; float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; @@ -1630,18 +1629,19 @@ namespace SDL { rtHi = rt_InUp * (1.f + (z_OutLo - z_InUp + zGeom1) / zInForHi) + rtGeom1; // Cut #2: rt condition - if (not((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi))) + if ((rt_OutLo < rtLo) || (rt_OutLo > rtHi)) return false; const float dzOutInAbs = alpaka::math::abs(acc, z_OutLo - z_InUp); const float cosh2Eta = 1.f + (pz * pz) / (ptIn * ptIn); const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ((cosh2Eta - 1.f) * (cosh2Eta - 1.f)); const float r3_InUp = alpaka::math::sqrt(acc, z_InUp * z_InUp + rt_InUp * rt_InUp); - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + const float sdlThetaMulsF2 = + (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float drtErr = (etaErr * etaErr) * multDzDr2; - drtErr += 0.03f * 0.03f; // pixel size x2. + drtErr += 0.03f * 0.03f; // Approximately account for IT module size drtErr *= 9.f; // 3 sigma drtErr += sdlMuls2 * multDzDr2 / 3.f * cosh2Eta; drtErr = alpaka::math::sqrt(acc, drtErr); @@ -1657,7 +1657,7 @@ namespace SDL { const float rtHi_point = rt_InUp + drtMean + rtWindow; // Cut #3: rt-z pointed - if (not((rt_OutLo >= rtLo_point) && (rt_OutLo <= rtHi_point))) + if ((rt_OutLo < rtLo_point) || (rt_OutLo > rtHi_point)) return false; const float alpha1GeV_OutLo = @@ -1676,7 +1676,7 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + if (alpaka::math::abs(acc, dPhi) > sdlCut) return false; float alpha_InLo = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); @@ -1804,7 +1804,7 @@ namespace SDL { + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + if (alpaka::math::abs(acc, betaOut) >= betaOutCut) return false; float drt_InSeg = rt_InUp - rt_InLo; @@ -1819,10 +1819,7 @@ namespace SDL { #ifdef CUT_VALUE_DEBUG deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); #endif - if (not(dBeta * dBeta <= dBetaCut2)) - return false; - - return true; + return dBeta * dBeta <= dBetaCut2; }; } // namespace SDL #endif @@ -1915,9 +1912,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), eta_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), phi_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * layers_pT5, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * hits_pT5, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * layers_pT5, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objHits::kpT5, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), pixelRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), quintupletRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), @@ -1961,62 +1958,63 @@ namespace SDL { pixelQuintupletsInGPU.centerX[pixelQuintupletIndex] = __F2H(centerX); pixelQuintupletsInGPU.centerY[pixelQuintupletIndex] = __F2H(centerY); - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex] = 0; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 1] = 0; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.logicalLayers[T5Index * layers_T5]; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 1]; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 2]; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 3]; - pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.logicalLayers[T5Index * layers_T5 + 4]; - - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex] = + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex] = 0; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 1] = 0; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 2] = + quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5]; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 3] = + quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 1]; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 2]; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 3]; + pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 4]; + + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 1]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 2]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 3]; - pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.lowerModuleIndices[T5Index * layers_T5 + 4]; - - unsigned int pixelInnerMD = segmentsInGPU.mdIndices[layers_pLS * pixelIndex]; - unsigned int pixelOuterMD = segmentsInGPU.mdIndices[layers_pLS * pixelIndex + 1]; - - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 1]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 2]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 7] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 3]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 8] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 4]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 9] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 5]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 10] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 6]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 11] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 7]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 12] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 8]; - pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex + 13] = - quintupletsInGPU.hitIndices[hits_T5 * T5Index + 9]; + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 2] = + quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5]; + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 3] = + quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 1]; + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 2]; + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 3]; + pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 4]; + + unsigned int pixelInnerMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex]; + unsigned int pixelOuterMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex + 1]; + + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 2] = + mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 4] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 5] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 1]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 6] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 2]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 7] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 3]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 8] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 4]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 9] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 5]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 10] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 6]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 11] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 7]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 12] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 8]; + pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 13] = + quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 9]; pixelQuintupletsInGPU.rzChiSquared[pixelQuintupletIndex] = rzChiSquared; pixelQuintupletsInGPU.rPhiChiSquared[pixelQuintupletIndex] = rPhiChiSquared; @@ -2519,27 +2517,27 @@ namespace SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex]; - uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 1]; - uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 2]; - uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 3]; - uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 4]; + uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex]; + uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1]; + uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2]; + uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3]; + uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4]; - uint16_t lowerModuleIndices[layers_T5] = { + uint16_t lowerModuleIndices[objLayers::kT5] = { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; - float zPix[layers_pLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; - float rtPix[layers_pLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float zs[layers_T5] = {mdsInGPU.anchorZ[firstMDIndex], - mdsInGPU.anchorZ[secondMDIndex], - mdsInGPU.anchorZ[thirdMDIndex], - mdsInGPU.anchorZ[fourthMDIndex], - mdsInGPU.anchorZ[fifthMDIndex]}; - float rts[layers_T5] = {mdsInGPU.anchorRt[firstMDIndex], - mdsInGPU.anchorRt[secondMDIndex], - mdsInGPU.anchorRt[thirdMDIndex], - mdsInGPU.anchorRt[fourthMDIndex], - mdsInGPU.anchorRt[fifthMDIndex]}; + float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float zs[objLayers::kT5] = {mdsInGPU.anchorZ[firstMDIndex], + mdsInGPU.anchorZ[secondMDIndex], + mdsInGPU.anchorZ[thirdMDIndex], + mdsInGPU.anchorZ[fourthMDIndex], + mdsInGPU.anchorZ[fifthMDIndex]}; + float rts[objLayers::kT5] = {mdsInGPU.anchorRt[firstMDIndex], + mdsInGPU.anchorRt[secondMDIndex], + mdsInGPU.anchorRt[thirdMDIndex], + mdsInGPU.anchorRt[fourthMDIndex], + mdsInGPU.anchorRt[fifthMDIndex]}; rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); @@ -2555,16 +2553,16 @@ namespace SDL { } //outer T5 - float xs[layers_T5] = {mdsInGPU.anchorX[firstMDIndex], - mdsInGPU.anchorX[secondMDIndex], - mdsInGPU.anchorX[thirdMDIndex], - mdsInGPU.anchorX[fourthMDIndex], - mdsInGPU.anchorX[fifthMDIndex]}; - float ys[layers_T5] = {mdsInGPU.anchorY[firstMDIndex], - mdsInGPU.anchorY[secondMDIndex], - mdsInGPU.anchorY[thirdMDIndex], - mdsInGPU.anchorY[fourthMDIndex], - mdsInGPU.anchorY[fifthMDIndex]}; + float xs[objLayers::kT5] = {mdsInGPU.anchorX[firstMDIndex], + mdsInGPU.anchorX[secondMDIndex], + mdsInGPU.anchorX[thirdMDIndex], + mdsInGPU.anchorX[fourthMDIndex], + mdsInGPU.anchorX[fifthMDIndex]}; + float ys[objLayers::kT5] = {mdsInGPU.anchorY[firstMDIndex], + mdsInGPU.anchorY[secondMDIndex], + mdsInGPU.anchorY[thirdMDIndex], + mdsInGPU.anchorY[fourthMDIndex], + mdsInGPU.anchorY[fifthMDIndex]}; //get the appropriate radii and centers centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; @@ -2627,7 +2625,7 @@ namespace SDL { float error2 = 0; //hardcoded array indices!!! float RMSE = 0; - for (size_t i = 0; i < layers_T5; i++) { + for (size_t i = 0; i < objLayers::kT5; i++) { uint16_t& lowerModuleIndex = lowerModuleIndices[i]; const int moduleType = modulesInGPU.moduleType[lowerModuleIndex]; const int moduleSide = modulesInGPU.sides[lowerModuleIndex]; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index c7783a609fcad..3463119a77db9 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -103,7 +103,7 @@ namespace SDL { template quintupletsBuffer(unsigned int nTotalQuintuplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : tripletIndices_buf(allocBufWrapper(devAccIn, 2 * nTotalQuintuplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_T5 * nTotalQuintuplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), nQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), @@ -121,8 +121,8 @@ namespace SDL { regressionRadius_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionG_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionF_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, layers_T5 * nTotalQuintuplets, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, hits_T5 * nTotalQuintuplets, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, objHits::kT5 * nTotalQuintuplets, queue)), rzChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), chiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), nonAnchorChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)) { @@ -170,11 +170,11 @@ namespace SDL { quintupletsInGPU.tripletIndices[2 * quintupletIndex] = innerTripletIndex; quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1] = outerTripletIndex; - quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex] = lowerModule1; - quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 1] = lowerModule2; - quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 2] = lowerModule3; - quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 3] = lowerModule4; - quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex + 4] = lowerModule5; + quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex] = lowerModule1; + quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1] = lowerModule2; + quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2] = lowerModule3; + quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3] = lowerModule4; + quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4] = lowerModule5; quintupletsInGPU.innerRadius[quintupletIndex] = __F2H(innerRadius); quintupletsInGPU.outerRadius[quintupletIndex] = __F2H(outerRadius); quintupletsInGPU.pt[quintupletIndex] = __F2H(pt); @@ -187,36 +187,37 @@ namespace SDL { quintupletsInGPU.regressionRadius[quintupletIndex] = regressionRadius; quintupletsInGPU.regressionG[quintupletIndex] = regressionG; quintupletsInGPU.regressionF[quintupletIndex] = regressionF; - quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex] = - tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex]; - quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 1] = - tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 2] = - tripletsInGPU.logicalLayers[layers_T3 * innerTripletIndex + 2]; - quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 3] = - tripletsInGPU.logicalLayers[layers_T3 * outerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex + 4] = - tripletsInGPU.logicalLayers[layers_T3 * outerTripletIndex + 2]; - - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex] = tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 1] = - tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 1]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 2] = - tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 2]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 3] = - tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 3]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 4] = - tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 4]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 5] = - tripletsInGPU.hitIndices[hits_T3 * innerTripletIndex + 5]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 6] = - tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 2]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 7] = - tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 3]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 8] = - tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 4]; - quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex + 9] = - tripletsInGPU.hitIndices[hits_T3 * outerTripletIndex + 5]; + quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex] = + tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex]; + quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 1] = + tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 2] = + tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 2]; + quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 3] = + tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 4] = + tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 2]; + + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 1] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 1]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 2] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 2]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 3] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 3]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 4] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 4]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 5] = + tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 5]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 6] = + tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 2]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 7] = + tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 3]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 8] = + tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 4]; + quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 9] = + tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 5]; quintupletsInGPU.bridgeRadius[quintupletIndex] = bridgeRadius; quintupletsInGPU.rzChiSquared[quintupletIndex] = rzChiSquared; quintupletsInGPU.chiSquared[quintupletIndex] = rPhiChiSquared; @@ -231,7 +232,7 @@ namespace SDL { uint16_t& lowerModuleIndex4, uint16_t& lowerModuleIndex5, float& chiSquared) { - //following Philip's layer number prescription + // Using sdlLayer numbering convention defined in ModuleMethods.h const int layer1 = modulesInGPU.sdlLayers[lowerModuleIndex1]; const int layer2 = modulesInGPU.sdlLayers[lowerModuleIndex2]; const int layer3 = modulesInGPU.sdlLayers[lowerModuleIndex3]; @@ -340,7 +341,7 @@ namespace SDL { const float& z4 = mdsInGPU.anchorZ[fourthMDIndex] / 100; const float& z5 = mdsInGPU.anchorZ[fifthMDIndex] / 100; - //following Philip's layer number prescription + // Using sdl_layer numbering convention defined in ModuleMethods.h const int layer1 = modulesInGPU.sdlLayers[lowerModuleIndex1]; const int layer2 = modulesInGPU.sdlLayers[lowerModuleIndex2]; const int layer3 = modulesInGPU.sdlLayers[lowerModuleIndex3]; @@ -1526,7 +1527,7 @@ namespace SDL { //Cut 1 - z compatibility zOut = z_OutLo; rtOut = rt_OutLo; - if (not((z_OutLo >= zLo) && (z_OutLo <= zHi))) + if ((z_OutLo < zLo) || (z_OutLo > zHi)) return false; float drt_OutLo_InLo = (rt_OutLo - rt_InLo); @@ -1539,7 +1540,8 @@ namespace SDL { float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitch_InLo + zpitch_OutLo) * (zpitch_InLo + zpitch_OutLo) * 2.f; - float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); + float sdlThetaMulsF2 = + (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1553,7 +1555,7 @@ namespace SDL { zHiPointed = z_InLo + dzMean * (z_InLo < 0.f ? 1.f : dzDrtScale) + zWindow; // Cut #2: Pointed Z (Inner segment two MD points to outer segment inner MD) - if (not((z_OutLo >= zLoPointed) && (z_OutLo <= zHiPointed))) + if ((z_OutLo < zLoPointed) || (z_OutLo > zHiPointed)) return false; float sdlPVoff = 0.1f / rt_OutLo; @@ -1561,7 +1563,7 @@ namespace SDL { deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); // Cut #3: FIXME:deltaPhiPos can be tighter - if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + if (alpaka::math::abs(acc, deltaPhiPos) > sdlCut) return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); @@ -1572,7 +1574,7 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #4: deltaPhiChange - if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + if (alpaka::math::abs(acc, dPhi) > sdlCut) return false; // First obtaining the raw betaIn and betaOut values without any correction and just purely based on the mini-doublet hit positions @@ -1656,7 +1658,7 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #5: first beta cut - if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + if (alpaka::math::abs(acc, betaInRHmin) >= betaInCut) return false; float betaAv = 0.5f * (betaIn + betaOut); @@ -1721,7 +1723,7 @@ namespace SDL { (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - if (not((alpaka::math::abs(acc, betaOut) < betaOutCut))) + if (alpaka::math::abs(acc, betaOut) >= betaOutCut) return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, drt_InSeg); @@ -1733,10 +1735,7 @@ namespace SDL { float dBeta = betaIn - betaOut; deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); - if (not(dBeta * dBeta <= dBetaCut2)) - return false; - - return true; + return dBeta * dBeta <= dBetaCut2; }; template @@ -1793,7 +1792,7 @@ namespace SDL { zLo = z_InLo + (z_InLo - SDL::deltaZLum) * (rtRatio_OutLoInLo - 1.f) * (z_InLo > 0.f ? 1.f : dzDrtScale) - zGeom; // Cut #0: Preliminary (Only here in endcap case) - if (not(z_InLo * z_OutLo > 0)) + if (z_InLo * z_OutLo <= 0) return false; float dLum = SDL::copysignf(SDL::deltaZLum, z_InLo); @@ -1806,7 +1805,7 @@ namespace SDL { rtOut = rt_OutLo; //Cut #1: rt condition - if (not(rtOut >= rtLo)) + if (rtOut < rtLo) return false; float zInForHi = z_InLo - zGeom1 - dLum; @@ -1816,7 +1815,7 @@ namespace SDL { rtHi = rt_InLo * (1.f + (z_OutLo - z_InLo + zGeom1) / zInForHi) + rtGeom1; //Cut #2: rt condition - if (not((rt_OutLo >= rtLo) && (rt_OutLo <= rtHi))) + if ((rt_OutLo < rtLo) || (rt_OutLo > rtHi)) return false; float rIn = alpaka::math::sqrt(acc, z_InLo * z_InLo + rt_InLo * rt_InLo); @@ -1832,13 +1831,14 @@ namespace SDL { kZ = (z_OutLo - z_InLo) / dzSDIn; float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); + const float sdlThetaMulsF2 = + (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); //Cut #3: rt-z pointed - if (not((kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi))) + if ((kZ < 0) || (rtOut < rtLo) || (rtOut > rtHi)) return false; const float sdlPVoff = 0.1f / rt_OutLo; @@ -1847,7 +1847,7 @@ namespace SDL { deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); //Cut #4: deltaPhiPos can be tighter - if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + if (alpaka::math::abs(acc, deltaPhiPos) > sdlCut) return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); @@ -1857,7 +1857,7 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - if (not(alpaka::math::abs(acc, dPhi) <= sdlCut)) + if (alpaka::math::abs(acc, dPhi) > sdlCut) return false; float sdIn_alpha = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); @@ -1928,7 +1928,7 @@ namespace SDL { (0.02f / sdIn_d); //Cut #6: first beta cut - if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + if (alpaka::math::abs(acc, betaInRHmin) >= betaInCut) return false; float betaAv = 0.5f * (betaIn + betaOut); @@ -1993,7 +1993,7 @@ namespace SDL { (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + if (alpaka::math::abs(acc, betaOut) >= betaOutCut) return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, sdIn_d); @@ -2005,10 +2005,7 @@ namespace SDL { float dBeta = betaIn - betaOut; deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); //Cut #7: Cut on dBet - if (not(dBeta * dBeta <= dBetaCut2)) - return false; - - return true; + return dBeta * dBeta <= dBetaCut2; }; template @@ -2066,7 +2063,7 @@ namespace SDL { zGeom; //slope-correction only on outer end // Cut #0: Preliminary (Only here in endcap case) - if (not((z_InLo * z_OutLo) > 0)) + if ((z_InLo * z_OutLo) <= 0) return false; float dLum = SDL::copysignf(SDL::deltaZLum, z_InLo); @@ -2087,7 +2084,7 @@ namespace SDL { rtHi = rt_InLo * (1.f + dz / (z_InLo - dLum)) + rtGeom; - if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + if ((rtOut < rtLo) || (rtOut > rtHi)) return false; bool isInSgOuterMDPS = modulesInGPU.moduleType[innerOuterLowerModuleIndex] == SDL::PS; @@ -2101,7 +2098,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); kZ = (z_OutLo - z_InLo) / dzSDIn; - float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); + float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; @@ -2120,7 +2117,7 @@ namespace SDL { if (isInSgInnerMDPS and isInSgOuterMDPS) // If both PS then we can point { - if (not(kZ >= 0 and rtOut >= rtLo_point and rtOut <= rtHi_point)) + if (kZ < 0 || rtOut < rtLo_point || rtOut > rtHi_point) return false; } @@ -2129,7 +2126,7 @@ namespace SDL { deltaPhiPos = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[fourthMDIndex] - mdsInGPU.anchorPhi[secondMDIndex]); - if (not(alpaka::math::abs(acc, deltaPhiPos) <= sdlCut)) + if (alpaka::math::abs(acc, deltaPhiPos) > sdlCut) return false; float midPointX = 0.5f * (mdsInGPU.anchorX[firstMDIndex] + mdsInGPU.anchorX[thirdMDIndex]); @@ -2140,7 +2137,7 @@ namespace SDL { dPhi = SDL::deltaPhi(acc, midPointX, midPointY, diffX, diffY); // Cut #5: deltaPhiChange - if (not((alpaka::math::abs(acc, dPhi) <= sdlCut))) + if (alpaka::math::abs(acc, dPhi) > sdlCut) return false; float sdIn_alpha = __H2F(segmentsInGPU.dPhiChanges[innerSegmentIndex]); @@ -2198,7 +2195,7 @@ namespace SDL { (0.02f / sdIn_d); //Cut #6: first beta cut - if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) + if (alpaka::math::abs(acc, betaInRHmin) >= betaInCut) return false; float betaAv = 0.5f * (betaIn + betaOut); @@ -2251,7 +2248,7 @@ namespace SDL { (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls2); //Cut #6: The real beta cut - if (not(alpaka::math::abs(acc, betaOut) < betaOutCut)) + if (alpaka::math::abs(acc, betaOut) >= betaOutCut) return false; float dBetaRes = 0.02f / alpaka::math::min(acc, sdOut_d, sdIn_d); @@ -2264,10 +2261,7 @@ namespace SDL { //Cut #7: Cut on dBeta deltaBetaCut = alpaka::math::sqrt(acc, dBetaCut2); - if (not(dBeta * dBeta <= dBetaCut2)) - return false; - - return true; + return dBeta * dBeta <= dBetaCut2; }; template @@ -2705,7 +2699,7 @@ namespace SDL { #else rzChiSquared = -1; #endif - if (not(innerRadius >= 0.95f * ptCut / (2.f * k2Rinv1GeVf))) + if (innerRadius < 0.95f * ptCut / (2.f * k2Rinv1GeVf)) return false; float innerInvRadiusMin, innerInvRadiusMax, bridgeInvRadiusMin, bridgeInvRadiusMax, outerInvRadiusMin, @@ -2884,7 +2878,7 @@ namespace SDL { computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); regressionRadius = computeRadiusUsingRegression( - acc, layers_T5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); + acc, objLayers::kT5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); #ifdef USE_T5_DNN unsigned int mdIndices[] = {firstMDIndex, secondMDIndex, thirdMDIndex, fourthMDIndex, fifthMDIndex}; @@ -2903,7 +2897,7 @@ namespace SDL { outerRadius, bridgeRadius); TightCutFlag = TightCutFlag and (inference > T5DNN::LSTWP2); // T5-in-TC cut - if (not(inference > T5DNN::LSTWP2)) // T5-building cut + if (inference <= T5DNN::LSTWP2) // T5-building cut return false; #endif @@ -2923,7 +2917,7 @@ namespace SDL { //compute the other chisquared //non anchor is always shifted for tilted and endcap! - float nonAnchorDelta1[layers_T5], nonAnchorDelta2[layers_T5], nonAnchorSlopes[layers_T5]; + float nonAnchorDelta1[objLayers::kT5], nonAnchorDelta2[objLayers::kT5], nonAnchorSlopes[objLayers::kT5]; float nonAnchorxs[] = {mdsInGPU.outerX[firstMDIndex], mdsInGPU.outerX[secondMDIndex], mdsInGPU.outerX[thirdMDIndex], @@ -2942,10 +2936,10 @@ namespace SDL { nonAnchorDelta2, nonAnchorSlopes, isFlat, - layers_T5, + objLayers::kT5, false); nonAnchorChiSquared = computeChiSquared(acc, - layers_T5, + objLayers::kT5, nonAnchorxs, nonAnchorys, nonAnchorDelta1, @@ -2988,14 +2982,14 @@ namespace SDL { for (unsigned int innerTripletArrayIndex = globalThreadIdx[1]; innerTripletArrayIndex < nInnerTriplets; innerTripletArrayIndex += gridThreadExtent[1]) { unsigned int innerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule1] + innerTripletArrayIndex; - uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[layers_T3 * innerTripletIndex + 1]; - uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[layers_T3 * innerTripletIndex + 2]; + uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 1]; + uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 2]; unsigned int nOuterTriplets = tripletsInGPU.nTriplets[lowerModule3]; for (unsigned int outerTripletArrayIndex = globalThreadIdx[2]; outerTripletArrayIndex < nOuterTriplets; outerTripletArrayIndex += gridThreadExtent[2]) { unsigned int outerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule3] + outerTripletArrayIndex; - uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[layers_T3 * outerTripletIndex + 1]; - uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[layers_T3 * outerTripletIndex + 2]; + uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 1]; + uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 2]; float innerRadius, outerRadius, bridgeRadius, regressionG, regressionF, regressionRadius, rzChiSquared, chiSquared, nonAnchorChiSquared; //required for making distributions @@ -3138,13 +3132,13 @@ namespace SDL { else category_number = -1; - if (module_eta < 0.75) + if (module_eta < 0.75f) eta_number = 0; - else if (module_eta > 0.75 && module_eta < 1.5) + else if (module_eta < 1.5f) eta_number = 1; - else if (module_eta > 1.5 && module_eta < 2.25) + else if (module_eta < 2.25f) eta_number = 2; - else if (module_eta > 2.25 && module_eta < 3) + else if (module_eta < 3.0f) eta_number = 3; else eta_number = -1; diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 7b3eaaa26afc8..39936d3d068d5 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -499,19 +499,19 @@ namespace SDL { zGeom; //slope-correction only on outer end zHi = zIn + (zIn + deltaZLum) * (rtOut / rtIn - 1.f) * (zIn < 0.f ? 1.f : dzDrtScale) + zGeom; - if (not((zOut >= zLo) && (zOut <= zHi))) + if ((zOut < zLo) || (zOut > zHi)) return false; sdCut = sdSlope + alpaka::math::sqrt(acc, sdMuls * sdMuls + sdPVoff * sdPVoff); dPhi = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[outerMDIndex] - mdsInGPU.anchorPhi[innerMDIndex]); - if (not(alpaka::math::abs(acc, dPhi) <= sdCut)) + if (alpaka::math::abs(acc, dPhi) > sdCut) return false; dPhiChange = SDL::phi_mpi_pi(acc, SDL::phi(acc, xOut - xIn, yOut - yIn) - mdsInGPU.anchorPhi[innerMDIndex]); - if (not(alpaka::math::abs(acc, dPhiChange) <= sdCut)) + if (alpaka::math::abs(acc, dPhiChange) > sdCut) return false; float dAlphaThresholdValues[3]; @@ -542,14 +542,11 @@ namespace SDL { dAlphaOuterMDSegmentThreshold = dAlphaThresholdValues[1]; dAlphaInnerMDOuterMDThreshold = dAlphaThresholdValues[2]; - if (not(alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaInnerMDSegmentThreshold)) + if (alpaka::math::abs(acc, dAlphaInnerMDSegment) >= dAlphaInnerMDSegmentThreshold) return false; - if (not(alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaOuterMDSegmentThreshold)) + if (alpaka::math::abs(acc, dAlphaOuterMDSegment) >= dAlphaOuterMDSegmentThreshold) return false; - if (not(alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaInnerMDOuterMDThreshold)) - return false; - - return true; + return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaInnerMDOuterMDThreshold; }; template @@ -604,7 +601,7 @@ namespace SDL { : (2.f * strip2SZpitch))); //cut 0 - z compatibility - if (not(zIn * zOut >= 0)) + if (zIn * zOut < 0) return false; float dz = zOut - zIn; @@ -618,7 +615,7 @@ namespace SDL { rtGeom; //dLum for luminous; rGeom for measurement size; no tanTheta_loc(pt) correction // Completeness - if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + if ((rtOut < rtLo) || (rtOut > rtHi)) return false; dPhi = SDL::phi_mpi_pi(acc, mdsInGPU.anchorPhi[outerMDIndex] - mdsInGPU.anchorPhi[innerMDIndex]); @@ -636,7 +633,7 @@ namespace SDL { dPhiMax = dPhi; dPhiMin = dPhi; } - if (not(alpaka::math::abs(acc, dPhi) <= sdCut)) + if (alpaka::math::abs(acc, dPhi) > sdCut) return false; float dzFrac = dz / zIn; @@ -644,7 +641,7 @@ namespace SDL { dPhiChangeMin = dPhiMin / dzFrac * (1.f + dzFrac); dPhiChangeMax = dPhiMax / dzFrac * (1.f + dzFrac); - if (not(alpaka::math::abs(acc, dPhiChange) <= sdCut)) + if (alpaka::math::abs(acc, dPhiChange) > sdCut) return false; float dAlphaThresholdValues[3]; @@ -675,14 +672,11 @@ namespace SDL { dAlphaOuterMDSegment = outerMDAlpha - dPhiChange; dAlphaInnerMDOuterMD = innerMDAlpha - outerMDAlpha; - if (not(alpaka::math::abs(acc, dAlphaInnerMDSegment) < dAlphaThresholdValues[0])) + if (alpaka::math::abs(acc, dAlphaInnerMDSegment) >= dAlphaThresholdValues[0]) return false; - if (not(alpaka::math::abs(acc, dAlphaOuterMDSegment) < dAlphaThresholdValues[1])) + if (alpaka::math::abs(acc, dAlphaOuterMDSegment) >= dAlphaThresholdValues[1]) return false; - if (not(alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2])) - return false; - - return true; + return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2] }; template @@ -933,13 +927,13 @@ namespace SDL { else category_number = -1; - if (module_eta < 0.75) + if (module_eta < 0.75f) eta_number = 0; - else if (module_eta < 1.5) + else if (module_eta < 1.5f) eta_number = 1; - else if (module_eta < 2.25) + else if (module_eta < 2.25f) eta_number = 2; - else if (module_eta < 3) + else if (module_eta < 3.0f) eta_number = 3; else eta_number = -1; @@ -1074,7 +1068,7 @@ namespace SDL { (hitsInGPU.zs[mdsInGPU.anchorHitIndices[outerMDIndex]]); score_lsq = score_lsq * score_lsq; - unsigned int hits1[hits_pLS]; + unsigned int hits1[objHits::kpLS]; hits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[innerMDIndex]]; hits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[outerMDIndex]]; hits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[innerMDIndex]]; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index 39f8661a209df..c527bc0eb9373 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -83,10 +83,10 @@ namespace SDL { nTrackCandidatespT5_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatespLS_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatesT5_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, layers_pT5 * maxTrackCandidates, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, hits_pT5 * maxTrackCandidates, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, objHits::kpT5 * maxTrackCandidates, queue)), pixelSeedIndex_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_pT5 * maxTrackCandidates, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), centerX_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), centerY_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), radius_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)) { @@ -115,11 +115,11 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = trackletIndex; - trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 0] = + trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 0] = hitIndices.x; // Order explanation in https://github.com/SegmentLinking/TrackLooper/issues/267 - trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 1] = hitIndices.z; - trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 2] = hitIndices.y; - trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + 3] = hitIndices.w; + trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 1] = hitIndices.z; + trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 2] = hitIndices.y; + trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 3] = hitIndices.w; }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTrackCandidateToMemory(struct SDL::trackCandidates& trackCandidatesInGPU, @@ -142,15 +142,16 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; - size_t limits = trackCandidateType == 7 ? layers_pT5 : layers_pT3; // 7 means pT5, layers_pT3 = layers_T5 = 5 + size_t limits = trackCandidateType == 7 ? objLayers::kpT5 + : objLayers::kpT3; // 7 means pT5, objLayers::kpT3 = objLayers::kT5 = 5 //send the starting pointer to the logicalLayer and hitIndices for (size_t i = 0; i < limits; i++) { - trackCandidatesInGPU.logicalLayers[layers_pT5 * trackCandidateIndex + i] = logicalLayerIndices[i]; - trackCandidatesInGPU.lowerModuleIndices[layers_pT5 * trackCandidateIndex + i] = lowerModuleIndices[i]; + trackCandidatesInGPU.logicalLayers[objLayers::kpT5 * trackCandidateIndex + i] = logicalLayerIndices[i]; + trackCandidatesInGPU.lowerModuleIndices[objLayers::kpT5 * trackCandidateIndex + i] = lowerModuleIndices[i]; } for (size_t i = 0; i < 2 * limits; i++) { - trackCandidatesInGPU.hitIndices[hits_pT5 * trackCandidateIndex + i] = hitIndices[i]; + trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + i] = hitIndices[i]; } trackCandidatesInGPU.centerX[trackCandidateIndex] = __F2H(centerX); trackCandidatesInGPU.centerY[trackCandidateIndex] = __F2H(centerY); @@ -162,8 +163,9 @@ namespace SDL { struct SDL::miniDoublets& mdsInGPU, struct SDL::segments& segmentsInGPU, struct SDL::hits& hitsInGPU) { - int phits1[hits_pLS] = {-1, -1, -1, -1}; - int phits2[hits_pLS] = {-1, -1, -1, -1}; + int phits1[objHits::kpLS]; + int phits2[objHits::kpLS]; + phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix + 1]]]; phits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; @@ -176,12 +178,12 @@ namespace SDL { int npMatched = 0; - for (int i = 0; i < hits_pLS; i++) { + for (int i = 0; i < objHits::kpLS; i++) { bool pmatched = false; if (phits1[i] == -1) continue; - for (int j = 0; j < hits_pLS; j++) { + for (int j = 0; j < objHits::kpLS; j++) { if (phits2[j] == -1) continue; @@ -413,9 +415,9 @@ namespace SDL { 5 /*track candidate type pT3=5*/, pixelTripletIndex, pixelTripletIndex, - &pixelTripletsInGPU.logicalLayers[layers_pT3 * pixelTripletIndex], - &pixelTripletsInGPU.lowerModuleIndices[layers_pT3 * pixelTripletIndex], - &pixelTripletsInGPU.hitIndices[hits_pT3 * pixelTripletIndex], + &pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex], + &pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex], + &pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex], segmentsInGPU.seedIdx[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), @@ -466,9 +468,9 @@ namespace SDL { 4 /*track candidate type T5=4*/, quintupletIndex, quintupletIndex, - &quintupletsInGPU.logicalLayers[layers_T5 * quintupletIndex], - &quintupletsInGPU.lowerModuleIndices[layers_T5 * quintupletIndex], - &quintupletsInGPU.hitIndices[hits_T5 * quintupletIndex], + &quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex], + &quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex], + &quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex], -1 /*no pixel seed index for T5s*/, quintupletsInGPU.regressionG[quintupletIndex], quintupletsInGPU.regressionF[quintupletIndex], @@ -558,9 +560,9 @@ namespace SDL { 7 /*track candidate type pT5=7*/, pT5PixelIndex, pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[layers_pT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[layers_pT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[hits_pT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex], segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index c8d3181c738c0..2bc5e63cd0098 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -108,12 +108,12 @@ namespace SDL { template tripletsBuffer(unsigned int maxTriplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : segmentIndices_buf(allocBufWrapper(devAccIn, 2 * maxTriplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, layers_T3 * maxTriplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT3 * maxTriplets, queue)), nTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * layers_T3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * hits_T3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * objLayers::kT3, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * objHits::kT3, queue)), betaIn_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleRadius_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleCenterX_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), @@ -191,31 +191,31 @@ namespace SDL { { tripletsInGPU.segmentIndices[tripletIndex * 2] = innerSegmentIndex; tripletsInGPU.segmentIndices[tripletIndex * 2 + 1] = outerSegmentIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3] = innerInnerLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3 + 1] = middleLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * layers_T3 + 2] = outerOuterLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3] = innerInnerLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 1] = middleLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 2] = outerOuterLowerModuleIndex; tripletsInGPU.betaIn[tripletIndex] = __F2H(betaIn); tripletsInGPU.circleRadius[tripletIndex] = circleRadius; tripletsInGPU.circleCenterX[tripletIndex] = circleCenterX; tripletsInGPU.circleCenterY[tripletIndex] = circleCenterY; - tripletsInGPU.logicalLayers[tripletIndex * layers_T3] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3] = modulesInGPU.layers[innerInnerLowerModuleIndex] + (modulesInGPU.subdets[innerInnerLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 1] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1] = modulesInGPU.layers[middleLowerModuleIndex] + (modulesInGPU.subdets[middleLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * layers_T3 + 2] = + tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3] = mdsInGPU.anchorHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * hits_T3 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3] = mdsInGPU.anchorHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; #ifdef CUT_VALUE_DEBUG tripletsInGPU.zOut[tripletIndex] = zOut; tripletsInGPU.rtOut[tripletIndex] = rtOut; @@ -252,7 +252,7 @@ namespace SDL { const float& z2 = mdsInGPU.anchorZ[secondMDIndex]; const float& z3 = mdsInGPU.anchorZ[thirdMDIndex]; - //following Philip's layer number prescription + // Using sdl_layer numbering convention defined in ModuleMethods.h const int layer1 = modulesInGPU.sdlLayers[innerInnerLowerModuleIndex]; const int layer2 = modulesInGPU.sdlLayers[middleLowerModuleIndex]; const int layer3 = modulesInGPU.sdlLayers[outerOuterLowerModuleIndex]; @@ -333,7 +333,7 @@ namespace SDL { (zpitchIn + zpitchOut); //slope-correction only on outer end //Cut 1 - z compatibility - if (not((zOut >= zLo) && (zOut <= zHi))) + if ((zOut < zLo) || (zOut > zHi)) return false; float drt_OutIn = (rtOut - rtIn); @@ -347,7 +347,7 @@ namespace SDL { float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f; - float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); + float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -363,7 +363,7 @@ namespace SDL { // Constructing upper and lower bound // Cut #2: Pointed Z (Inner segment two MD points to outer segment inner MD) - if (not((zOut >= zLoPointed) && (zOut <= zHiPointed))) + if ((zOut < zLoPointed) || (zOut > zHiPointed)) return false; // raw betaIn value without any correction, based on the mini-doublet hit positions @@ -388,10 +388,7 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #3: first beta cut - if (not(alpaka::math::abs(acc, betaIn) < betaInCut)) - return false; - - return true; + return alpaka::math::abs(acc, betaIn) < betaInCut }; template @@ -433,7 +430,7 @@ namespace SDL { float zGeom = zpitchIn + zpitchOut; // Cut #0: Preliminary (Only here in endcap case) - if (not(zIn * zOut > 0)) + if (zIn * zOut <= 0) return false; float dLum = SDL::copysignf(SDL::deltaZLum, zIn); @@ -451,7 +448,7 @@ namespace SDL { float rtHi = rtIn * (1.f + (zOut - zIn + zGeom1) / zInForHi) + rtGeom1; //Cut #2: rt condition - if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + if ((rtOut < rtLo) || (rtOut > rtHi)) return false; float rIn = alpaka::math::sqrt(acc, zIn * zIn + rtIn * rtIn); @@ -468,14 +465,14 @@ namespace SDL { const float kZ = (zOut - zIn) / dzSDIn; float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); - const float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); + const float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); //Cut #3: rt-z pointed - if (not((kZ >= 0) && (rtOut >= rtLo) && (rtOut <= rtHi))) + if ((kZ < 0) || (rtOut < rtLo) || (rtOut > rtHi)) return false; float rt_InLo = mdsInGPU.anchorRt[firstMDIndex]; @@ -512,10 +509,7 @@ namespace SDL { (0.02f / sdIn_d); //Cut #4: first beta cut - if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) - return false; - - return true; + return alpaka::math::abs(acc, betaInRHmin) < betaInCut; }; template @@ -550,7 +544,7 @@ namespace SDL { alpaka::math::tan(acc, alpha1GeV_Out) / alpha1GeV_Out; // The track can bend in r-z plane slightly // Cut #0: Preliminary (Only here in endcap case) - if (not(zIn * zOut > 0)) + if (zIn * zOut <= 0) return false; float dLum = SDL::copysignf(SDL::deltaZLum, zIn); @@ -566,7 +560,7 @@ namespace SDL { const float rtHi = rtIn * (1.f + dz / (zIn - dLum)) + rtGeom; //Cut #1: rt condition - if (not((rtOut >= rtLo) && (rtOut <= rtHi))) + if ((rtOut < rtLo) || (rtOut > rtHi)) return false; bool isInSgOuterMDPS = modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS; @@ -581,7 +575,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); float kZ = (zOut - zIn) / dzSDIn; - float sdlThetaMulsF2 = (0.015f * 0.015f) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); + float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; @@ -600,7 +594,7 @@ namespace SDL { if (isInSgInnerMDPS and isInSgOuterMDPS) // If both PS then we can point { - if (not((kZ >= 0) && (rtOut >= rtLo_point) && (rtOut <= rtHi_point))) + if ((kZ < 0) || (rtOut < rtLo_point) || (rtOut > rtHi_point)) return false; } @@ -638,10 +632,7 @@ namespace SDL { (0.02f / sdIn_d); //Cut #4: first beta cut - if (not(alpaka::math::abs(acc, betaInRHmin) < betaInCut)) - return false; - - return true; + return alpaka::math::abs(acc, betaInRHmin) < betaInCut; }; template @@ -1033,13 +1024,13 @@ namespace SDL { else category_number = -1; - if (module_eta < 0.75) + if (module_eta < 0.75f) eta_number = 0; - else if (module_eta < 1.5) + else if (module_eta < 1.5f) eta_number = 1; - else if (module_eta < 2.25) + else if (module_eta < 2.25f) eta_number = 2; - else if (module_eta < 3) + else if (module_eta < 3.0f) eta_number = 3; else eta_number = -1; From f47212f13ca208b20aa0fcd5f30ec5b411a647e1 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 8 Jul 2024 07:32:46 -0700 Subject: [PATCH 14/18] Renamed new endcap geometry class --- .../interface/alpaka/EndcapGeometryBuffer.h | 14 +++++++------- RecoTracker/LSTCore/interface/alpaka/LSTESData.h | 6 +++--- RecoTracker/LSTCore/src/alpaka/Event.h | 2 +- RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h index 97e755e57601c..192048bbbf006 100644 --- a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h +++ b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h @@ -15,7 +15,7 @@ namespace SDL { - struct endcapGeom { + struct EndcapGeometryDev { const unsigned int* geoMapDetId; const float* geoMapPhi; @@ -27,29 +27,29 @@ namespace SDL { }; template - struct endcapGeometryBuffer : endcapGeom { + struct EndcapGeometryBuffer : EndcapGeometryDev { Buf geoMapDetId_buf; Buf geoMapPhi_buf; - endcapGeometryBuffer(TDev const& dev, unsigned int nEndCapMap) + EndcapGeometryBuffer(TDev const& dev, unsigned int nEndCapMap) : geoMapDetId_buf(allocBufWrapper(dev, nEndCapMap)), geoMapPhi_buf(allocBufWrapper(dev, nEndCapMap)) { setData(*this); } template - inline void copyFromSrc(TQueue queue, const endcapGeometryBuffer& src) { + inline void copyFromSrc(TQueue queue, const EndcapGeometryBuffer& src) { alpaka::memcpy(queue, geoMapDetId_buf, src.geoMapDetId_buf); alpaka::memcpy(queue, geoMapPhi_buf, src.geoMapPhi_buf); } template - endcapGeometryBuffer(TQueue queue, const endcapGeometryBuffer& src, unsigned int nEndCapMap) - : endcapGeometryBuffer(alpaka::getDev(queue), nEndCapMap) { + EndcapGeometryBuffer(TQueue queue, const EndcapGeometryBuffer& src, unsigned int nEndCapMap) + : EndcapGeometryBuffer(alpaka::getDev(queue), nEndCapMap) { copyFromSrc(queue, src); } - inline SDL::endcapGeom const* data() const { return this; } + inline SDL::EndcapGeometryDev const* data() const { return this; } }; } // namespace SDL diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index ea7e5a7fa647d..c407462ea7a34 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -21,7 +21,7 @@ namespace SDL { unsigned int nPixels; unsigned int nEndCapMap; std::shared_ptr> modulesBuffers; - std::shared_ptr> endcapGeometryBuffers; + std::shared_ptr> endcapGeometryBuffers; std::shared_ptr pixelMapping; LSTESData(uint16_t const& nModulesIn, @@ -29,7 +29,7 @@ namespace SDL { unsigned int const& nPixelsIn, unsigned int const& nEndCapMapIn, std::shared_ptr> const& modulesBuffersIn, - std::shared_ptr> const& endcapGeometryBuffersIn, + std::shared_ptr> const& endcapGeometryBuffersIn, std::shared_ptr const& pixelMappingIn) : nModules(nModulesIn), nLowerModules(nLowerModulesIn), @@ -54,7 +54,7 @@ namespace cms::alpakatools { alpaka::getDev(queue), srcData.nModules, srcData.nPixels); deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers); auto deviceEndcapGeometryBuffers = - std::make_shared>>(alpaka::getDev(queue), srcData.nEndCapMap); + std::make_shared>>(alpaka::getDev(queue), srcData.nEndCapMap); deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers); return SDL::LSTESData>(srcData.nModules, diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index bb7b1737ac9d0..53cb824fb729a 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -87,7 +87,7 @@ namespace SDL { const unsigned int nEndCapMap_; const std::shared_ptr> modulesBuffers_; const std::shared_ptr pixelMapping_; - const std::shared_ptr> endcapGeometryBuffers_; + const std::shared_ptr> endcapGeometryBuffers_; public: // Constructor used for CMSSW integration. Uses an external queue. diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index cb073bf955e50..6b635673837ae 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -90,7 +90,7 @@ std::unique_ptr> SDL::loadAndFillESHost() { ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); auto endcapGeometryBuffers = - std::make_shared>(cms::alpakatools::host(), endcapGeometry->nEndCapMap); + std::make_shared>(cms::alpakatools::host(), endcapGeometry->nEndCapMap); alpaka::QueueCpuBlocking queue(cms::alpakatools::host()); alpaka::memcpy( queue, endcapGeometryBuffers->geoMapDetId_buf, endcapGeometry->geoMapDetId_buf, endcapGeometry->nEndCapMap); From 86503a29d741a5654caf588fedd7240addc7dff6 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 8 Jul 2024 07:41:35 -0700 Subject: [PATCH 15/18] Fixed include guards for headers in interface directory --- RecoTracker/LST/interface/LSTOutput.h | 4 ++-- RecoTracker/LST/interface/LSTPhase2OTHitsInput.h | 4 ++-- RecoTracker/LST/interface/LSTPixelSeedInput.h | 4 ++-- RecoTracker/LSTCore/interface/alpaka/Constants.h | 4 ++-- RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h | 4 ++-- RecoTracker/LSTCore/interface/alpaka/LST.h | 4 ++-- RecoTracker/LSTCore/interface/alpaka/LSTESData.h | 4 ++-- RecoTracker/LSTCore/interface/alpaka/Module.h | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/RecoTracker/LST/interface/LSTOutput.h b/RecoTracker/LST/interface/LSTOutput.h index 765be209201d9..7a581cc3299f9 100644 --- a/RecoTracker/LST/interface/LSTOutput.h +++ b/RecoTracker/LST/interface/LSTOutput.h @@ -1,5 +1,5 @@ -#ifndef RecoTracker_LST_LSTOutput_h -#define RecoTracker_LST_LSTOutput_h +#ifndef RecoTracker_LST_interface_LSTOutput_h +#define RecoTracker_LST_interface_LSTOutput_h #include #include diff --git a/RecoTracker/LST/interface/LSTPhase2OTHitsInput.h b/RecoTracker/LST/interface/LSTPhase2OTHitsInput.h index 524a06be1250a..6a65d09dd30d7 100644 --- a/RecoTracker/LST/interface/LSTPhase2OTHitsInput.h +++ b/RecoTracker/LST/interface/LSTPhase2OTHitsInput.h @@ -1,5 +1,5 @@ -#ifndef RecoTracker_LST_LSTPhase2OTHitsInput_h -#define RecoTracker_LST_LSTPhase2OTHitsInput_h +#ifndef RecoTracker_LST_interface_LSTPhase2OTHitsInput_h +#define RecoTracker_LST_interface_LSTPhase2OTHitsInput_h #include #include diff --git a/RecoTracker/LST/interface/LSTPixelSeedInput.h b/RecoTracker/LST/interface/LSTPixelSeedInput.h index 14681f266de2f..69fa1ed0d4ece 100644 --- a/RecoTracker/LST/interface/LSTPixelSeedInput.h +++ b/RecoTracker/LST/interface/LSTPixelSeedInput.h @@ -1,5 +1,5 @@ -#ifndef RecoTracker_LST_LSTPixelSeedInput_h -#define RecoTracker_LST_LSTPixelSeedInput_h +#ifndef RecoTracker_LST_interface_LSTPixelSeedInput_h +#define RecoTracker_LST_interface_LSTPixelSeedInput_h #include #include diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index aa6898b814f57..5f2574ff5a6a0 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -1,5 +1,5 @@ -#ifndef Constants_cuh -#define Constants_cuh +#ifndef RecoTracker_LSTCore_interface_alpaka_Constants_h +#define RecoTracker_LSTCore_interface_alpaka_Constants_h #include diff --git a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h index 192048bbbf006..3def25c3ccb7b 100644 --- a/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h +++ b/RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h @@ -1,5 +1,5 @@ -#ifndef EndcapGeometryBuffers_h -#define EndcapGeometryBuffers_h +#ifndef RecoTracker_LSTCore_interface_alpaka_EndcapGeometryBuffers_h +#define RecoTracker_LSTCore_interface_alpaka_EndcapGeometryBuffers_h #include #include diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index ba63691764ecd..6b8ee7e23ddd3 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -1,5 +1,5 @@ -#ifndef LST_H -#define LST_H +#ifndef RecoTracker_LSTCore_interface_alpaka_LST_h +#define RecoTracker_LSTCore_interface_alpaka_LST_h #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/LSTESData.h" diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index c407462ea7a34..5bec4018daba5 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -1,5 +1,5 @@ -#ifndef LSTESData_H -#define LSTESData_H +#ifndef RecoTracker_LSTCore_interface_alpaka_LSTESData_h +#define RecoTracker_LSTCore_interface_alpaka_LSTESData_h #include "RecoTracker/LSTCore/interface/alpaka/Constants.h" #include "RecoTracker/LSTCore/interface/alpaka/EndcapGeometryBuffer.h" diff --git a/RecoTracker/LSTCore/interface/alpaka/Module.h b/RecoTracker/LSTCore/interface/alpaka/Module.h index 6f7d23ea08e88..323b74fa146dd 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Module.h +++ b/RecoTracker/LSTCore/interface/alpaka/Module.h @@ -1,5 +1,5 @@ -#ifndef Module_cuh -#define Module_cuh +#ifndef RecoTracker_LSTCore_interface_alpaka_Module_h +#define RecoTracker_LSTCore_interface_alpaka_Module_h #include From a3a8054945636973191c9c4cc76e2ed36e271e1e Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Tue, 9 Jul 2024 05:19:42 -0700 Subject: [PATCH 16/18] Even further work on naming values and sqrt, loop, etc. simplifications --- .../LSTCore/interface/alpaka/Constants.h | 32 +-- RecoTracker/LSTCore/src/alpaka/Event.dev.cc | 12 +- RecoTracker/LSTCore/src/alpaka/Kernels.h | 76 ++--- RecoTracker/LSTCore/src/alpaka/LST.dev.cc | 10 +- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 264 +++++++++--------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 100 +++---- RecoTracker/LSTCore/src/alpaka/Segment.h | 4 +- .../LSTCore/src/alpaka/TrackCandidate.h | 50 ++-- RecoTracker/LSTCore/src/alpaka/Triplet.h | 38 +-- 9 files changed, 287 insertions(+), 299 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index aa6898b814f57..7cb70125a427e 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -120,28 +120,16 @@ namespace SDL { constexpr unsigned int size_superbins = 45000; //defining the constant host device variables right up here - namespace objLayers { - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = - 2; // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4). To be potentially handled better in the future. - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 2; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 3; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 5; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 7; - } // namespace objLayers - - namespace objHits { - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpLS = - 4; // Currently pixel tracks treated as LSs with 4 hits. To be potentially handled better in the future. - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kLS = 4; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT3 = 6; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT3 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kT5 = 10; - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr int kpT5 = 14; - } // namespace objHits - - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGev2 = - 0.015; // 15 MeV constant from the approximate Bethe-Bloch formula + // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4) and 4 hits. To be potentially handled better in the future. + struct Params_pLS { static constexpr int kLayers = 2, kHits = 4; }; + struct Params_LS { static constexpr int kLayers = 2, kHits = 4; }; + struct Params_T3 { static constexpr int kLayers = 3, kHits = 6; }; + struct Params_pT3 { static constexpr int kLayers = 5, kHits = 10; }; + struct Params_T5 { static constexpr int kLayers = 5, kHits = 10; }; + struct Params_pT5 { static constexpr int kLayers = 7, kHits = 14; }; + + // 15 MeV constant from the approximate Bethe-Bloch formula + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV = 0.015; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleBarrel[6] = { 0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034}; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006}; diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 1cc547e505442..18f86217f9e72 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -1623,9 +1623,9 @@ SDL::tripletsBuffer* SDL::Event::getTriplets() { alpaka::memcpy(queue, tripletsInCPU->rtLo_buf, tripletsBuffers->rtLo_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->rtHi_buf, tripletsBuffers->rtHi_buf, nMemHost); #endif - alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, objHits::kT3 * nMemHost); + alpaka::memcpy(queue, tripletsInCPU->hitIndices_buf, tripletsBuffers->hitIndices_buf, Params_T3::kHits * nMemHost); alpaka::memcpy( - queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, objLayers::kT3 * nMemHost); + queue, tripletsInCPU->logicalLayers_buf, tripletsBuffers->logicalLayers_buf, Params_T3::kLayers * nMemHost); alpaka::memcpy(queue, tripletsInCPU->segmentIndices_buf, tripletsBuffers->segmentIndices_buf, 2 * nMemHost); alpaka::memcpy(queue, tripletsInCPU->betaIn_buf, tripletsBuffers->betaIn_buf, nMemHost); alpaka::memcpy(queue, tripletsInCPU->circleRadius_buf, tripletsBuffers->circleRadius_buf, nMemHost); @@ -1655,7 +1655,7 @@ SDL::quintupletsBuffer* SDL::Event::getQuintuplets() { alpaka::memcpy(queue, quintupletsInCPU->lowerModuleIndices_buf, quintupletsBuffers->lowerModuleIndices_buf, - objLayers::kT5 * nMemHost); + Params_T5::kLayers * nMemHost); alpaka::memcpy(queue, quintupletsInCPU->innerRadius_buf, quintupletsBuffers->innerRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->bridgeRadius_buf, quintupletsBuffers->bridgeRadius_buf, nMemHost); alpaka::memcpy(queue, quintupletsInCPU->outerRadius_buf, quintupletsBuffers->outerRadius_buf, nMemHost); @@ -1763,13 +1763,13 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - objHits::kpT5 * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->logicalLayers_buf, trackCandidatesBuffers->logicalLayers_buf, - objLayers::kpT5 * nTrackCanHost); + Params_pT5::kLayers * nTrackCanHost); alpaka::memcpy(queue, trackCandidatesInCPU->directObjectIndices_buf, trackCandidatesBuffers->directObjectIndices_buf, @@ -1801,7 +1801,7 @@ SDL::trackCandidatesBuffer* SDL::Event::getTrackCandid alpaka::memcpy(queue, trackCandidatesInCPU->hitIndices_buf, trackCandidatesBuffers->hitIndices_buf, - objHits::kpT5 * nTrackCanHost); + Params_pT5::kHits * nTrackCanHost); alpaka::memcpy( queue, trackCandidatesInCPU->pixelSeedIndex_buf, trackCandidatesBuffers->pixelSeedIndex_buf, nTrackCanHost); alpaka::memcpy(queue, diff --git a/RecoTracker/LSTCore/src/alpaka/Kernels.h b/RecoTracker/LSTCore/src/alpaka/Kernels.h index 9edafaa7d1520..c053f9e52c1e6 100644 --- a/RecoTracker/LSTCore/src/alpaka/Kernels.h +++ b/RecoTracker/LSTCore/src/alpaka/Kernels.h @@ -37,18 +37,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitsT5(unsigned int ix, unsigned int jx, struct SDL::quintuplets& quintupletsInGPU) { - unsigned int hits1[objHits::kT5]; - unsigned int hits2[objHits::kT5]; + unsigned int hits1[Params_T5::kHits]; + unsigned int hits2[Params_T5::kHits]; - for (int i = 0; i < objHits::kT5; i++) { - hits1[i] = quintupletsInGPU.hitIndices[objHits::kT5 * ix + i]; - hits2[i] = quintupletsInGPU.hitIndices[objHits::kT5 * jx + i]; + for (int i = 0; i < Params_T5::kHits; i++) { + hits1[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * ix + i]; + hits2[i] = quintupletsInGPU.hitIndices[Params_T5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < objHits::kT5; i++) { + for (int i = 0; i < Params_T5::kHits; i++) { bool matched = false; - for (int j = 0; j < objHits::kT5; j++) { + for (int j = 0; j < Params_T5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -64,18 +64,18 @@ namespace SDL { ALPAKA_FN_ACC ALPAKA_FN_INLINE int checkHitspT5(unsigned int ix, unsigned int jx, struct SDL::pixelQuintuplets& pixelQuintupletsInGPU) { - unsigned int hits1[objHits::kpT5]; - unsigned int hits2[objHits::kpT5]; + unsigned int hits1[Params_pT5::kHits]; + unsigned int hits2[Params_pT5::kHits]; - for (int i = 0; i < objHits::kpT5; i++) { - hits1[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * ix + i]; - hits2[i] = pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * jx + i]; + for (int i = 0; i < Params_pT5::kHits; i++) { + hits1[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * ix + i]; + hits2[i] = pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * jx + i]; } int nMatched = 0; - for (int i = 0; i < objHits::kpT5; i++) { + for (int i = 0; i < Params_pT5::kHits; i++) { bool matched = false; - for (int j = 0; j < objHits::kpT5; j++) { + for (int j = 0; j < Params_pT5::kHits; j++) { if (hits1[i] == hits2[j]) { matched = true; break; @@ -92,18 +92,18 @@ namespace SDL { unsigned int jx, struct SDL::pixelTriplets& pixelTripletsInGPU, int* matched) { - int phits1[objHits::kpLS]; - int phits2[objHits::kpLS]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; - for (int i = 0; i < objHits::kpLS; i++) { - phits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i]; - phits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i]; + for (int i = 0; i < Params_pLS::kHits; i++) { + phits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i]; + phits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i]; } int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; @@ -114,18 +114,18 @@ namespace SDL { } } - int hits1[objHits::kT3]; - int hits2[objHits::kT3]; + int hits1[Params_T3::kHits]; + int hits2[Params_T3::kHits]; - for (int i = 0; i < objHits::kpLS; i++) { - hits1[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * ix + i + 4]; // Omitting the pLS hits - hits2[i] = pixelTripletsInGPU.hitIndices[objHits::kpT3 * jx + i + 4]; // Omitting the pLS hits + for (int i = 0; i < Params_pLS::kHits; i++) { + hits1[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * ix + i + 4]; // Omitting the pLS hits + hits2[i] = pixelTripletsInGPU.hitIndices[Params_pT3::kHits * jx + i + 4]; // Omitting the pLS hits } int nMatched = 0; - for (int i = 0; i < objHits::kT3; i++) { + for (int i = 0; i < Params_T3::kHits; i++) { bool tmatched = false; - for (int j = 0; j < objHits::kT3; j++) { + for (int j = 0; j < Params_T3::kHits; j++) { if (hits1[i] == hits2[j]) { tmatched = true; break; @@ -281,17 +281,17 @@ namespace SDL { const int minNHitsForDup_pT3 = 5; if ((nMatched[0] + nMatched[1]) >= minNHitsForDup_pT3) { // Check the layers - if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] < - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2]) { + if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] < + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2]) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && __H2F(pixelTripletsInGPU.score[ix]) > __H2F(pixelTripletsInGPU.score[jx])) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; - } else if (pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * ix + 2] == - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * jx + 2] && + } else if (pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * ix + 2] == + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * jx + 2] && (__H2F(pixelTripletsInGPU.score[ix]) == __H2F(pixelTripletsInGPU.score[jx])) && (ix < jx)) { rmPixelTripletFromMemory(pixelTripletsInGPU, ix); break; @@ -348,7 +348,7 @@ namespace SDL { if (secondpass && (!segmentsInGPU.isQuad[ix] || (segmentsInGPU.isDup[ix] & 1))) continue; - unsigned int phits1[objHits::kpLS]; + unsigned int phits1[Params_pLS::kHits]; phits1[0] = segmentsInGPU.pLSHitsIdxs[ix].x; phits1[1] = segmentsInGPU.pLSHitsIdxs[ix].y; phits1[2] = segmentsInGPU.pLSHitsIdxs[ix].z; @@ -381,16 +381,16 @@ namespace SDL { else idxToRemove = ix; - unsigned int phits2[objHits::kpLS]; + unsigned int phits2[Params_pLS::kHits]; phits2[0] = segmentsInGPU.pLSHitsIdxs[jx].x; phits2[1] = segmentsInGPU.pLSHitsIdxs[jx].y; phits2[2] = segmentsInGPU.pLSHitsIdxs[jx].z; phits2[3] = segmentsInGPU.pLSHitsIdxs[jx].w; int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits1[i] == phits2[j]) { pmatched = true; break; diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index b42095df156b6..0c6cf5cc0e961 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -397,16 +397,16 @@ std::vector SDL::LST::getHitIdxs(const short trackCandid unsigned int maxNHits = 0; if (trackCandidateType == 7) - maxNHits = objHits::kpT5; // pT5 + maxNHits = Params_pT5::kHits; // pT5 else if (trackCandidateType == 5) - maxNHits = objHits::kpT3; // pT3 + maxNHits = Params_pT3::kHits; // pT3 else if (trackCandidateType == 4) - maxNHits = objHits::kT5; // T5 + maxNHits = Params_T5::kHits; // T5 else if (trackCandidateType == 8) - maxNHits = objHits::kpLS; // pLS + maxNHits = Params_pLS::kHits; // pLS for (unsigned int i = 0; i < maxNHits; i++) { - unsigned int hitIdxInGPU = TCHitIndices[objHits::kpT5 * TCIdx + i]; + unsigned int hitIdxInGPU = TCHitIndices[Params_pT5::kHits * TCIdx + i]; unsigned int hitIdx = (trackCandidateType == 8) ? hitIdxInGPU diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 9b2bcaaed841e..b4323c03dabb0 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -110,9 +110,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), isDup_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), partOfPT5_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objHits::kpT3, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * objLayers::kpT3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelTriplets * Params_pT3::kLayers, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), centerY_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), pixelRadiusError_buf(allocBufWrapper(devAccIn, maxPixelTriplets, queue)), @@ -161,46 +161,46 @@ namespace SDL { pixelTripletsInGPU.centerX[pixelTripletIndex] = __F2H(centerX); pixelTripletsInGPU.centerY[pixelTripletIndex] = __F2H(centerY); - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex] = 0; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 1] = 0; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 2] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3]; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 3] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1]; - pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2]; - - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex] = + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 1] = 0; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1]; + pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2]; + + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 1] = + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelSegmentIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 2] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 3] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; - pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 2] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 3] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex + 4] = + tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; unsigned int pixelInnerMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[2 * pixelSegmentIndex + 1]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 4] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 5] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 1]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 6] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 2]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 7] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 3]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 8] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 4]; - pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex + 9] = - tripletsInGPU.hitIndices[objHits::kT3 * tripletIndex + 5]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 1]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 2]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 3]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 4]; + pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * tripletIndex + 5]; pixelTripletsInGPU.rPhiChiSquared[pixelTripletIndex] = rPhiChiSquared; pixelTripletsInGPU.rPhiChiSquaredInwards[pixelTripletIndex] = rPhiChiSquaredInwards; pixelTripletsInGPU.rzChiSquared[pixelTripletIndex] = rzChiSquared; @@ -247,11 +247,11 @@ namespace SDL { short outerInnerLowerModuleSubdet = modulesInGPU.subdets[outerInnerLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; - unsigned int firstMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex]; - unsigned int secondMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * innerSegmentIndex + 1]; + unsigned int firstMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex]; + unsigned int secondMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * innerSegmentIndex + 1]; - unsigned int thirdMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex]; - unsigned int fourthMDIndex = segmentsInGPU.mdIndices[objLayers::kLS * outerSegmentIndex + 1]; + unsigned int thirdMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex]; + unsigned int fourthMDIndex = segmentsInGPU.mdIndices[Params_LS::kLayers * outerSegmentIndex + 1]; if (outerInnerLowerModuleSubdet == SDL::Barrel and (outerOuterLowerModuleSubdet == SDL::Barrel or outerOuterLowerModuleSubdet == SDL::Endcap)) { @@ -765,7 +765,7 @@ namespace SDL { float a = -2.f * k2Rinv1GeVf * 100 * charge; // multiply by 100 to make the correct length units - for (size_t i = 0; i < objLayers::kT3; i++) { + for (size_t i = 0; i < Params_T3::kLayers; i++) { float zsi = zs[i] / 100; float rtsi = rts[i] / 100; uint16_t lowerModuleIndex = lowerModuleIndices[i]; @@ -845,9 +845,9 @@ namespace SDL { //run pT4 compatibility between the pixel segment and inner segment, and between the pixel and outer segment of the triplet uint16_t pixelModuleIndex = segmentsInGPU.innerLowerModuleIndices[pixelSegmentIndex]; - uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex]; - uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 1]; - uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * tripletIndex + 2]; + uint16_t lowerModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex]; + uint16_t middleModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 1]; + uint16_t upperModuleIndex = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * tripletIndex + 2]; { //placeholder @@ -864,7 +864,7 @@ namespace SDL { lowerModuleIndex, middleModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex], zOut, rtOut, deltaPhiPos, @@ -895,7 +895,7 @@ namespace SDL { middleModuleIndex, upperModuleIndex, pixelSegmentIndex, - tripletsInGPU.segmentIndices[objLayers::kLS * tripletIndex + 1], + tripletsInGPU.segmentIndices[Params_LS::kLayers * tripletIndex + 1], zOut, rtOut, deltaPhiPos, @@ -930,8 +930,8 @@ namespace SDL { float pixelF = segmentsInGPU.circleCenterY[pixelSegmentArrayIndex]; float pixelRadiusPCA = segmentsInGPU.circleRadius[pixelSegmentArrayIndex]; - unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex]; - unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[objLayers::kpLS * pixelSegmentIndex + 1]; + unsigned int pixelInnerMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex]; + unsigned int pixelOuterMDIndex = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelSegmentIndex + 1]; pixelRadius = pixelSegmentPt * kR1GeVf; pixelRadiusError = pixelSegmentPtError * kR1GeVf; @@ -942,9 +942,9 @@ namespace SDL { unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * tripletInnerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * tripletOuterSegmentIndex + 1]; - float xs[objLayers::kT3] = { + float xs[Params_T3::kLayers] = { mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex]}; - float ys[objLayers::kT3] = { + float ys[Params_T3::kLayers] = { mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex]}; float g, f; @@ -962,17 +962,17 @@ namespace SDL { upperModuleIndex)) return false; - uint16_t lowerModuleIndices[objLayers::kT3] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; + uint16_t lowerModuleIndices[Params_T3::kLayers] = {lowerModuleIndex, middleModuleIndex, upperModuleIndex}; if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { - float rts[objLayers::kT3] = { + float rts[Params_T3::kLayers] = { mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex]}; - float zs[objLayers::kT3] = { + float zs[Params_T3::kLayers] = { mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex]}; - float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; - float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; rzChiSquared = computePT3RZChiSquared(acc, modulesInGPU, @@ -1006,8 +1006,8 @@ namespace SDL { return false; } - float xPix[objLayers::kpLS] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; - float yPix[objLayers::kpLS] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; + float xPix[Params_pLS::kLayers] = {mdsInGPU.anchorX[pixelInnerMDIndex], mdsInGPU.anchorX[pixelOuterMDIndex]}; + float yPix[Params_pLS::kLayers] = {mdsInGPU.anchorY[pixelInnerMDIndex], mdsInGPU.anchorY[pixelOuterMDIndex]}; rPhiChiSquaredInwards = computePT3RPhiChiSquaredInwards(modulesInGPU, g, f, tripletRadius, xPix, yPix); if (runChiSquaredCuts and pixelSegmentPt < 5.0f) { @@ -1351,7 +1351,7 @@ namespace SDL { float drt_InSeg = rt_InOut - rt_InLo; const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float dzErr = (drt_OutLo_InUp * drt_OutLo_InUp) * (etaErr * etaErr) * cosh2Eta; @@ -1637,7 +1637,7 @@ namespace SDL { const float multDzDr2 = (dzOutInAbs * dzOutInAbs) * cosh2Eta / ((cosh2Eta - 1.f) * (cosh2Eta - 1.f)); const float r3_InUp = alpaka::math::sqrt(acc, z_InUp * z_InUp + rt_InUp * rt_InUp); const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InUp) / 50.f) * (r3_InUp / rt_InUp); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (ptCut * ptCut) * 16.f; float drtErr = (etaErr * etaErr) * multDzDr2; @@ -1912,9 +1912,9 @@ namespace SDL { score_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), eta_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), phi_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objHits::kpT5, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * objLayers::kpT5, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kHits, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets * Params_pT5::kLayers, queue)), pixelRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), quintupletRadius_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), centerX_buf(allocBufWrapper(devAccIn, maxPixelQuintuplets, queue)), @@ -1958,63 +1958,63 @@ namespace SDL { pixelQuintupletsInGPU.centerX[pixelQuintupletIndex] = __F2H(centerX); pixelQuintupletsInGPU.centerY[pixelQuintupletIndex] = __F2H(centerY); - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex] = 0; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 1] = 0; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 1]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 2]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 3]; - pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.logicalLayers[T5Index * objLayers::kT5 + 4]; - - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex] = + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 1] = 0; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.logicalLayers[T5Index * Params_T5::kLayers + 4]; + + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex] = segmentsInGPU.innerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 1] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 1] = segmentsInGPU.outerLowerModuleIndices[pixelIndex]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 2] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 3] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 1]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 2]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 3]; - pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.lowerModuleIndices[T5Index * objLayers::kT5 + 4]; - - unsigned int pixelInnerMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex]; - unsigned int pixelOuterMD = segmentsInGPU.mdIndices[objLayers::kpLS * pixelIndex + 1]; - - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 2] = + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 2] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 3] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 1]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 4] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 2]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 5] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 3]; + pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex + 6] = + quintupletsInGPU.lowerModuleIndices[T5Index * Params_T5::kLayers + 4]; + + unsigned int pixelInnerMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex]; + unsigned int pixelOuterMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex + 1]; + + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; - - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 4] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 5] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 1]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 6] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 2]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 7] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 3]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 8] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 4]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 9] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 5]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 10] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 6]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 11] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 7]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 12] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 8]; - pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex + 13] = - quintupletsInGPU.hitIndices[objHits::kT5 * T5Index + 9]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 4] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 5] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 1]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 6] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 2]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 7] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 3]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 8] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 4]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 9] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 5]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 10] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 6]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 11] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 7]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 12] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 8]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 13] = + quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index + 9]; pixelQuintupletsInGPU.rzChiSquared[pixelQuintupletIndex] = rzChiSquared; pixelQuintupletsInGPU.rPhiChiSquared[pixelQuintupletIndex] = rPhiChiSquared; @@ -2517,23 +2517,23 @@ namespace SDL { unsigned int fourthMDIndex = segmentsInGPU.mdIndices[2 * thirdSegmentIndex + 1]; unsigned int fifthMDIndex = segmentsInGPU.mdIndices[2 * fourthSegmentIndex + 1]; - uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex]; - uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1]; - uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2]; - uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3]; - uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4]; + uint16_t lowerModuleIndex1 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex]; + uint16_t lowerModuleIndex2 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1]; + uint16_t lowerModuleIndex3 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2]; + uint16_t lowerModuleIndex4 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3]; + uint16_t lowerModuleIndex5 = quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4]; - uint16_t lowerModuleIndices[objLayers::kT5] = { + uint16_t lowerModuleIndices[Params_T5::kLayers] = { lowerModuleIndex1, lowerModuleIndex2, lowerModuleIndex3, lowerModuleIndex4, lowerModuleIndex5}; - float zPix[objLayers::kpLS] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; - float rtPix[objLayers::kpLS] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; - float zs[objLayers::kT5] = {mdsInGPU.anchorZ[firstMDIndex], + float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; + float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; + float zs[Params_T5::kLayers] = {mdsInGPU.anchorZ[firstMDIndex], mdsInGPU.anchorZ[secondMDIndex], mdsInGPU.anchorZ[thirdMDIndex], mdsInGPU.anchorZ[fourthMDIndex], mdsInGPU.anchorZ[fifthMDIndex]}; - float rts[objLayers::kT5] = {mdsInGPU.anchorRt[firstMDIndex], + float rts[Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex], mdsInGPU.anchorRt[secondMDIndex], mdsInGPU.anchorRt[thirdMDIndex], mdsInGPU.anchorRt[fourthMDIndex], @@ -2553,12 +2553,12 @@ namespace SDL { } //outer T5 - float xs[objLayers::kT5] = {mdsInGPU.anchorX[firstMDIndex], + float xs[Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex], mdsInGPU.anchorX[secondMDIndex], mdsInGPU.anchorX[thirdMDIndex], mdsInGPU.anchorX[fourthMDIndex], mdsInGPU.anchorX[fifthMDIndex]}; - float ys[objLayers::kT5] = {mdsInGPU.anchorY[firstMDIndex], + float ys[Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex], mdsInGPU.anchorY[secondMDIndex], mdsInGPU.anchorY[thirdMDIndex], mdsInGPU.anchorY[fourthMDIndex], @@ -2625,7 +2625,7 @@ namespace SDL { float error2 = 0; //hardcoded array indices!!! float RMSE = 0; - for (size_t i = 0; i < objLayers::kT5; i++) { + for (size_t i = 0; i < Params_T5::kLayers; i++) { uint16_t& lowerModuleIndex = lowerModuleIndices[i]; const int moduleType = modulesInGPU.moduleType[lowerModuleIndex]; const int moduleSide = modulesInGPU.sides[lowerModuleIndex]; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 3463119a77db9..0950e2244d20e 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -103,7 +103,7 @@ namespace SDL { template quintupletsBuffer(unsigned int nTotalQuintuplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : tripletIndices_buf(allocBufWrapper(devAccIn, 2 * nTotalQuintuplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), nQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyQuintuplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), @@ -121,8 +121,8 @@ namespace SDL { regressionRadius_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionG_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), regressionF_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kT5 * nTotalQuintuplets, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, objHits::kT5 * nTotalQuintuplets, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_T5::kLayers * nTotalQuintuplets, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_T5::kHits * nTotalQuintuplets, queue)), rzChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), chiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)), nonAnchorChiSquared_buf(allocBufWrapper(devAccIn, nTotalQuintuplets, queue)) { @@ -170,11 +170,11 @@ namespace SDL { quintupletsInGPU.tripletIndices[2 * quintupletIndex] = innerTripletIndex; quintupletsInGPU.tripletIndices[2 * quintupletIndex + 1] = outerTripletIndex; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex] = lowerModule1; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 1] = lowerModule2; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 2] = lowerModule3; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 3] = lowerModule4; - quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex + 4] = lowerModule5; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex] = lowerModule1; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 1] = lowerModule2; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 2] = lowerModule3; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 3] = lowerModule4; + quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex + 4] = lowerModule5; quintupletsInGPU.innerRadius[quintupletIndex] = __F2H(innerRadius); quintupletsInGPU.outerRadius[quintupletIndex] = __F2H(outerRadius); quintupletsInGPU.pt[quintupletIndex] = __F2H(pt); @@ -187,37 +187,37 @@ namespace SDL { quintupletsInGPU.regressionRadius[quintupletIndex] = regressionRadius; quintupletsInGPU.regressionG[quintupletIndex] = regressionG; quintupletsInGPU.regressionF[quintupletIndex] = regressionF; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 1] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 2] = - tripletsInGPU.logicalLayers[objLayers::kT3 * innerTripletIndex + 2]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 3] = - tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 1]; - quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex + 4] = - tripletsInGPU.logicalLayers[objLayers::kT3 * outerTripletIndex + 2]; - - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 1] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 1]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 2] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 2]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 3] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 3]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 4] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 4]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 5] = - tripletsInGPU.hitIndices[objHits::kT3 * innerTripletIndex + 5]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 6] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 2]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 7] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 3]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 8] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 4]; - quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex + 9] = - tripletsInGPU.hitIndices[objHits::kT3 * outerTripletIndex + 5]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 1] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 2] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * innerTripletIndex + 2]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 3] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 1]; + quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex + 4] = + tripletsInGPU.logicalLayers[Params_T3::kLayers * outerTripletIndex + 2]; + + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 1] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 1]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 2] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 3] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 4] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 5] = + tripletsInGPU.hitIndices[Params_T3::kHits * innerTripletIndex + 5]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 6] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 2]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 7] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 3]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 8] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 4]; + quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex + 9] = + tripletsInGPU.hitIndices[Params_T3::kHits * outerTripletIndex + 5]; quintupletsInGPU.bridgeRadius[quintupletIndex] = bridgeRadius; quintupletsInGPU.rzChiSquared[quintupletIndex] = rzChiSquared; quintupletsInGPU.chiSquared[quintupletIndex] = rPhiChiSquared; @@ -1541,7 +1541,7 @@ namespace SDL { float dzErr = (zpitch_InLo + zpitch_OutLo) * (zpitch_InLo + zpitch_OutLo) * 2.f; float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (r3_InLo / rt_InLo); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1832,7 +1832,7 @@ namespace SDL { float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF2 = - (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); + (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * (rIn / rt_InLo); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); @@ -2098,7 +2098,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); kZ = (z_OutLo - z_InLo) / dzSDIn; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; @@ -2878,7 +2878,7 @@ namespace SDL { computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); regressionRadius = computeRadiusUsingRegression( - acc, objLayers::kT5, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); + acc, Params_T5::kLayers, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); #ifdef USE_T5_DNN unsigned int mdIndices[] = {firstMDIndex, secondMDIndex, thirdMDIndex, fourthMDIndex, fifthMDIndex}; @@ -2917,7 +2917,7 @@ namespace SDL { //compute the other chisquared //non anchor is always shifted for tilted and endcap! - float nonAnchorDelta1[objLayers::kT5], nonAnchorDelta2[objLayers::kT5], nonAnchorSlopes[objLayers::kT5]; + float nonAnchorDelta1[Params_T5::kLayers], nonAnchorDelta2[Params_T5::kLayers], nonAnchorSlopes[Params_T5::kLayers]; float nonAnchorxs[] = {mdsInGPU.outerX[firstMDIndex], mdsInGPU.outerX[secondMDIndex], mdsInGPU.outerX[thirdMDIndex], @@ -2936,10 +2936,10 @@ namespace SDL { nonAnchorDelta2, nonAnchorSlopes, isFlat, - objLayers::kT5, + Params_T5::kLayers, false); nonAnchorChiSquared = computeChiSquared(acc, - objLayers::kT5, + Params_T5::kLayers, nonAnchorxs, nonAnchorys, nonAnchorDelta1, @@ -2982,14 +2982,14 @@ namespace SDL { for (unsigned int innerTripletArrayIndex = globalThreadIdx[1]; innerTripletArrayIndex < nInnerTriplets; innerTripletArrayIndex += gridThreadExtent[1]) { unsigned int innerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule1] + innerTripletArrayIndex; - uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 1]; - uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * innerTripletIndex + 2]; + uint16_t lowerModule2 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 1]; + uint16_t lowerModule3 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * innerTripletIndex + 2]; unsigned int nOuterTriplets = tripletsInGPU.nTriplets[lowerModule3]; for (unsigned int outerTripletArrayIndex = globalThreadIdx[2]; outerTripletArrayIndex < nOuterTriplets; outerTripletArrayIndex += gridThreadExtent[2]) { unsigned int outerTripletIndex = rangesInGPU.tripletModuleIndices[lowerModule3] + outerTripletArrayIndex; - uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 1]; - uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[objLayers::kT3 * outerTripletIndex + 2]; + uint16_t lowerModule4 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 1]; + uint16_t lowerModule5 = tripletsInGPU.lowerModuleIndices[Params_T3::kLayers * outerTripletIndex + 2]; float innerRadius, outerRadius, bridgeRadius, regressionG, regressionF, regressionRadius, rzChiSquared, chiSquared, nonAnchorChiSquared; //required for making distributions diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index 39936d3d068d5..0acf2623b4675 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -676,7 +676,7 @@ namespace SDL { return false; if (alpaka::math::abs(acc, dAlphaOuterMDSegment) >= dAlphaThresholdValues[1]) return false; - return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2] + return alpaka::math::abs(acc, dAlphaInnerMDOuterMD) < dAlphaThresholdValues[2]; }; template @@ -1068,7 +1068,7 @@ namespace SDL { (hitsInGPU.zs[mdsInGPU.anchorHitIndices[outerMDIndex]]); score_lsq = score_lsq * score_lsq; - unsigned int hits1[objHits::kpLS]; + unsigned int hits1[Params_pLS::kHits]; hits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[innerMDIndex]]; hits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[outerMDIndex]]; hits1[2] = hitsInGPU.idxs[mdsInGPU.outerHitIndices[innerMDIndex]]; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index c527bc0eb9373..5adb74e79932e 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -83,10 +83,10 @@ namespace SDL { nTrackCandidatespT5_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatespLS_buf(allocBufWrapper(devAccIn, 1, queue)), nTrackCandidatesT5_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, objHits::kpT5 * maxTrackCandidates, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kHits * maxTrackCandidates, queue)), pixelSeedIndex_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kpT5 * maxTrackCandidates, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_pT5::kLayers * maxTrackCandidates, queue)), centerX_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), centerY_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)), radius_buf(allocBufWrapper(devAccIn, maxTrackCandidates, queue)) { @@ -115,11 +115,11 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = trackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = trackletIndex; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 0] = + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 0] = hitIndices.x; // Order explanation in https://github.com/SegmentLinking/TrackLooper/issues/267 - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 1] = hitIndices.z; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 2] = hitIndices.y; - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + 3] = hitIndices.w; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 1] = hitIndices.z; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 2] = hitIndices.y; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + 3] = hitIndices.w; }; ALPAKA_FN_ACC ALPAKA_FN_INLINE void addTrackCandidateToMemory(struct SDL::trackCandidates& trackCandidatesInGPU, @@ -142,16 +142,16 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; - size_t limits = trackCandidateType == 7 ? objLayers::kpT5 - : objLayers::kpT3; // 7 means pT5, objLayers::kpT3 = objLayers::kT5 = 5 + size_t limits = trackCandidateType == 7 ? Params_pT5::kLayers + : Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5 //send the starting pointer to the logicalLayer and hitIndices for (size_t i = 0; i < limits; i++) { - trackCandidatesInGPU.logicalLayers[objLayers::kpT5 * trackCandidateIndex + i] = logicalLayerIndices[i]; - trackCandidatesInGPU.lowerModuleIndices[objLayers::kpT5 * trackCandidateIndex + i] = lowerModuleIndices[i]; + trackCandidatesInGPU.logicalLayers[Params_pT5::kLayers * trackCandidateIndex + i] = logicalLayerIndices[i]; + trackCandidatesInGPU.lowerModuleIndices[Params_pT5::kLayers * trackCandidateIndex + i] = lowerModuleIndices[i]; } for (size_t i = 0; i < 2 * limits; i++) { - trackCandidatesInGPU.hitIndices[objHits::kpT5 * trackCandidateIndex + i] = hitIndices[i]; + trackCandidatesInGPU.hitIndices[Params_pT5::kHits * trackCandidateIndex + i] = hitIndices[i]; } trackCandidatesInGPU.centerX[trackCandidateIndex] = __F2H(centerX); trackCandidatesInGPU.centerY[trackCandidateIndex] = __F2H(centerY); @@ -163,8 +163,8 @@ namespace SDL { struct SDL::miniDoublets& mdsInGPU, struct SDL::segments& segmentsInGPU, struct SDL::hits& hitsInGPU) { - int phits1[objHits::kpLS]; - int phits2[objHits::kpLS]; + int phits1[Params_pLS::kHits]; + int phits2[Params_pLS::kHits]; phits1[0] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix]]]; phits1[1] = hitsInGPU.idxs[mdsInGPU.anchorHitIndices[segmentsInGPU.mdIndices[2 * ix + 1]]]; @@ -178,12 +178,12 @@ namespace SDL { int npMatched = 0; - for (int i = 0; i < objHits::kpLS; i++) { + for (int i = 0; i < Params_pLS::kHits; i++) { bool pmatched = false; if (phits1[i] == -1) continue; - for (int j = 0; j < objHits::kpLS; j++) { + for (int j = 0; j < Params_pLS::kHits; j++) { if (phits2[j] == -1) continue; @@ -415,9 +415,9 @@ namespace SDL { 5 /*track candidate type pT3=5*/, pixelTripletIndex, pixelTripletIndex, - &pixelTripletsInGPU.logicalLayers[objLayers::kpT3 * pixelTripletIndex], - &pixelTripletsInGPU.lowerModuleIndices[objLayers::kpT3 * pixelTripletIndex], - &pixelTripletsInGPU.hitIndices[objHits::kpT3 * pixelTripletIndex], + &pixelTripletsInGPU.logicalLayers[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.lowerModuleIndices[Params_pT3::kLayers * pixelTripletIndex], + &pixelTripletsInGPU.hitIndices[Params_pT3::kHits * pixelTripletIndex], segmentsInGPU.seedIdx[pT3PixelIndex - pLS_offset], __H2F(pixelTripletsInGPU.centerX[pixelTripletIndex]), __H2F(pixelTripletsInGPU.centerY[pixelTripletIndex]), @@ -468,9 +468,9 @@ namespace SDL { 4 /*track candidate type T5=4*/, quintupletIndex, quintupletIndex, - &quintupletsInGPU.logicalLayers[objLayers::kT5 * quintupletIndex], - &quintupletsInGPU.lowerModuleIndices[objLayers::kT5 * quintupletIndex], - &quintupletsInGPU.hitIndices[objHits::kT5 * quintupletIndex], + &quintupletsInGPU.logicalLayers[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.lowerModuleIndices[Params_T5::kLayers * quintupletIndex], + &quintupletsInGPU.hitIndices[Params_T5::kHits * quintupletIndex], -1 /*no pixel seed index for T5s*/, quintupletsInGPU.regressionG[quintupletIndex], quintupletsInGPU.regressionF[quintupletIndex], @@ -560,9 +560,9 @@ namespace SDL { 7 /*track candidate type pT5=7*/, pT5PixelIndex, pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[objLayers::kpT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[objLayers::kpT5 * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[objHits::kpT5 * pixelQuintupletIndex], + &pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex], segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 2bc5e63cd0098..08309b1f50443 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -108,12 +108,12 @@ namespace SDL { template tripletsBuffer(unsigned int maxTriplets, unsigned int nLowerModules, TDevAcc const& devAccIn, TQueue& queue) : segmentIndices_buf(allocBufWrapper(devAccIn, 2 * maxTriplets, queue)), - lowerModuleIndices_buf(allocBufWrapper(devAccIn, objLayers::kT3 * maxTriplets, queue)), + lowerModuleIndices_buf(allocBufWrapper(devAccIn, Params_T3::kLayers * maxTriplets, queue)), nTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), totOccupancyTriplets_buf(allocBufWrapper(devAccIn, nLowerModules, queue)), nMemoryLocations_buf(allocBufWrapper(devAccIn, 1, queue)), - logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * objLayers::kT3, queue)), - hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * objHits::kT3, queue)), + logicalLayers_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kLayers, queue)), + hitIndices_buf(allocBufWrapper(devAccIn, maxTriplets * Params_T3::kHits, queue)), betaIn_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleRadius_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), circleCenterX_buf(allocBufWrapper(devAccIn, maxTriplets, queue)), @@ -191,31 +191,31 @@ namespace SDL { { tripletsInGPU.segmentIndices[tripletIndex * 2] = innerSegmentIndex; tripletsInGPU.segmentIndices[tripletIndex * 2 + 1] = outerSegmentIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3] = innerInnerLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 1] = middleLowerModuleIndex; - tripletsInGPU.lowerModuleIndices[tripletIndex * objLayers::kT3 + 2] = outerOuterLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers] = innerInnerLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 1] = middleLowerModuleIndex; + tripletsInGPU.lowerModuleIndices[tripletIndex * Params_T3::kLayers + 2] = outerOuterLowerModuleIndex; tripletsInGPU.betaIn[tripletIndex] = __F2H(betaIn); tripletsInGPU.circleRadius[tripletIndex] = circleRadius; tripletsInGPU.circleCenterX[tripletIndex] = circleCenterX; tripletsInGPU.circleCenterY[tripletIndex] = circleCenterY; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers] = modulesInGPU.layers[innerInnerLowerModuleIndex] + (modulesInGPU.subdets[innerInnerLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 1] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 1] = modulesInGPU.layers[middleLowerModuleIndex] + (modulesInGPU.subdets[middleLowerModuleIndex] == 4) * 6; - tripletsInGPU.logicalLayers[tripletIndex * objLayers::kT3 + 2] = + tripletsInGPU.logicalLayers[tripletIndex * Params_T3::kLayers + 2] = modulesInGPU.layers[outerOuterLowerModuleIndex] + (modulesInGPU.subdets[outerOuterLowerModuleIndex] == 4) * 6; //get the hits unsigned int firstMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex]; unsigned int secondMDIndex = segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1]; unsigned int thirdMDIndex = segmentsInGPU.mdIndices[2 * outerSegmentIndex + 1]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3] = mdsInGPU.anchorHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; - tripletsInGPU.hitIndices[tripletIndex * objHits::kT3 + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits] = mdsInGPU.anchorHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 1] = mdsInGPU.outerHitIndices[firstMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 2] = mdsInGPU.anchorHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 3] = mdsInGPU.outerHitIndices[secondMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 4] = mdsInGPU.anchorHitIndices[thirdMDIndex]; + tripletsInGPU.hitIndices[tripletIndex * Params_T3::kHits + 5] = mdsInGPU.outerHitIndices[thirdMDIndex]; #ifdef CUT_VALUE_DEBUG tripletsInGPU.zOut[tripletIndex] = zOut; tripletsInGPU.rtOut[tripletIndex] = rtOut; @@ -347,7 +347,7 @@ namespace SDL { float coshEta = dr3_InSeg / drt_InSeg; float dzErr = (zpitchIn + zpitchOut) * (zpitchIn + zpitchOut) * 2.f; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f) * (r3In / rtIn); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; dzErr += sdlMuls2 * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; dzErr = alpaka::math::sqrt(acc, dzErr); @@ -388,7 +388,7 @@ namespace SDL { (0.02f / drt_InSeg); //Cut #3: first beta cut - return alpaka::math::abs(acc, betaIn) < betaInCut + return alpaka::math::abs(acc, betaIn) < betaInCut; }; template @@ -465,7 +465,7 @@ namespace SDL { const float kZ = (zOut - zIn) / dzSDIn; float drtErr = zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); - const float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); + const float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2 * (rtOut - rtIn) / 50.f) * (rIn / rtIn); const float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; drtErr += sdlMuls2 * multDzDr * multDzDr / 3.f * coshEta * coshEta; drtErr = alpaka::math::sqrt(acc, drtErr); @@ -575,7 +575,7 @@ namespace SDL { float multDzDr = dzOutInAbs * coshEta / (coshEta * coshEta - 1.f); float kZ = (zOut - zIn) / dzSDIn; - float sdlThetaMulsF2 = (kMulsInGev2 * kMulsInGev2) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); + float sdlThetaMulsF2 = (kMulsInGeV * kMulsInGeV) * (0.1f + 0.2f * (rtOut - rtIn) / 50.f); float sdlMuls2 = sdlThetaMulsF2 * 9.f / (SDL::ptCut * SDL::ptCut) * 16.f; From 7cfe3a5bccce359c4f7a9cb073cf4533883ca481 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Tue, 9 Jul 2024 06:06:39 -0700 Subject: [PATCH 17/18] Code format and checks --- .../LSTCore/interface/alpaka/Constants.h | 26 ++++++++---- RecoTracker/LSTCore/src/alpaka/PixelTriplet.h | 41 ++++++++++--------- RecoTracker/LSTCore/src/alpaka/Quintuplet.h | 14 ++++++- .../LSTCore/src/alpaka/TrackCandidate.h | 32 ++++++++------- 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index 7cb70125a427e..2050c5e0727b0 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -121,15 +121,27 @@ namespace SDL { //defining the constant host device variables right up here // Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4) and 4 hits. To be potentially handled better in the future. - struct Params_pLS { static constexpr int kLayers = 2, kHits = 4; }; - struct Params_LS { static constexpr int kLayers = 2, kHits = 4; }; - struct Params_T3 { static constexpr int kLayers = 3, kHits = 6; }; - struct Params_pT3 { static constexpr int kLayers = 5, kHits = 10; }; - struct Params_T5 { static constexpr int kLayers = 5, kHits = 10; }; - struct Params_pT5 { static constexpr int kLayers = 7, kHits = 14; }; + struct Params_pLS { + static constexpr int kLayers = 2, kHits = 4; + }; + struct Params_LS { + static constexpr int kLayers = 2, kHits = 4; + }; + struct Params_T3 { + static constexpr int kLayers = 3, kHits = 6; + }; + struct Params_pT3 { + static constexpr int kLayers = 5, kHits = 10; + }; + struct Params_T5 { + static constexpr int kLayers = 5, kHits = 10; + }; + struct Params_pT5 { + static constexpr int kLayers = 7, kHits = 14; + }; // 15 MeV constant from the approximate Bethe-Bloch formula - ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV = 0.015; + ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMulsInGeV = 0.015; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleBarrel[6] = { 0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034}; ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float miniMulsPtScaleEndcap[5] = {0.006, 0.006, 0.006, 0.006, 0.006}; diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index b4323c03dabb0..d36150ffd48ff 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -1989,11 +1989,14 @@ namespace SDL { unsigned int pixelInnerMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex]; unsigned int pixelOuterMD = segmentsInGPU.mdIndices[Params_pLS::kLayers * pixelIndex + 1]; - pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = mdsInGPU.anchorHitIndices[pixelInnerMD]; - pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] = mdsInGPU.outerHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex] = + mdsInGPU.anchorHitIndices[pixelInnerMD]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 1] = + mdsInGPU.outerHitIndices[pixelInnerMD]; pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 2] = mdsInGPU.anchorHitIndices[pixelOuterMD]; - pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = mdsInGPU.outerHitIndices[pixelOuterMD]; + pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 3] = + mdsInGPU.outerHitIndices[pixelOuterMD]; pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex + 4] = quintupletsInGPU.hitIndices[Params_T5::kHits * T5Index]; @@ -2529,15 +2532,15 @@ namespace SDL { float zPix[Params_pLS::kLayers] = {mdsInGPU.anchorZ[pixelInnerMDIndex], mdsInGPU.anchorZ[pixelOuterMDIndex]}; float rtPix[Params_pLS::kLayers] = {mdsInGPU.anchorRt[pixelInnerMDIndex], mdsInGPU.anchorRt[pixelOuterMDIndex]}; float zs[Params_T5::kLayers] = {mdsInGPU.anchorZ[firstMDIndex], - mdsInGPU.anchorZ[secondMDIndex], - mdsInGPU.anchorZ[thirdMDIndex], - mdsInGPU.anchorZ[fourthMDIndex], - mdsInGPU.anchorZ[fifthMDIndex]}; + mdsInGPU.anchorZ[secondMDIndex], + mdsInGPU.anchorZ[thirdMDIndex], + mdsInGPU.anchorZ[fourthMDIndex], + mdsInGPU.anchorZ[fifthMDIndex]}; float rts[Params_T5::kLayers] = {mdsInGPU.anchorRt[firstMDIndex], - mdsInGPU.anchorRt[secondMDIndex], - mdsInGPU.anchorRt[thirdMDIndex], - mdsInGPU.anchorRt[fourthMDIndex], - mdsInGPU.anchorRt[fifthMDIndex]}; + mdsInGPU.anchorRt[secondMDIndex], + mdsInGPU.anchorRt[thirdMDIndex], + mdsInGPU.anchorRt[fourthMDIndex], + mdsInGPU.anchorRt[fifthMDIndex]}; rzChiSquared = computePT5RZChiSquared(acc, modulesInGPU, lowerModuleIndices, rtPix, zPix, rts, zs); @@ -2554,15 +2557,15 @@ namespace SDL { //outer T5 float xs[Params_T5::kLayers] = {mdsInGPU.anchorX[firstMDIndex], - mdsInGPU.anchorX[secondMDIndex], - mdsInGPU.anchorX[thirdMDIndex], - mdsInGPU.anchorX[fourthMDIndex], - mdsInGPU.anchorX[fifthMDIndex]}; + mdsInGPU.anchorX[secondMDIndex], + mdsInGPU.anchorX[thirdMDIndex], + mdsInGPU.anchorX[fourthMDIndex], + mdsInGPU.anchorX[fifthMDIndex]}; float ys[Params_T5::kLayers] = {mdsInGPU.anchorY[firstMDIndex], - mdsInGPU.anchorY[secondMDIndex], - mdsInGPU.anchorY[thirdMDIndex], - mdsInGPU.anchorY[fourthMDIndex], - mdsInGPU.anchorY[fifthMDIndex]}; + mdsInGPU.anchorY[secondMDIndex], + mdsInGPU.anchorY[thirdMDIndex], + mdsInGPU.anchorY[fourthMDIndex], + mdsInGPU.anchorY[fifthMDIndex]}; //get the appropriate radii and centers centerX = segmentsInGPU.circleCenterX[pixelSegmentArrayIndex]; diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index 0950e2244d20e..99be477d167c4 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -2877,8 +2877,18 @@ namespace SDL { bool isFlat[5]; computeSigmasForRegression(acc, modulesInGPU, lowerModuleIndices, delta1, delta2, slopes, isFlat); - regressionRadius = computeRadiusUsingRegression( - acc, Params_T5::kLayers, xVec, yVec, delta1, delta2, slopes, isFlat, regressionG, regressionF, sigmas2, chiSquared); + regressionRadius = computeRadiusUsingRegression(acc, + Params_T5::kLayers, + xVec, + yVec, + delta1, + delta2, + slopes, + isFlat, + regressionG, + regressionF, + sigmas2, + chiSquared); #ifdef USE_T5_DNN unsigned int mdIndices[] = {firstMDIndex, secondMDIndex, thirdMDIndex, fourthMDIndex, fifthMDIndex}; diff --git a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h index 5adb74e79932e..69f2396003000 100644 --- a/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h +++ b/RecoTracker/LSTCore/src/alpaka/TrackCandidate.h @@ -142,8 +142,9 @@ namespace SDL { trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex] = innerTrackletIndex; trackCandidatesInGPU.objectIndices[2 * trackCandidateIndex + 1] = outerTrackletIndex; - size_t limits = trackCandidateType == 7 ? Params_pT5::kLayers - : Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5 + size_t limits = trackCandidateType == 7 + ? Params_pT5::kLayers + : Params_pT3::kLayers; // 7 means pT5, Params_pT3::kLayers = Params_T5::kLayers = 5 //send the starting pointer to the logicalLayer and hitIndices for (size_t i = 0; i < limits; i++) { @@ -556,19 +557,20 @@ namespace SDL { float radius = 0.5f * (__H2F(pixelQuintupletsInGPU.pixelRadius[pixelQuintupletIndex]) + __H2F(pixelQuintupletsInGPU.quintupletRadius[pixelQuintupletIndex])); unsigned int pT5PixelIndex = pixelQuintupletsInGPU.pixelIndices[pixelQuintupletIndex]; - addTrackCandidateToMemory(trackCandidatesInGPU, - 7 /*track candidate type pT5=7*/, - pT5PixelIndex, - pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], - &pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex], - &pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex], - &pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex], - segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], - __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), - __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), - radius, - trackCandidateIdx, - pixelQuintupletIndex); + addTrackCandidateToMemory( + trackCandidatesInGPU, + 7 /*track candidate type pT5=7*/, + pT5PixelIndex, + pixelQuintupletsInGPU.T5Indices[pixelQuintupletIndex], + &pixelQuintupletsInGPU.logicalLayers[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.lowerModuleIndices[Params_pT5::kLayers * pixelQuintupletIndex], + &pixelQuintupletsInGPU.hitIndices[Params_pT5::kHits * pixelQuintupletIndex], + segmentsInGPU.seedIdx[pT5PixelIndex - pLS_offset], + __H2F(pixelQuintupletsInGPU.centerX[pixelQuintupletIndex]), + __H2F(pixelQuintupletsInGPU.centerY[pixelQuintupletIndex]), + radius, + trackCandidateIdx, + pixelQuintupletIndex); } } } From ae67290cb97aed9e53efc9e340c7bd030b2f7748 Mon Sep 17 00:00:00 2001 From: Manos Vourliotis Date: Tue, 9 Jul 2024 06:07:31 -0700 Subject: [PATCH 18/18] Simplify LST workflows --- .../python/upgradeWorkflowComponents.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 1bf692607f1ab..86fb13f414cd9 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -485,16 +485,8 @@ def condition_(self, fragment, stepList, key, hasHarvest): return ('2026' in key) upgradeWFs['lstOnCPUIters01TrackingOnly'] = UpgradeWorkflow_lstOnCPUIters01TrackingOnly( steps = [ - 'Reco', - 'RecoFakeHLT', - 'HARVEST', - 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', - 'RecoNano', - 'RecoNanoFakeHLT', - 'HARVESTNano', - 'HARVESTNanoFakeHLT', # Add ALCA steps explicitly, so that they can be properly removed 'ALCA', 'ALCAPhase2' @@ -518,16 +510,8 @@ def condition_(self, fragment, stepList, key, hasHarvest): return ('2026' in key) upgradeWFs['lstOnGPUIters01TrackingOnly'] = UpgradeWorkflow_lstOnGPUIters01TrackingOnly( steps = [ - 'Reco', - 'RecoFakeHLT', - 'HARVEST', - 'HARVESTFakeHLT', 'RecoGlobal', 'HARVESTGlobal', - 'RecoNano', - 'RecoNanoFakeHLT', - 'HARVESTNano', - 'HARVESTNanoFakeHLT', # Add ALCA steps explicitly, so that they can be properly removed 'ALCA', 'ALCAPhase2'