Skip to content

Commit

Permalink
Merge pull request #699 from beomki-yeo/fix-cell-io-type
Browse files Browse the repository at this point in the history
Replace hit_id column of cell with measurement_id
  • Loading branch information
stephenswat authored Sep 17, 2024
2 parents 9171ece + cd44ad9 commit 884457a
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion data/traccc_data_get_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ usage() {
}

# Default script arguments.
TRACCC_DATA_NAME=${TRACCC_DATA_NAME:-"traccc-data-v7"}
TRACCC_DATA_NAME=${TRACCC_DATA_NAME:-"traccc-data-v8"}
TRACCC_WEB_DIRECTORY=${TRACCC_WEB_DIRECTORY:-"https://acts.web.cern.ch/traccc/data"}
TRACCC_DATA_DIRECTORY=${TRACCC_DATA_DIRECTORY:-$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)}
TRACCC_CMAKE_EXECUTABLE=${TRACCC_CMAKE_EXECUTABLE:-cmake}
Expand Down
2 changes: 1 addition & 1 deletion data/traccc_data_package_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ usage() {
}

# Default script arguments.
TRACCC_DATA_NAME=${TRACCC_DATA_NAME:-"traccc-data-v8"}
TRACCC_DATA_NAME=${TRACCC_DATA_NAME:-"traccc-data-v9"}
TRACCC_DATA_DIRECTORY_NAMES=("cca_test" "detray_simulation" "geometries" "odd"
"single_module" "tml_detector" "tml_full" "tml_pixel_barrel" "tml_pixels"
"two_modules")
Expand Down
4 changes: 2 additions & 2 deletions extras/ccl_generator/ccl_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def generate_file(name, Md, Hd, size, N):
f,
fieldnames=[
"geometry_id",
"hit_id",
"measurement_id",
"channel0",
"channel1",
"timestamp",
Expand Down Expand Up @@ -73,7 +73,7 @@ def generate_file(name, Md, Hd, size, N):
w.writerow(
{
"geometry_id": m,
"hit_id": h,
"measurement_id": h,
"channel0": p[0],
"channel1": p[1],
"timestamp": 0,
Expand Down
8 changes: 4 additions & 4 deletions io/include/traccc/io/csv/cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ namespace traccc::io::csv {
struct cell {

uint64_t geometry_id = 0;
uint64_t hit_id = 0;
uint64_t measurement_id = 0;
uint32_t channel0 = 0;
uint32_t channel1 = 0;
float timestamp = 0.;
float value = 0.;

// geometry_id,hit_id,channel0,channel1,timestamp,value
DFE_NAMEDTUPLE(cell, geometry_id, hit_id, channel0, channel1, timestamp,
value);
// geometry_id,measurement_id,channel0,channel1,timestamp,value
DFE_NAMEDTUPLE(cell, geometry_id, measurement_id, channel0, channel1,
timestamp, value);
};

} // namespace traccc::io::csv
6 changes: 3 additions & 3 deletions io/src/csv/make_cell_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace traccc::io::csv {

dfe::NamedTupleCsvReader<cell> make_cell_reader(std::string_view filename) {

return {
filename.data(),
{"geometry_id", "hit_id", "cannel0", "channel1", "timestamp", "value"}};
return {filename.data(),
{"geometry_id", "measurement_id", "cannel0", "channel1",
"timestamp", "value"}};
}

} // namespace traccc::io::csv
2 changes: 1 addition & 1 deletion io/src/mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ hit_cell_map generate_hit_cell_map(std::size_t event,
if (it != link_map.end()) {
link = (*it).second;
}
result[hmap[iocell.hit_id]].push_back(
result[hmap[iocell.measurement_id]].push_back(
cell{iocell.channel0, iocell.channel1, iocell.value,
iocell.timestamp, link});
}
Expand Down
6 changes: 3 additions & 3 deletions tests/common/tests/cca_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ class ConnectedComponentAnalysisTests
public:
struct cca_truth_hit {
uint64_t geometry_id = 0;
uint64_t hit_id = 0;
uint64_t measurement_id = 0;
uint64_t num_cells = 0;
traccc::scalar channel0 = 0;
traccc::scalar channel1 = 0;
traccc::scalar variance0 = 0.;
traccc::scalar variance1 = 0.;

DFE_NAMEDTUPLE(cca_truth_hit, geometry_id, hit_id, num_cells, channel0,
channel1, variance0, variance1);
DFE_NAMEDTUPLE(cca_truth_hit, geometry_id, measurement_id, num_cells,
channel0, channel1, variance0, variance1);
};

using cca_truth_hit_reader = dfe::NamedTupleCsvReader<cca_truth_hit>;
Expand Down
22 changes: 11 additions & 11 deletions tests/io/mock_data/event000000000-cells.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
geometry_id,hit_id,channel0,channel1,timestamp,value
576460889742407168,0,1,0,0,0.0041470062
576460889742407168,0,0,1,0,0.00306466641
576460889742407168,0,1,1,0,0.00868905429
576460889742407168,1,1,1,0,0.00886478275
576460889742407168,1,1,2,0,0.00580428448
576460889742407168,1,2,1,0,0.0016894876
576460889742407168,1,2,2,0,0.00199076766
576460889742407168,2,5,5,0,0.00632160669
576460889742407168,2,5,6,0,0.00911649223
576460889742407168,2,5,7,0,0.00518329488
geometry_id,measurement_id,channel0,channel1,timestamp,value
1224979236083738112,0,1,0,0,0.0041470062
1224979236083738112,0,0,1,0,0.00306466641
1224979236083738112,0,1,1,0,0.00868905429
1224979236083738112,1,1,1,0,0.00886478275
1224979236083738112,1,1,2,0,0.00580428448
1224979236083738112,1,2,1,0,0.0016894876
1224979236083738112,1,2,2,0,0.00199076766
1224979236083738112,2,5,5,0,0.00632160669
1224979236083738112,2,5,6,0,0.00911649223
1224979236083738112,2,5,7,0,0.00518329488
6 changes: 3 additions & 3 deletions tests/io/mock_data/event000000000-hits.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
particle_id,geometry_id,tx,ty,tz,tt,tpx,tpy,tpz,te,deltapx,deltapy,deltapz,deltae,index
4503599644147712,576460889742407168,39.2037048,0.352969825,-1502.5,11.427907,0.584509015,-0.00557432789,-21.142601,21.1511402,-2.12927662e-05,0.000648729096,9.68955137e-05,-9.76058363e-05,3
4503599660924928,576460889742407168,31.5048428,5.16000509,-1502.5,2.78843093,0.435487628,0.0612908453,-21.5235882,21.528532,-6.28146518e-05,2.1960961e-05,8.08380282e-05,-8.20274799e-05,1
4503599744811008,576460889742407168,90.4015808,0.7420941,-1502.5,2.79669714,0.478592962,-0.0223038904,-8.27326393,8.28830051,0.000280289998,0.000398003991,8.34398961e-05,-6.81602833e-05,13
4503599644147712,1224979236083738112,39.2037048,0.352969825,-1502.5,11.427907,0.584509015,-0.00557432789,-21.142601,21.1511402,-2.12927662e-05,0.000648729096,9.68955137e-05,-9.76058363e-05,3
4503599660924928,1224979236083738112,31.5048428,5.16000509,-1502.5,2.78843093,0.435487628,0.0612908453,-21.5235882,21.528532,-6.28146518e-05,2.1960961e-05,8.08380282e-05,-8.20274799e-05,1
4503599744811008,1224979236083738112,90.4015808,0.7420941,-1502.5,2.79669714,0.478592962,-0.0223038904,-8.27326393,8.28830051,0.000280289998,0.000398003991,8.34398961e-05,-6.81602833e-05,13
6 changes: 3 additions & 3 deletions tests/io/mock_data/event000000000-measurements.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
measurement_id,geometry_id,local_key,local0,local1,phi,theta,time,var_local0,var_local1,var_phi,var_theta,var_time
0,576460889742407168,,4.2657785415649414,11.742777824401855,-2.8126237392425537,2.1995303630828857,0,0.0025000001769512892,0.0025000001769512892,0,0,0
1,576460889742407168,,2.4493119716644287,-17.223770141601562,-2.8123311996459961,2.1995320320129395,0,0.0025000001769512892,0.0025000001769512892,0,0,0
2,576460889742407168,,3.1442358493804932,21.099834442138672,-2.8119988441467285,2.1995346546173096,0,0.0025000001769512892,0.0025000001769512892,0,0,0
0,1224979236083738112,,4.2657785415649414,11.742777824401855,-2.8126237392425537,2.1995303630828857,0,0.0025000001769512892,0.0025000001769512892,0,0,0
1,1224979236083738112,,2.4493119716644287,-17.223770141601562,-2.8123311996459961,2.1995320320129395,0,0.0025000001769512892,0.0025000001769512892,0,0,0
2,1224979236083738112,,3.1442358493804932,21.099834442138672,-2.8119988441467285,2.1995346546173096,0,0.0025000001769512892,0.0025000001769512892,0,0,0
2 changes: 1 addition & 1 deletion tests/io/test_mapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ TEST(mappper, measurement_cell_map) {
traccc::generate_measurement_cell_map(event, cells_dir, dd, resource);

// The module that the cells of event 0 belong to, happens to be this one.
constexpr traccc::cell::link_type module_link = 873;
constexpr traccc::cell::link_type module_link = 12465;

vecmem::vector<traccc::cell> cells0;
cells0.push_back({1, 0, 0.0041470062f, 0, module_link});
Expand Down

0 comments on commit 884457a

Please sign in to comment.