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

updates to get module maps used as ES products jointly with CMSSW #355

Merged
merged 20 commits into from
Feb 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
810f844
define values derived from Acc only when it's expected to be defined
slava77devel Oct 19, 2023
0efcf09
split heavier methods from Module.h to ModuleMethods.h
slava77devel Oct 19, 2023
f75a8af
make module parseIs methods static
slava77devel Oct 20, 2023
7962508
make loadMaps static (consider moving it out of the LST class to redu…
slava77devel Oct 20, 2023
73667f9
make modules data pointers const
slava77devel Nov 14, 2023
4c574d1
drop emacs temp files
slava77devel Dec 4, 2023
01760bf
check both CMSSW_BASE and CMSSW_RELEASE_BASE if available
slava77devel Dec 4, 2023
ce85856
initialize derived quantities
slava77devel Dec 28, 2023
08743db
move constants away from global namespace to SDL (unless already in a…
slava77devel Dec 28, 2023
bd004dd
sdlLayers before connectedPixels consistently in modules and buffers
slava77devel Dec 29, 2023
d91352b
clang-format
slava77devel Dec 30, 2023
2340fed
clang-tidy
slava77devel Dec 30, 2023
412596f
describe lst_headers variant of the LST external
slava77devel Jan 3, 2024
7b58aa0
use device/TDev template argument trait for Buf instead of accelerato…
slava77devel Jan 3, 2024
ac98d78
clang-format and clang-tidy
slava77devel Jan 3, 2024
817c1c5
clang-fix
slava77devel Jan 25, 2024
0aa37d2
refactor LST ES-related calls to be usable by CMSSW directly
slava77devel Jan 25, 2024
5487bf0
cleanup unused var
slava77devel Jan 31, 2024
87ad3de
clang compile fix
slava77devel Feb 1, 2024
eca2c59
move data buffer templates from Acc to Dev to be more in line with al…
slava77devel Feb 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor LST ES-related calls to be usable by CMSSW directly
slava77devel committed Jan 31, 2024
commit 0aa37d2be2c6fe0d34a3e1076358b472e6d18ed6
101 changes: 51 additions & 50 deletions SDL/LST.cc
Original file line number Diff line number Diff line change
@@ -2,60 +2,61 @@

namespace {
TString trackLooperDir() { return getenv("LST_BASE"); }
} // namespace

void SDL::LST::eventSetup() {
static std::once_flag mapsLoaded;
std::call_once(mapsLoaded, &SDL::LST::loadMaps);
TString path = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/centroid_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
static std::once_flag modulesInited;
std::call_once(modulesInited, SDL::initModules, path);
}

void SDL::LST::loadMaps() {
// Module orientation information (DrDz or phi angles)
auto const& tldir = trackLooperDir();
TString endcap_geom = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/endcap_orientation_data_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
TString tilted_geom = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/tilted_orientation_data_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
SDL::endcapGeometry->load(endcap_geom.Data()); // centroid values added to the map
SDL::tiltedGeometry.load(tilted_geom.Data());

// Module connection map (for line segment building)
TString mappath = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/module_connection_tracing_CMSSW_12_2_0_pre2_merged.txt", trackLooperDir().Data()).Data());
SDL::moduleConnectionMap.load(mappath.Data());

TString pLSMapDir = trackLooperDir() + "/data/pixelmaps_CMSSW_12_2_0_pre2_0p8minPt/pLS_map";
std::string connects[] = {"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"};
TString path;

for (std::string& connect : connects) {
auto connectData = connect.data();

path = TString::Format("%s%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer.emplace_back(
ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));

path = TString::Format("%s_pos%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer_pos.emplace_back(
ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));

path = TString::Format("%s_neg%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer_neg.emplace_back(
ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));
TString get_absolute_path_after_check_file_exists(const std::string name) {
std::filesystem::path fullpath = std::filesystem::absolute(name.c_str());
if (not std::filesystem::exists(fullpath)) {
std::cout << "ERROR: Could not find the file = " << fullpath << std::endl;
exit(2);
}
return TString(fullpath.string().c_str());
}
}

TString SDL::LST::get_absolute_path_after_check_file_exists(const std::string name) {
std::filesystem::path fullpath = std::filesystem::absolute(name.c_str());
if (not std::filesystem::exists(fullpath)) {
std::cout << "ERROR: Could not find the file = " << fullpath << std::endl;
exit(2);
void loadMaps() {
// Module orientation information (DrDz or phi angles)
auto const& tldir = trackLooperDir();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of defining this, if trackLooperDir() is used almost everywhere in the following? Was it meant to be a short version but then it was forgotten?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed now

TString endcap_geom = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/endcap_orientation_data_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
TString tilted_geom = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/tilted_orientation_data_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
SDL::endcapGeometry->load(endcap_geom.Data()); // centroid values added to the map
SDL::tiltedGeometry.load(tilted_geom.Data());

// Module connection map (for line segment building)
TString mappath = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/module_connection_tracing_CMSSW_12_2_0_pre2_merged.txt", trackLooperDir().Data())
.Data());
SDL::moduleConnectionMap.load(mappath.Data());

TString pLSMapDir = trackLooperDir() + "/data/pixelmaps_CMSSW_12_2_0_pre2_0p8minPt/pLS_map";
std::string connects[] = {"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"};
TString path;

for (std::string& connect : connects) {
auto connectData = connect.data();

path = TString::Format("%s%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer.emplace_back(
SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));

path = TString::Format("%s_pos%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer_pos.emplace_back(
SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));

path = TString::Format("%s_neg%s.txt", pLSMapDir.Data(), connectData).Data();
SDL::moduleConnectionMap_pLStoLayer_neg.emplace_back(
SDL::ModuleConnectionMap(get_absolute_path_after_check_file_exists(path.Data()).Data()));
}
}
return TString(fullpath.string().c_str());

} // namespace

void SDL::LST::loadAndFillES(alpaka::QueueCpuBlocking& queue, struct modulesBuffer<alpaka::DevCpu>* modules) {
::loadMaps();

TString path = get_absolute_path_after_check_file_exists(
TString::Format("%s/data/centroid_CMSSW_12_2_0_pre2.txt", trackLooperDir().Data()).Data());
SDL::loadModulesFromFile(modules, SDL::nModules, SDL::nLowerModules, *SDL::pixelMapping, queue, path.Data());
}

void SDL::LST::prepareInput(const std::vector<float> see_px,
5 changes: 2 additions & 3 deletions SDL/LST.h
Original file line number Diff line number Diff line change
@@ -19,7 +19,8 @@ namespace SDL {
public:
LST() = default;

void eventSetup();
static void loadAndFillES(alpaka::QueueCpuBlocking& queue, struct modulesBuffer<alpaka::DevCpu>* modules);

template <typename TQueue>
void run(TQueue& queue,
bool verbose,
@@ -174,10 +175,8 @@ namespace SDL {
std::vector<unsigned int> len() { return out_tc_len_; }
std::vector<int> seedIdx() { return out_tc_seedIdx_; }
std::vector<short> trackCandidateType() { return out_tc_trackCandidateType_; }
static void loadMaps();

private:
static TString get_absolute_path_after_check_file_exists(const std::string name);
void prepareInput(const std::vector<float> see_px,
const std::vector<float> see_py,
const std::vector<float> see_pz,