Commit 6fb52dc2 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

add DVMP observable layer (first version)

parent b53e0bcf
......@@ -37,6 +37,23 @@ experiment_id INTEGER,
hash_sum VARCHAR(40) NOT NULL);
CREATE INDEX dvcs_observable_kinematic_index ON dvcs_observable_kinematic (hash_sum);
CREATE TABLE dvmp_observable_kinematic (
dvmp_observable_kinematic_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
xB DOUBLE NOT NULL,
xB_unit INTEGER NOT NULL,
t DOUBLE NOT NULL,
t_unit INTEGER NOT NULL,
Q2 DOUBLE NOT NULL,
Q2_unit INTEGER NOT NULL,
E DOUBLE NOT NULL,
E_unit INTEGER NOT NULL,
phi DOUBLE NOT NULL,
phi_unit INTEGER NOT NULL,
meson_type_id INTEGER NOT NULL,
experiment_id INTEGER,
hash_sum VARCHAR(40) NOT NULL);
CREATE INDEX dvmp_observable_kinematic_index ON dvmp_observable_kinematic (hash_sum);
CREATE TABLE tcs_observable_kinematic (
tcs_observable_kinematic_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
t DOUBLE NOT NULL,
......@@ -70,6 +87,21 @@ dvcs_observable_kinematic_id INTEGER NOT NULL,
computation_id INTEGER NOT NULL);
CREATE INDEX dvcs_observable_result_index ON dvcs_observable_result (computation_id);
CREATE TABLE dvmp_observable_result (
dvmp_observable_result_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
observable_name VARCHAR(255) NOT NULL,
value DOUBLE NOT NULL,
stat_error_lb DOUBLE,
stat_error_ub DOUBLE,
syst_error_lb DOUBLE,
syst_error_ub DOUBLE,
scale_error_lb DOUBLE,
scale_error_ub DOUBLE,
value_unit INTEGER NOT NULL,
dvmp_observable_kinematic_id INTEGER NOT NULL,
computation_id INTEGER NOT NULL);
CREATE INDEX dvmp_observable_result_index ON dvmp_observable_result (computation_id);
CREATE TABLE tcs_observable_result (
tcs_observable_result_id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
observable_name VARCHAR(255) NOT NULL,
......@@ -92,6 +124,11 @@ SELECT obk.dvcs_observable_kinematic_id, obk.xB, obk.xB_unit, obk.t, obk.t_unit
FROM dvcs_observable_kinematic obk
ORDER BY obk.dvcs_observable_kinematic_id;
CREATE VIEW dvmp_observable_kinematic_view AS
SELECT obk.dvmp_observable_kinematic_id, obk.xB, obk.xB_unit, obk.t, obk.t_unit, obk.Q2, obk.Q2_unit, obk.E, obk.E_unit, obk.phi, obk.phi_unit, obk.meson_type_id, obk.hash_sum
FROM dvmp_observable_kinematic obk
ORDER BY obk.dvmp_observable_kinematic_id;
CREATE VIEW tcs_observable_kinematic_view AS
SELECT obk.tcs_observable_kinematic_id, obk.t, obk.t_unit, obk.Q2Prim, obk.Q2Prim_unit, obk.E, obk.E_unit, obk.phi, obk.phi_unit, obk.theta, obk.theta_unit, obk.hash_sum
FROM tcs_observable_kinematic obk
......@@ -112,6 +149,21 @@ FROM dvcs_observable_result obr
INNER JOIN dvcs_observable_kinematic obk ON obr.dvcs_observable_kinematic_id = obk.dvcs_observable_kinematic_id
ORDER BY obr.dvcs_observable_result_id;
CREATE VIEW dvmp_observable_plot_2d_view AS
SELECT obr.computation_id, obk.dvmp_observable_kinematic_id,
obk.xB, obk.xB_unit,
obk.t, obk.t_unit,
obk.Q2, obk.Q2_unit,
obk.E, obk.E_unit,
obk.phi, obk.phi_unit,
mt.meson_type_short_name,
obr.dvmp_observable_result_id, obr.observable_name,
obr.value, obr.value_unit
FROM dvmp_observable_result obr
INNER JOIN dvmp_observable_kinematic obk ON obr.dvmp_observable_kinematic_id = obk.dvmp_observable_kinematic_id
INNER JOIN meson_type mt ON obk.meson_type_id = mt.meson_type_id
ORDER BY obr.dvmp_observable_result_id;
CREATE VIEW tcs_observable_plot_2d_view AS
SELECT obr.computation_id, obk.tcs_observable_kinematic_id,
obk.t, obk.t_unit,
......
......@@ -19,6 +19,7 @@ class ActiveFlavorsThresholdsModule;
class BaseObjectFactory;
class DVCSScalesModule;
class TCSScalesModule;
class DVMPScalesModule;
class DVCSConvolCoeffFunctionModule;
class DVMPConvolCoeffFunctionModule;
class TCSConvolCoeffFunctionModule;
......@@ -26,6 +27,8 @@ class TCSObservable;
class TCSProcessModule;
class DVCSObservable;
class DVCSProcessModule;
class DVMPObservable;
class DVMPProcessModule;
class GPDEvolutionModule;
class GPDModule;
class GPDSubtractionConstantModule;
......@@ -33,6 +36,7 @@ class ModuleObject;
class RunningAlphaStrongModule;
class DVCSXiConverterModule;
class TCSXiConverterModule;
class DVMPXiConverterModule;
} /* namespace PARTONS */
namespace PARTONS {
......@@ -188,6 +192,19 @@ public:
*/
TCSProcessModule* newTCSProcessModule(const std::string & className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPProcessModule.
* @param classId Unique identifier of last child class.
* @return DVMPProcessModule pointer.
*/
DVMPProcessModule* newDVMPProcessModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPProcessModule.
* @param className Name of last child class.
* @return DVMPProcessModule pointer.
*/
DVMPProcessModule* newDVMPProcessModule(const std::string & className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a RunningAlphaStrongModule.
* @param classId Unique identifier of last child class.
......@@ -243,6 +260,19 @@ public:
*/
TCSScalesModule* newTCSScalesModule(const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPScalesModule.
* @param classId Unique identifier of last child class.
* @return DVMPScalesModule pointer.
*/
DVMPScalesModule* newDVMPScalesModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPScalesModule.
* @param className Name of last child class.
* @return DVMPScalesModule pointer.
*/
DVMPScalesModule* newDVMPScalesModule(const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVCSXiConverterModule.
* @param classId Unique identifier of last child class.
......@@ -254,20 +284,35 @@ public:
* @param className Name of last child class.
* @return DVCSXiConverterModule pointer.
*/
DVCSXiConverterModule* newDVCSXiConverterModule(const std::string &className);
DVCSXiConverterModule* newDVCSXiConverterModule(
const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a TCSXiConverterModule.
* @param classId Unique identifier of last child class.
* @return TCSXiConverterModule pointer.
*/
TCSXiConverterModule* newTCSXiConverterModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a TCSXiConverterModule.
* @param className Name of last child class.
* @return TCSXiConverterModule pointer.
*/
TCSXiConverterModule* newTCSXiConverterModule(const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a TCSXiConverterModule.
* @param classId Unique identifier of last child class.
* @return TCSXiConverterModule pointer.
*/
TCSXiConverterModule* newTCSXiConverterModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a TCSXiConverterModule.
* @param className Name of last child class.
* @return TCSXiConverterModule pointer.
*/
TCSXiConverterModule* newTCSXiConverterModule(const std::string &className);
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPXiConverterModule.
* @param classId Unique identifier of last child class.
* @return DVMPXiConverterModule pointer.
*/
DVMPXiConverterModule* newDVMPXiConverterModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a DVMPXiConverterModule.
* @param className Name of last child class.
* @return DVMPXiConverterModule pointer.
*/
DVMPXiConverterModule* newDVMPXiConverterModule(
const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a Observable.
......@@ -296,6 +341,20 @@ public:
*/
TCSObservable* newTCSObservable(const std::string & className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a Observable.
* @param classId Unique identifier of last child class.
* @return Observable pointer.
*/
DVMPObservable* newDVMPObservable(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a Observable.
* @param className Name of last child class.
* @return Observable pointer.
*/
DVMPObservable* newDVMPObservable(const std::string & className);
/**
* Method to update a pointer. Used to keep track of the modules and remove them when they become orphans (i.e. no pointer points to them).
* @param pModuleObjectTarget The pointer to be modified.
......
......@@ -20,6 +20,7 @@ class DVMPConvolCoeffFunctionService;
class TCSConvolCoeffFunctionService;
class GPDService;
class DVCSObservableService;
class DVMPObservableService;
class TCSObservableService;
class ServiceObject;
class VizualisationService;
......@@ -44,6 +45,7 @@ public:
DVMPConvolCoeffFunctionService* getDVMPConvolCoeffFunctionService() const;
TCSConvolCoeffFunctionService* getTCSConvolCoeffFunctionService() const;
DVCSObservableService* getDVCSObservableService() const;
DVMPObservableService* getDVMPObservableService() const;
TCSObservableService* getTCSObservableService() const;
VizualisationService* getVizualisationService() const;
ComparisonService* getComparisonService() const;
......
......@@ -18,6 +18,7 @@
#include "gpd/GPDKinematic.h"
#include "List.h"
#include "observable/DVCS/DVCSObservableKinematic.h"
#include "observable/DVMP/DVMPObservableKinematic.h"
#include "observable/TCS/TCSObservableKinematic.h"
namespace PARTONS {
......@@ -97,6 +98,15 @@ public:
List<TCSObservableKinematic> getTCSObservableKinematicFromFile(
const std::string &filePath);
/**
* Parse a text file in order to retrieve a list of ObservableKinematic objects.
* The parsed file should display separate lines of the form "xB | t | Q2 | E | phi | mesonType".
* @param filePath Path to file to be parsed.
* @return List of extracted ObservableKinematic objects.
*/
List<DVMPObservableKinematic> getDVMPObservableKinematicFromFile(
const std::string &filePath);
private:
/**
......
#ifndef DVMP_OBSERVABLE_KINEMATIC_DAO_H
#define DVMP_OBSERVABLE_KINEMATIC_DAO_H
/**
* @file DVMPObservableKinematicDao.h
* @author: Bryan BERTHOU (SPhN / CEA Saclay)
* @date November 02, 2015
* @version 1.0
*/
#include <QtSql/qsqlquery.h>
#include <string>
#include "../../../beans/List.h"
#include "../../../beans/MesonType.h"
#include "../../../beans/observable/DVMP/DVMPObservableKinematic.h"
#include "../../../utils/type/PhysicalType.h"
#include "ObservableKinematicDao.h"
namespace PARTONS {
/**
* @class DVMPObservableKinematicDao
*
* @brief DVMP Observable kinematics Data Access Object (DAO).
*/
class DVMPObservableKinematicDao: public ObservableKinematicDao {
public:
/**
* Default constructor.
*/
DVMPObservableKinematicDao();
/**
* Destructor.
*/
virtual ~DVMPObservableKinematicDao();
/**
* Insert observable kinematics into the database.
* @param xB Bjorken variable.
* @param t Four-momentum transfer squared of hadron target (in GeV^2).
* @param Q2 Virtual-photon virtuality.
* @param E Beam energy (in GeV).
* @param phi Angle between leptonic and hadronic planes (in degrees, Trento convention).
* @param mesonType Meson type.
* @param hashSum Hash sum.
* @return Unique id of inserted row in the database.
*/
int insert(const PhysicalType<double>& xB, const PhysicalType<double>& t,
const PhysicalType<double>& Q2, const PhysicalType<double>& E,
const PhysicalType<double>& phi, MesonType::Type mesonType,
const std::string& hashSum) const;
/**
* Select GPD kinematics from the database.
* @param xB Bjorken variable.
* @param t Four-momentum transfer squared of hadron target (in GeV^2).
* @param Q2 Virtual-photon virtuality.
* @param E Beam energy (in GeV).
* @param phi Angle between leptonic and hadronic planes (in degrees, Trento convention).
* @param mesonType Meson type.
* @return Unique id of selected row in the database.
*/
int select(const PhysicalType<double>& xB, const PhysicalType<double>& t,
const PhysicalType<double>& Q2, const PhysicalType<double>& E,
const PhysicalType<double>& phi, MesonType::Type mesonType) const;
/**
* Retrieve observable kinematics from the database by given unique id of row.
* @param id Unique id of row in the database to be selected.
* @return ObservableKinematic object containing GPD kinematics retrieved from the database.
*/
DVMPObservableKinematic getKinematicById(const int id) const;
/**
* Retrieve list of observable kinematics from the database by given unique id of computation.
* @param computationId Unique id of computation to be selected.
* @return List of ObservableKinematic objects containing GPD kinematics retrieved from the database.
*/
List<DVMPObservableKinematic> getKinematicListByComputationId(
int computationId) const;
/**
* Retrieve unique id of row containing observable kinematics in the database by given hash sum.
* @param hashSum Hash sum of observable kinematics to be selected.
* @return Unique id of selected row in the database.
*/
int getKinematicIdByHashSum(const std::string &hashSum) const;
private:
/**
* Fill ObservableKinematic object from given query.
* @param observableKinematic ObservableKinematic object to be filled.
* @param query Input QSqlQuery query.
*/
void fillKinematicFromQuery(DVMPObservableKinematic &observableKinematic,
QSqlQuery &query) const;
/**
* Fill List of ObservableKinematic objects from given query.
* @param observableKinematicList List of ObservableKinematic objects to be filled.
* @param query Input QSqlQuery query.
*/
void fillObservableKinematicListFromQuery(
List<DVMPObservableKinematic> &observableKinematicList,
QSqlQuery &query) const;
};
} /* namespace PARTONS */
#endif /* DVMP_OBSERVABLE_KINEMATIC_DAO_H */
#ifndef DVMP_OBSERVABLE_RESULT_DAO_H
#define DVMP_OBSERVABLE_RESULT_DAO_H
/**
* @file DVMPObservableResultDao.h
* @author: Bryan BERTHOU (SPhN / CEA Saclay)
* @date November 02, 2015
* @version 1.0
*/
#include <QtSql/qsqlquery.h>
#include <string>
#include "../../../beans/List.h"
#include "../../../beans/observable/DVMP/DVMPObservableResult.h"
#include "../../../utils/type/PhysicalUnit.h"
#include "DVMPObservableKinematicDao.h"
namespace PARTONS {
/**
* @class DVMPObservableResultDao
*
* @brief DVMP Observable result Data Access Object (DAO).
*/
class DVMPObservableResultDao: public BaseObject {
public:
/**
* Default constructor.
*/
DVMPObservableResultDao();
/**
* Destructor.
*/
virtual ~DVMPObservableResultDao();
/**
* Insert observable result into database.
* @param observableName Observable name.
* @param value Observable value.
* @param statErrorLB Statistical error (lower bound).
* @param statErrorUB Statistical error (upper bound).
* @param systErrorLB Systematic error (lower bound).
* @param systErrorUB Systematic error (upper bound).
* @param scaleErrorLB Scale error (lower bound).
* @param scaleErrorUB Scale error (upper bound).
* @param valueUnit Unit.
* @param kinematicId Unique id of row in the database containing observable kinematics associated to this result.
* @param computationId Unique id of row in the database containing computation information associated to this result.
* @return Unique id of inserted row in the database.
*/
int insert(const std::string& observableName, const double value,
const double statErrorLB, const double statErrorUB,
const double systErrorLB, const double systErrorUB,
const double scaleErrorLB, const double scaleErrorUB,
const PhysicalUnit::Type valueUnit, const int kinematicId,
const int computationId) const;
/**
* Retrieve list of observable results from the database by given unique id of computation.
* @param computationId Unique id of computation to be selected.
* @return List of ObservableResult objects containing observable results retrieved from the database.
*/
List<DVMPObservableResult> getObservableResultListByComputationId(
const int computationId) const;
/**
* Retrieve list of observable results from the database by user-defined SQL query.
* @param sqlQuery User-defined SQL query.
* @return List of ObservableResult objects containing observable results retrieved from the database.
*/
List<DVMPObservableResult> getObservableResultListFromSQLQuery(
const std::string &sqlQuery) const;
private:
/**
* Fill List of ObservableResult objects from given query.
* @param observableResultList List of ObservableResult objects to be filled.
* @param query Input QSqlQuery query.
*/
void fillObservableResultList(
List<DVMPObservableResult> &observableResultList,
QSqlQuery& query) const;
/**
* Kinematic DAO.
*/
DVMPObservableKinematicDao m_dvmpObservableKinematicDao;
};
} /* namespace PARTONS */
#endif /* DVMP_OBSERVABLE_RESULT_DAO_H */
#ifndef DVMP_OBSERVABLE_KINEMATIC_DAO_SERVICE_H
#define DVMP_OBSERVABLE_KINEMATIC_DAO_SERVICE_H
/**
* @file DVMPObservableKinematicDaoService.h
* @author: Bryan BERTHOU (SPhN / CEA Saclay)
* @date November 02, 2015
* @version 1.0
*/
#include <string>
#include "../../../beans/List.h"
#include "../../../beans/observable/DVMP/DVMPObservableKinematic.h"
#include "../dao/DVMPObservableKinematicDao.h"
#include "ObservableKinematicDaoService.h"
namespace PARTONS {
/**
* @class DVMPObservableKinematicDaoService
*
* @brief DVMP Observable kinematics Data Access Object (DAO) service.
*/
class DVMPObservableKinematicDaoService: public ObservableKinematicDaoService {
public:
/**
* Default constructor.
*/
DVMPObservableKinematicDaoService();
/**
* Destructor.
*/
virtual ~DVMPObservableKinematicDaoService();
/**
* Insert into database a new ObservableKinematic object with transactions mechanisms.
*
* @param observableKinematic Reference to ObservableKinematic object to be inserted.
* @return Unique id related to the new entry inserted into the database.
*/
int insert(const DVMPObservableKinematic &observableKinematic) const;
/**
* Insert into database a list of ObservableKinematic objects with transactions mechanisms.
*
* @param observableKinematicList Reference to List of ObservableKinematic objects to be inserted.
* @return Unique id related to the last entry inserted into the database.
*/
int insert(
const List<DVMPObservableKinematic> &observableKinematicList) const;
/**
* Try to find an entry in the database that matches with given observable kinematics.
*
* @param observableKinematic Reference to ObservableKinematic object with kinematics to be found.
* @return Unique id related to the entry that matches with ObservableKinematic object or -1 if couldn't find it.
*/
int getIdByKinematicObject(
const DVMPObservableKinematic &observableKinematic) const;
/**
* Try to find an entry in the database containing observable kinematics that matches with given unique id value.
*
* @param id Unique id of database entry to be found.
* @return ObservableKinematic object filled with the retrieved data or a default ObservableKinematic object if couldn't find it.
*/
DVMPObservableKinematic getKinematicById(const int kinematicId) const;
/**
* Try to find all entries in the database containing observable kinematics that are associated with given unique computation id value.
*
* @param computationId Computation id of database entries to be found.
* @return List of ObservableKinematic objects that matches with computation id.
*/
List<DVMPObservableKinematic> getKinematicListByComputationId(
int computationId) const;
/**
* Try to find unique id of database entry containing observable kinematics that matches with given hash sum value.
* @param hashSum Hash sum value of database entry to be retrieved.
* @return Unique id of database entry that matches with hash sum value.
*/
virtual int getKinematicIdByHashSum(const std::string &hashSum) const;
private:
/**
* Allow DVMPObservableResultDaoService to call private member function insertWithoutTransaction(...).
*/
friend class DVMPObservableResultDaoService;
/**
* DVMPObservableKinematicDao object to perform database queries
*/
DVMPObservableKinematicDao m_dvmpObservableKinematicDao;
/**
* Insert into the database a new ObservableKinematic object without using transactions mechanisms.
* Helpful when dealing with a List<ObservableKinematic> object, because transactions are already performed earlier.
*
* @param observableKinematic
* @return unique id related to the new entry inserted into the database
*/
int insertWithoutTransaction(
const DVMPObservableKinematic &observableKinematic) const;
};
} /* namespace PARTONS */
#endif /* DVMP_OBSERVABLE_KINEMATIC_DAO_SERVICE_H */
#ifndef DVMP_OBSERVABLE_RESULT_DAO_SERVICE_H
#define DVMP_OBSERVABLE_RESULT_DAO_SERVICE_H
/**
* @file DVMPObservableResultDaoService.h
* @author: Bryan BERTHOU (SPhN / CEA Saclay)
* @date November 02, 2015
* @version 1.0
*/
#include <string>
#include "../../../beans/List.h"
#include "../../../beans/observable/DVMP/DVMPObservableResult.h"
#include "../dao/DVMPObservableResultDao.h"
#include "DVMPObservableKinematicDaoService.h"
#include "ObservableResultDaoService.h"
namespace PARTONS {
/**
* @class DVMPObservableResultDaoService