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

make GPD modules dependent on PDF modules (WIP)

parent f50cb7d8
......@@ -25,7 +25,8 @@ class CollinearDistributionLHAPDF: public CollinearDistributionModule {
public:
static const std::string PARAM_NAME_SET_NAME;
static const std::string PARAM_NAME_MEMBER;
static const std::string PARAM_NAME_SET_TYPE;
static const std::string PARAM_NAME_SET_MEMBER;
static const unsigned int classId; ///< Unique ID to automatically register the class in the registry.
......
......@@ -11,7 +11,6 @@
#include <ElementaryUtils/parameters/Parameters.h>
#include <string>
#include <vector>
#include <LHAPDF/LHAPDF.h>
#include "../../beans/QuarkFlavor.h"
#include "../MathIntegratorModule.h"
......@@ -30,9 +29,6 @@ class GPDMMS13: public GPDModule, public MathIntegratorModule {
public:
static const std::string PARAM_NAME_SET_NAME;
static const std::string PARAM_NAME_MEMBER;
static const std::string PARAMETER_NAME_MMS13MODEL_NHpE; ///< Name of parameter to set #m_NHpE via configure()
static const std::string PARAMETER_NAME_MMS13MODEL_NE; ///< Name of parameter to set #m_NE via configure()
static const std::string PARAMETER_NAME_MMS13MODEL_C; ///< Name of parameter to set #m_C via configure()
......@@ -56,12 +52,6 @@ public:
virtual void configure(const ElemUtils::Parameters &parameters);
virtual std::string toString() const;
std::string getSetName() const;
int getMember() const;
void setSetName(const std::string &setname);
void setMember(const int &member);
/** D term function.
@param zeta Variable equals x/xi.
*/
......@@ -86,10 +76,6 @@ private:
int m_NE; ///< %Double distribution profile function parameter for E+.
double m_C; ///< Scaling parameter for D term.
std::string m_setName;
int m_member;
LHAPDF::PDF* m_pForward;
/** Forward limit of GPD H.
@param beta %Double distribution parameter.
@param flavor Quark flavor.
......
......@@ -19,17 +19,14 @@
#include "../../ModuleObject.h"
namespace PARTONS {
class CollinearDistributionModule;
class GPDEvolutionModule;
class GPDKinematic;
} /* namespace PARTONS */
namespace PARTONS {
class GPDResult;
} /* namespace PARTONS */
namespace PARTONS {
class GPDEvolutionModule;
/**
* @class GPDModule
* @brief Abstract class that provides a skeleton to implement a Generalized Parton Distributions (GPD) module.
......@@ -136,6 +133,16 @@ public:
*/
void setEvolQcdModule(GPDEvolutionModule* pEvolQcdModule);
/**
* Set underlying PDF module.
*/
const CollinearDistributionModule* getPDFModule() const;
/**
* Get underlying PDF module.
*/
void setPDFModule(CollinearDistributionModule* pPDFModule);
protected:
/**
......@@ -184,6 +191,8 @@ protected:
double m_MuF2_ref; ///< Reference factorization scale used by the GPD model before evolution.
GPDEvolutionModule* m_pGPDEvolutionModule; ///< Pointer to the underlying GPD Evolution module.
CollinearDistributionModule* m_pCollinearDistributionModule; ///< Pointer to the underlying PDF module.
};
} /* namespace PARTONS */
......
......@@ -2,7 +2,6 @@
#include <ElementaryUtils/logger/CustomException.h>
#include <ElementaryUtils/parameters/GenericType.h>
#include <ElementaryUtils/PropertiesManager.h>
#include <ElementaryUtils/string_utils/Formatter.h>
#include <NumA/functor/one_dimension/Functor1D.h>
#include <NumA/integration/one_dimension/Integrator1D.h>
......@@ -10,18 +9,19 @@
#include <cmath>
#include <utility>
#include "../../../../include/partons/beans/collinear_distribution/CollinearDistributionKinematic.h"
#include "../../../../include/partons/beans/collinear_distribution/CollinearDistributionType.h"
#include "../../../../include/partons/beans/gpd/GPDType.h"
#include "../../../../include/partons/beans/parton_distribution/GluonDistribution.h"
#include "../../../../include/partons/beans/parton_distribution/QuarkDistribution.h"
#include "../../../../include/partons/BaseObjectRegistry.h"
#include "../../../../include/partons/FundamentalPhysicalConstants.h"
#include "../../../../include/partons/utils/PartonContent.h"
#include "../../../../include/partons/modules/collinear_distribution/CollinearDistributionLHAPDF.h"
#include "../../../../include/partons/ModuleObjectFactory.h"
#include "../../../../include/partons/Partons.h"
namespace PARTONS {
const std::string GPDMMS13::PARAM_NAME_SET_NAME = "setName";
const std::string GPDMMS13::PARAM_NAME_MEMBER = "member";
const unsigned int GPDMMS13::classId =
BaseObjectRegistry::getInstance()->registerBaseObject(
new GPDMMS13("GPDMMS13"));
......@@ -31,8 +31,7 @@ const std::string GPDMMS13::PARAMETER_NAME_MMS13MODEL_NE = "MMS13Model_NE";
const std::string GPDMMS13::PARAMETER_NAME_MMS13MODEL_C = "MMS13Model_C";
GPDMMS13::GPDMMS13(const std::string &className) :
GPDModule(className), MathIntegratorModule(), m_pForward(0), m_setName("UNDEFINED"),
m_member(0) {
GPDModule(className), MathIntegratorModule() {
m_MuF2_ref = 4.;
......@@ -56,20 +55,11 @@ GPDMMS13::GPDMMS13(const GPDMMS13& other) :
m_NHpE = other.m_NHpE;
m_C = other.m_C;
m_setName = other.m_setName;
m_member = other.m_member;
m_pForward = other.m_pForward;
initFunctorsForIntegrations();
}
GPDMMS13::~GPDMMS13() {
if (m_pForward) {
delete m_pForward;
m_pForward = 0;
}
if (m_pint_IntHpEDDval) {
delete m_pint_IntHpEDDval;
m_pint_IntHpEDDval = 0;
......@@ -111,29 +101,32 @@ GPDMMS13* GPDMMS13::clone() const {
}
void GPDMMS13::resolveObjectDependencies() {
//set integrator type
setIntegrator(NumA::IntegratorType1D::DEXP);
}
void GPDMMS13::configure(const ElemUtils::Parameters &parameters) {
//set pdf module
if (m_pCollinearDistributionModule == 0) {
GPDModule::configure(parameters);
MathIntegratorModule::configureIntegrator(parameters);
CollinearDistributionModule* pCollinearDistributionModule =
PARTONS::Partons::getInstance()->getModuleObjectFactory()->newCollinearDistributionModule(
PARTONS::CollinearDistributionLHAPDF::classId);
// LHAPDF in silent mode
LHAPDF::setVerbosity(0);
static_cast<CollinearDistributionLHAPDF*>(pCollinearDistributionModule)->setSetName(
"MSTW2008nlo68cl");
static_cast<CollinearDistributionLHAPDF*>(pCollinearDistributionModule)->setIndexId(
0);
static_cast<CollinearDistributionLHAPDF*>(pCollinearDistributionModule)->setType(
CollinearDistributionType::UnpolPDF);
//check and set
if (parameters.isAvailable(GPDMMS13::PARAM_NAME_SET_NAME)) {
setSetName(parameters.getLastAvailable().getString());
info(__func__, ElemUtils::Formatter() << GPDMMS13::PARAM_NAME_SET_NAME
<< " configured with value = " << getSetName());
setPDFModule(pCollinearDistributionModule);
}
}
if (parameters.isAvailable(GPDMMS13::PARAM_NAME_MEMBER)) {
setMember(parameters.getLastAvailable().toUInt());
info(__func__, ElemUtils::Formatter() << GPDMMS13::PARAM_NAME_MEMBER
<< " configured with value = " << getMember());
}
void GPDMMS13::configure(const ElemUtils::Parameters &parameters) {
GPDModule::configure(parameters);
MathIntegratorModule::configureIntegrator(parameters);
if (parameters.isAvailable(GPDMMS13::PARAMETER_NAME_MMS13MODEL_NHpE)) {
m_NHpE = parameters.getLastAvailable().toInt();
......@@ -153,25 +146,19 @@ std::string GPDMMS13::toString() const {
}
void GPDMMS13::isModuleWellConfigured() {
GPDModule::isModuleWellConfigured();
//check that the set name in no UNDEFINED
if (m_setName == "UNDEFINED") {
throw ElemUtils::CustomException(getClassName(), __func__, ElemUtils::Formatter() << "The set name is undefined");
}
//run for mother
GPDModule::isModuleWellConfigured();
//check that the member index is non-negative
if (m_member < 0) {
throw ElemUtils::CustomException(getClassName(), __func__, ElemUtils::Formatter() << "The member index is negative");
//check if PDF module set
if (m_pCollinearDistributionModule == 0) {
throw ElemUtils::CustomException(getClassName(), __func__,
"CollinearDistributionModule is NULL");
}
}
void GPDMMS13::initModule() {
GPDModule::initModule();
if (m_pForward == nullptr) {
m_pForward = LHAPDF::mkPDF(m_setName, m_member);
}
}
PartonDistribution GPDMMS13::computeH() {
......@@ -294,6 +281,11 @@ double GPDMMS13::forwardHval(double beta, QuarkFlavor::Type flavor) const {
//parameters
double alpha_prim;
//get pdf
PartonDistribution pdf = m_pCollinearDistributionModule->compute(
CollinearDistributionKinematic(beta, m_MuF2, m_MuR2),
CollinearDistributionType::UnpolPDF);
//check flavor
switch (flavor) {
......@@ -301,8 +293,10 @@ double GPDMMS13::forwardHval(double beta, QuarkFlavor::Type flavor) const {
alpha_prim = 0.9;
return pow(beta, -1 * alpha_prim * m_t)
* ( m_pForward->xfxQ2(2, beta, m_MuF2) - m_pForward->xfxQ2(-2, beta, m_MuF2) ) / beta;
double uVal =
pdf.getQuarkDistribution(QuarkFlavor::UP).getQuarkDistributionMinus();
return pow(beta, -1 * alpha_prim * m_t) * uVal / beta;
}
break;
......@@ -310,8 +304,10 @@ double GPDMMS13::forwardHval(double beta, QuarkFlavor::Type flavor) const {
alpha_prim = 0.9;
return pow(beta, -1 * alpha_prim * m_t)
* ( m_pForward->xfxQ2(1, beta, m_MuF2) - m_pForward->xfxQ2(-1, beta, m_MuF2) ) / beta;
double dVal =
pdf.getQuarkDistribution(QuarkFlavor::DOWN).getQuarkDistributionMinus();
return pow(beta, -1 * alpha_prim * m_t) * dVal / beta;
}
break;
......@@ -499,20 +495,4 @@ double GPDMMS13::IntEvalPlusB(double beta, std::vector<double> par) {
* profileFunction(beta, par[0] / m_xi, int(par[2])) / beta;
}
void GPDMMS13::setSetName(const std::string &setname) {
m_setName = setname;
}
void GPDMMS13::setMember(const int &member) {
m_member = member;
}
std::string GPDMMS13::getSetName() const {
return m_setName;
}
int GPDMMS13::getMember() const {
return m_member;
}
} /* namespace PARTONS */
......@@ -10,6 +10,7 @@
#include "../../../../include/partons/beans/channel/ChannelType.h"
#include "../../../../include/partons/beans/gpd/GPDKinematic.h"
#include "../../../../include/partons/beans/Result.h"
#include "../../../../include/partons/modules/collinear_distribution/CollinearDistributionModule.h"
#include "../../../../include/partons/modules/evolution/gpd/GPDEvolutionModule.h"
#include "../../../../include/partons/ModuleObjectFactory.h"
#include "../../../../include/partons/Partons.h"
......@@ -26,7 +27,8 @@ const std::string GPDModule::GPD_MODULE_CLASS_NAME = "GPDModule";
GPDModule::GPDModule(const std::string &className) :
ModuleObject(className, ChannelType::UNDEFINED), m_x(0.), m_xi(0.), m_t(
0.), m_MuF2(0.), m_MuR2(0.), m_currentGPDComputeType(
GPDType::ALL), m_MuF2_ref(0.), m_pGPDEvolutionModule(0) {
GPDType::ALL), m_MuF2_ref(0.), m_pGPDEvolutionModule(0), m_pCollinearDistributionModule(
0) {
}
GPDModule::GPDModule(const GPDModule &other) :
......@@ -41,16 +43,28 @@ GPDModule::GPDModule(const GPDModule &other) :
m_pGPDEvolutionModule = 0;
}
if (other.m_pCollinearDistributionModule != 0) {
m_pCollinearDistributionModule =
m_pModuleObjectFactory->cloneModuleObject(
other.m_pCollinearDistributionModule);
} else {
m_pCollinearDistributionModule = 0;
}
m_listGPDComputeTypeAvailable = other.m_listGPDComputeTypeAvailable;
}
GPDModule::~GPDModule() {
/*
if (m_pGPDEvolutionModule) {
setEvolQcdModule(0);
m_pGPDEvolutionModule = 0;
}
*/
if (m_pCollinearDistributionModule) {
setPDFModule(0);
m_pCollinearDistributionModule = 0;
}
}
std::string GPDModule::toString() const {
......@@ -113,6 +127,8 @@ void GPDModule::prepareSubModules(
std::map<std::string, BaseObjectData>::const_iterator it;
//evolution
it = subModulesData.find(
GPDEvolutionModule::GPD_EVOLUTION_MODULE_CLASS_NAME);
......@@ -140,6 +156,38 @@ void GPDModule::prepareSubModules(
(it->second).getSubModules());
}
}
//PDF
it =
subModulesData.find(
CollinearDistributionModule::COLLINEAR_DISTRIBUTION_MODULE_CLASS_NAME);
if (it != subModulesData.end()) {
if (m_pCollinearDistributionModule) {
setPDFModule(0);
m_pCollinearDistributionModule = 0;
}
if (!m_pCollinearDistributionModule) {
m_pCollinearDistributionModule =
Partons::getInstance()->getModuleObjectFactory()->newCollinearDistributionModule(
(it->second).getModuleClassName());
info(__func__,
ElemUtils::Formatter()
<< "Configure with CollinearDistributionModule = "
<< m_pCollinearDistributionModule->getClassName());
m_pCollinearDistributionModule->configure(
(it->second).getParameters());
m_pCollinearDistributionModule->prepareSubModules(
(it->second).getSubModules());
}
}
}
PartonDistribution GPDModule::compute(const GPDKinematic &kinematic,
......@@ -190,10 +238,11 @@ GPDResult GPDModule::compute(const GPDKinematic &kinematic,
GPDModule* gpdModule =
m_pModuleObjectFactory->cloneModuleObject(this);
partonDistribution = m_pGPDEvolutionModule->compute(kinematic, gpdModule, (m_it->first));
partonDistribution = m_pGPDEvolutionModule->compute(kinematic,
gpdModule, (m_it->first));
m_pModuleObjectFactory->updateModulePointerReference(gpdModule,
0);
0);
} else {
partonDistribution = ((*this).*(m_it->second))();
}
......@@ -250,6 +299,16 @@ void GPDModule::setEvolQcdModule(GPDEvolutionModule* pEvolQcdModule) {
m_pGPDEvolutionModule = pEvolQcdModule;
}
const CollinearDistributionModule* GPDModule::getPDFModule() const {
return m_pCollinearDistributionModule;
}
void GPDModule::setPDFModule(CollinearDistributionModule* pPDFModule) {
m_pModuleObjectFactory->updateModulePointerReference(
m_pCollinearDistributionModule, pPDFModule);
m_pCollinearDistributionModule = pPDFModule;
}
PartonDistribution GPDModule::computeH() {
throw ElemUtils::CustomException(getClassName(), __func__,
"Check your implementation ; must be implemented in daughter class");
......
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