Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #395 from SegmentLinking/LSTCore_compatibility
Browse files Browse the repository at this point in the history
Make code compatible with LSTCore structure
  • Loading branch information
slava77 authored May 2, 2024
2 parents 1931181 + 0dac245 commit fb75df2
Show file tree
Hide file tree
Showing 19 changed files with 132 additions and 15 deletions.
4 changes: 4 additions & 0 deletions SDL/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <vector>
#include <stdexcept>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

#include "HeterogeneousCore/AlpakaInterface/interface/host.h"

Expand Down
14 changes: 9 additions & 5 deletions SDL/Event.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#ifndef Event_cuh
#define Event_cuh

#include "Hit.h"
#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 "ModuleMethods.h"
#include "Segment.h"
#include "Triplet.h"
Expand All @@ -11,7 +18,6 @@
#include "MiniDoublet.h"
#include "PixelTriplet.h"
#include "TrackCandidate.h"
#include "Constants.h"

#include "HeterogeneousCore/AlpakaInterface/interface/host.h"

Expand Down Expand Up @@ -179,9 +185,7 @@ namespace SDL {
modulesBuffer<alpaka::DevCpu>* getModules(bool isFull = false);

//read from file and init
static void initModules(QueueAcc& queue,
const MapPLStoLayer& pLStoLayer,
const char* moduleMetaDataFilePath);
static void initModules(QueueAcc& queue, const MapPLStoLayer& pLStoLayer, const char* moduleMetaDataFilePath);
};

} // namespace SDL
Expand Down
6 changes: 6 additions & 0 deletions SDL/Globals.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#ifndef Globals_h
#define Globals_h

#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"
#include "ModuleConnectionMap.h"
Expand Down
5 changes: 5 additions & 0 deletions SDL/Hit.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#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 {
Expand Down
8 changes: 7 additions & 1 deletion SDL/Kernels.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#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"
#include "Segment.h"
#include "Triplet.h"
#include "Quintuplet.h"
#include "PixelTriplet.h"
#include "Constants.h"

namespace SDL {
ALPAKA_FN_ACC ALPAKA_FN_INLINE void rmQuintupletFromMemory(struct SDL::quintuplets& quintupletsInGPU,
Expand Down
19 changes: 18 additions & 1 deletion SDL/LST.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
#else
#include "LST.h"
#endif

#include "Event.h"
#include "Globals.h"

#include "Math/Vector3D.h"
using XYZVector = ROOT::Math::XYZVector;

namespace {
std::string trackLooperDir() { return getenv("LST_BASE"); }
std::string trackLooperDir() {
const char* path = std::getenv("LST_BASE");
std::string path_str;
if (path != nullptr) {
path_str = path;
} else {
// FIXME: temporary solution, will need to pass a value from FileInPath or CMSSW search path
// in the `LSTProducer` or a related ES producer
path_str = std::getenv("CMSSW_BASE");
path_str += "/src/RecoTracker/LSTCore/TrackLooper";
}
return path_str;
}

std::string get_absolute_path_after_check_file_exists(const std::string name) {
std::filesystem::path fullpath = std::filesystem::absolute(name.c_str());
Expand Down
4 changes: 4 additions & 0 deletions SDL/LST.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef LST_H
#define LST_H

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

#include <filesystem>
#include <cstdlib>
Expand Down
8 changes: 7 additions & 1 deletion SDL/MiniDoublet.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#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 "EndcapGeometry.h"
#include "Module.h"
#endif

#include "EndcapGeometry.h"
#include "Hit.h"

namespace SDL {
Expand Down
5 changes: 5 additions & 0 deletions SDL/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define Module_cuh

#include <alpaka/alpaka.hpp>

#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 };
Expand Down
4 changes: 4 additions & 0 deletions SDL/ModuleConnectionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
#include <sstream>
#include <algorithm>

#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
Expand Down
6 changes: 6 additions & 0 deletions SDL/ModuleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
#include <map>
#include <iostream>

#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"
#include "ModuleConnectionMap.h"
Expand Down
8 changes: 7 additions & 1 deletion SDL/NeuralNetwork.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#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"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"

Expand Down
4 changes: 4 additions & 0 deletions SDL/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#include <vector>
#include <cstdint>

#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.
Expand Down
16 changes: 14 additions & 2 deletions SDL/PixelTriplet.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#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"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Quintuplet.h"

Expand Down Expand Up @@ -1878,10 +1884,16 @@ 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"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"
#include "Quintuplet.h"
Expand Down
8 changes: 7 additions & 1 deletion SDL/Quintuplet.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#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"
#include "Segment.h"
#include "MiniDoublet.h"
#include "Module.h"
#include "Hit.h"
#include "Triplet.h"

Expand Down
8 changes: 7 additions & 1 deletion SDL/Segment.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#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"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down
4 changes: 4 additions & 0 deletions SDL/TiltedGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
#include <string>
#include <stdexcept>

#ifdef LST_IS_CMSSW_PACKAGE
#include "RecoTracker/LSTCore/interface/alpaka/Constants.h"
#else
#include "Constants.h"
#endif

namespace SDL {
template <typename>
Expand Down
8 changes: 7 additions & 1 deletion SDL/TrackCandidate.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#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"
#include "MiniDoublet.h"
#include "PixelTriplet.h"
#include "Quintuplet.h"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down
8 changes: 7 additions & 1 deletion SDL/Triplet.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#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"
#include "Module.h"
#include "Hit.h"

namespace SDL {
Expand Down

0 comments on commit fb75df2

Please sign in to comment.