-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Dense
MeasurementContainer
for Examples
- Loading branch information
Showing
16 changed files
with
482 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 22 additions & 24 deletions
46
Examples/Algorithms/Digitization/src/MeasurementCreation.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// Copyright (C) 2021-2024 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include "ActsExamples/Digitization/MeasurementCreation.hpp" | ||
|
||
#include "Acts/EventData/MeasurementHelpers.hpp" | ||
#include "Acts/EventData/SourceLink.hpp" | ||
#include "ActsExamples/EventData/IndexSourceLink.hpp" | ||
#include "ActsExamples/EventData/Measurement.hpp" | ||
|
||
#include <stdexcept> | ||
#include <string> | ||
#include <utility> | ||
|
||
ActsExamples::Measurement ActsExamples::createMeasurement( | ||
const DigitizedParameters& dParams, const IndexSourceLink& isl) { | ||
ActsExamples::VariableBoundMeasurementProxy ActsExamples::createMeasurement( | ||
MeasurementContainer& container, const DigitizedParameters& dParams, | ||
const IndexSourceLink& isl) { | ||
Acts::SourceLink sl{isl}; | ||
switch (dParams.indices.size()) { | ||
case 1u: { | ||
auto [indices, par, cov] = measurementConstituents<1>(dParams); | ||
return ActsExamples::Measurement(std::move(sl), indices, par, cov); | ||
} | ||
case 2u: { | ||
auto [indices, par, cov] = measurementConstituents<2>(dParams); | ||
return ActsExamples::Measurement(std::move(sl), indices, par, cov); | ||
}; | ||
case 3u: { | ||
auto [indices, par, cov] = measurementConstituents<3>(dParams); | ||
return ActsExamples::Measurement(std::move(sl), indices, par, cov); | ||
}; | ||
case 4u: { | ||
auto [indices, par, cov] = measurementConstituents<4>(dParams); | ||
return ActsExamples::Measurement(std::move(sl), indices, par, cov); | ||
}; | ||
default: | ||
std::string errorMsg = "Invalid/mismatching measurement dimension: " + | ||
std::to_string(dParams.indices.size()); | ||
throw std::runtime_error(errorMsg.c_str()); | ||
|
||
if (dParams.indices.size() > 4u) { | ||
std::string errorMsg = "Invalid/mismatching measurement dimension: " + | ||
std::to_string(dParams.indices.size()); | ||
throw std::runtime_error(errorMsg.c_str()); | ||
} | ||
|
||
return Acts::visit_measurement( | ||
dParams.indices.size(), [&](auto dim) -> VariableBoundMeasurementProxy { | ||
auto [indices, par, cov] = measurementConstituents<dim>(dParams); | ||
FixedBoundMeasurementProxy<dim> measurement = | ||
container.makeMeasurement<dim>(); | ||
measurement.setSubspaceIndices(indices); | ||
measurement.parameters() = par; | ||
measurement.covariance() = cov; | ||
return measurement; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.