Skip to content

Commit

Permalink
feat: Add method to return measurement indices (#2028)
Browse files Browse the repository at this point in the history
Add a method to return the measurement indices. This is useful to implement measurement calibration because to do this you basically need to 1) expand measurement parameters 2) calibrate 3) project back to the original subspace and 4) create a new measurement object. But, to create that object, we need to have the same ordering of the indices and it's cumbersome to obtain it without such a method. For instance, this is the best I could do:

```
	    std::array<Acts::BoundIndices, kSize> indices;
	    for (size_t i = 0; i < kSize; i++) {
		Eigen::Index _, c;
		double v = P.row(i).maxCoeff(&_, &c); // P is meas.projector()
		assert(v > 0 && "invalid indices");
		indices[i] = static_cast<Acts::BoundIndices>(c);
	    }
```

However, this probably needs a bit of discussion. For instance, currently the method will cast the subspace indices from uint8_t to the measurement indice type, and when the measurement is created they will just be cast back to uint8_t which seems wastefull. Not sure it's an issue but if we want to avoid this we could return the subspace itself and add a new constructor for Measurement. But that's more intrusive.

Thoughts, @asalzburger @paulgessinger ?
  • Loading branch information
gagnonlg committed Apr 19, 2023
1 parent 00e64ea commit 5868791
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Core/include/Acts/EventData/Measurement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ class Measurement {
/// Check if a specific parameter is part of this measurement.
bool contains(indices_t i) const { return m_subspace.contains(i); }

/// The measurement indices
constexpr std::array<indices_t, kSize> indices() const {
std::array<uint8_t, kSize> subInds = m_subspace.indices();
std::array<indices_t, kSize> inds;
for (size_t i = 0; i < kSize; i++) {
inds[i] = static_cast<indices_t>(subInds[i]);
}
return inds;
}

/// Measured parameters values.
const ParametersVector& parameters() const { return m_params; }

Expand Down

0 comments on commit 5868791

Please sign in to comment.