From 94681c27b4656fdb897c1121cb78f904a2c26054 Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Thu, 30 Apr 2020 15:26:14 +0200 Subject: [PATCH 1/6] new observables added --- .../DVCSCrossSectionUUDVCSSubProc.h | 63 ++++++++++++++ ...CSCrossSectionUUDVCSSubProcPhiIntegrated.h | 85 ++++++++++++++++++ .../DVCSCrossSectionUUMinusPhiIntegrated.h | 85 ++++++++++++++++++ .../modules/observable/TCS/asymmetry/TCSAfb.h | 63 ++++++++++++++ .../DVCSCrossSectionUUDVCSSubProc.cpp | 59 +++++++++++++ ...CrossSectionUUDVCSSubProcPhiIntegrated.cpp | 87 +++++++++++++++++++ .../DVCSCrossSectionUUMinusPhiIntegrated.cpp | 87 +++++++++++++++++++ .../observable/TCS/asymmetry/TCSAbf.cpp | 73 ++++++++++++++++ 8 files changed, 602 insertions(+) create mode 100644 include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.h create mode 100644 include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h create mode 100644 include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.h create mode 100644 include/partons/modules/observable/TCS/asymmetry/TCSAfb.h create mode 100644 src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.cpp create mode 100644 src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.cpp create mode 100644 src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.cpp create mode 100644 src/partons/modules/observable/TCS/asymmetry/TCSAbf.cpp diff --git a/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.h b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.h new file mode 100644 index 00000000..ecd87013 --- /dev/null +++ b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.h @@ -0,0 +1,63 @@ +#ifndef DVCSCROSSSECTIONUUDVCSSUBPROC_H +#define DVCSCROSSSECTIONUUDVCSSUBPROC_H + +/** + * @file DVCSCrossSectionUUDVCSSubProc.h + * @author Pawel Sznajder (IPNO) + * @date November 25, 2016 + * @version 1.0 + */ + +#include + +#include "../../../../beans/gpd/GPDType.h" +#include "../../../../beans/List.h" +#include "../../../../utils/type/PhysicalType.h" +#include "../DVCSObservable.h" + +namespace PARTONS { + +/** + * @class DVCSCrossSectionUUDVCSSubProc + * @brief Unpolarized cross-section for DVCS only. + * + * Unit: \f$\mathrm{nbarn}/\mathrm{GeV}^4\f$. + */ +class DVCSCrossSectionUUDVCSSubProc: public DVCSObservable { + +public: + + /** + * Unique ID to automatically register the class in the registry. + */ + static const unsigned int classId; + + /** + * Constructor. + * @param className Name of class. + */ + DVCSCrossSectionUUDVCSSubProc(const std::string &className); + + /** + * Destructor. + */ + virtual ~DVCSCrossSectionUUDVCSSubProc(); + + virtual DVCSCrossSectionUUDVCSSubProc* clone() const; + +protected: + + /** + * Copy constructor. + * @param other Object to be copied. + */ + DVCSCrossSectionUUDVCSSubProc(const DVCSCrossSectionUUDVCSSubProc &other); + + virtual PhysicalType computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType); +}; + +} /* namespace PARTONS */ + +#endif /* DVCSCROSSSECTIONUUDVCSSUBPROC_H */ diff --git a/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h new file mode 100644 index 00000000..74c04d64 --- /dev/null +++ b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h @@ -0,0 +1,85 @@ +#ifndef DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H +#define DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H + +/** + * @file DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h + * @author Luca COLANERI (IPNO) + * @date April 24, 2017 + * @version 1.0 + */ + +#include +#include +#include + +#include "../../../../beans/gpd/GPDType.h" +#include "../../../../beans/List.h" +#include "../../../../utils/type/PhysicalType.h" +#include "../../../MathIntegratorModule.h" +#include "DVCSCrossSectionUUDVCSSubProc.h" + +namespace PARTONS { + +/** + * @class DVCSCrossSectionUUDVCSSubProcPhiIntegrated + * @brief Unpolarized cross-section for electro-production integrated over \f$\phi\f$. + * + * Unit: \f$\mathrm{nbarn}/\mathrm{GeV}^4\f$. + */ +class DVCSCrossSectionUUDVCSSubProcPhiIntegrated: public DVCSCrossSectionUUDVCSSubProc, + public MathIntegratorModule { + +public: + + /** + * Unique ID to automatically register the class in the registry. + */ + static const unsigned int classId; + + /** + * Constructor. + * @param className Name of class. + */ + DVCSCrossSectionUUDVCSSubProcPhiIntegrated(const std::string &className); + + /** + * Destructor. + */ + virtual ~DVCSCrossSectionUUDVCSSubProcPhiIntegrated(); + + virtual DVCSCrossSectionUUDVCSSubProcPhiIntegrated* clone() const; + virtual void configure(const ElemUtils::Parameters ¶meters); + +protected: + + /** + * Copy constructor. + * @param other Object to be copied. + */ + DVCSCrossSectionUUDVCSSubProcPhiIntegrated( + const DVCSCrossSectionUUDVCSSubProcPhiIntegrated &other); + + virtual PhysicalType computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType); + + /** + * Functor to perform the integration. + */ + NumA::FunctionType1D* m_pFunctionToIntegrateObservable; + + /** + * Function to be integrated. + */ + virtual double functionToIntegrateObservable(double x, + std::vector params); + + /** + * Initialize functors. + */ + void initFunctorsForIntegrations(); +}; + +} /* namespace PARTONS */ + +#endif /* DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H */ diff --git a/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.h b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.h new file mode 100644 index 00000000..1a864352 --- /dev/null +++ b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.h @@ -0,0 +1,85 @@ +#ifndef DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H +#define DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H + +/** + * @file DVCSCrossSectionUUMinusPhiIntegrated.h + * @author Luca COLANERI (IPNO) + * @date April 24, 2017 + * @version 1.0 + */ + +#include +#include +#include + +#include "../../../../beans/gpd/GPDType.h" +#include "../../../../beans/List.h" +#include "../../../../utils/type/PhysicalType.h" +#include "../../../MathIntegratorModule.h" +#include "DVCSCrossSectionUUMinus.h" + +namespace PARTONS { + +/** + * @class DVCSCrossSectionUUMinusPhiIntegrated + * @brief Unpolarized cross-section for electro-production integrated over \f$\phi\f$. + * + * Unit: \f$\mathrm{nbarn}/\mathrm{GeV}^4\f$. + */ +class DVCSCrossSectionUUMinusPhiIntegrated: public DVCSCrossSectionUUMinus, + public MathIntegratorModule { + +public: + + /** + * Unique ID to automatically register the class in the registry. + */ + static const unsigned int classId; + + /** + * Constructor. + * @param className Name of class. + */ + DVCSCrossSectionUUMinusPhiIntegrated(const std::string &className); + + /** + * Destructor. + */ + virtual ~DVCSCrossSectionUUMinusPhiIntegrated(); + + virtual DVCSCrossSectionUUMinusPhiIntegrated* clone() const; + virtual void configure(const ElemUtils::Parameters ¶meters); + +protected: + + /** + * Copy constructor. + * @param other Object to be copied. + */ + DVCSCrossSectionUUMinusPhiIntegrated( + const DVCSCrossSectionUUMinusPhiIntegrated &other); + + virtual PhysicalType computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType); + + /** + * Functor to perform the integration. + */ + NumA::FunctionType1D* m_pFunctionToIntegrateObservable; + + /** + * Function to be integrated. + */ + virtual double functionToIntegrateObservable(double x, + std::vector params); + + /** + * Initialize functors. + */ + void initFunctorsForIntegrations(); +}; + +} /* namespace PARTONS */ + +#endif /* DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H */ diff --git a/include/partons/modules/observable/TCS/asymmetry/TCSAfb.h b/include/partons/modules/observable/TCS/asymmetry/TCSAfb.h new file mode 100644 index 00000000..d0a96237 --- /dev/null +++ b/include/partons/modules/observable/TCS/asymmetry/TCSAfb.h @@ -0,0 +1,63 @@ +#ifndef TCSACU_H +#define TCSACU_H + +/** + * @file TCSAfb.h + * @author Pawel Sznajder (IPNO) + * @date November 25, 2016 + * @version 1.0 + */ + +#include + +#include "../../../../beans/gpd/GPDType.h" +#include "../../../../beans/List.h" +#include "../../../../utils/type/PhysicalType.h" +#include "../TCSObservable.h" + +namespace PARTONS { + +/** + * @class TCSAfb + * @brief Forward-backward TCS asymmetry. + * + * Unit: none. + */ +class TCSAfb: public TCSObservable { + +public: + + /** + * Unique ID to automatically register the class in the registry. + */ + static const unsigned int classId; + + /** + * Constructor. + * @param className Name of class. + */ + TCSAfb(const std::string &className); + + /** + * Destructor. + */ + virtual ~TCSAfb(); + + virtual TCSAfb* clone() const; + +protected: + + /** + * Copy constructor. + * @param other Object to be copied. + */ + TCSAfb(const TCSAfb &other); + + virtual PhysicalType computeObservable( + const TCSObservableKinematic& kinematic, + const List& gpdType); +}; + +} /* namespace PARTONS */ + +#endif /* TCSACU_H */ diff --git a/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.cpp b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.cpp new file mode 100644 index 00000000..3ef796e1 --- /dev/null +++ b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.cpp @@ -0,0 +1,59 @@ +#include "../../../../../../include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProc.h" + +#include + +#include "../../../../../../include/partons/beans/observable/ObservableResult.h" +#include "../../../../../../include/partons/beans/process/VCSSubProcessType.h" +#include "../../../../../../include/partons/BaseObjectRegistry.h" +#include "../../../../../../include/partons/FundamentalPhysicalConstants.h" +#include "../../../../../../include/partons/modules/process/DVCS/DVCSProcessModule.h" +#include "../../../../../../include/partons/utils/type/PhysicalUnit.h" + +namespace PARTONS { + +const unsigned int DVCSCrossSectionUUDVCSSubProc::classId = + BaseObjectRegistry::getInstance()->registerBaseObject( + new DVCSCrossSectionUUDVCSSubProc( + "DVCSCrossSectionUUDVCSSubProc")); + +DVCSCrossSectionUUDVCSSubProc::DVCSCrossSectionUUDVCSSubProc( + const std::string &className) : + DVCSObservable(className) { +} + +DVCSCrossSectionUUDVCSSubProc::DVCSCrossSectionUUDVCSSubProc( + const DVCSCrossSectionUUDVCSSubProc& other) : + DVCSObservable(other) { +} + +DVCSCrossSectionUUDVCSSubProc::~DVCSCrossSectionUUDVCSSubProc() { +} + +DVCSCrossSectionUUDVCSSubProc* DVCSCrossSectionUUDVCSSubProc::clone() const { + return new DVCSCrossSectionUUDVCSSubProc(*this); +} + +PhysicalType DVCSCrossSectionUUDVCSSubProc::computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType) { + + //evaluate + DVCSObservableResult A = m_pProcessModule->compute(1., -1, + NumA::Vector3D(0., 0., 0.), kinematic, gpdType, + VCSSubProcessType::DVCS); + + DVCSObservableResult B = m_pProcessModule->compute(-1., -1, + NumA::Vector3D(0., 0., 0.), kinematic, gpdType, + VCSSubProcessType::DVCS); + + //combine + PhysicalType result = (A.getValue() + B.getValue()) / 2.; + + //integrate over transversely polarized target dependence to obtain 4-fold differential cross-section + result *= 2. * Constant::PI; + + //change to nb + return result.makeSameUnitAs(PhysicalUnit::NB); +} + +} /* namespace PARTONS */ diff --git a/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.cpp b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.cpp new file mode 100644 index 00000000..e52b4ef2 --- /dev/null +++ b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.cpp @@ -0,0 +1,87 @@ +#include "../../../../../../include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h" + +#include +#include +#include + +#include "../../../../../../include/partons/beans/observable/DVCS/DVCSObservableKinematic.h" +#include "../../../../../../include/partons/BaseObjectRegistry.h" +#include "../../../../../../include/partons/FundamentalPhysicalConstants.h" +#include "../../../../../../include/partons/modules/observable/Observable.h" +#include "../../../../../../include/partons/utils/type/PhysicalUnit.h" + +namespace PARTONS { + +const unsigned int DVCSCrossSectionUUDVCSSubProcPhiIntegrated::classId = + BaseObjectRegistry::getInstance()->registerBaseObject( + new DVCSCrossSectionUUDVCSSubProcPhiIntegrated( + "DVCSCrossSectionUUDVCSSubProcPhiIntegrated")); + +DVCSCrossSectionUUDVCSSubProcPhiIntegrated::DVCSCrossSectionUUDVCSSubProcPhiIntegrated( + const std::string &className) : + DVCSCrossSectionUUDVCSSubProc(className), MathIntegratorModule(), m_pFunctionToIntegrateObservable( + 0) { + + setIntegrator(NumA::IntegratorType1D::DEXP); + initFunctorsForIntegrations(); +} + +DVCSCrossSectionUUDVCSSubProcPhiIntegrated::DVCSCrossSectionUUDVCSSubProcPhiIntegrated( + const DVCSCrossSectionUUDVCSSubProcPhiIntegrated& other) : + DVCSCrossSectionUUDVCSSubProc(other), MathIntegratorModule(other) { + + m_pFunctionToIntegrateObservable = 0; + initFunctorsForIntegrations(); +} + +DVCSCrossSectionUUDVCSSubProcPhiIntegrated::~DVCSCrossSectionUUDVCSSubProcPhiIntegrated() { + + if (m_pFunctionToIntegrateObservable) { + delete m_pFunctionToIntegrateObservable; + m_pFunctionToIntegrateObservable = 0; + } +} + +void DVCSCrossSectionUUDVCSSubProcPhiIntegrated::initFunctorsForIntegrations() { + m_pFunctionToIntegrateObservable = + NumA::Integrator1D::newIntegrationFunctor(this, + &DVCSCrossSectionUUDVCSSubProcPhiIntegrated::functionToIntegrateObservable); +} + +DVCSCrossSectionUUDVCSSubProcPhiIntegrated* DVCSCrossSectionUUDVCSSubProcPhiIntegrated::clone() const { + return new DVCSCrossSectionUUDVCSSubProcPhiIntegrated(*this); +} + +void DVCSCrossSectionUUDVCSSubProcPhiIntegrated::configure( + const ElemUtils::Parameters ¶meters) { + + DVCSCrossSectionUUDVCSSubProc::configure(parameters); + MathIntegratorModule::configureIntegrator(parameters); +} + +double DVCSCrossSectionUUDVCSSubProcPhiIntegrated::functionToIntegrateObservable( + double x, std::vector params) { + + DVCSObservableKinematic kinematic; + List gpdType; + + unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType); + + kinematic.setPhi(PhysicalType(x, PhysicalUnit::RAD)); + + return DVCSCrossSectionUUDVCSSubProc::computeObservable(kinematic, gpdType).getValue(); +} + +PhysicalType DVCSCrossSectionUUDVCSSubProcPhiIntegrated::computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType) { + + std::vector params = serializeKinematicsAndGPDTypesIntoStdVector( + kinematic, gpdType); + + return PhysicalType( + integrate(m_pFunctionToIntegrateObservable, 0., (2 * Constant::PI), + params), PhysicalUnit::NB); +} + +} /* namespace PARTONS */ diff --git a/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.cpp b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.cpp new file mode 100644 index 00000000..2a3ffe83 --- /dev/null +++ b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.cpp @@ -0,0 +1,87 @@ +#include "../../../../../../include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionUUMinusPhiIntegrated.h" + +#include +#include +#include + +#include "../../../../../../include/partons/beans/observable/DVCS/DVCSObservableKinematic.h" +#include "../../../../../../include/partons/BaseObjectRegistry.h" +#include "../../../../../../include/partons/FundamentalPhysicalConstants.h" +#include "../../../../../../include/partons/modules/observable/Observable.h" +#include "../../../../../../include/partons/utils/type/PhysicalUnit.h" + +namespace PARTONS { + +const unsigned int DVCSCrossSectionUUMinusPhiIntegrated::classId = + BaseObjectRegistry::getInstance()->registerBaseObject( + new DVCSCrossSectionUUMinusPhiIntegrated( + "DVCSCrossSectionUUMinusPhiIntegrated")); + +DVCSCrossSectionUUMinusPhiIntegrated::DVCSCrossSectionUUMinusPhiIntegrated( + const std::string &className) : + DVCSCrossSectionUUMinus(className), MathIntegratorModule(), m_pFunctionToIntegrateObservable( + 0) { + + setIntegrator(NumA::IntegratorType1D::DEXP); + initFunctorsForIntegrations(); +} + +DVCSCrossSectionUUMinusPhiIntegrated::DVCSCrossSectionUUMinusPhiIntegrated( + const DVCSCrossSectionUUMinusPhiIntegrated& other) : + DVCSCrossSectionUUMinus(other), MathIntegratorModule(other) { + + m_pFunctionToIntegrateObservable = 0; + initFunctorsForIntegrations(); +} + +DVCSCrossSectionUUMinusPhiIntegrated::~DVCSCrossSectionUUMinusPhiIntegrated() { + + if (m_pFunctionToIntegrateObservable) { + delete m_pFunctionToIntegrateObservable; + m_pFunctionToIntegrateObservable = 0; + } +} + +void DVCSCrossSectionUUMinusPhiIntegrated::initFunctorsForIntegrations() { + m_pFunctionToIntegrateObservable = + NumA::Integrator1D::newIntegrationFunctor(this, + &DVCSCrossSectionUUMinusPhiIntegrated::functionToIntegrateObservable); +} + +DVCSCrossSectionUUMinusPhiIntegrated* DVCSCrossSectionUUMinusPhiIntegrated::clone() const { + return new DVCSCrossSectionUUMinusPhiIntegrated(*this); +} + +void DVCSCrossSectionUUMinusPhiIntegrated::configure( + const ElemUtils::Parameters ¶meters) { + + DVCSCrossSectionUUMinus::configure(parameters); + MathIntegratorModule::configureIntegrator(parameters); +} + +double DVCSCrossSectionUUMinusPhiIntegrated::functionToIntegrateObservable( + double x, std::vector params) { + + DVCSObservableKinematic kinematic; + List gpdType; + + unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType); + + kinematic.setPhi(PhysicalType(x, PhysicalUnit::RAD)); + + return DVCSCrossSectionUUMinus::computeObservable(kinematic, gpdType).getValue(); +} + +PhysicalType DVCSCrossSectionUUMinusPhiIntegrated::computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType) { + + std::vector params = serializeKinematicsAndGPDTypesIntoStdVector( + kinematic, gpdType); + + return PhysicalType( + integrate(m_pFunctionToIntegrateObservable, 0., (2 * Constant::PI), + params), PhysicalUnit::NB); +} + +} /* namespace PARTONS */ diff --git a/src/partons/modules/observable/TCS/asymmetry/TCSAbf.cpp b/src/partons/modules/observable/TCS/asymmetry/TCSAbf.cpp new file mode 100644 index 00000000..d0eeb59e --- /dev/null +++ b/src/partons/modules/observable/TCS/asymmetry/TCSAbf.cpp @@ -0,0 +1,73 @@ +#include +#include +#include + +#include "../../../../../../include/partons/beans/gpd/GPDType.h" +#include "../../../../../../include/partons/beans/List.h" +#include "../../../../../../include/partons/beans/observable/ObservableResult.h" +#include "../../../../../../include/partons/beans/observable/TCS/TCSObservableKinematic.h" +#include "../../../../../../include/partons/BaseObjectRegistry.h" +#include "../../../../../../include/partons/modules/observable/TCS/asymmetry/TCSAfb.h" +#include "../../../../../../include/partons/modules/process/TCS/TCSProcessModule.h" +#include "../../../../../../include/partons/utils/type/PhysicalType.h" +#include "../../../../../../include/partons/utils/type/PhysicalUnit.h" + +namespace PARTONS { + +const unsigned int TCSAfb::classId = + BaseObjectRegistry::getInstance()->registerBaseObject( + new TCSAfb("TCSAfb")); + +TCSAfb::TCSAfb(const std::string &className) : + TCSObservable(className) { +} + +TCSAfb::TCSAfb(const TCSAfb& other) : + TCSObservable(other) { +} + +TCSAfb::~TCSAfb() { +} + +TCSAfb* TCSAfb::clone() const { + return new TCSAfb(*this); +} + +PhysicalType TCSAfb::computeObservable( + const TCSObservableKinematic& kinematic, const List& gpdType) { + + //backward kinematics + TCSObservableKinematic kinematicBackward = kinematic; + + kinematicBackward.setPhi( + M_PI + kinematic.getPhi().makeSameUnitAs(PhysicalUnit::RAD).getValue(), + PhysicalUnit::RAD); + kinematicBackward.setTheta( + M_PI - kinematic.getTheta().makeSameUnitAs(PhysicalUnit::RAD).getValue(), + PhysicalUnit::RAD); + + //evaluate + PhysicalType A = m_pProcessModule->compute(1, + NumA::Vector3D(0., 0., 0.), kinematic, gpdType).getValue(); + + PhysicalType B = m_pProcessModule->compute(-1, + NumA::Vector3D(0., 0., 0.), kinematic, gpdType).getValue(); + + PhysicalType C = m_pProcessModule->compute(1, + NumA::Vector3D(0., 0., 0.), kinematicBackward, gpdType).getValue(); + + PhysicalType D = m_pProcessModule->compute(-1, + NumA::Vector3D(0., 0., 0.), kinematicBackward, gpdType).getValue(); + + //combine + if ((A + B + C + D).getValue() == 0.) { + + warn(__func__, "Asymmetry denominator is zero"); + return PhysicalType(0., PhysicalUnit::NONE); + } + + //return + return ((A + B) - (C + D)) / (A + B + C + D); +} + +} /* namespace PARTONS */ -- GitLab From f6aa72b21215efbccd1345b022fbd7127a578cc5 Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Fri, 15 May 2020 16:47:32 +0200 Subject: [PATCH 2/6] add docker Dockerfile in data/docker --- data/docker/Dockerfile.partons | 77 ++++++++++++++++++++++++++ data/docker/Dockerfile.partons.mysql | 41 ++++++++++++++ data/docker/Dockerfile.partons.startup | 20 +++++++ data/docker/README | 4 ++ 4 files changed, 142 insertions(+) create mode 100644 data/docker/Dockerfile.partons create mode 100644 data/docker/Dockerfile.partons.mysql create mode 100644 data/docker/Dockerfile.partons.startup create mode 100644 data/docker/README diff --git a/data/docker/Dockerfile.partons b/data/docker/Dockerfile.partons new file mode 100644 index 00000000..12a85528 --- /dev/null +++ b/data/docker/Dockerfile.partons @@ -0,0 +1,77 @@ +# start from debian jessie +FROM debian:stretch + +# PARTONS version +ENV PARTONSTAG="v1.0" + +# set WORKSPACE env. variable +ENV WORKSPACE="/root/workspace" + +# set working directory +WORKDIR ${WORKSPACE} + +# install git +# install cmake, build and runtime libraries +RUN apt-get update && \ + apt-get install -y --no-install-recommends git && \ + apt-get install -y --no-install-recommends cmake build-essential libeigen3-dev libcln-dev libsfml-dev libqt4-dev libqt4-sql-mysql && \ + apt-get clean && \ + apt-get autoclean && \ + rm -rf /var/lib/apt/lists/* + +# pull and install elem-utils +RUN cd ${WORKSPACE} && \ + git config --global http.sslVerify false && \ + git clone --single-branch --depth 1 --branch ${PARTONSTAG} https://drf-gitlab.cea.fr/partons/core/elementary-utils.git && \ + cd ${WORKSPACE}/elementary-utils/build && \ + cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release && \ + make + +# pull and install numa +RUN cd ${WORKSPACE} && \ + git config --global http.sslVerify false && \ + git clone --single-branch --depth 1 --branch ${PARTONSTAG} https://drf-gitlab.cea.fr/partons/core/numa.git && \ + cd ${WORKSPACE}/numa/build && \ + cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release && \ + make + +# pull and install partons +RUN cd ${WORKSPACE} && \ + git config --global http.sslVerify false && \ + git clone --single-branch --depth 1 --branch ${PARTONSTAG} https://drf-gitlab.cea.fr/partons/core/partons.git && \ + cd ${WORKSPACE}/partons/build && \ + cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release && \ + make + +# pull and compile partons-example +RUN cd ${WORKSPACE} && \ + git config --global http.sslVerify false && \ + git clone --single-branch --depth 1 --branch ${PARTONSTAG} https://drf-gitlab.cea.fr/partons/core/partons-example.git && \ + cd ${WORKSPACE}/partons-example/build && \ + cmake -G"Unix Makefiles" ../ -DCMAKE_BUILD_TYPE=Release && \ + make + +# creare directories and copy scripts +RUN mkdir ${WORKSPACE}/.docker && \ + mkdir ${WORKSPACE}/partons-example/scenarios + +COPY ./Dockerfile.partons.mysql ${WORKSPACE}/.docker +COPY ./Dockerfile.partons.startup ${WORKSPACE}/.docker + +RUN chmod u+x ${WORKSPACE}/.docker/Dockerfile.partons.mysql && \ + chmod u+x ${WORKSPACE}/.docker/Dockerfile.partons.startup + +# set up database +RUN echo "mysql-server mysql-server/root_password password partons" | debconf-set-selections && \ + echo "mysql-server mysql-server/root_password_again password partons" | debconf-set-selections && \ + apt-get update && \ + apt-get install -y --no-install-recommends mysql-server && \ + apt-get clean && \ + apt-get autoclean && \ + rm -rf /var/lib/apt/lists/* && \ + ${WORKSPACE}/.docker/Dockerfile.partons.mysql && \ + rm ${WORKSPACE}/.docker/Dockerfile.partons.mysql + +# start mysql server each time container is used +# due to issue: https://github.com/docker/for-linux/issues/72 +ENTRYPOINT [".docker/Dockerfile.partons.startup"] diff --git a/data/docker/Dockerfile.partons.mysql b/data/docker/Dockerfile.partons.mysql new file mode 100644 index 00000000..80f0a7ae --- /dev/null +++ b/data/docker/Dockerfile.partons.mysql @@ -0,0 +1,41 @@ +#!/bin/bash + +# start +find /var/lib/mysql -type f -exec touch {} \; +service mysql start &> /dev/null + +# set env. +__mysql_database="partons" +__mysql_root="root" +__mysql_root_password="partons" +__mysql_user="partons" +__mysql_user_password="partons" + +#define functioni to execute queries +function sql_exec() { + mysql -u "${__mysql_root}" -D "${__mysql_database}" -p${__mysql_root_password} -e "${1}" +} + +# go to directory with schema +cd /root/workspace/partons/data/database/sql_schema + +# create database and add user +mysql -u "${__mysql_root}" -p"${__mysql_root_password}" -e "create database ${__mysql_database}" +sql_exec "CREATE USER '${__mysql_user}'@'localhost' IDENTIFIED BY '${__mysql_user_password}';" +sql_exec "GRANT SELECT, INSERT, UPDATE, DELETE ON ${__mysql_database}.* TO '${__mysql_user}'@'localhost';" +sql_exec "GRANT FILE ON *.* TO '${__mysql_user}'@'localhost';" + +# excecute scripts +# TODO: if scripts are going to be enumerated this piece of the code +#+ can be automated, therefore will need less further involvement +#+ of anyone. +#+ +#+ Desirable naming might look like following: +#+ mysql5_common.sql -> mysql5_001_common.sql +#+ mysql5_gpd_layer.sql -> mysql5_002_gpd_layer.sql +#+ mysql5_convol_coeff_function_layer.sql -> mysql5_003_convol_coeff_function_layer.sql +#+ mysql5_observable_layer.sql -> mysql5_004_observable_layer.sql +sql_exec "SOURCE mysql5_common.sql" +sql_exec "SOURCE mysql5_gpd_layer.sql" +sql_exec "SOURCE mysql5_convol_coeff_function_layer.sql" +sql_exec "SOURCE mysql5_observable_layer.sql" diff --git a/data/docker/Dockerfile.partons.startup b/data/docker/Dockerfile.partons.startup new file mode 100644 index 00000000..6c04632a --- /dev/null +++ b/data/docker/Dockerfile.partons.startup @@ -0,0 +1,20 @@ +#!/bin/bash + + +echo "Welcome to PARTONS" +echo "See http://partons.cea.fr for description and technical documentation" + +#mysql +find /var/lib/mysql -type f -exec touch {} \; +service mysql start &> /dev/null + +if [ $# -eq 0 ]; then + /bin/bash +else + + cd /root/workspace/partons-example + + for i in $@; do + ./bin/PARTONS_example scenarios/$i + done +fi diff --git a/data/docker/README b/data/docker/README new file mode 100644 index 00000000..01dd1133 --- /dev/null +++ b/data/docker/README @@ -0,0 +1,4 @@ +to create new image: +1) select PARTONS version (code tag) in Dockerfile.partons +2) execute (remamber to change vX.Y): + docker build . -f Dockerfile.partons -t pawelsznajder/partons:vX.Y -- GitLab From 11c25c4c17df9374a776f2c95e17971095a4a699 Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Fri, 15 May 2020 16:48:20 +0200 Subject: [PATCH 3/6] change Dockerfile for v2.0 --- data/docker/Dockerfile.partons | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/docker/Dockerfile.partons b/data/docker/Dockerfile.partons index 12a85528..a0fb9dcb 100644 --- a/data/docker/Dockerfile.partons +++ b/data/docker/Dockerfile.partons @@ -2,7 +2,7 @@ FROM debian:stretch # PARTONS version -ENV PARTONSTAG="v1.0" +ENV PARTONSTAG="v2.0" # set WORKSPACE env. variable ENV WORKSPACE="/root/workspace" @@ -14,7 +14,7 @@ WORKDIR ${WORKSPACE} # install cmake, build and runtime libraries RUN apt-get update && \ apt-get install -y --no-install-recommends git && \ - apt-get install -y --no-install-recommends cmake build-essential libeigen3-dev libcln-dev libsfml-dev libqt4-dev libqt4-sql-mysql && \ + apt-get install -y --no-install-recommends cmake build-essential libeigen3-dev libcln-dev libsfml-dev libqt4-dev libqt4-sql-mysql libgsl-dev && \ apt-get clean && \ apt-get autoclean && \ rm -rf /var/lib/apt/lists/* -- GitLab From 67e361d0041bed8e0c4ca62a63c1be0b05d12cf4 Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Fri, 15 May 2020 17:10:38 +0200 Subject: [PATCH 4/6] add docker description in Download page --- doc/markdown/partons_download.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/markdown/partons_download.md b/doc/markdown/partons_download.md index 5eda0c23..2fb32510 100644 --- a/doc/markdown/partons_download.md +++ b/doc/markdown/partons_download.md @@ -39,3 +39,21 @@ User | 25/02/2020 | 2.0 | [Download](http://partons.cea.fr/vm/ Developer | 25/02/2020 | 2.0 | [Download](http://partons.cea.fr/vm/PARTONS_250220_DEV.ova) | 2.8 GB | The `Developer` version has a set-up development environment in Eclipse to start contributing to the %PARTONS project, and has more packages installed, which makes the image heavier. + +# Docker {#download_docker} + +Docker images containing PARTONS with its runtime environment are available via [DockerHub](https://hub.docker.com), see [here](https://hub.docker.com/repository/docker/partons/partons). The basic usage is the following: +* pull the image (by default containing the latest version of PARTONS) +~~~~~~~~~~~~~{.sh} +docker pull partons/partons +~~~~~~~~~~~~~ +* run interactively +~~~~~~~~~~~~~{.sh} +docker run -it --rm partons/partons +~~~~~~~~~~~~~ +* use image as executable: run specific scenario (here: 'myScenario.xml') stored in your host (here: in 'ABSOLUTEPATH/MYDIR' directory) +~~~~~~~~~~~~~{.sh} +docker run -it --rm -v ABSOLUTEPATH/MYDIR:/root/workspace/partons-example/scenarios partons/partons myScenario.xml +~~~~~~~~~~~~~ + +For more details please see Docker manual. -- GitLab From d74fdcdd4c9ab42a0412dc551008de7acd0f2bfb Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Sun, 17 May 2020 12:26:42 +0200 Subject: [PATCH 5/6] improve README in docker --- data/docker/README | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/data/docker/README b/data/docker/README index 01dd1133..9c2a35f2 100644 --- a/data/docker/README +++ b/data/docker/README @@ -1,4 +1,10 @@ -to create new image: +to create new image and send it to DockerHub: 1) select PARTONS version (code tag) in Dockerfile.partons -2) execute (remamber to change vX.Y): - docker build . -f Dockerfile.partons -t pawelsznajder/partons:vX.Y +2) execute (remember to change vX.Y): + docker build . -f Dockerfile.partons -t partons/partons:vX.Y +3) push (remember to change vX.Y): + docker push partons/partons:vX.Y +4) also tag as latest (remember to change vX.Y): + docker image tag partons/partons:vX.Y partons/partons:lates +5) push: + docker push partons/partons:latest \ No newline at end of file -- GitLab From 2415ead2c8f08f5937433df5c97ca1d02c5db132 Mon Sep 17 00:00:00 2001 From: Pawel Sznajder Date: Mon, 18 May 2020 11:42:29 +0200 Subject: [PATCH 6/6] Add observable evaluating total DVCS cross-section --- .../cross_section/DVCSCrossSectionTotal.h | 125 ++++++++ .../cross_section/DVCSCrossSectionTotal.cpp | 296 ++++++++++++++++++ 2 files changed, 421 insertions(+) create mode 100644 include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.h create mode 100644 src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.cpp diff --git a/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.h b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.h new file mode 100644 index 00000000..c0c37f12 --- /dev/null +++ b/include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.h @@ -0,0 +1,125 @@ +#ifndef DVCSCROSSSECTIONTOTAL_H +#define DVCSCROSSSECTIONTOTAL_H + +/** + * @file DVCSCrossSectionTotal.h + * @author Pawel Sznajder (NCBJ) + * @date May 17, 2020 + * @version 1.0 + */ + +#include +#include +#include +#include + +#include "../../../../beans/gpd/GPDType.h" +#include "../../../../beans/List.h" +#include "../../../../utils/type/PhysicalType.h" +#include "DVCSCrossSectionUUMinusPhiIntegrated.h" + +namespace PARTONS { + +/** + * @class DVCSCrossSectionTotal + * @brief Unpolarized cross-section for electro-production integrated over \f$xB\f$, \f$Q^{2}\f$, \f$t\f$ and angles. + * + * Default ranges: \f$1E-4 < xB < 0.7\f$, \f$-1 < t < 0\f$, \f$1 < Q^{2} < 1E3\f$ and \f$0 < y < 1\f$. Full integration over angles. + * + * Unit: \f$\mathrm{nbarn}\f$. + */ +class DVCSCrossSectionTotal: public DVCSCrossSectionUUMinusPhiIntegrated { + +public: + + static const std::string DVCS_CROSSSECTION_TOTAL_RANGEXb; ///< String used to set integration xB range via XML scenario. + static const std::string DVCS_CROSSSECTION_TOTAL_RANGET; ///< String used to set integration t range via XML scenario. + static const std::string DVCS_CROSSSECTION_TOTAL_RANGEQ2; ///< String used to set integration Q2 range via XML scenario. + static const std::string DVCS_CROSSSECTION_TOTAL_RANGEY; ///< String used to set integration y range via XML scenario. + static const std::string DVCS_CROSSSECTION_TOTAL_N0; ///< String used to set number of MC integration iterations per cycle via XML scenario. + static const std::string DVCS_CROSSSECTION_TOTAL_N1; ///< String used to set number of MC integration cycles via XML scenario. + + /** + * Unique ID to automatically register the class in the registry. + */ + static const unsigned int classId; + + /** + * Function for the integration. + */ + static double DVCSCrossSectionTotalFunction(double* kin, size_t dim, + void* par); + + /** + * Constructor. + * @param className Name of class. + */ + DVCSCrossSectionTotal(const std::string &className); + + /** + * Destructor. + */ + virtual ~DVCSCrossSectionTotal(); + + virtual DVCSCrossSectionTotal* clone() const; + virtual void configure(const ElemUtils::Parameters ¶meters); + + size_t getNI0() const; + void setNI0(size_t nI0); + size_t getNI1() const; + void setNI1(size_t nI1); + const std::pair& getRangeQ2() const; + void setRangeQ2(const std::pair& rangeQ2); + const std::pair& getRangeT() const; + void setRangeT(const std::pair& rangeT); + const std::pair& getRangexB() const; + void setRangexB(const std::pair& rangexB); + const std::pair& getRangeY() const; + void setRangeY(const std::pair& rangeY); + +protected: + + /** + * Copy constructor. + * @param other Object to be copied. + */ + DVCSCrossSectionTotal(const DVCSCrossSectionTotal &other); + + virtual PhysicalType computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType); + +private: + + /** + * Print change of ranges. + */ + void printChangeOfRange(const std::string& func, const std::string& name, + const std::pair& oldValues, + const std::pair& newValues) const; + + /** + * Parse range. + */ + std::pair parseRange(const std::string& str) const; + + size_t m_nI0; ///< Number of iteration in single cycle. + size_t m_nI1; ///< Number of cycles. + + std::pair m_rangexB; ///< xB integration range. + std::pair m_rangeT; ///< t integration range. + std::pair m_rangeQ2; ///< Q2 integration range. + std::pair m_rangeY; ///< y integration range. +}; + +struct DVCSCrossSectionTotalParameters { + + DVCSCrossSectionTotal* m_pDVCSCrossSectionTotal; ///< Pointer to DVCSCrossSectionTotal. + double m_E; ///< Beam energy. + List m_gpdType; ///< GPD types. + std::pair m_yCut; +}; + +} /* namespace PARTONS */ + +#endif /* DVCSCROSSSECTIONTOTAL_H */ diff --git a/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.cpp b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.cpp new file mode 100644 index 00000000..d3e108a1 --- /dev/null +++ b/src/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.cpp @@ -0,0 +1,296 @@ +#include "../../../../../../include/partons/modules/observable/DVCS/cross_section/DVCSCrossSectionTotal.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../../../../../include/partons/beans/observable/DVCS/DVCSObservableKinematic.h" +#include "../../../../../../include/partons/BaseObjectRegistry.h" +#include "../../../../../../include/partons/FundamentalPhysicalConstants.h" +#include "../../../../../../include/partons/utils/type/PhysicalUnit.h" + +namespace PARTONS { + +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_RANGEXb = + "DVCSCrossSectionTotal_rangeXb"; +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_RANGET = + "DVCSCrossSectionTotal_rangeT"; +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_RANGEQ2 = + "DVCSCrossSectionTotal_rangeQ2"; +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_RANGEY = + "DVCSCrossSectionTotal_rangeY"; +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_N0 = + "DVCSCrossSectionTotal_rangeN0"; +const std::string DVCSCrossSectionTotal::DVCS_CROSSSECTION_TOTAL_N1 = + "DVCSCrossSectionTotal_rangeN1"; + +const unsigned int DVCSCrossSectionTotal::classId = + BaseObjectRegistry::getInstance()->registerBaseObject( + new DVCSCrossSectionTotal("DVCSCrossSectionTotal")); + +DVCSCrossSectionTotal::DVCSCrossSectionTotal(const std::string &className) : + DVCSCrossSectionUUMinusPhiIntegrated(className), m_nI0(1000), m_nI1(5) { + + m_rangexB = std::pair(1.E-4, 0.7); + m_rangeT = std::pair(-1., 0.); + m_rangeQ2 = std::pair(1., 1.E3); + m_rangeY = std::pair(0., 1.); +} + +DVCSCrossSectionTotal::DVCSCrossSectionTotal(const DVCSCrossSectionTotal& other) : + DVCSCrossSectionUUMinusPhiIntegrated(other), m_nI0(other.m_nI0), m_nI1( + other.m_nI1) { + + m_rangexB = other.m_rangexB; + m_rangeT = other.m_rangeT; + m_rangeQ2 = other.m_rangeQ2; + m_rangeY = other.m_rangeY; +} + +DVCSCrossSectionTotal::~DVCSCrossSectionTotal() { +} + +DVCSCrossSectionTotal* DVCSCrossSectionTotal::clone() const { + return new DVCSCrossSectionTotal(*this); +} + +void DVCSCrossSectionTotal::configure(const ElemUtils::Parameters ¶meters) { + + //run for base + DVCSCrossSectionUUMinusPhiIntegrated::configure(parameters); + + //check + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_RANGEXb)) { + setRangexB(parseRange(parameters.getLastAvailable().getString())); + } + + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_RANGET)) { + setRangeT(parseRange(parameters.getLastAvailable().getString())); + } + + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_RANGEQ2)) { + setRangeQ2(parseRange(parameters.getLastAvailable().getString())); + } + + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_RANGEY)) { + setRangeY(parseRange(parameters.getLastAvailable().getString())); + } + + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_N0)) { + setNI0( + ElemUtils::GenericType( + parameters.getLastAvailable().getString()).toUInt()); + } + + if (parameters.isAvailable(DVCS_CROSSSECTION_TOTAL_N1)) { + setNI1( + ElemUtils::GenericType( + parameters.getLastAvailable().getString()).toUInt()); + } +} + +double DVCSCrossSectionTotal::DVCSCrossSectionTotalFunction(double* kin, + size_t dim, void* par) { + + //parameters + DVCSCrossSectionTotalParameters* params = + static_cast(par); + double xB = kin[0]; + double t = kin[1]; + double Q2 = kin[2]; + double E = params->m_E; + + //check kinematic range + double y = Q2 / (2 * xB * Constant::PROTON_MASS * E); + double epsilon = 2 * xB * Constant::PROTON_MASS / sqrt(Q2); + double eps2 = epsilon * epsilon; + double epsroot = sqrt(1 + eps2); + double tfactor = -Q2 / (4 * xB * (1 - xB) + eps2); + double tmin = tfactor * (2 * (1 - xB) * (1 - epsroot) + eps2); + double tmax = tfactor * (2 * (1 - xB) * (1 + epsroot) + eps2); + double xBmin = 2 * Q2 * E / Constant::PROTON_MASS / (4 * E * E - Q2); + + if (xB < xBmin || xB > 1.) + return 0.; + + if (t > tmin || t < tmax) + return 0.; + + if (y < params->m_yCut.first || y > params->m_yCut.second) + return 0.; + + //evaluate + double result = + params->m_pDVCSCrossSectionTotal->DVCSCrossSectionUUMinusPhiIntegrated::computeObservable( + DVCSObservableKinematic(xB, t, Q2, E, 0.), + params->m_gpdType).getValue(); + + return result; +} + +PhysicalType DVCSCrossSectionTotal::computeObservable( + const DVCSObservableKinematic& kinematic, + const List& gpdType) { + + //result and error + double res, err; + + //parameters + DVCSCrossSectionTotalParameters params; + + params.m_pDVCSCrossSectionTotal = this; + params.m_E = kinematic.getE().getValue(); + + //Q2 max + double maxQ2 = 2 * Constant::PROTON_MASS * kinematic.getE().getValue(); + + if (m_rangeQ2.second > maxQ2) { + warn(__func__, + ElemUtils::Formatter() << "Upper limit of Q2 " + << m_rangeQ2.second + << " grater than maximum value allowed for this energy, " + << maxQ2 << ", the later used instead"); + } + + //ranges + // xB, Q2, t + double xl[3] = { m_rangexB.first, m_rangeT.first, m_rangeQ2.first }; + double xu[3] = { m_rangexB.second, m_rangeT.second, ( + (m_rangeQ2.second > maxQ2) ? (maxQ2) : (m_rangeQ2.second)) }; + + // y cut + params.m_yCut = m_rangeY; + + //random + const gsl_rng_type* T = gsl_rng_default; + gsl_rng* r = gsl_rng_alloc(T); + + //function + gsl_monte_function G = { &DVCSCrossSectionTotalFunction, 3, ¶ms }; + + //run + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc(3); + + for (size_t i = 0; i < m_nI1; i++) { + + gsl_monte_vegas_integrate(&G, xl, xu, 3, m_nI0, r, s, &res, &err); + + info(__func__, + ElemUtils::Formatter() << "Intermediate result: cycle: " << i + << " result: " << res << " error: " << err << " [nb]"); + } + + //free + gsl_monte_vegas_free(s); + gsl_rng_free(r); + + //return + return PhysicalType(res, PhysicalUnit::NB); +} + +void DVCSCrossSectionTotal::printChangeOfRange(const std::string& func, + const std::string& name, const std::pair& oldValues, + const std::pair& newValues) const { + info(func, + ElemUtils::Formatter() << "Integration range of " << name + << " changed from (" << oldValues.first << ", " + << oldValues.second << ") to (" << newValues.first << ", " + << newValues.second << ")"); +} + +std::pair DVCSCrossSectionTotal::parseRange( + const std::string& str) const { + + // split string + std::vector resultStr = ElemUtils::StringUtils::split(str, + '|'); + + //check size + if (resultStr.size() != 2) { + throw ElemUtils::CustomException(getClassName(), __func__, + ElemUtils::Formatter() << "Unable to parse " << str + << " into range"); + } + + //result + return std::pair( + ElemUtils::GenericType(resultStr.at(0)).toDouble(), + ElemUtils::GenericType(resultStr.at(1)).toDouble()); + +} + +size_t DVCSCrossSectionTotal::getNI0() const { + return m_nI0; +} + +void DVCSCrossSectionTotal::setNI0(size_t nI0) { + + info(__func__, + ElemUtils::Formatter() + << "Number of iteration in single cycle changed from " + << m_nI0 << " to " << nI0); + m_nI0 = nI0; +} + +size_t DVCSCrossSectionTotal::getNI1() const { + return m_nI1; +} + +void DVCSCrossSectionTotal::setNI1(size_t nI1) { + + info(__func__, + ElemUtils::Formatter() << "Number of cycles changed from " << m_nI1 + << " to " << nI1); + m_nI1 = nI1; +} + +const std::pair& DVCSCrossSectionTotal::getRangeQ2() const { + return m_rangeQ2; +} + +void DVCSCrossSectionTotal::setRangeQ2( + const std::pair& rangeQ2) { + + printChangeOfRange(__func__, "Q2", m_rangeQ2, rangeQ2); + m_rangeQ2 = rangeQ2; +} + +const std::pair& DVCSCrossSectionTotal::getRangeT() const { + return m_rangeT; +} + +void DVCSCrossSectionTotal::setRangeT(const std::pair& rangeT) { + + printChangeOfRange(__func__, "t", m_rangeT, rangeT); + m_rangeT = rangeT; +} + +const std::pair& DVCSCrossSectionTotal::getRangexB() const { + return m_rangexB; +} + +void DVCSCrossSectionTotal::setRangexB( + const std::pair& rangexB) { + + printChangeOfRange(__func__, "xB", m_rangexB, rangexB); + m_rangexB = rangexB; +} + +const std::pair& DVCSCrossSectionTotal::getRangeY() const { + return m_rangeY; +} + +void DVCSCrossSectionTotal::setRangeY(const std::pair& rangeY) { + + printChangeOfRange(__func__, "y", m_rangeY, rangeY); + m_rangeY = rangeY; +} + +} /* namespace PARTONS */ + -- GitLab