Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:44

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2021 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsExamples/Digitization/MeasurementCreation.hpp"
0010 
0011 #include "Acts/EventData/Measurement.hpp"
0012 #include "Acts/EventData/SourceLink.hpp"
0013 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0014 
0015 #include <stdexcept>
0016 #include <string>
0017 #include <utility>
0018 
0019 ActsExamples::Measurement ActsExamples::createMeasurement(
0020     const DigitizedParameters& dParams, const IndexSourceLink& isl) {
0021   Acts::SourceLink sl{isl};
0022   switch (dParams.indices.size()) {
0023     case 1u: {
0024       auto [indices, par, cov] = measurementConstituents<1>(dParams);
0025       return Acts::Measurement<Acts::BoundIndices, 1>(std::move(sl), indices,
0026                                                       par, cov);
0027     }
0028     case 2u: {
0029       auto [indices, par, cov] = measurementConstituents<2>(dParams);
0030       return Acts::Measurement<Acts::BoundIndices, 2>(std::move(sl), indices,
0031                                                       par, cov);
0032     };
0033     case 3u: {
0034       auto [indices, par, cov] = measurementConstituents<3>(dParams);
0035       return Acts::Measurement<Acts::BoundIndices, 3>(std::move(sl), indices,
0036                                                       par, cov);
0037     };
0038     case 4u: {
0039       auto [indices, par, cov] = measurementConstituents<4>(dParams);
0040       return Acts::Measurement<Acts::BoundIndices, 4>(std::move(sl), indices,
0041                                                       par, cov);
0042     };
0043     default:
0044       std::string errorMsg = "Invalid/mismatching measurement dimension: " +
0045                              std::to_string(dParams.indices.size());
0046       throw std::runtime_error(errorMsg.c_str());
0047   }
0048 }