Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:15:06

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       default:
0035         return "unknown";
0036     }
0037   }
0038 };
0039 
0040 }  // namespace
0041 
0042 std::error_code ActsFatras::make_error_code(ActsFatras::DigitizationError e) {
0043   static DigitizationErrorCategory c;
0044   return {static_cast<int>(e), c};
0045 }