Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-28 07:12:25

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/Digitization/DigitizationError.hpp"
0010 
0011 #include <string>
0012 
0013 namespace {
0014 
0015 /// Custom error category for digitization errors.
0016 class DigitizationErrorCategory : public std::error_category {
0017  public:
0018   /// Return a short descriptive name for the category.
0019   const char* name() const noexcept final { return "DigitizationError"; }
0020 
0021   /// Return what each enum means in text.
0022   std::string message(int c) const final {
0023     using ActsFatras::DigitizationError;
0024 
0025     switch (static_cast<DigitizationError>(c)) {
0026       case DigitizationError::SmearingOutOfRange:
0027         return "Smeared out of surface bounds.";
0028       case DigitizationError::SmearingError:
0029         return "Smearing error occurred.";
0030       case DigitizationError::UndefinedSurface:
0031         return "Surface undefined for this operation.";
0032       case DigitizationError::MaskingError:
0033         return "Surface mask could not be applied.";
0034       case DigitizationError::DriftError:
0035         return "Drift error occurred.";
0036       case DigitizationError::MaximumRetriesExceeded:
0037         return "Maximum number of retries exceeded.";
0038       default:
0039         return "unknown";
0040     }
0041   }
0042 };
0043 
0044 }  // namespace
0045 
0046 std::error_code ActsFatras::make_error_code(ActsFatras::DigitizationError e) {
0047   static DigitizationErrorCategory c;
0048   return {static_cast<int>(e), c};
0049 }