Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:14

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsFatras/Kernel/detail/SimulationError.hpp"
0010 
0011 #include <string>
0012 
0013 namespace ActsFatras::detail {
0014 namespace {
0015 
0016 // Define a custom error code category derived from std::error_category
0017 class SimulationErrorCategory final : public std::error_category {
0018  public:
0019   const char* name() const noexcept final { return "SimulationError"; }
0020   std::string message(int c) const final {
0021     switch (static_cast<SimulationError>(c)) {
0022       case SimulationError::eInvalidInputParticleId:
0023         return "Input particle id with non-zero generation or sub-particle";
0024       default:
0025         return "unknown";
0026     }
0027   }
0028 };
0029 
0030 const SimulationErrorCategory s_simulatorErrorCategory;
0031 
0032 }  // namespace
0033 
0034 std::error_code make_error_code(SimulationError e) {
0035   return {static_cast<int>(e), s_simulatorErrorCategory};
0036 }
0037 
0038 }  // namespace ActsFatras::detail