File indexing completed on 2026-06-02 08:51:43
0001 #ifndef OBSERVABLE_RESULT_H
0002 #define OBSERVABLE_RESULT_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <ElementaryUtils/logger/CustomException.h>
0012 #include <ElementaryUtils/string_utils/Formatter.h>
0013 #include <ElementaryUtils/string_utils/StringUtils.h>
0014 #include <string>
0015
0016 #include "../../utils/type/PhysicalType.h"
0017 #include "../channel/ChannelType.h"
0018 #include "../Result.h"
0019
0020 namespace PARTONS {
0021
0022
0023
0024
0025
0026
0027
0028
0029 template<typename KinematicType>
0030 class ObservableResult: public Result<KinematicType> {
0031
0032 public:
0033
0034
0035
0036
0037 virtual ~ObservableResult() {
0038 }
0039
0040 virtual std::string toString() const {
0041
0042 ElemUtils::Formatter formatter;
0043
0044 formatter << "\n" << Result<KinematicType>::toString() << "\n\n";
0045 formatter << "Result: " << m_value.toString();
0046 formatter << '\n';
0047
0048 return formatter.str();
0049 }
0050
0051
0052
0053
0054
0055
0056
0057
0058 const PhysicalType<double>& getValue() const {
0059 return m_value;
0060 }
0061
0062
0063
0064
0065 void setValue(const PhysicalType<double>& value) {
0066 m_value = value;
0067 }
0068
0069 protected:
0070
0071
0072
0073
0074 ObservableResult(const std::string &className,
0075 ChannelType::Type channelType) :
0076 Result<KinematicType>(className, channelType) {
0077 }
0078
0079
0080
0081
0082
0083 ObservableResult(const std::string &className,
0084 ChannelType::Type channelType, const PhysicalType<double>& value) :
0085 Result<KinematicType>(className, channelType), m_value(value) {
0086 }
0087
0088
0089
0090
0091
0092 ObservableResult(const std::string &className,
0093 ChannelType::Type channelType, const KinematicType& kinematic) :
0094 Result<KinematicType>(className, channelType, kinematic) {
0095 }
0096
0097
0098
0099
0100
0101
0102 ObservableResult(const std::string &className,
0103 ChannelType::Type channelType, const PhysicalType<double>& value,
0104 const KinematicType& kinematic) :
0105 Result<KinematicType>(className, channelType, kinematic), m_value(
0106 value) {
0107 }
0108
0109
0110
0111
0112
0113 ObservableResult(const ObservableResult& other) :
0114 Result<KinematicType>(other), m_value(other.m_value) {
0115 }
0116
0117
0118
0119
0120 PhysicalType<double> m_value;
0121 };
0122
0123 }
0124
0125 #endif