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

Move Maps to CSV Based Method #374

Merged
merged 7 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
4 changes: 2 additions & 2 deletions SDL/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ namespace SDL {
const unsigned int size_superbins = 45000;

// Temporary fix for endcap buffer allocation.
const unsigned int endcap_size = 9105;
const unsigned int endcap_size = 9104;

// Temporary fix for module buffer allocation.
const unsigned int modules_size = 26401;
const unsigned int pix_tot = 1796504;
const unsigned int pix_tot = 1794686;

//defining the constant host device variables right up here
ALPAKA_STATIC_ACC_MEM_GLOBAL const float miniMulsPtScaleBarrel[6] = {0.0052, 0.0038, 0.0034, 0.0034, 0.0032, 0.0034};
Expand Down
57 changes: 10 additions & 47 deletions SDL/EndcapGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,21 @@ SDL::EndcapGeometry::EndcapGeometry(std::string filename, unsigned int sizef)
SDL::EndcapGeometry::~EndcapGeometry() {}

void SDL::EndcapGeometry::load(std::string filename) {
avgr2s_.clear();
yls_.clear();
sls_.clear();
yus_.clear();
sus_.clear();
centroid_rs_.clear();
centroid_phis_.clear();
centroid_zs_.clear();

std::ifstream ifile;
ifile.open(filename.c_str());
std::string line;
std::ifstream ifile(filename);

std::string line;
while (std::getline(ifile, line)) {
std::istringstream ss(line);
unsigned int detid;
float avgr2;
float yl;
float sl;
float yh;
float sh;
float cr;
float cp;
float cz;

std::stringstream ss(line);

ss >> detid >> avgr2 >> yl >> sl >> yh >> sh >> cr >> cp >> cz;

// std::cout << " detid: " << detid << " avgr2: " << avgr2 << " yl: " << yl << " sl: " << sl << " yh: " << yh << " sh: " << sh << std::endl;

avgr2s_[detid] = avgr2;
yls_[detid] = yl;
sls_[detid] = sl;
yus_[detid] = yh;
sus_[detid] = sh;
centroid_rs_[detid] = cp;
centroid_phis_[detid] = cr;
centroid_zs_[detid] = cz;
float sl, cp;

if (ss >> detid >> sl >> cp) {
sls_[detid] = sl;
centroid_phis_[detid] = cp;
}
}

fillGeoMapArraysExplicit();
Expand Down Expand Up @@ -103,18 +80,4 @@ void SDL::EndcapGeometry::fillGeoMapArraysExplicit() {
alpaka::wait(queue);
}

float SDL::EndcapGeometry::getAverageR2(unsigned int detid) { return avgr2s_[detid]; }

float SDL::EndcapGeometry::getYInterceptLower(unsigned int detid) { return yls_[detid]; }

float SDL::EndcapGeometry::getSlopeLower(unsigned int detid) { return sls_[detid]; }

float SDL::EndcapGeometry::getYInterceptUpper(unsigned int detid) { return yus_[detid]; }

float SDL::EndcapGeometry::getSlopeUpper(unsigned int detid) { return sus_[detid]; }

float SDL::EndcapGeometry::getCentroidR(unsigned int detid) { return centroid_rs_[detid]; }

float SDL::EndcapGeometry::getCentroidPhi(unsigned int detid) { return centroid_phis_[detid]; }

float SDL::EndcapGeometry::getCentroidZ(unsigned int detid) { return centroid_zs_[detid]; }
float SDL::EndcapGeometry::getSlopeLower(unsigned int detid) { return sls_[detid]; }
12 changes: 0 additions & 12 deletions SDL/EndcapGeometry.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef EndcapGeometry_h
#define EndcapGeometry_h

#include <vector>
#include <map>
#include <iostream>
#include <fstream>
Expand All @@ -14,14 +13,8 @@
namespace SDL {
class EndcapGeometry {
private:
std::map<unsigned int, float> avgr2s_;
std::map<unsigned int, float> yls_; // lower hits
std::map<unsigned int, float> sls_; // lower slope
std::map<unsigned int, float> yus_; // upper hits
std::map<unsigned int, float> sus_; // upper slope
std::map<unsigned int, float> centroid_rs_; // centroid r
std::map<unsigned int, float> centroid_phis_; // centroid phi
std::map<unsigned int, float> centroid_zs_; // centroid z

public:
Buf<SDL::Dev, unsigned int> geoMapDetId_buf;
Expand All @@ -40,11 +33,6 @@ namespace SDL {
float getAverageR2(unsigned int detid);
float getYInterceptLower(unsigned int detid);
float getSlopeLower(unsigned int detid);
float getYInterceptUpper(unsigned int detid);
float getSlopeUpper(unsigned int detid);
float getCentroidR(unsigned int detid);
float getCentroidPhi(unsigned int detid);
float getCentroidZ(unsigned int detid);
};
void freeEndcap();
extern EndcapGeometry* endcapGeometry;
Expand Down
3 changes: 2 additions & 1 deletion SDL/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ namespace SDL {
extern SDL::modulesBuffer<Dev> const* modulesBuffersES; // not owned const buffers
extern uint16_t nModules;
extern uint16_t nLowerModules;
void initModules(const char* moduleMetaDataFilePath = "data/centroid.txt"); //read from file and init
void initModules(
const char* moduleMetaDataFilePath = "data/OT800_IT615_pt0.8/sensor_centroids.txt"); //read from file and init
void freeModules();
void initModulesHost(); //read from file and init
extern std::shared_ptr<SDL::pixelMap> pixelMapping;
Expand Down
5 changes: 1 addition & 4 deletions SDL/Hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,7 @@ namespace SDL {

if (modulesInGPU.subdets[lastModuleIndex] == Endcap && modulesInGPU.moduleType[lastModuleIndex] == TwoS) {
found_index = binary_search(geoMapDetId, iDetId, nEndCapMap);
float phi = 0;
// Unclear why these are not in map, but CPU map returns phi = 0 for all exceptions.
if (found_index != -1)
phi = geoMapPhi[found_index];
float phi = geoMapPhi[found_index];
float cos_phi = alpaka::math::cos(acc, phi);
hitsInGPU.highEdgeXs[ihit] = ihit_x + 2.5f * cos_phi;
hitsInGPU.lowEdgeXs[ihit] = ihit_x - 2.5f * cos_phi;
Expand Down
10 changes: 5 additions & 5 deletions SDL/LST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ namespace {
void loadMaps() {
// Module orientation information (DrDz or phi angles)
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::Format("%s/data/OT800_IT615_pt0.8/endcap_orientation.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());
TString::Format("%s/data/OT800_IT615_pt0.8/tilted_barrel_orientation.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())
TString::Format("%s/data/OT800_IT615_pt0.8/module_connection_tracing_merged.txt", trackLooperDir().Data())
.Data());
SDL::moduleConnectionMap.load(mappath.Data());

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

Expand All @@ -54,7 +54,7 @@ void SDL::LST::loadAndFillES(alpaka::QueueCpuBlocking& queue, struct modulesBuff
::loadMaps();

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

Expand Down
10 changes: 5 additions & 5 deletions code/core/trkCore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ void loadMaps()
TString TrackLooperDir = gSystem->Getenv("TRACKLOOPERDIR");

// Module orientation information (DrDz or phi angles)
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());
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());
TString centroid = get_absolute_path_after_check_file_exists(TString::Format("%s/data/centroid_CMSSW_12_2_0_pre2.txt", gSystem->Getenv("TRACKLOOPERDIR")).Data()).Data();
TString pLSMapDir = TrackLooperDir+"/data/pixelmaps_CMSSW_12_2_0_pre2_0p8minPt";
TString endcap_geom = get_absolute_path_after_check_file_exists(TString::Format("%s/data/OT800_IT615_pt0.8/endcap_orientation.txt", TrackLooperDir.Data()).Data());
TString tilted_geom = get_absolute_path_after_check_file_exists(TString::Format("%s/data/OT800_IT615_pt0.8/tilted_barrel_orientation.txt", TrackLooperDir.Data()).Data());
TString mappath = get_absolute_path_after_check_file_exists(TString::Format("%s/data/OT800_IT615_pt0.8/module_connection_tracing_merged.txt", TrackLooperDir.Data()).Data());
TString centroid = get_absolute_path_after_check_file_exists(TString::Format("%s/data/OT800_IT615_pt0.8/sensor_centroids.txt", gSystem->Getenv("TRACKLOOPERDIR")).Data()).Data();
TString pLSMapDir = TrackLooperDir+"/data/OT800_IT615_pt0.8/pixelmap";

std::cout << "============ CMSSW_12_2_0_pre2 geometry ===========" << std::endl;
std::cout << "endcap geometry: " << endcap_geom << std::endl;
Expand Down
Loading