Skip to content

Commit

Permalink
Merge pull request #68 from SegmentLinking/renameClassesRemoveCopies
Browse files Browse the repository at this point in the history
Renaming of namespaces/classes/macros and removal of vector, etc. copies
  • Loading branch information
slava77 authored Jul 22, 2024
2 parents ff12237 + 7fdcabd commit fac2958
Show file tree
Hide file tree
Showing 49 changed files with 1,718 additions and 1,714 deletions.
2 changes: 1 addition & 1 deletion RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void TrackListMerger::produce(edm::Event& e, const edm::EventSetup& es) {
}

//DL here
if LIKELY (ngood > 0 && collsSize > 0)
if LIKELY (ngood > 1 && collsSize > 1)
for (unsigned int ltm = 0; ltm < listsToMerge_.size(); ltm++) {
int saveSelected[rSize];
bool notActive[collsSize];
Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
descriptions.addWithDefaultLabel(desc);
}

std::unique_ptr<SDL::LSTESData<DevHost>> produce(TrackerRecoGeometryRecord const& iRecord) {
return SDL::loadAndFillESHost();
std::unique_ptr<lst::LSTESData<DevHost>> produce(TrackerRecoGeometryRecord const& iRecord) {
return lst::loadAndFillESHost();
}
};

Expand Down
4 changes: 2 additions & 2 deletions RecoTracker/LST/plugins/alpaka/LSTProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
private:
edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
device::ESGetToken<SDL::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
device::ESGetToken<lst::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
const bool verbose_, nopLSDupClean_, tcpLSTriplets_;
edm::EDPutTokenT<LSTOutput> lstOutputToken_;

SDL::LST<Acc3D> lst_;
lst::LST<Acc3D> lst_;
};

} // namespace ALPAKA_ACCELERATOR_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/LST/src/ES_ModulesDev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(SDL::LSTESData<alpaka_common::DevHost>);
TYPELOOKUP_DATA_REG(lst::LSTESData<alpaka_common::DevHost>);
2 changes: 1 addition & 1 deletion RecoTracker/LST/src/alpaka/ES_ModulesDev.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "RecoTracker/LSTCore/interface/LSTESData.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/typelookup.h"

TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(SDL::LSTESData);
TYPELOOKUP_ALPAKA_TEMPLATED_DATA_REG(lst::LSTESData);
20 changes: 10 additions & 10 deletions RecoTracker/LSTCore/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "HeterogeneousCore/AlpakaInterface/interface/CachedBufAlloc.h"
#endif

