Commit 8e5f0dbb authored by Valerio Bertone's avatar Valerio Bertone
Browse files

Including CollinerDitribution object on the same footing as a GPD object

parent 3727763d
......@@ -27,6 +27,8 @@ class DVCSObservable;
class DVCSProcessModule;
class GPDEvolutionModule;
class GPDModule;
class CollinearDistributionEvolutionModule;
class CollinearDistributionModule;
class GPDSubtractionConstantModule;
class ModuleObject;
class RunningAlphaStrongModule;
......@@ -101,6 +103,32 @@ public:
*/
GPDModule* newGPDModule(const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a CollinearDistributionEvolutionModule.
* @param classId Unique identifier of last child class.
* @return CollinearDistributionEvolutionModule pointer.
*/
CollinearDistributionEvolutionModule* newCollinearDistributionEvolutionModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a CollinearDistributionEvolutionModule.
* @param className Name of last child class.
* @return CollinearDistributionEvolutionModule pointer.
*/
CollinearDistributionEvolutionModule* newCollinearDistributionEvolutionModule(const std::string & className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a CollinearDistributionModule.
* @param classId Unique identifier of last child class.
* @return CollinearDistributionModule pointer.
*/
CollinearDistributionModule* newCollinearDistributionModule(unsigned int classId);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a CollinearDistributionModule.
* @param className Name of last child class.
* @return CollinearDistributionModule pointer.
*/
CollinearDistributionModule* newCollinearDistributionModule(const std::string &className);
/**
* Specialization of ModuleObjectFactory::newModuleObject into a GPDSubtractionConstantModule.
* @param classId Unique identifier of last child class.
......
......@@ -13,6 +13,7 @@
#include <string>
#include "beans/gpd/GPDType.h"
#include "beans/parton_distribution/CollinearDistributionType.h"
#include "beans/List.h"
#include "utils/thread/ThreadManager.h"
#include "utils/thread/ThreadQueue.h"
......@@ -124,6 +125,11 @@ protected:
*/
List<GPDType> getGPDTypeListFromTask(Task &task) const;
/**
* Get list of Collinear Distribution types to be computed from a task.
*/
List<CollinearDistributionType> getCollinearDistributionTypeListFromTask(Task &task) const;
/**
* Throw exception if unknown method.
*/
......
......@@ -18,6 +18,7 @@ class CryptographicHashService;
class DVCSConvolCoeffFunctionService;
class TCSConvolCoeffFunctionService;
class GPDService;
class CollinearDistributionService;
class DVCSObservableService;
class TCSObservableService;
class ServiceObject;
......@@ -39,6 +40,7 @@ public:
ServiceObject* get(const std::string &className) const;
GPDService* getGPDService() const;
CollinearDistributionService* getCollinearDistributionService() const;
DVCSConvolCoeffFunctionService* getDVCSConvolCoeffFunctionService() const;
TCSConvolCoeffFunctionService* getTCSConvolCoeffFunctionService() const;
DVCSObservableService* getDVCSObservableService() const;
......
......@@ -15,6 +15,7 @@
#include "convol_coeff_function/DVCS/DVCSConvolCoeffFunctionKinematic.h"
#include "convol_coeff_function/TCS/TCSConvolCoeffFunctionKinematic.h"
#include "gpd/GPDKinematic.h"
#include "parton_distribution/CollinearDistributionKinematic.h"
#include "List.h"
#include "observable/DVCS/DVCSObservableKinematic.h"
#include "observable/TCS/TCSObservableKinematic.h"
......@@ -51,6 +52,14 @@ public:
*/
List<GPDKinematic> getGPDKinematicFromFile(const std::string &filePath);
/**
* Parse a text file in order to retrieve a list of CollienearDistributionKinematic objects.
* The parsed file should display separate lines of the form "x | MuF2 | MuR2".
* @param filePath Path to file to be parsed.
* @return List of extracted GPDKinematic objects.
*/
List<CollinearDistributionKinematic> getCollinearDistributionKinematicFromFile(const std::string &filePath);
/**
* Parse a text file in order to retrieve a list of DVCSConvolCoeffFunctionKinematic objects.
* The parsed file should display separate lines of the form "xi | t | Q2 | MuF2 | MuR2".
......
#ifndef PARTON_DISTRIBUTION_KINEMATIC_H
#define PARTON_DISTRIBUTION_KINEMATIC_H
#ifndef COLLINEAR_DISTRIBUTION_KINEMATIC_H
#define COLLINEAR_DISTRIBUTION_KINEMATIC_H
/**
* @file PartonDistributionKinematic.h
* @file CollinearDistributionKinematic.h
* @author: Valerio BERTONE (CEA Saclay)
* @date July 17, 2020
* @version 1.0
......@@ -24,17 +24,17 @@ class Packet;
namespace PARTONS {
/**
* @class PartonDistributionKinematic
* @class CollinearDistributionKinematic
*
* @brief Class representing a single collinear-distribution kinematics.
*
* This class represents a single collinear-distribution kinematics (x, \f$\mu_{F}^{2}\f$, \f$\mu_{F}^{2}\f$).
*/
class PartonDistributionKinematic: public Kinematic {
class CollinearDistributionKinematic: public Kinematic {
public:
static const std::string PARTON_DISTRIBUTION_KNEMATIC_CLASS_NAME; ///< Type of the kinematic in XML automation.
static const std::string COLLINEAR_DISTRIBUTION_KNEMATIC_CLASS_NAME; ///< Type of the kinematic in XML automation.
/**
* Parameter name to set variable \f$x\f$ via configuration methods.
......@@ -69,7 +69,7 @@ public:
/**
* Default constructor.
*/
PartonDistributionKinematic();
CollinearDistributionKinematic();
/**
* Assignment constructor.
......@@ -78,7 +78,7 @@ public:
* @param MuF2 Factorization scale squared (in \f$GeV^{2}\f$).
* @param MuR2 Renormalization scale squared (in \f$GeV^{2}\f$).
*/
PartonDistributionKinematic(double x, double MuF2, double MuR2);
CollinearDistributionKinematic(double x, double MuF2, double MuR2);
/**
* Assignment constructor.
......@@ -87,7 +87,7 @@ public:
* @param MuF2 Factorization scale squared (in \f$GeV^{2}\f$).
* @param MuR2 Renormalization scale squared (in \f$GeV^{2}\f$).
*/
PartonDistributionKinematic(const PhysicalType<double> &x, const PhysicalType<double> &MuF2, const PhysicalType<double> &MuR2);
CollinearDistributionKinematic(const PhysicalType<double> &x, const PhysicalType<double> &MuF2, const PhysicalType<double> &MuR2);
/**
* Assignment constructor.
......@@ -96,18 +96,18 @@ public:
* @param MuF2 Factorization scale squared (in \f$GeV^{2}\f$).
* @param MuR2 Renormalization scale squared (in \f$GeV^{2}\f$).
*/
PartonDistributionKinematic(const ElemUtils::GenericType &x, const ElemUtils::GenericType &MuF2, const ElemUtils::GenericType &MuR2);
CollinearDistributionKinematic(const ElemUtils::GenericType &x, const ElemUtils::GenericType &MuF2, const ElemUtils::GenericType &MuR2);
/**
* Copy constructor.
* @param other Object to be copied.
*/
PartonDistributionKinematic(const PartonDistributionKinematic &other);
CollinearDistributionKinematic(const CollinearDistributionKinematic &other);
/**
* Destructor.
*/
virtual ~PartonDistributionKinematic();
virtual ~CollinearDistributionKinematic();
virtual void configure(const ElemUtils::Parameters &parameters);
virtual std::string toString() const;
......@@ -138,12 +138,12 @@ public:
/**
* Is equal operator. Checks if values of kinematic variables are the same.
*/
bool operator ==(const PartonDistributionKinematic& other) const;
bool operator ==(const CollinearDistributionKinematic& other) const;
/**
* Is different operator. Checks of values of kinematic variables are different.
*/
bool operator !=(const PartonDistributionKinematic& other) const;
bool operator !=(const CollinearDistributionKinematic& other) const;
//********************************************************
//*** SETTERS AND GETTERS ********************************
......@@ -217,15 +217,15 @@ private:
};
/**
* Stream operator to serialize class into Packet. See also PartonDistributionType::serialize().
* Stream operator to serialize class into Packet. See also CollinearDistributionType::serialize().
*/
ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, PartonDistributionKinematic& kinematic);
ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, CollinearDistributionKinematic& kinematic);
/**
* Stream operator to retrieve class from Packet. See also PartonDistributionType::unserialize().
* Stream operator to retrieve class from Packet. See also CollinearDistributionType::unserialize().
*/
ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, PartonDistributionKinematic& kinematic);
ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, CollinearDistributionKinematic& kinematic);
} /* namespace PARTONS */
#endif /* PARTON_DISTRIBUTION_KINEMATIC_H */
#endif /* COLLINEAR_DISTRIBUTION_KINEMATIC_H */
#ifndef COLLINEAR_DISTRIBUTION_RESULT_H
#define COLLINEAR_DISTRIBUTION_RESULT_H
/**
* @file CollinearDistributionResult.h
* @author: Valerio BERTONE (CEA Saclay)
* @date 18 July 2020
* @version 1.0
*/
#include <map>
#include <string>
#include <vector>
#include "../../utils/compare/ComparisonReport.h"
#include "../parton_distribution/PartonDistribution.h"
#include "../Result.h"
#include "CollinearDistributionKinematic.h"
#include "CollinearDistributionType.h"
namespace PARTONS {
/**
* @class CollinearDistributionResult
*
* @brief Class representing single result of a collinear-distribution
* computation.
*
* This class is used to store results of a single collinear
* distribution computation. In other words, the class stores a
* collection of PartonDistribution objects, with each of them
* containing a part of the result defined for a specific collinear
* distribution type.
*/
class CollinearDistributionResult: public Result<CollinearDistributionKinematic> {
public:
/**
* Default constructor.
*/
CollinearDistributionResult();
/**
* Assignment constructor.
* @param kinematic collinear distribution kinematics to be assigned.
*/
CollinearDistributionResult(const CollinearDistributionKinematic& kinematic);
/**
* Copy constructor.
* @param other Object to be copied.
*/
CollinearDistributionResult(const CollinearDistributionResult &other);
/**
* Destructor.
*/
virtual ~CollinearDistributionResult();
virtual std::string toString() const;
/**
* Add parton distribution associated to given collinear distribution type.
* @param colldistType collinear distribution type of parton distribution to be inserted.
* @param partonDistribution Parton distribution to be added.
*/
void addPartonDistribution(CollinearDistributionType::Type colldistType,
const PartonDistribution& partonDistribution);
/**
* Get reference to parton distribution associated to given collinear distribution type.
* @param colldistType collinear distribution type associated to parton distribution to be selected.
* @return Reference to selected parton distribution.
*/
const PartonDistribution& getPartonDistribution(
CollinearDistributionType::Type colldistType) const;
/**
* Check if the object stores parton distribution of given collinear distribution type.
* @param colldistType collinear distribution type to be checked.
* @return True if the object stores parton distribution of given collinear distribution type, otherwise false.
* @see CollinearDistributionResult::getLastAvailable()
*/
bool isAvailable(const CollinearDistributionType::Type &colldistType) const;
/**
* Get reference to parton distribution marked by the last call of CollinearDistributionResult::isAvailible() function.
* @return Reference to selected parton distribution.
* @see CollinearDistributionResult::isAvailible()
*/
PartonDistribution& getLastAvailable() const;
/**
* Compare to other CollinearDistributionResult object and store comparison result in given comparison report.
* @param rootComparisonReport Reference to comparison report to be used to store comparison result.
* @param referenceObject Reference to object to be compared.
* @param parentObjectInfo Addition information coming from the parent object (if needed).
*/
void compare(ComparisonReport &rootComparisonReport,
const CollinearDistributionResult &referenceObject,
std::string parentObjectInfo = "") const;
/**
* Get list of collinear distribution types associated to stored parton distributions.
* @return Vector of associated types.
*/
std::vector<CollinearDistributionType> listCollinearDistributionTypeComputed() const;
//********************************************************
//*** SETTERS AND GETTERS ********************************
//********************************************************
/**
* Get reference to map containing stored parton distributions distinguished by associated collinear distribution types.
*/
const std::map<CollinearDistributionType::Type, PartonDistribution>& getPartonDistributions() const;
/**
* Set map containing stored parton distributions distinguished by associated collinear distribution types.
*/
void setPartonDistributions(
const std::map<CollinearDistributionType::Type, PartonDistribution>& partonDistributions);
private:
/**
* Map containing stored parton distributions distinguished by associated collinear distribution types.
*/
std::map<CollinearDistributionType::Type, PartonDistribution> m_partonDistributions;
/**
* Iterator used to mark a specific entry in CollinearDistributionResult::m_partonDistributions.
*/
mutable std::map<CollinearDistributionType::Type, PartonDistribution>::const_iterator m_it;
};
} /* namespace PARTONS */
#endif /* COLLINEAR_DISTRIBUTION_RESULT_H */
#ifndef COLLINEAR_DISTRIBUTION_TYPE_H
#define COLLINEAR_DISTRIBUTION_TYPE_H
/**
* @file CollinearDistributionType.h
* @author: Valerio BERTONE (CEA Saclay)
* @date 18 July 2020
* @version 1.0
*/
#include <string>
#include "../List.h"
namespace ElemUtils {
class Packet;
} /* namespace ElemUtils */
namespace PARTONS {
/**
* @class CollinearDistributionType
*
* @brief Definition of enumeration values for collinear distribution types.
*
* This class defines a set of enumeration values that are used to
distinguish between collinear distributions. In addition, a declared
object of this class is always associated to one
collinear-distribution type (see CollinearDistributionType::m_type),
so member functions can act on it.
*/
class CollinearDistributionType {
public:
/**
* Name of table in the database corresponding to this class.
*/
static const std::string COLLINEAR_DISTRIBUTION_TYPE_DB_COLUMN_NAME;
/**
* Definition of enumerate values corresponding to
* collinear-distribution types.
*/
enum Type {
UNDEFINED = 0, //!< Undefined type.
ALL = 1, //!< All-like type, useful to indicate all available types.
UnpolPDF = 2, //!< Twist-2 collinear unpolarised PDFs
PolPDF = 3, //!< Twist-2 collinear logitudinally polarised PDFs
TransPDF = 4, //!< Twist-2 collinear transversely polarised PDFs
UnpolFF = 5, //!< Twist-2 collinear unpolarised FFs
PolFF = 6, //!< Twist-2 collinear logitudinally polarised FFs
TransFF = 7, //!< Twist-2 collinear transversely polarised FFs
END //!< End-like type, useful to define loops over all types.
};
/**
* Default constructor.
*/
CollinearDistributionType();
/**
* Assignment constructor.
* @param type Type to be assigned.
*/
CollinearDistributionType(Type type);
/**
* Copy constructor.
* @param other Object to be copied.
*/
CollinearDistributionType(const CollinearDistributionType &other);
/**
* Automatic cast to enum.
*/
operator Type() const;
/**
* Get string representation of type being assigned to a declared object of this class.
* @return String representation of assigned type, like "H" for CollinearDistributionType::H.
*/
std::string toString() const;
/**
* Serialize into given Packet.
* @param packet Target Packet.
*/
void serialize(ElemUtils::Packet &packet) const;
/**
* Retrieve data from given Packet.
* @param packet Input Packet.
*/
void unserialize(ElemUtils::Packet &packet);
/**
* Relation operator that checks if the value of left operand is less than the value of right operand (based on values assigned in the definition of CollinearDistributionType::Type).
* Used by std::sort function.
* @param other Right hand value.
* @return True if the value of left operand is less than the value of right operand, otherwise false.
*/
bool operator <(const CollinearDistributionType &other) const;
/**
* Try to match collinear distribution type from given string.
* @param colldistTypeStr String to be matched.
* @return Matched type or CollinearDistributionType::UNDEFINED if unable to match.
*/
static CollinearDistributionType::Type fromString(const std::string & colldistTypeStr);
/**
* Try to match list of collinear distribution types from given string. Types should be separated by the pipe symbol, e.g. "H|E|..."
* @param colldistTypeListAsString String to be matched.
* @return List of matched CollinearDistributionType objects.
*/
static List<CollinearDistributionType> getListOfCollinearDistributionTypeFromString(
const std::string &colldistTypeListAsString);
//********************************************************
//*** SETTERS AND GETTERS ********************************
//********************************************************
/**
* Get type being assigned to a declared object of this class.
*/
CollinearDistributionType::Type getType() const;
/**
* Assign type to a declared object of this class.
*/
void setType(Type type);
private:
/**
* Type associated to a declared object of this class.
*/
CollinearDistributionType::Type m_type;
};
/**
* Stream operator to serialize class into Packet. See also CollinearDistributionType::serialize().
*/
ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, CollinearDistributionType& colldistType);
/**
* Stream operator to retrieve class from Packet. See also CollinearDistributionType::unserialize().
*/
ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, CollinearDistributionType& colldistType);
} /* namespace PARTONS */
#endif /* COLLINEAR_DISTRIBUTION_TYPE_H */
......@@ -47,6 +47,12 @@ public:
static const std::string TABLE_NAME_GPD_RESULT;
static const std::string COLUMN_NAME_GPD_RESULT_ID;
static const std::string TABLE_NAME_COLLINEAR_DISTRIBUTION_KINEMATIC;
static const std::string COLUMN_NAME_COLLINEAR_DISTRIBUTION_KINEMATIC_ID;
static const std::string TABLE_NAME_COLLINEAR_DISTRIBUTION_RESULT;
static const std::string COLUMN_NAME_COLLINEAR_DISTRIBUTION_RESULT_ID;
static const std::string COLUMN_NAME_PARTON_DISTRIBUTION_ID;
static const std::string TABLE_NAME_OBSERVABLE_KINEMATIC;
......@@ -59,6 +65,8 @@ public:
static const std::string COLUMN_NAME_GPD_TYPE_ID;
static const std::string COLUMN_NAME_COLLINEAR_DISTRIBUTION_TYPE_ID;
static const std::string COLUMN_NAME_GLUON_DISTRIBUTION;
static const std::string COLUMN_NAME_QUARK_FLAVOR_ID;
......
#ifndef COLLINEAR_DISTRIBUTION_KINEMATIC_DAO
#define COLLINEAR_DISTRIBUTION_KINEMATIC_DAO
/**
* @file CollinearDistributionKinematicDao.h
* @author: Valerio BERTONE (CEA Saclay)
* @date July 18, 2020
* @version 1.0
*/
#include <QtSql/qsqlquery.h>
#include <string>
#include "../../../beans/parton_distribution/CollinearDistributionKinematic.h"
#include "../../../beans/List.h"
#include "../../../utils/type/PhysicalType.h"
namespace PARTONS {
/**
* @class CollinearDistributionKinematicDao
*
* @brief collinear distribution kinematics Data Access Object (DAO).
*
* This DAO is used to insert, select and delete collinear distribution kinematics from the database. This class in not intended to be used by regular users who should deal with CollinearDistributionKinematicDaoService instead.
*/
class CollinearDistributionKinematicDao: public BaseObject {
public:
/**
* Default constructor.
*/
CollinearDistributionKinematicDao();
/**
* Destructor.
*/
virtual ~CollinearDistributionKinematicDao();
/**
* Insert collinear distribution kinematics into the database.
* @param x Longitudinal momentum fraction of active parton.
* @param MuF2 Factorization scale squared.
* @param MuR2 Renormalization scale squared.
* @param hashSum Hash sum.
* @return Unique id of inserted row in the database.
*/
int insert(const PhysicalType<double>& x, const PhysicalType<double>& MuF2,
const PhysicalType<double>& MuR2, const std::string& hashSum) const;
/**
* Select collinear distribution kinematics from the database.
* @param x Longitudinal momentum fraction of active parton.
* @param MuF2 Factorization scale squared.
* @param MuR2 Renormalization scale squared.
* @return Unique id of selected row in the database.
*/
int select(const PhysicalType<double>& x, const PhysicalType<double>& MuF2,
const PhysicalType<double>& MuR2) const;
/**
* Retrieve collinear distribution kinematics from the database by given unique id of row.
* @param id Unique id of row in the database to be selected.