File indexing completed on 2026-06-02 08:51:44
0001 #ifndef DVCS_CFF_NN_H
0002 #define DVCS_CFF_NN_H
0003
0004 #include <ElementaryUtils/parameters/Parameters.h>
0005 #include <NumA/neural_network/neural_network/NeuralNetwork.h>
0006 #include <stddef.h>
0007 #include <complex>
0008 #include <map>
0009 #include <string>
0010 #include <utility>
0011 #include <vector>
0012
0013 #include "../../../beans/automation/BaseObjectData.h"
0014 #include "../../../beans/gpd/GPDType.h"
0015 #include "DVCSConvolCoeffFunctionModule.h"
0016
0017 namespace PARTONS {
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class DVCSCFFNN: public DVCSConvolCoeffFunctionModule {
0034
0035 public:
0036
0037 static const std::string PARAMETER_NAME_REPLICA;
0038
0039 static const unsigned int classId;
0040
0041
0042
0043
0044
0045
0046 DVCSCFFNN(const std::string &className);
0047
0048
0049
0050
0051 virtual ~DVCSCFFNN();
0052
0053 virtual DVCSCFFNN* clone() const;
0054
0055 virtual void configure(const ElemUtils::Parameters ¶meters);
0056 virtual void resolveObjectDependencies();
0057
0058 virtual void prepareSubModules(
0059 const std::map<std::string, PARTONS::BaseObjectData>& subModulesData);
0060
0061 virtual std::complex<double> computeCFF();
0062
0063
0064
0065
0066 void loadParameters(size_t replica, bool printInfo = true);
0067
0068
0069
0070
0071 void setParameters(const std::vector<double>& params);
0072
0073
0074
0075
0076 const std::map<PARTONS::GPDType::Type,
0077 std::pair<NumA::NeuralNetwork*, NumA::NeuralNetwork*> >& getNeuralNetworks() const;
0078
0079
0080
0081
0082 void getMeanAndUncertainty(const std::vector<double>& v, double& mean,
0083 double& unc) const;
0084
0085 protected:
0086
0087
0088
0089
0090
0091 DVCSCFFNN(const DVCSCFFNN &other);
0092
0093 virtual void initModule();
0094 virtual void isModuleWellConfigured();
0095
0096 private:
0097
0098
0099
0100
0101 void buildNeuralNetworks();
0102
0103
0104
0105
0106 NumA::NeuralNetwork* buildAndConfigureSingleNeuralNetwork(
0107 PARTONS::GPDType::Type gpdType, bool isReal);
0108
0109
0110
0111
0112 double getMean(const std::vector<double>& v) const;
0113
0114
0115
0116
0117 double getSigma(const std::vector<double>& v) const;
0118
0119
0120
0121
0122 size_t removeOutliers(std::vector<double>& v) const;
0123
0124 std::map<PARTONS::GPDType::Type,
0125 std::pair<NumA::NeuralNetwork*, NumA::NeuralNetwork*> > m_neuralNetworks;
0126
0127 std::pair<double, double> m_rangeLog10Xi;
0128 std::pair<double, double> m_rangeT;
0129 std::pair<double, double> m_rangeLog10Q2;
0130 std::map<PARTONS::GPDType::Type, std::pair<double, double> > m_rangeXiReCFF;
0131 std::map<PARTONS::GPDType::Type, std::pair<double, double> > m_rangeXiImCFF;
0132
0133 size_t m_replica;
0134 };
0135
0136 }
0137
0138 #endif