Skip to content

Commit

Permalink
Namespace renaming SDL->lst and inclusion of the T5DNN->t5dnn namespa…
Browse files Browse the repository at this point in the history
…ce under it
  • Loading branch information
VourMa committed Jul 21, 2024
1 parent ff12237 commit 5d0ef1e
Show file tree
Hide file tree
Showing 42 changed files with 1,670 additions and 1,656 deletions.
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);
4 changes: 2 additions & 2 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 @@ -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
16 changes: 8 additions & 8 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 Down Expand Up @@ -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
4 changes: 2 additions & 2 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 @@ -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
4 changes: 2 additions & 2 deletions RecoTracker/LSTCore/interface/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

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

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
20 changes: 10 additions & 10 deletions RecoTracker/LSTCore/src/LSTESData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ namespace {
return fullpath.string();
}

void loadMapsHost(SDL::MapPLStoLayer& pLStoLayer,
std::shared_ptr<SDL::EndcapGeometry> endcapGeometry,
std::shared_ptr<SDL::TiltedGeometry> tiltedGeometry,
std::shared_ptr<SDL::ModuleConnectionMap> moduleConnectionMap) {
void loadMapsHost(lst::MapPLStoLayer& pLStoLayer,
std::shared_ptr<lst::EndcapGeometry> endcapGeometry,
std::shared_ptr<lst::TiltedGeometry> tiltedGeometry,
std::shared_ptr<lst::ModuleConnectionMap> moduleConnectionMap) {
// Module orientation information (DrDz or phi angles)
auto endcap_geom =
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin");
Expand All @@ -66,22 +66,22 @@ namespace {
auto connectData = connects[i].data();

path = pLSMapDir + connectData + ".bin";
pLStoLayer[0][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));
pLStoLayer[0][i] = lst::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));

path = pLSMapDir + "_pos" + connectData + ".bin";
pLStoLayer[1][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));
pLStoLayer[1][i] = lst::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));

path = pLSMapDir + "_neg" + connectData + ".bin";
pLStoLayer[2][i] = SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));
pLStoLayer[2][i] = lst::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path));
}
}
} // namespace

std::unique_ptr<SDL::LSTESData<alpaka_common::DevHost>> SDL::loadAndFillESHost() {
std::unique_ptr<lst::LSTESData<alpaka_common::DevHost>> lst::loadAndFillESHost() {
uint16_t nModules;
uint16_t nLowerModules;
unsigned int nPixels;
std::shared_ptr<SDL::ModulesBuffer<alpaka_common::DevHost>> modulesBuffers = nullptr;
std::shared_ptr<lst::ModulesBuffer<alpaka_common::DevHost>> modulesBuffers = nullptr;
auto pLStoLayer = std::make_shared<MapPLStoLayer>();
auto endcapGeometry = std::make_shared<EndcapGeometry>();
auto tiltedGeometry = std::make_shared<TiltedGeometry>();
Expand All @@ -99,7 +99,7 @@ std::unique_ptr<SDL::LSTESData<alpaka_common::DevHost>> SDL::loadAndFillESHost()

auto path =
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin");
SDL::loadModulesFromFile(pLStoLayer.get(),
lst::loadModulesFromFile(pLStoLayer.get(),
path.c_str(),
nModules,
nLowerModules,
Expand Down
Loading

0 comments on commit 5d0ef1e

Please sign in to comment.