diff --git a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc index e6b3c42b7ed10..8a594565a6139 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc @@ -25,29 +25,32 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { private: edm::ESGetToken, TrackerRecoGeometryRecord> lstESHostToken_; + std::string ptCutLabel_; }; - LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig) { - setWhatProduced(this, &LSTModulesDevESProducer::produceHost); - auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice); - lstESHostToken_ = cc.consumes(); + LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) + : ESProducer(iConfig), ptCutLabel_(iConfig.getParameter("ptCutLabel")) { + setWhatProduced(this, &LSTModulesDevESProducer::produceHost, ptCutLabel_); + auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice, ptCutLabel_); + lstESHostToken_ = cc.consumes(edm::ESInputTag("", ptCutLabel_)); } void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("ptCutLabel", "0.8"); descriptions.addWithDefaultLabel(desc); } std::unique_ptr> LSTModulesDevESProducer::produceHost( TrackerRecoGeometryRecord const& iRecord) { - return SDL::loadAndFillESHost(); + return SDL::loadAndFillESHost(ptCutLabel_); } std::unique_ptr> LSTModulesDevESProducer::produceDevice( device::Record const& iRecord) { auto const& lstESHostData = iRecord.get(lstESHostToken_); SDL::QueueAcc& queue = iRecord.queue(); - return SDL::loadAndFillESDevice(queue, &lstESHostData); + return SDL::loadAndFillESDevice(queue, &lstESHostData, ptCutLabel_); } } // namespace ALPAKA_ACCELERATOR_NAMESPACE diff --git a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc index e9c9bc0883be4..27be5e4b944cf 100644 --- a/RecoTracker/LST/plugins/alpaka/LSTProducer.cc +++ b/RecoTracker/LST/plugins/alpaka/LSTProducer.cc @@ -29,8 +29,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { : lstPixelSeedInputToken_{consumes(config.getParameter("pixelSeedInput"))}, lstPhase2OTHitsInputToken_{ consumes(config.getParameter("phase2OTHitsInput"))}, - lstESToken_{esConsumes()}, + lstESToken_{esConsumes(edm::ESInputTag("", config.getParameter("ptCutLabel")))}, verbose_(config.getParameter("verbose")), + ptCut_(config.getParameter("ptCut")), nopLSDupClean_(config.getParameter("nopLSDupClean")), tcpLSTriplets_(config.getParameter("tcpLSTriplets")), lstOutputToken_{produces()} {} @@ -44,6 +45,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { lst_.run(event.queue(), verbose_, + static_cast(ptCut_), &lstESDeviceData, pixelSeeds.px(), pixelSeeds.py(), @@ -81,6 +83,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { desc.add("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"}); desc.add("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"}); desc.add("verbose", false); + desc.add("ptCut", 0.8); + desc.add("ptCutLabel", "0.8"); desc.add("nopLSDupClean", false); desc.add("tcpLSTriplets", false); descriptions.addWithDefaultLabel(desc); @@ -90,7 +94,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { edm::EDGetTokenT lstPixelSeedInputToken_; edm::EDGetTokenT lstPhase2OTHitsInputToken_; device::ESGetToken, TrackerRecoGeometryRecord> lstESToken_; - const bool verbose_, nopLSDupClean_, tcpLSTriplets_; + const bool verbose_; + const double ptCut_; + const bool nopLSDupClean_; + const bool tcpLSTriplets_; edm::EDPutTokenT lstOutputToken_; SDL::LST lst_; diff --git a/RecoTracker/LSTCore/BuildFile.xml b/RecoTracker/LSTCore/BuildFile.xml index 2aa254e0c0f6c..f4ee9125750ca 100644 --- a/RecoTracker/LSTCore/BuildFile.xml +++ b/RecoTracker/LSTCore/BuildFile.xml @@ -2,7 +2,7 @@ - + diff --git a/RecoTracker/LSTCore/interface/alpaka/Constants.h b/RecoTracker/LSTCore/interface/alpaka/Constants.h index d4f023631af1d..1262e86afcb00 100644 --- a/RecoTracker/LSTCore/interface/alpaka/Constants.h +++ b/RecoTracker/LSTCore/interface/alpaka/Constants.h @@ -99,11 +99,6 @@ namespace SDL { return WorkDiv(adjustedBlocks, adjustedThreads, elementsPerThreadArg); } -// If a compile time flag does not define PT_CUT, default to 0.8 (GeV) -#ifndef PT_CUT - constexpr float PT_CUT = 0.8f; -#endif - const unsigned int MAX_BLOCKS = 80; const unsigned int MAX_CONNECTED_MODULES = 40; @@ -129,7 +124,6 @@ namespace SDL { ALPAKA_STATIC_ACC_MEM_GLOBAL const float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2; ALPAKA_STATIC_ACC_MEM_GLOBAL const float kR1GeVf = 1. / (2.99792458e-3 * 3.8); ALPAKA_STATIC_ACC_MEM_GLOBAL const float sinAlphaMax = 0.95; - ALPAKA_STATIC_ACC_MEM_GLOBAL const float ptCut = PT_CUT; ALPAKA_STATIC_ACC_MEM_GLOBAL const float deltaZLum = 15.0; ALPAKA_STATIC_ACC_MEM_GLOBAL const float pixelPSZpitch = 0.15; ALPAKA_STATIC_ACC_MEM_GLOBAL const float strip2SZpitch = 5.0; diff --git a/RecoTracker/LSTCore/interface/alpaka/LST.h b/RecoTracker/LSTCore/interface/alpaka/LST.h index 16f3e87361489..4bd50b0da3dbf 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LST.h +++ b/RecoTracker/LSTCore/interface/alpaka/LST.h @@ -23,6 +23,7 @@ namespace SDL { void run(QueueAcc& queue, bool verbose, + const float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, @@ -69,7 +70,8 @@ namespace SDL { const std::vector ph2_detId, const std::vector ph2_x, const std::vector ph2_y, - const std::vector ph2_z); + const std::vector ph2_z, + const float ptCut); void getOutput(SDL::Event& event); std::vector getHitIdxs(const short trackCandidateType, diff --git a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h index 12b39135766ba..f603ceb8c8908 100644 --- a/RecoTracker/LSTCore/interface/alpaka/LSTESData.h +++ b/RecoTracker/LSTCore/interface/alpaka/LSTESData.h @@ -72,8 +72,10 @@ namespace SDL { pixelMapping(pixelMappingIn) {} }; - std::unique_ptr> loadAndFillESHost(); - std::unique_ptr> loadAndFillESDevice(SDL::QueueAcc& queue, const LSTESHostData* hostData); + std::unique_ptr> loadAndFillESHost(std::string& ptCutLabel); + std::unique_ptr> loadAndFillESDevice(SDL::QueueAcc& queue, + const LSTESHostData* hostData, + std::string& ptCutLabel); } // namespace SDL diff --git a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc index 785cd3e35be01..e4aaceaba8435 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/Event.dev.cc @@ -440,7 +440,8 @@ void SDL::Event::createMiniDoublets() { *modulesBuffers_->data(), *hitsInGPU, *mdsInGPU, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createMiniDoubletsInGPUv2Task); @@ -485,7 +486,8 @@ void SDL::Event::createSegmentsWithModuleMap() { *modulesBuffers_->data(), *mdsInGPU, *segmentsInGPU, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createSegmentsInGPUv2Task); @@ -593,7 +595,8 @@ void SDL::Event::createTriplets() { *tripletsInGPU, *rangesInGPU, alpaka::getPtrNative(index_gpu_buf), - nonZeroModules)); + nonZeroModules, + ptCut)); alpaka::enqueue(queue, createTripletsInGPUv2Task); @@ -872,7 +875,8 @@ void SDL::Event::createPixelTriplets() { *pixelTripletsInGPU, alpaka::getPtrNative(connectedPixelSize_dev_buf), alpaka::getPtrNative(connectedPixelIndex_dev_buf), - nInnerSegments)); + nInnerSegments, + ptCut)); alpaka::enqueue(queue, createPixelTripletsInGPUFromMapv2Task); alpaka::wait(queue); @@ -951,7 +955,8 @@ void SDL::Event::createQuintuplets() { *tripletsInGPU, *quintupletsInGPU, *rangesInGPU, - nEligibleT5Modules)); + nEligibleT5Modules, + ptCut)); alpaka::enqueue(queue, createQuintupletsInGPUv2Task); @@ -1102,7 +1107,8 @@ void SDL::Event::createPixelQuintuplets() { alpaka::getPtrNative(connectedPixelSize_dev_buf), alpaka::getPtrNative(connectedPixelIndex_dev_buf), nInnerSegments, - *rangesInGPU)); + *rangesInGPU, + ptCut)); alpaka::enqueue(queue, createPixelQuintupletsInGPUFromMapv2Task); diff --git a/RecoTracker/LSTCore/src/alpaka/Event.h b/RecoTracker/LSTCore/src/alpaka/Event.h index 11f1fe6c68898..aa91a3c14a3d3 100644 --- a/RecoTracker/LSTCore/src/alpaka/Event.h +++ b/RecoTracker/LSTCore/src/alpaka/Event.h @@ -25,6 +25,7 @@ namespace SDL { class Event { private: QueueAcc queue; + const float ptCut; Dev devAcc; DevHost devHost; bool addObjects; @@ -91,8 +92,9 @@ 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, const float pt_cut, TQueue const& q, const LSTESDeviceData* deviceESData) : queue(q), + ptCut(pt_cut), devAcc(alpaka::getDev(q)), devHost(cms::alpakatools::host()), nModules_(deviceESData->nModules), @@ -101,6 +103,10 @@ namespace SDL { modulesBuffers_(deviceESData->modulesBuffers), pixelMapping_(deviceESData->pixelMapping), endcapGeometry_(deviceESData->endcapGeometry) { + if (pt_cut < 0.6f) { + throw std::invalid_argument("Minimum pT cut must be at least 0.6 GeV. Provided value: " + + std::to_string(pt_cut)); + } init(verbose); } void resetEvent(); diff --git a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc index 47c2b9c6546be..0476d5d72a165 100644 --- a/RecoTracker/LSTCore/src/alpaka/LST.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LST.dev.cc @@ -7,6 +7,7 @@ using XYZVector = ROOT::Math::XYZVector; void SDL::LST::run(SDL::QueueAcc& queue, bool verbose, + const float ptCut, const LSTESDeviceData* deviceESData, const std::vector see_px, const std::vector see_py, @@ -29,7 +30,7 @@ void SDL::LST::run(SDL::QueueAcc& queue, const std::vector ph2_z, bool no_pls_dupclean, bool tc_pls_triplets) { - auto event = SDL::Event(verbose, queue, deviceESData); + auto event = SDL::Event(verbose, ptCut, queue, deviceESData); prepareInput(see_px, see_py, see_pz, @@ -48,7 +49,8 @@ void SDL::LST::run(SDL::QueueAcc& queue, ph2_detId, ph2_x, ph2_y, - ph2_z); + ph2_z, + ptCut); event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_); event.addPixelSegmentToEvent(in_hitIndices_vec0_, @@ -188,7 +190,8 @@ void SDL::LST::prepareInput(const std::vector see_px, const std::vector ph2_detId, const std::vector ph2_x, const std::vector ph2_y, - const std::vector ph2_z) { + const std::vector ph2_z, + const float ptCut) { unsigned int count = 0; auto n_see = see_stateTrajGlbPx.size(); std::vector px_vec; @@ -240,7 +243,7 @@ void SDL::LST::prepareInput(const std::vector see_px, float eta = p3LH.eta(); float ptErr = see_ptErr[iSeed]; - if ((ptIn > 0.8 - 2 * ptErr)) { + if ((ptIn > ptCut - 2 * ptErr)) { XYZVector r3LH(see_stateTrajGlbX[iSeed], see_stateTrajGlbY[iSeed], see_stateTrajGlbZ[iSeed]); XYZVector p3PCA(see_px[iSeed], see_py[iSeed], see_pz[iSeed]); XYZVector r3PCA(calculateR3FromPCA(p3PCA, see_dxy[iSeed], see_dz[iSeed])); @@ -256,7 +259,7 @@ void SDL::LST::prepareInput(const std::vector see_px, if (ptIn >= 2.0) pixtype = 0; - else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) { + else if (ptIn >= (ptCut - 2 * ptErr) and ptIn < 2.0) { if (pixelSegmentDeltaPhiChange >= 0) pixtype = 1; else diff --git a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc index 0523aac61d4f9..8e13c4d6ddb05 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTESData.dev.cc @@ -41,21 +41,22 @@ namespace { void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer, std::shared_ptr> endcapGeometry, std::shared_ptr> tiltedGeometry, - std::shared_ptr> moduleConnectionMap) { + std::shared_ptr> moduleConnectionMap, + std::string& ptCutLabel) { // Module orientation information (DrDz or phi angles) - auto endcap_geom = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin"); - auto tilted_geom = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.8/tilted_barrel_orientation.bin"); + auto endcap_geom = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + + ptCutLabel + "/endcap_orientation.bin"); + auto tilted_geom = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + + ptCutLabel + "/tilted_barrel_orientation.bin"); // Module connection map (for line segment building) - auto mappath = get_absolute_path_after_check_file_exists( - trackLooperDir() + "/data/OT800_IT615_pt0.8/module_connection_tracing_merged.bin"); + auto mappath = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + + "/module_connection_tracing_merged.bin"); endcapGeometry->load(endcap_geom); tiltedGeometry->load(tilted_geom); moduleConnectionMap->load(mappath); - auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.8/pixelmap/pLS_map"; + auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + "/pixelmap/pLS_map"; const std::array connects{ {"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"}}; std::string path; @@ -76,17 +77,18 @@ namespace { } } // namespace -std::unique_ptr> SDL::loadAndFillESHost() { +std::unique_ptr> SDL::loadAndFillESHost(std::string& ptCutLabel) { auto pLStoLayer = std::make_shared(); auto endcapGeometry = std::make_shared>(); auto tiltedGeometry = std::make_shared>(); auto moduleConnectionMap = std::make_shared>(); - ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); + ::loadMapsHost(*pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap, ptCutLabel); return std::make_unique>(pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap); } std::unique_ptr> SDL::loadAndFillESDevice(SDL::QueueAcc& queue, - const LSTESHostData* hostData) { + const LSTESHostData* hostData, + std::string& ptCutLabel) { SDL::Dev const& devAccIn = alpaka::getDev(queue); uint16_t nModules; uint16_t nLowerModules; @@ -96,8 +98,8 @@ std::unique_ptr> SDL::loadAndFillESDevice(SDL::Qu auto pixelMapping = std::make_shared(); auto moduleConnectionMap = hostData->moduleConnectionMap; - auto path = - get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin"); + auto path = get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt" + ptCutLabel + + "/sensor_centroids.bin"); SDL::loadModulesFromFile(queue, hostData->mapPLStoLayer.get(), path.c_str(), diff --git a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h index c91d6d825b618..c07ed9501b6cc 100644 --- a/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h +++ b/RecoTracker/LSTCore/src/alpaka/MiniDoublet.h @@ -336,6 +336,7 @@ namespace SDL { float rt, struct SDL::modules& modulesInGPU, uint16_t& moduleIndex, + const float ptCut, float dPhi = 0, float dz = 0) { // ================================================================= @@ -584,7 +585,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + const float ptCut) { if (modulesInGPU.subdets[lowerModuleIndex] == SDL::Barrel) { return runMiniDoubletDefaultAlgoBarrel(acc, modulesInGPU, @@ -608,7 +610,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); } else { return runMiniDoubletDefaultAlgoEndcap(acc, modulesInGPU, @@ -632,7 +635,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); } }; @@ -659,7 +663,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + const float ptCut) { bool pass = true; dz = zLower - zUpper; const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f; @@ -674,8 +679,8 @@ namespace SDL { float miniCut = 0; miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel - ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex) - : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex); + ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut) + : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut); // Cut #2: dphi difference // Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3085 @@ -793,7 +798,8 @@ namespace SDL { float xUpper, float yUpper, float zUpper, - float rtUpper) { + float rtUpper, + const float ptCut) { bool pass = true; // There are series of cuts that applies to mini-doublet in a "endcap" region @@ -870,8 +876,8 @@ namespace SDL { float miniCut = 0; miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel - ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, dPhi, dz) - : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, dPhi, dz); + ? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz) + : dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz); pass = pass && (alpaka::math::abs(acc, dPhi) < miniCut); if (not pass) @@ -894,7 +900,8 @@ namespace SDL { struct SDL::modules modulesInGPU, struct SDL::hits hitsInGPU, struct SDL::miniDoublets mdsInGPU, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -950,7 +957,8 @@ namespace SDL { xUpper, yUpper, zUpper, - rtUpper); + rtUpper, + ptCut); if (success) { int totOccupancyMDs = alpaka::atomicOp(acc, &mdsInGPU.totOccupancyMDs[lowerModuleIndex], 1u); diff --git a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h index 6bd590fe63bd5..feddb405bf53b 100644 --- a/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h +++ b/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h @@ -225,7 +225,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + const float ptCut) { zLo = -999; zHi = -999; rtLo = -999; @@ -273,7 +274,8 @@ namespace SDL { zHiPointed, sdlCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runTripletDefaultAlgoPPEE(acc, modulesInGPU, @@ -303,7 +305,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } return false; }; @@ -833,6 +836,7 @@ namespace SDL { float& rzChiSquared, float& rPhiChiSquared, float& rPhiChiSquaredInwards, + const float ptCut, bool runChiSquaredCuts = true) { bool pass = true; @@ -876,7 +880,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -908,7 +913,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; } @@ -1028,7 +1034,8 @@ namespace SDL { struct SDL::pixelTriplets pixelTripletsInGPU, unsigned int* connectedPixelSize, unsigned int* connectedPixelIndex, - unsigned int nPixelSegments) const { + unsigned int nPixelSegments, + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -1105,7 +1112,8 @@ namespace SDL { centerY, rzChiSquared, rPhiChiSquared, - rPhiChiSquaredInwards); + rPhiChiSquaredInwards, + ptCut); if (success) { float phi = @@ -1282,7 +1290,8 @@ namespace SDL { float& zHiPointed, float& sdlCut, float& betaOutCut, - float& deltaBetaCut) // pixel to BB and BE segments + float& deltaBetaCut, + const float ptCut) // pixel to BB and BE segments { bool pass = true; @@ -1574,7 +1583,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) // pixel to EE segments + float& kZ, + const float ptCut) // pixel to EE segments { bool pass = true; bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -2480,7 +2490,8 @@ namespace SDL { float& quintupletRadius, float& centerX, float& centerY, - unsigned int pixelSegmentArrayIndex) { + unsigned int pixelSegmentArrayIndex, + const float ptCut) { bool pass = true; unsigned int T5InnerT3Index = quintupletsInGPU.tripletIndices[2 * quintupletIndex]; @@ -2505,6 +2516,7 @@ namespace SDL { rzChiSquaredTemp, rPhiChiSquaredTemp, rPhiChiSquaredInwardsTemp, + ptCut, false); if (not pass) return false; @@ -2742,7 +2754,8 @@ namespace SDL { unsigned int* connectedPixelSize, unsigned int* connectedPixelIndex, unsigned int nPixelSegments, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -2796,7 +2809,8 @@ namespace SDL { quintupletRadius, centerX, centerY, - static_cast(i_pLS)); + static_cast(i_pLS), + ptCut); if (success) { unsigned int totOccupancyPixelQuintuplets = alpaka::atomicOp(acc, pixelQuintupletsInGPU.totOccupancyPixelQuintuplets, 1u); diff --git a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h index e0bbb5c6adf9f..666e7fb93b6f9 100644 --- a/RecoTracker/LSTCore/src/alpaka/Quintuplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Quintuplet.h @@ -1487,7 +1487,8 @@ namespace SDL { float& sdlCut, float& betaInCut, float& betaOutCut, - float& deltaBetaCut) { + float& deltaBetaCut, + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -1502,7 +1503,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -1534,7 +1535,7 @@ namespace SDL { float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * alpaka::math::sqrt(acc, r3_InLo / rt_InLo); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; // will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? dzErr += sdlMuls * sdlMuls * drt_OutLo_InLo * drt_OutLo_InLo / 3.f * coshEta * coshEta; //sloppy dzErr = alpaka::math::sqrt(acc, dzErr); @@ -1542,7 +1543,7 @@ namespace SDL { const float dzMean = dz_InSeg / drt_InSeg * drt_OutLo_InLo; const float zWindow = dzErr / drt_InSeg * drt_OutLo_InLo + - (zpitch_InLo + zpitch_OutLo); //FIXME for SDL::ptCut lower than ~0.8 need to add curv path correction + (zpitch_InLo + zpitch_OutLo); //FIXME for ptCut lower than ~0.8 need to add curv path correction zLoPointed = z_InLo + dzMean * (z_InLo > 0.f ? 1.f : dzDrtScale) - zWindow; zHiPointed = z_InLo + dzMean * (z_InLo < 0.f ? 1.f : dzDrtScale) + zWindow; @@ -1647,11 +1648,11 @@ namespace SDL { (mdsInGPU.anchorX[secondMDIndex] - mdsInGPU.anchorX[firstMDIndex]) + (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex]) * (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex])); - betaInCut = alpaka::math::asin( - acc, - alpaka::math::min( - acc, (-rt_InSeg * corrF + drt_tl_axis) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / drt_InSeg); + betaInCut = + alpaka::math::asin( + acc, + alpaka::math::min(acc, (-rt_InSeg * corrF + drt_tl_axis) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / drt_InSeg); //Cut #5: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -1717,7 +1718,7 @@ namespace SDL { //FIXME: need faster version betaOutCut = - alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + alpaka::math::asin(acc, alpaka::math::min(acc, drt_tl_axis * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -1768,7 +1769,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPS_OutLo = (modulesInGPU.moduleType[outerInnerLowerModuleIndex] == SDL::PS); @@ -1782,7 +1784,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -1838,7 +1840,7 @@ namespace SDL { zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f) * alpaka::math::sqrt(acc, rIn / rt_InLo); - const float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? drtErr += sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls drtErr = alpaka::math::sqrt(acc, drtErr); @@ -1931,10 +1933,9 @@ namespace SDL { float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); const float corrF = 1.f; - betaInCut = - alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = alpaka::math::asin( + acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #6: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -2000,7 +2001,7 @@ namespace SDL { const float dBetaROut2 = dBetaROut * dBetaROut; //FIXME: need faster version - betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -2051,7 +2052,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + const float ptCut) { bool pass = true; bool isPS_InLo = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -2066,7 +2068,7 @@ namespace SDL { float z_OutLo = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rt_OutLo * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutLoInLo = rt_OutLo / rt_InLo; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = @@ -2118,7 +2120,7 @@ namespace SDL { kZ = (z_OutLo - z_InLo) / dzSDIn; float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rt_OutLo - rt_InLo) / 50.f); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? float drtErr = alpaka::math::sqrt( acc, @@ -2210,10 +2212,9 @@ namespace SDL { float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); const float corrF = 1.f; - betaInCut = - alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = alpaka::math::asin( + acc, alpaka::math::min(acc, (-sdIn_dr * corrF + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #6: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -2267,7 +2268,7 @@ namespace SDL { float dBetaROut2 = 0; //TODO-RH //FIXME: need faster version - betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + betaOutCut = alpaka::math::asin(acc, alpaka::math::min(acc, dr * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / sdOut_d) + alpaka::math::sqrt(acc, dBetaLum2 + dBetaMuls * dBetaMuls); //Cut #6: The real beta cut @@ -2322,7 +2323,8 @@ namespace SDL { float& betaInCut, float& betaOutCut, float& deltaBetaCut, - float& kZ) { + float& kZ, + const float ptCut) { bool pass = false; zLo = -999; @@ -2369,7 +2371,8 @@ namespace SDL { sdlCut, betaInCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Barrel and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBEE(acc, @@ -2400,7 +2403,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Barrel and outerInnerLowerModuleSubdet == SDL::Barrel and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBBB(acc, @@ -2431,7 +2435,8 @@ namespace SDL { sdlCut, betaInCut, betaOutCut, - deltaBetaCut); + deltaBetaCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and innerOuterLowerModuleSubdet == SDL::Endcap and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoBBEE(acc, @@ -2462,7 +2467,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Endcap and innerOuterLowerModuleSubdet == SDL::Endcap and outerInnerLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return runQuintupletDefaultAlgoEEEE(acc, @@ -2493,7 +2499,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); } return pass; @@ -2521,7 +2528,8 @@ namespace SDL { float& rzChiSquared, float& chiSquared, float& nonAnchorChiSquared, - bool& TightCutFlag) { + bool& TightCutFlag, + const float ptCut) { bool pass = true; unsigned int firstSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex]; unsigned int secondSegmentIndex = tripletsInGPU.segmentIndices[2 * innerTripletIndex + 1]; @@ -2578,7 +2586,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -2613,7 +2622,8 @@ namespace SDL { betaInCut, betaOutCut, deltaBetaCut, - kZ); + kZ, + ptCut); if (not pass) return pass; @@ -2989,7 +2999,8 @@ namespace SDL { struct SDL::triplets tripletsInGPU, struct SDL::quintuplets quintupletsInGPU, struct SDL::objectRanges rangesInGPU, - uint16_t nEligibleT5Modules) const { + uint16_t nEligibleT5Modules, + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -3044,7 +3055,8 @@ namespace SDL { rzChiSquared, chiSquared, nonAnchorChiSquared, - TightCutFlag); + TightCutFlag, + ptCut); if (success) { int totOccupancyQuintuplets = diff --git a/RecoTracker/LSTCore/src/alpaka/Segment.h b/RecoTracker/LSTCore/src/alpaka/Segment.h index c3d795bd8cc5f..e40fa2e946ae1 100644 --- a/RecoTracker/LSTCore/src/alpaka/Segment.h +++ b/RecoTracker/LSTCore/src/alpaka/Segment.h @@ -271,7 +271,8 @@ namespace SDL { uint16_t& innerLowerModuleIndex, uint16_t& outerLowerModuleIndex, unsigned int& innerMDIndex, - unsigned int& outerMDIndex) { + unsigned int& outerMDIndex, + const float ptCut) { float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) ? miniMulsPtScaleBarrel[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut : miniMulsPtScaleEndcap[modulesInGPU.layers[innerLowerModuleIndex] - 1] * 3.f / ptCut; @@ -472,7 +473,8 @@ namespace SDL { float& sdCut, float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, - float& dAlphaInnerMDOuterMDThreshold) { + float& dAlphaInnerMDOuterMDThreshold, + const float ptCut) { bool pass = true; float sdMuls = (modulesInGPU.subdets[innerLowerModuleIndex] == SDL::Barrel) @@ -535,7 +537,8 @@ namespace SDL { innerLowerModuleIndex, outerLowerModuleIndex, innerMDIndex, - outerMDIndex); + outerMDIndex, + ptCut); float innerMDAlpha = mdsInGPU.dphichanges[innerMDIndex]; float outerMDAlpha = mdsInGPU.dphichanges[outerMDIndex]; @@ -584,7 +587,8 @@ namespace SDL { float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, float& dAlphaInnerMDOuterMDThreshold, - float& dAlphaInnerMDOuterMD) { + float& dAlphaInnerMDOuterMD, + const float ptCut) { bool pass = true; float xIn, yIn; @@ -675,7 +679,8 @@ namespace SDL { innerLowerModuleIndex, outerLowerModuleIndex, innerMDIndex, - outerMDIndex); + outerMDIndex, + ptCut); dAlphaInnerMDSegmentThreshold = dAlphaThresholdValues[0]; dAlphaOuterMDSegmentThreshold = dAlphaThresholdValues[1]; @@ -726,7 +731,8 @@ namespace SDL { float& sdCut, float& dAlphaInnerMDSegmentThreshold, float& dAlphaOuterMDSegmentThreshold, - float& dAlphaInnerMDOuterMDThreshold) { + float& dAlphaInnerMDOuterMDThreshold, + const float ptCut) { zLo = -999.f; zHi = -999.f; rtLo = -999.f; @@ -759,7 +765,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); } else { return runSegmentDefaultAlgoEndcap(acc, modulesInGPU, @@ -786,7 +793,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); } }; @@ -796,7 +804,8 @@ namespace SDL { struct SDL::modules modulesInGPU, struct SDL::miniDoublets mdsInGPU, struct SDL::segments segmentsInGPU, - struct SDL::objectRanges rangesInGPU) const { + struct SDL::objectRanges rangesInGPU, + const float ptCut) const { auto const globalBlockIdx = alpaka::getIdx(acc); auto const blockThreadIdx = alpaka::getIdx(acc); auto const gridBlockExtent = alpaka::getWorkDiv(acc); @@ -868,7 +877,8 @@ namespace SDL { sdCut, dAlphaInnerMDSegmentThreshold, dAlphaOuterMDSegmentThreshold, - dAlphaInnerMDOuterMDThreshold); + dAlphaInnerMDOuterMDThreshold, + ptCut); if (pass) { unsigned int totOccupancySegments = alpaka::atomicOp( diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index 1dfdbd5e9a900..36fe437b889a0 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -307,7 +307,8 @@ namespace SDL { float& rtOut, unsigned int& innerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + const float ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); bool isPSOut = (modulesInGPU.moduleType[outerOuterLowerModuleIndex] == SDL::PS); @@ -321,7 +322,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeVOut = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float rtRatio_OutIn = rtOut / rtIn; // Outer segment beginning rt divided by inner segment beginning rt; float dzDrtScale = alpaka::math::tan(acc, alpha1GeVOut) / alpha1GeVOut; // The track can bend in r-z plane slightly @@ -351,15 +352,14 @@ namespace SDL { float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rtOut - rtIn) / 50.f) * alpaka::math::sqrt(acc, r3In / rtIn); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; // will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; // will need a better guess than x4? dzErr += sdlMuls * sdlMuls * drt_OutIn * drt_OutIn / 3.f * coshEta * coshEta; //sloppy dzErr = alpaka::math::sqrt(acc, dzErr); // Constructing upper and lower bound const float dzMean = dz_InSeg / drt_InSeg * drt_OutIn; - const float zWindow = - dzErr / drt_InSeg * drt_OutIn + - (zpitchIn + zpitchOut); //FIXME for SDL::ptCut lower than ~0.8 need to add curv path correction + const float zWindow = dzErr / drt_InSeg * drt_OutIn + + (zpitchIn + zpitchOut); //FIXME for ptCut lower than ~0.8 need to add curv path correction const float zLoPointed = zIn + dzMean * (zIn > 0.f ? 1.f : dzDrtScale) - zWindow; const float zHiPointed = zIn + dzMean * (zIn < 0.f ? 1.f : dzDrtScale) + zWindow; @@ -386,7 +386,7 @@ namespace SDL { (mdsInGPU.anchorY[secondMDIndex] - mdsInGPU.anchorY[firstMDIndex])); betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-rt_InSeg + drt_tl_axis) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + + acc, alpaka::math::min(acc, (-rt_InSeg + drt_tl_axis) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + (0.02f / drt_InSeg); //Cut #3: first beta cut @@ -412,7 +412,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + const float ptCut) { bool pass = true; bool isPSIn = (modulesInGPU.moduleType[innerInnerLowerModuleIndex] == SDL::PS); @@ -427,7 +428,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_OutLo = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float dzDrtScale = alpaka::math::tan(acc, alpha1GeV_OutLo) / alpha1GeV_OutLo; // The track can bend in r-z plane slightly @@ -475,7 +476,7 @@ namespace SDL { zGeom1_another * zGeom1_another * drtSDIn * drtSDIn / dzSDIn / dzSDIn * (1.f - 2.f * kZ + 2.f * kZ * kZ); const float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2 * (rtOut - rtIn) / 50.f) * alpaka::math::sqrt(acc, rIn / rtIn); - const float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + const float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? drtErr += sdlMuls * sdlMuls * multDzDr * multDzDr / 3.f * coshEta * coshEta; //sloppy: relative muls is 1/3 of total muls drtErr = alpaka::math::sqrt(acc, drtErr); @@ -513,9 +514,9 @@ namespace SDL { float sdIn_d = rt_InOut - rt_InLo; float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); - betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = + alpaka::math::asin(acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #4: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -538,7 +539,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + const float ptCut) { bool pass = true; float rtIn = mdsInGPU.anchorRt[firstMDIndex]; @@ -550,7 +552,7 @@ namespace SDL { zOut = mdsInGPU.anchorZ[thirdMDIndex]; float alpha1GeV_Out = - alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)); + alpaka::math::asin(acc, alpaka::math::min(acc, rtOut * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)); float dzDrtScale = alpaka::math::tan(acc, alpha1GeV_Out) / alpha1GeV_Out; // The track can bend in r-z plane slightly @@ -591,7 +593,7 @@ namespace SDL { float kZ = (zOut - zIn) / dzSDIn; float sdlThetaMulsF = 0.015f * alpaka::math::sqrt(acc, 0.1f + 0.2f * (rtOut - rtIn) / 50.f); - float sdlMuls = sdlThetaMulsF * 3.f / SDL::ptCut * 4.f; //will need a better guess than x4? + float sdlMuls = sdlThetaMulsF * 3.f / ptCut * 4.f; //will need a better guess than x4? float drtErr = alpaka::math::sqrt( acc, @@ -640,9 +642,9 @@ namespace SDL { float sdIn_d = rt_InOut - rt_InLo; float dr = alpaka::math::sqrt(acc, tl_axis_x * tl_axis_x + tl_axis_y * tl_axis_y); - betaInCut = alpaka::math::asin( - acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / SDL::ptCut, SDL::sinAlphaMax)) + - (0.02f / sdIn_d); + betaInCut = + alpaka::math::asin(acc, alpaka::math::min(acc, (-sdIn_dr + dr) * SDL::k2Rinv1GeVf / ptCut, SDL::sinAlphaMax)) + + (0.02f / sdIn_d); //Cut #4: first beta cut pass = pass and (alpaka::math::abs(acc, betaInRHmin) < betaInCut); @@ -666,7 +668,8 @@ namespace SDL { unsigned int& innerSegmentIndex, unsigned int& outerSegmentIndex, float& betaIn, - float& betaInCut) { + float& betaInCut, + const float ptCut) { short innerInnerLowerModuleSubdet = modulesInGPU.subdets[innerInnerLowerModuleIndex]; short middleLowerModuleSubdet = modulesInGPU.subdets[middleLowerModuleIndex]; short outerOuterLowerModuleSubdet = modulesInGPU.subdets[outerOuterLowerModuleIndex]; @@ -687,7 +690,8 @@ namespace SDL { rtOut, innerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and middleLowerModuleSubdet == SDL::Barrel and outerOuterLowerModuleSubdet == SDL::Endcap) { return passPointingConstraintBBE(acc, @@ -706,7 +710,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } else if (innerInnerLowerModuleSubdet == SDL::Barrel and middleLowerModuleSubdet == SDL::Endcap and outerOuterLowerModuleSubdet == SDL::Endcap) { return passPointingConstraintBBE(acc, @@ -725,7 +730,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } @@ -746,7 +752,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut); + betaInCut, + ptCut); } return false; // failsafe }; @@ -811,7 +818,8 @@ namespace SDL { float& zLoPointed, float& zHiPointed, float& sdlCut, - float& betaInCut) { + float& betaInCut, + const float ptCut) { bool pass = true; //this cut reduces the number of candidates by a factor of 4, i.e., 3 out of 4 warps can end right here! if (segmentsInGPU.mdIndices[2 * innerSegmentIndex + 1] != segmentsInGPU.mdIndices[2 * outerSegmentIndex]) @@ -849,7 +857,8 @@ namespace SDL { innerSegmentIndex, outerSegmentIndex, betaIn, - betaInCut)); + betaInCut, + ptCut)); if (not pass) return pass; @@ -873,7 +882,8 @@ namespace SDL { struct SDL::triplets tripletsInGPU, struct SDL::objectRanges rangesInGPU, uint16_t* index_gpu, - uint16_t nonZeroModules) const { + uint16_t nonZeroModules, + const float ptCut) const { auto const globalThreadIdx = alpaka::getIdx(acc); auto const gridThreadExtent = alpaka::getWorkDiv(acc); @@ -931,7 +941,8 @@ namespace SDL { zLoPointed, zHiPointed, sdlCut, - betaInCut); + betaInCut, + ptCut); if (success) { unsigned int totOccupancyTriplets = alpaka::atomicOp( diff --git a/RecoTracker/LSTCore/standalone/.gitignore b/RecoTracker/LSTCore/standalone/.gitignore index aae6f2984e8cc..6411d674967ac 100644 --- a/RecoTracker/LSTCore/standalone/.gitignore +++ b/RecoTracker/LSTCore/standalone/.gitignore @@ -9,6 +9,7 @@ plots_*/ scripts/moduleconnection*.txt *.root .make.log* +performance* bin/doAnalysis bin/sdl bin/sdl_cuda diff --git a/RecoTracker/LSTCore/standalone/Makefile b/RecoTracker/LSTCore/standalone/Makefile index 4e8071b3e7a80..9ec50a5b7596a 100644 --- a/RecoTracker/LSTCore/standalone/Makefile +++ b/RecoTracker/LSTCore/standalone/Makefile @@ -25,7 +25,6 @@ ALPAKA_CUDA = -DALPAKA_ACC_GPU_CUDA_ENABLED -DALPAKA_HOST_ONLY ALPAKA_ROCM = -DALPAKA_ACC_GPU_HIP_ENABLED -DALPAKA_HOST_ONLY -DALPAKA_DISABLE_VENDOR_RNG -D__HIP_PLATFORM_HCC__ -D__HIP_PLATFORM_AMD__ EXTRAFLAGS = -ITMultiDrawTreePlayer -Wunused-variable -lTMVA -lEG -lGenVector -lXMLIO -lMLP -lTreePlayer -fopenmp DOQUINTUPLET = -PTCUTFLAG = CUTVALUEFLAG = CUTVALUEFLAG_FLAGS = -DCUT_VALUE_DEBUG @@ -47,20 +46,20 @@ cutvalue_primitive: rooutil efficiency $(EXES) bin/sdl_cpu: SDLLIB=-lsdl_cpu bin/sdl_cpu: bin/sdl_cpu.o $(OBJECTS_CPU) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) -o $@ bin/sdl_cuda: SDLLIB=-lsdl_cuda bin/sdl_cuda: bin/sdl_cuda.o $(OBJECTS_CUDA) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(LDFLAGS_CUDA) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(LDFLAGS_CUDA) -o $@ bin/sdl_rocm: SDLLIB=-lsdl_rocm bin/sdl_rocm: bin/sdl_rocm.o $(OBJECTS_ROCM) - $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(LDFLAGS_ROCM) -o $@ + $(CXX) $(LDFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $^ $(ROOTLIBS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(LDFLAGS_ROCM) -o $@ %_cpu.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CPU) $< -c -o $@ %_cuda.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(CUDAINCLUDE) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_CUDA) $(CUDAINCLUDE) $< -c -o $@ %_rocm.o: %.cc rooutil - $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(PTCUTFLAG) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(ROCMINCLUDE) $< -c -o $@ + $(CXX) $(CXXFLAGS) $(EXTRAFLAGS) $(INCLUDEFLAGS) $(ALPAKAFLAGS) $(CUTVALUEFLAG) $(PRIMITIVEFLAG) $(DOQUINTUPLET) $(ALPAKA_ROCM) $(ROCMINCLUDE) $< -c -o $@ rooutil: $(MAKE) -C code/rooutil/ diff --git a/RecoTracker/LSTCore/standalone/SDL/Makefile b/RecoTracker/LSTCore/standalone/SDL/Makefile index df2fbb6d9f8af..6ae7f702cbb6c 100644 --- a/RecoTracker/LSTCore/standalone/SDL/Makefile +++ b/RecoTracker/LSTCore/standalone/SDL/Makefile @@ -59,7 +59,6 @@ ROOTCFLAGS = -pthread -m64 $(ROOTINCLUDE) PRINTFLAG = -DT4FromT3 DUPLICATES = -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 #-DFP16_Base CACHEFLAG = -PTCUTFLAG = LSTWARNINGSFLAG = CMSSW_WERRORS_CPU = -Werror=pointer-arith -Werror=overlength-strings -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label \ -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing \ @@ -91,13 +90,13 @@ CUTVALUEFLAG = CUTVALUEFLAG_FLAGS = -DCUT_VALUE_DEBUG %_cpu.o: ../../src/alpaka/%.dev.cc - $(COMPILE_CMD_CPU) $(CXXFLAGS_CPU) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CPU) $(T5CUTFLAGS) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CPU) $< -o $@ + $(COMPILE_CMD_CPU) $(CXXFLAGS_CPU) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CPU) $(T5CUTFLAGS) $(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) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_CUDA) $< -o $@ + $(COMPILE_CMD_CUDA) $(CXXFLAGS_CUDA) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_CUDA) $(T5CUTFLAGS) $(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) $(PTCUTFLAG) $(DUPLICATES) $(ALPAKAINCLUDE) $(ALPAKABACKEND_ROCM) $< -o $@ + $(COMPILE_CMD_ROCM) $(CXXFLAGS_ROCM) $(ROOTINCLUDE) $(PRINTFLAG) $(CACHEFLAG) $(CUTVALUEFLAG) $(LSTWARNINGSFLAG) $(CMSSW_WERRORS_ROCM) $(T5CUTFLAGS) $(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 ce1b0f12461ed..bdba8f9d5e44f 100644 --- a/RecoTracker/LSTCore/standalone/bin/sdl.cc +++ b/RecoTracker/LSTCore/standalone/bin/sdl.cc @@ -50,6 +50,7 @@ int main(int argc, char **argv) { cxxopts::value()->default_value("trackingNtuple/tree"))( "o,output", "Output file name", cxxopts::value())( "N,nmatch", "N match for MTV-like matching", cxxopts::value()->default_value("9"))( + "p,ptCut", "Min pT cut In GeV", cxxopts::value()->default_value("0.8"))( "n,nevents", "N events to loop over", cxxopts::value()->default_value("-1"))( "x,event_index", "specific event index to process", cxxopts::value()->default_value("-1"))( "g,pdg_id", "The simhit pdgId match option", cxxopts::value()->default_value("0"))( @@ -142,6 +143,10 @@ int main(int argc, char **argv) { } } + //_______________________________________________________________________________ + // --ptCut + ana.ptCut = result["ptCut"].as(); + //_______________________________________________________________________________ // --nmatch ana.nmatch_threshold = result["nmatch"].as(); @@ -266,6 +271,7 @@ int main(int argc, char **argv) { std::cout << " ana.mode: " << ana.mode << std::endl; std::cout << " ana.streams: " << ana.streams << std::endl; std::cout << " ana.verbose: " << ana.verbose << std::endl; + std::cout << " ana.ptCut: " << ana.ptCut << std::endl; std::cout << " ana.nmatch_threshold: " << ana.nmatch_threshold << std::endl; std::cout << " ana.tc_pls_triplets: " << ana.tc_pls_triplets << std::endl; std::cout << " ana.no_pls_dupclean: " << ana.no_pls_dupclean << std::endl; @@ -305,8 +311,10 @@ void run_sdl() { // Load various maps used in the SDL reconstruction TStopwatch full_timer; full_timer.Start(); - auto hostESData = SDL::loadAndFillESHost(); - auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get()); + // Determine which maps to use based on given pt cut for standalone. + std::string ptCutString = (ana.ptCut >= 0.8) ? "0.8" : "0.6"; + auto hostESData = SDL::loadAndFillESHost(ptCutString); + auto deviceESData = SDL::loadAndFillESDevice(queues[0], hostESData.get(), ptCutString); float timeForMapLoading = full_timer.RealTime() * 1000; if (ana.do_write_ntuple) { @@ -384,7 +392,7 @@ void run_sdl() { full_timer.Start(); std::vector *> events; for (int s = 0; s < ana.streams; s++) { - SDL::Event *event = new SDL::Event(ana.verbose >= 2, queues[s], deviceESData.get()); + SDL::Event *event = new SDL::Event(ana.verbose >= 2, ana.ptCut, queues[s], deviceESData.get()); events.push_back(event); } float timeForEventCreation = full_timer.RealTime() * 1000; diff --git a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper index ae4678ec18892..ca510e2cc3d48 100755 --- a/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper +++ b/RecoTracker/LSTCore/standalone/bin/sdl_make_tracklooper @@ -29,7 +29,6 @@ usage() echo " -G GPU (CUDA) backend (Compile for CUDA)" echo " -R ROCm backend (Compile for ROCm)" echo " -A All backends (Compile for all backends, including ROCm)" - echo " -P PT Cut Value (In GeV, Default is 0.8, Works only for standalone version of code)" echo " -w Warning mode (Print extra warning outputs)" echo exit @@ -49,7 +48,6 @@ while getopts ":cxgsmdp3NCGRA2ehwP:" OPTION; do R) ROCMBACKEND=true;; A) ALLBACKENDS=true;; w) PRINTWARNINGS=true;; - P) PTCUTVALUE=$OPTARG;; h) usage;; :) usage;; esac @@ -67,7 +65,6 @@ if [ -z ${CUDABACKEND} ]; then CUDABACKEND=false; fi if [ -z ${ROCMBACKEND} ]; then ROCMBACKEND=false; fi if [ -z ${ALLBACKENDS} ]; then ALLBACKENDS=false; fi if [ -z ${PRINTWARNINGS} ]; then PRINTWARNINGS=false; fi -if [ -z ${PTCUTVALUE} ]; then PTCUTVALUE=0.8; fi # Default to only CPU and CUDA backends if [ "${CPUBACKEND}" == false ] && [ "${CUDABACKEND}" == false ] && [ "${ROCMBACKEND}" == false ]; then @@ -106,7 +103,6 @@ echo " CPUBACKEND : ${CPUBACKEND}" | tee -a ${LOG} echo " CUDABACKEND : ${CUDABACKEND}" | tee -a ${LOG} echo " ROCMBACKEND : ${ROCMBACKEND}" | tee -a ${LOG} echo " PRINTWARNINGS : ${PRINTWARNINGS}" | tee -a ${LOG} -echo " PTCUTVALUE : ${PTCUTVALUE} GeV" | tee -a ${LOG} echo "" | tee -a ${LOG} echo " (cf. Run > sh $(basename $0) -h to see all options)" | tee -a ${LOG} echo "" | tee -a ${LOG} @@ -173,8 +169,6 @@ if $PRINTWARNINGS; then PRINTWARNINGSOPT="LSTWARNINGSFLAG=-DWarnings" fi -PTCUTOPT="PTCUTFLAG=-DPT_CUT=${PTCUTVALUE}" - ### ### ### Making Line Segment Tracking Library @@ -187,9 +181,9 @@ echo "-------------------------------------------------------------------------- echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 if $SHOWLOG; then - (cd SDL && make clean && make ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${PTCUTOPT} -j 32 ${MAKETARGET} && cd -) 2>&1 | tee -a ${LOG} + (cd SDL && make clean && make ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} -j 32 ${MAKETARGET} && cd -) 2>&1 | tee -a ${LOG} else - (cd SDL && make clean && make ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} ${PTCUTOPT} -j 32 ${MAKETARGET} && cd -) >> ${LOG} 2>&1 + (cd SDL && make clean && make ${T5CUTOPT} ${BACKENDOPT} ${PRINTWARNINGSOPT} -j 32 ${MAKETARGET} && cd -) >> ${LOG} 2>&1 fi if ([[ "$BACKENDOPT" == *"all"* ]] || [[ "$BACKENDOPT" == *"cpu"* ]]) && [ ! -f SDL/libsdl_cpu.so ]; then @@ -224,9 +218,9 @@ echo "-------------------------------------------------------------------------- echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 echo "---------------------------------------------------------------------------------------------" >> ${LOG} 2>&1 if $SHOWLOG; then - make EXES="${EXES}" ${TRACKLOOPERTARGET} ${PTCUTOPT} -j 2>&1 | tee -a ${LOG} + make EXES="${EXES}" ${TRACKLOOPERTARGET} -j 2>&1 | tee -a ${LOG} else - make EXES="${EXES}" ${TRACKLOOPERTARGET} ${PTCUTOPT} -j >> ${LOG} 2>&1 + make EXES="${EXES}" ${TRACKLOOPERTARGET} -j >> ${LOG} 2>&1 fi if ([[ "$BACKENDOPT" == *"all"* ]] || [[ "$BACKENDOPT" == *"cpu"* ]]) && [ ! -f bin/sdl_cpu ]; then diff --git a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h index 14b3df631c6c8..50ef9a1ff5a71 100644 --- a/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h +++ b/RecoTracker/LSTCore/standalone/code/core/AnalysisConfig.h @@ -46,6 +46,9 @@ class AnalysisConfig { // pt binning options int ptbound_mode; + // pt cut + float ptCut; + // pdg id of the particles to compute efficincies on int pdg_id; diff --git a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc index d16394cc06f98..1a8593d12d113 100644 --- a/RecoTracker/LSTCore/standalone/code/core/trkCore.cc +++ b/RecoTracker/LSTCore/standalone/code/core/trkCore.cc @@ -690,7 +690,7 @@ void addInputsToLineSegmentTrackingPreLoad(std::vector> &out_ float eta = p3LH.Eta(); float ptErr = trk.see_ptErr()[iSeed]; - if ((ptIn > PT_CUT - 2 * ptErr)) { + if ((ptIn > ana.ptCut - 2 * ptErr)) { TVector3 r3LH(trk.see_stateTrajGlbX()[iSeed], trk.see_stateTrajGlbY()[iSeed], trk.see_stateTrajGlbZ()[iSeed]); TVector3 p3PCA(trk.see_px()[iSeed], trk.see_py()[iSeed], trk.see_pz()[iSeed]); TVector3 r3PCA(calculateR3FromPCA(p3PCA, trk.see_dxy()[iSeed], trk.see_dz()[iSeed])); @@ -712,7 +712,7 @@ void addInputsToLineSegmentTrackingPreLoad(std::vector> &out_ int pixtype = -1; if (ptIn >= 2.0) { /*ptbin = 1;*/ pixtype = 0; - } else if (ptIn >= (PT_CUT - 2 * ptErr) and ptIn < 2.0) { + } else if (ptIn >= (ana.ptCut - 2 * ptErr) and ptIn < 2.0) { // ptbin = 0; if (pixelSegmentDeltaPhiChange >= 0) { pixtype = 1; @@ -1190,7 +1190,7 @@ void writeMetaData() { float ptErr = trk.see_ptErr()[iSeed]; float eta = p3LH.Eta(); - if ((ptIn > 0.8 - 2 * ptErr)) { + if ((ptIn > ana.ptCut - 2 * ptErr)) { TVector3 r3LH(trk.see_stateTrajGlbX()[iSeed], trk.see_stateTrajGlbY()[iSeed], trk.see_stateTrajGlbZ()[iSeed]); TVector3 p3PCA(trk.see_px()[iSeed], trk.see_py()[iSeed], trk.see_pz()[iSeed]); TVector3 r3PCA(calculateR3FromPCA(p3PCA, trk.see_dxy()[iSeed], trk.see_dz()[iSeed])); @@ -1215,7 +1215,7 @@ void writeMetaData() { int pixtype = -1; if (ptIn >= 2.0) { /*ptbin = 1;*/ pixtype = 0; - } else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) { + } else if (ptIn >= (ana.ptCut - 2 * ptErr) and ptIn < 2.0) { // ptbin = 0; if (pixelSegmentDeltaPhiChange >= 0) { pixtype = 1;