Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODD Strip Module Handling, main branch (2024.05.08.) #581

Merged
merged 4 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ TRACCC_HOST_DEVICE inline void fill_measurement(

// For the ambiguity resolution algorithm, give a unique measurement ID
m.measurement_id = measurement_index;

// Adjust the measurement object for 1D surfaces.
if (module.pixel.dimension == 1) {
m.meas_dim = 1;
m.local[1] = 0.f;
m.variance[1] = module.pixel.variance_y;
}
}
}

Expand Down
12 changes: 7 additions & 5 deletions core/include/traccc/geometry/pixel_data.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -19,10 +19,12 @@ namespace traccc {
/// No checking on out of bounds done
struct pixel_data {

scalar min_center_x = 0.;
scalar min_center_y = 0.;
scalar pitch_x = 1.;
scalar pitch_y = 1.;
scalar min_center_x = 0.f;
scalar min_center_y = 0.f;
scalar pitch_x = 1.f;
scalar pitch_y = 1.f;
char dimension = 2;
scalar variance_y = 0.f;

TRACCC_HOST_DEVICE
vector2 get_pitch() const { return {pitch_x, pitch_y}; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,16 @@ inline void aggregate_cluster(
out.variance = var;
out.surface_link = this_module.surface_link;
out.module_link = module_link;
// The following will need to be filled properly "soon".
out.meas_dim = 2u;
// Set a unique identifier for the measurement.
out.measurement_id = link;
// Adjust the output object for 1D surfaces.
if (this_module.pixel.dimension == 1) {
out.meas_dim = 1;
out.local[1] = 0.f;
out.variance[1] = this_module.pixel.variance_y;
} else {
out.meas_dim = 2;
}
}

} // namespace traccc::device
4 changes: 3 additions & 1 deletion io/include/traccc/io/digitization_config.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2022 CERN for the benefit of the ACTS project
* (c) 2022-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -16,6 +16,8 @@ namespace traccc {
/// Type describing the digitization configuration of a detector module
struct module_digitization_config {
Acts::BinUtility segmentation;
char dimensions = 2;
float variance_y = 0.f;
};

/// Type describing the digitization configuration for the whole detector
Expand Down
12 changes: 9 additions & 3 deletions io/src/csv/read_cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ traccc::cell_module get_module(const std::uint64_t geometry_id,

// Set the value on the module description.
const auto& binning_data = geo_it->segmentation.binningData();
assert(binning_data.size() >= 2);
result.pixel = {binning_data[0].min, binning_data[1].min,
binning_data[0].step, binning_data[1].step};
assert(binning_data.size() > 0);
result.pixel.min_center_x = binning_data[0].min;
result.pixel.pitch_x = binning_data[0].step;
if (binning_data.size() > 1) {
result.pixel.min_center_y = binning_data[1].min;
result.pixel.pitch_y = binning_data[1].step;
}
result.pixel.dimension = geo_it->dimensions;
result.pixel.variance_y = geo_it->variance_y;
}

return result;
Expand Down
27 changes: 25 additions & 2 deletions io/src/read_digitization_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Acts/Plugins/Json/UtilitiesJsonConverter.hpp>

// System include(s).
#include <algorithm>
#include <fstream>
#include <string>

Expand All @@ -31,10 +32,32 @@ void from_json(const nlohmann::json& json, module_digitization_config& cfg) {
// Names/keywords used in the JSON file.
static const char* geometric = "geometric";
static const char* segmentation = "segmentation";
static const char* variances = "variances";

// Read the object, if possible.
// Read the binning information, if possible.
if (json.find(geometric) != json.end()) {
from_json(json[geometric][segmentation], cfg.segmentation);
const auto& json_geom = json[geometric];
if (json_geom.find(segmentation) != json_geom.end()) {
from_json(json_geom[segmentation], cfg.segmentation);
}
if (json_geom.find(variances) != json_geom.end()) {
for (const auto& jdata : json_geom[variances]) {
const int index = jdata["index"];
if (index != 1) {
continue;
}
for (const auto& rms : jdata["rms"]) {
// A large RMS value associated to the second index happens
// to mean that this is a strip detector...
const float frms = rms.get<float>();
if (frms > 1.0f) {
cfg.dimensions = 1;
cfg.variance_y = std::max(frms, cfg.variance_y);
}
}
break;
}
}
}
}

Expand Down
Loading