namespace SDL {
namespace lst {

// Buffer type for allocations where auto type can't be used.
template <typename TDev, typename TData>
Expand Down Expand Up @@ -39,18 +39,18 @@ namespace SDL {
constexpr float PT_CUT = 0.8f;
#endif

constexpr unsigned int MAX_BLOCKS = 80;
constexpr unsigned int MAX_CONNECTED_MODULES = 40;
constexpr unsigned int max_blocks = 80;
constexpr unsigned int max_connected_modules = 40;

constexpr unsigned int N_MAX_PIXEL_SEGMENTS_PER_MODULE = 50000;
constexpr unsigned int n_max_pixel_segments_per_module = 50000;

constexpr 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;

constexpr unsigned int N_MAX_PIXEL_TRIPLETS = 5000;
constexpr unsigned int N_MAX_PIXEL_QUINTUPLETS = 15000;
constexpr unsigned int n_max_pixel_triplets = 5000;
constexpr unsigned int n_max_pixel_quintuplets = 15000;

constexpr unsigned int N_MAX_PIXEL_TRACK_CANDIDATES = 30000;
constexpr 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;

constexpr unsigned int size_superbins = 45000;

Expand All @@ -75,6 +75,6 @@ namespace SDL {
static constexpr int kLayers = 7, kHits = 14;
};

} //namespace SDL
} //namespace lst

#endif
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <vector>
#include <stdexcept>

namespace SDL {
namespace lst {
class EndcapGeometry {
private:
std::map<unsigned int, float> dxdy_slope_; // dx/dy slope
Expand All @@ -29,6 +29,6 @@ namespace SDL {
void fillGeoMapArraysExplicit();
float getdxdy_slope(unsigned int detid) const;
};
} // namespace SDL
} // namespace lst

#endif
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "RecoTracker/LSTCore/interface/Constants.h"

namespace SDL {
namespace lst {

struct EndcapGeometryDev {
const unsigned int* geoMapDetId;
Expand Down Expand Up @@ -51,6 +51,6 @@ namespace SDL {
inline EndcapGeometryDev const* data() const { return &data_; }
};

} // namespace SDL
} // namespace lst

#endif
7 changes: 3 additions & 4 deletions RecoTracker/LSTCore/interface/LST.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

#include <cstdlib>
#include <numeric>
#include <mutex>
#include <alpaka/alpaka.hpp>

namespace SDL {
namespace lst {
template <typename>
class Event;

Expand Down Expand Up @@ -72,7 +71,7 @@ namespace SDL {
const std::vector<float> ph2_y,
const std::vector<float> ph2_z);

void getOutput(SDL::Event<TAcc>& event);
void getOutput(lst::Event<TAcc>& event);
std::vector<unsigned int> getHitIdxs(const short trackCandidateType,
const unsigned int TCIdx,
const unsigned int* TCHitIndices,
Expand Down Expand Up @@ -108,6 +107,6 @@ namespace SDL {
std::vector<short> out_tc_trackCandidateType_;
};

} // namespace SDL
} // namespace lst

#endif
20 changes: 10 additions & 10 deletions RecoTracker/LSTCore/interface/LSTESData.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <filesystem>
#include <memory>

namespace SDL {
namespace lst {

template <typename TDev>
struct LSTESData {
Expand All @@ -21,15 +21,15 @@ namespace SDL {
unsigned int nEndCapMap;
std::shared_ptr<const ModulesBuffer<TDev>> modulesBuffers;
std::shared_ptr<const EndcapGeometryBuffer<TDev>> endcapGeometryBuffers;
std::shared_ptr<const pixelMap> pixelMapping;
std::shared_ptr<const PixelMap> pixelMapping;

LSTESData(uint16_t const& nModulesIn,
uint16_t const& nLowerModulesIn,
unsigned int const& nPixelsIn,
unsigned int const& nEndCapMapIn,
std::shared_ptr<const ModulesBuffer<TDev>> const& modulesBuffersIn,
std::shared_ptr<const EndcapGeometryBuffer<TDev>> const& endcapGeometryBuffersIn,
std::shared_ptr<const pixelMap> const& pixelMappingIn)
std::shared_ptr<const PixelMap> const& pixelMappingIn)
: nModules(nModulesIn),
nLowerModules(nLowerModulesIn),
nPixels(nPixelsIn),
Expand All @@ -41,22 +41,22 @@ namespace SDL {

std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost();

} // namespace SDL
} // namespace lst

namespace cms::alpakatools {
template <>
struct CopyToDevice<SDL::LSTESData<alpaka_common::DevHost>> {
struct CopyToDevice<lst::LSTESData<alpaka_common::DevHost>> {
template <typename TQueue>
static SDL::LSTESData<alpaka::Dev<TQueue>> copyAsync(TQueue& queue,
SDL::LSTESData<alpaka_common::DevHost> const& srcData) {
auto deviceModulesBuffers = std::make_shared<SDL::ModulesBuffer<alpaka::Dev<TQueue>>>(
static lst::LSTESData<alpaka::Dev<TQueue>> copyAsync(TQueue& queue,
lst::LSTESData<alpaka_common::DevHost> const& srcData) {
auto deviceModulesBuffers = std::make_shared<lst::ModulesBuffer<alpaka::Dev<TQueue>>>(
alpaka::getDev(queue), srcData.nModules, srcData.nPixels);
deviceModulesBuffers->copyFromSrc(queue, *srcData.modulesBuffers);
auto deviceEndcapGeometryBuffers =
std::make_shared<SDL::EndcapGeometryBuffer<alpaka::Dev<TQueue>>>(alpaka::getDev(queue), srcData.nEndCapMap);
std::make_shared<lst::EndcapGeometryBuffer<alpaka::Dev<TQueue>>>(alpaka::getDev(queue), srcData.nEndCapMap);
deviceEndcapGeometryBuffers->copyFromSrc(queue, *srcData.endcapGeometryBuffers);

return SDL::LSTESData<alpaka::Dev<TQueue>>(srcData.nModules,
return lst::LSTESData<alpaka::Dev<TQueue>>(srcData.nModules,
srcData.nLowerModules,
srcData.nPixels,
srcData.nEndCapMap,
Expand Down
6 changes: 3 additions & 3 deletions RecoTracker/LSTCore/interface/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "RecoTracker/LSTCore/interface/Constants.h"

namespace SDL {
namespace lst {
enum SubDet { InnerPixel = 0, Barrel = 5, Endcap = 4 };

enum Side { NegZ = 1, PosZ = 2, Center = 3 };
Expand Down Expand Up @@ -146,7 +146,7 @@ namespace SDL {

ModulesBuffer(TDev const& dev, unsigned int nMod, unsigned int nPixs)
: detIds_buf(allocBufWrapper<unsigned int>(dev, nMod)),
moduleMap_buf(allocBufWrapper<uint16_t>(dev, nMod * MAX_CONNECTED_MODULES)),
moduleMap_buf(allocBufWrapper<uint16_t>(dev, nMod * max_connected_modules)),
mapdetId_buf(allocBufWrapper<unsigned int>(dev, nMod)),
mapIdx_buf(allocBufWrapper<uint16_t>(dev, nMod)),
nConnectedModules_buf(allocBufWrapper<uint16_t>(dev, nMod)),
Expand Down Expand Up @@ -224,5 +224,5 @@ namespace SDL {
inline Modules const* data() const { return &data_; }
};

} // namespace SDL
} // namespace lst
#endif
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/ModuleConnectionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <sstream>
#include <algorithm>

namespace SDL {
namespace lst {
class ModuleConnectionMap {
private:
std::map<unsigned int, std::vector<unsigned int>> moduleConnections_;
Expand All @@ -27,6 +27,6 @@ namespace SDL {
};

using MapPLStoLayer = std::array<std::array<ModuleConnectionMap, 4>, 3>;
} // namespace SDL
} // namespace lst

#endif
8 changes: 4 additions & 4 deletions RecoTracker/LSTCore/interface/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#include "RecoTracker/LSTCore/interface/Constants.h"

namespace SDL {
struct pixelMap {
namespace lst {
struct PixelMap {
uint16_t pixelModuleIndex;

std::vector<unsigned int> connectedPixelsIndex;
Expand All @@ -19,7 +19,7 @@ namespace SDL {

int* pixelType;

pixelMap(unsigned int sizef = size_superbins)
PixelMap(unsigned int sizef = size_superbins)
: pixelModuleIndex(0),
connectedPixelsIndex(sizef),
connectedPixelsSizes(sizef),
Expand All @@ -28,6 +28,6 @@ namespace SDL {
connectedPixelsIndexNeg(sizef),
connectedPixelsSizesNeg(sizef) {}
};
} // namespace SDL
} // namespace lst

#endif
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/TiltedGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <string>
#include <stdexcept>

namespace SDL {
namespace lst {
class TiltedGeometry {
private:
std::map<unsigned int, float> drdzs_; // dr/dz slope
Expand All @@ -26,6 +26,6 @@ namespace SDL {
float getDxDy(unsigned int detid) const;
};

} // namespace SDL
} // namespace lst

#endif
43 changes: 23 additions & 20 deletions RecoTracker/LSTCore/interface/alpaka/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <cuda_fp16.h>
#endif

namespace SDL {
namespace lst {

using namespace ALPAKA_ACCELERATOR_NAMESPACE;

Expand Down Expand Up @@ -83,23 +83,26 @@ namespace SDL {
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 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 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 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
// Since C++ can't represent infinity, lst_INF = 123456789 was used to represent infinity in the data table
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float lst_INF = 123456789.0;

namespace t5dnn {

// Working points matching LST fake rate (43.9%) or signal acceptance (82.0%)
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 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

} //namespace lst
#endif
8 changes: 4 additions & 4 deletions RecoTracker/LSTCore/src/EndcapGeometry.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"

SDL::EndcapGeometry::EndcapGeometry(std::string filename) { load(filename); }
lst::EndcapGeometry::EndcapGeometry(std::string filename) { load(filename); }

void SDL::EndcapGeometry::load(std::string filename) {
void lst::EndcapGeometry::load(std::string filename) {
dxdy_slope_.clear();
centroid_phis_.clear();

Expand Down Expand Up @@ -34,7 +34,7 @@ void SDL::EndcapGeometry::load(std::string filename) {
fillGeoMapArraysExplicit();
}

void SDL::EndcapGeometry::fillGeoMapArraysExplicit() {
void lst::EndcapGeometry::fillGeoMapArraysExplicit() {
nEndCapMap = centroid_phis_.size();

geoMapDetId_buf.reserve(nEndCapMap);
Expand All @@ -48,7 +48,7 @@ void SDL::EndcapGeometry::fillGeoMapArraysExplicit() {
}
}

float SDL::EndcapGeometry::getdxdy_slope(unsigned int detid) const {
float lst::EndcapGeometry::getdxdy_slope(unsigned int detid) const {
if (dxdy_slope_.find(detid) != dxdy_slope_.end()) {
return dxdy_slope_.at(detid);
} else {
Expand Down
Loading

0 comments on commit fac2958

Please sign in to comment.