Commit c2a08ae6 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

move serialization of GPD types into vector and vice versa from DVCSObs

to Obs
parent 8156871b
......@@ -11,7 +11,6 @@
#include <ElementaryUtils/parameters/Parameters.h>
#include <map>
#include <string>
#include <vector>
#include "../../../beans/automation/BaseObjectData.h"
#include "../../../beans/gpd/GPDType.h"
......@@ -88,16 +87,6 @@ protected:
const DVCSObservableKinematic& kinematic,
const List<GPDType>& gpdType) = 0;
/**
* List of GPD types to std::vector<double>.
*/
std::vector<double> gpdTypesToVector(const List<GPDType>& list) const;
/**
* std::vector<double> to list of GPD types.
*/
List<GPDType> gpdTypesFromVector(const std::vector<double>& vec) const;
double m_xB; ///< Bjorken variable.
double m_t; ///< Mandelstam variable (square of the 4-momentum transferm in GeV2).
double m_Q2; ///< Virtuality of the incoming photon (in GeV2).
......
......@@ -10,8 +10,10 @@
#include <ElementaryUtils/logger/CustomException.h>
#include <ElementaryUtils/parameters/Parameters.h>
#include <stddef.h>
#include <map>
#include <string>
#include <vector>
#include "../../beans/automation/BaseObjectData.h"
#include "../../beans/channel/ChannelType.h"
......@@ -115,6 +117,35 @@ protected:
*/
virtual PhysicalType<double> computeObservable(
const KinematicType& kinematic, const List<GPDType>& gpdType) = 0;
/**
* List of GPD types to std::vector<double>.
*/
std::vector<double> gpdTypesToVector(const List<GPDType>& list) const {
std::vector<double> result;
for (size_t i = 0; i < list.size(); i++) {
result.push_back(static_cast<double>(list[i].getType()));
}
return result;
}
/**
* std::vector<double> to list of GPD types.
*/
List<GPDType> gpdTypesFromVector(const std::vector<double>& vec) const {
List<GPDType> result;
for (size_t i = 0; i < vec.size(); i++) {
result.add(GPDType(static_cast<GPDType::Type>(vec[i])));
}
return result;
}
};
} /* namespace PARTONS */
......
......@@ -245,28 +245,4 @@ void DVCSObservable::setProcessModule(DVCSProcessModule* pProcessModule) {
}
}
std::vector<double> DVCSObservable::gpdTypesToVector(
const List<GPDType>& list) const {
std::vector<double> result;
for (size_t i = 0; i < list.size(); i++) {
result.push_back(static_cast<double>(list[i].getType()));
}
return result;
}
List<GPDType> DVCSObservable::gpdTypesFromVector(
const std::vector<double>& vec) const {
List<GPDType> result;
for (size_t i = 0; i < vec.size(); i++) {
result.add(GPDType(static_cast<GPDType::Type>(vec[i])));
}
return result;
}
} /* namespace PARTONS */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment