Commit 55a3a618 authored by Valerio Bertone's avatar Valerio Bertone
Browse files

Merge branch '49-new_observables' into 'master'

new observables

Closes #49

See merge request !28
parents d32b698a 2415ead2
# start from debian jessie
FROM debian:stretch
# PARTONS version
ENV PARTONSTAG="v2.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 libgsl-dev && \
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"]
#!/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"
#!/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
to create new image and send it to DockerHub:
1) select PARTONS version (code tag) in Dockerfile.partons
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
......@@ -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.
#ifndef DVCSCROSSSECTIONTOTAL_H
#define DVCSCROSSSECTIONTOTAL_H
/**
* @file DVCSCrossSectionTotal.h
* @author Pawel Sznajder (NCBJ)
* @date May 17, 2020
* @version 1.0
*/
#include <ElementaryUtils/parameters/Parameters.h>
#include <stddef.h>
#include <string>
#include <utility>
#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 &parameters);
size_t getNI0() const;
void setNI0(size_t nI0);
size_t getNI1() const;
void setNI1(size_t nI1);
const std::pair<double, double>& getRangeQ2() const;
void setRangeQ2(const std::pair<double, double>& rangeQ2);
const std::pair<double, double>& getRangeT() const;
void setRangeT(const std::pair<double, double>& rangeT);
const std::pair<double, double>& getRangexB() const;
void setRangexB(const std::pair<double, double>& rangexB);
const std::pair<double, double>& getRangeY() const;
void setRangeY(const std::pair<double, double>& rangeY);
protected:
/**
* Copy constructor.
* @param other Object to be copied.
*/
DVCSCrossSectionTotal(const DVCSCrossSectionTotal &other);
virtual PhysicalType<double> computeObservable(
const DVCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
private:
/**
* Print change of ranges.
*/
void printChangeOfRange(const std::string& func, const std::string& name,
const std::pair<double, double>& oldValues,
const std::pair<double, double>& newValues) const;
/**
* Parse range.
*/
std::pair<double, double> 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<double, double> m_rangexB; ///< xB integration range.
std::pair<double, double> m_rangeT; ///< t integration range.
std::pair<double, double> m_rangeQ2; ///< Q2 integration range.
std::pair<double, double> m_rangeY; ///< y integration range.
};
struct DVCSCrossSectionTotalParameters {
DVCSCrossSectionTotal* m_pDVCSCrossSectionTotal; ///< Pointer to DVCSCrossSectionTotal.
double m_E; ///< Beam energy.
List<GPDType> m_gpdType; ///< GPD types.
std::pair<double, double> m_yCut;
};
} /* namespace PARTONS */
#endif /* DVCSCROSSSECTIONTOTAL_H */
#ifndef DVCSCROSSSECTIONUUDVCSSUBPROC_H
#define DVCSCROSSSECTIONUUDVCSSUBPROC_H
/**
* @file DVCSCrossSectionUUDVCSSubProc.h
* @author Pawel Sznajder (IPNO)
* @date November 25, 2016
* @version 1.0
*/
#include <string>
#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<double> computeObservable(
const DVCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
};
} /* namespace PARTONS */
#endif /* DVCSCROSSSECTIONUUDVCSSUBPROC_H */
#ifndef DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H
#define DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H
/**
* @file DVCSCrossSectionUUDVCSSubProcPhiIntegrated.h
* @author Luca COLANERI (IPNO)
* @date April 24, 2017
* @version 1.0
*/
#include <ElementaryUtils/parameters/Parameters.h>
#include <string>
#include <vector>
#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 &parameters);
protected:
/**
* Copy constructor.
* @param other Object to be copied.
*/
DVCSCrossSectionUUDVCSSubProcPhiIntegrated(
const DVCSCrossSectionUUDVCSSubProcPhiIntegrated &other);
virtual PhysicalType<double> computeObservable(
const DVCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
/**
* Functor to perform the integration.
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservable;
/**
* Function to be integrated.
*/
virtual double functionToIntegrateObservable(double x,
std::vector<double> params);
/**
* Initialize functors.
*/
void initFunctorsForIntegrations();
};
} /* namespace PARTONS */
#endif /* DVCSCROSSSECTIONUUDVCSSUBPROCPHIINTEGRATED_H */
#ifndef DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H
#define DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H
/**
* @file DVCSCrossSectionUUMinusPhiIntegrated.h
* @author Luca COLANERI (IPNO)
* @date April 24, 2017
* @version 1.0
*/
#include <ElementaryUtils/parameters/Parameters.h>
#include <string>
#include <vector>
#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 &parameters);
protected:
/**
* Copy constructor.
* @param other Object to be copied.
*/
DVCSCrossSectionUUMinusPhiIntegrated(
const DVCSCrossSectionUUMinusPhiIntegrated &other);
virtual PhysicalType<double> computeObservable(
const DVCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
/**
* Functor to perform the integration.
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservable;
/**
* Function to be integrated.
*/
virtual double functionToIntegrateObservable(double x,
std::vector<double> params);
/**
* Initialize functors.
*/
void initFunctorsForIntegrations();
};
} /* namespace PARTONS */
#endif /* DVCSCROSSSECTIONUUMINUSPHIINTEGRATED_H */
#ifndef TCSACU_H
#define TCSACU_H
/**
* @file TCSAfb.h
* @author Pawel Sznajder (IPNO)
* @date November 25, 2016
* @version 1.0
*/
#include <string>
#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<double> computeObservable(
const TCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
};
<