Commit 943dac33 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

add theta integrated TCS Aut's

parent defc3b0d
......@@ -23,13 +23,7 @@ namespace PARTONS {
/**
* @class TCSAcuThetaIntegrated
* @brief ACU asymmetry integrated over \f$\theta\f$ in a given range (default: \f$|\theta - \pi/2| < \pi/4\f$).
*
* Definition:<br>
*
* \f$ \displaystyle
* \int_{\theta_{\mathrm{min}}}^{\theta_{\mathrm{max}}} A_{CU}{\mathrm{d}|t| \mathrm{d}Q^2 \mathrm{d}\phi \mathrm{d}\theta}\left(t, Q^2, \phi, \theta\right)\, .
* \f$
* @brief Acu asymmetry with cross-sections integrated over \f$\theta\f$ in a given range (default: \f$|\theta - \pi/2| < \pi/4\f$)
*
* Unit: none.
*/
......
#ifndef TCSAUTCOSPHIMPHISTHETAINTEGRATED_H
#define TCSAUTCOSPHIMPHISTHETAINTEGRATED_H
/**
* @file TCSAutCosPhiMPhisThetaIntegrated.h
* @author Pawel Sznajder (IPNO)
* @date November 25, 2016
* @version 1.0
*/
#include <ElementaryUtils/parameters/Parameters.h>
#include <string>
#include <utility>
#include <vector>
#include "../../../../beans/gpd/GPDType.h"
#include "../../../../beans/List.h"
#include "../../../../utils/type/PhysicalType.h"
#include "../../../MathIntegratorModule.h"
#include "../TCSObservable.h"
namespace PARTONS {
/**
* @class TCSAutCosPhiMPhisThetaIntegrated
* @brief AutCosPhiMPhis asymmetry with cross-sections integrated over \f$\theta\f$ in a given range (default: \f$|\theta - \pi/2| < \pi/4\f$).
*
* Unit: none.
*/
class TCSAutCosPhiMPhisThetaIntegrated: public TCSObservable,
public MathIntegratorModule {
public:
static const std::string PARAMETER_NAME_THETA_LIMIT; ///< Name of parameter to set \f$\theta_{\mathrm{limit}}\f$, which is the limit on \f$\theta\f$ angle integration, defined as \f$|\theta - \pi/2| < \theta_{\mathrm{limit}}\f$. In degrees.
/**
* Unique ID to automatically register the class in the registry.
*/
static const unsigned int classId;
/**
* Constructor.
* @param className Name of class.
*/
TCSAutCosPhiMPhisThetaIntegrated(const std::string &className);
/**
* Destructor.
*/
virtual ~TCSAutCosPhiMPhisThetaIntegrated();
virtual TCSAutCosPhiMPhisThetaIntegrated* clone() const;
virtual void configure(const ElemUtils::Parameters &parameters);
/**
* Get range of theta angle used in the integration.
*/
const std::pair<double, double>& getThetaRange() const;
/**
* Set range of theta angle used in the integration.
*/
void setThetaRange(const std::pair<double, double>& thetaRange);
protected:
/**
* Copy constructor.
* @param other Object to be copied.
*/
TCSAutCosPhiMPhisThetaIntegrated(
const TCSAutCosPhiMPhisThetaIntegrated &other);
virtual PhysicalType<double> computeObservable(
const TCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
/**
* Functor to perform the integration (polarization + target +).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta1;
/**
* Functor to perform the integration (polarization - target +).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta2;
/**
* Functor to perform the integration (polarization + target -).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta3;
/**
* Functor to perform the integration (polarization - target -).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta4;
/**
* Function to be integrated (polarization + target +).
*/
virtual double functionToIntegrateObservableTheta1(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization - target +).
*/
virtual double functionToIntegrateObservableTheta2(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization + target -).
*/
virtual double functionToIntegrateObservableTheta3(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization - target -).
*/
virtual double functionToIntegrateObservableTheta4(double x,
std::vector<double> params);
/**
* Initialize functors.
*/
virtual void initFunctorsForIntegrations();
std::pair<double, double> m_thetaRange; ///< Range of theta angle used in the integration.
};
} /* namespace PARTONS */
#endif /* TCSAUTCOSPHIMPHISTHETAINTEGRATED_H */
#ifndef TCSAUTSINPHIMPHISTHETAINTEGRATED_H
#define TCSAUTSINPHIMPHISTHETAINTEGRATED_H
/**
* @file TCSAutSinPhiMPhisThetaIntegrated.h
* @author Pawel Sznajder (IPNO)
* @date November 25, 2016
* @version 1.0
*/
#include <ElementaryUtils/parameters/Parameters.h>
#include <string>
#include <utility>
#include <vector>
#include "../../../../beans/gpd/GPDType.h"
#include "../../../../beans/List.h"
#include "../../../../utils/type/PhysicalType.h"
#include "../../../MathIntegratorModule.h"
#include "../TCSObservable.h"
namespace PARTONS {
/**
* @class TCSAutSinPhiMPhisThetaIntegrated
* @brief AutSinPhiMPhis asymmetry with cross-sections integrated over \f$\theta\f$ in a given range (default: \f$|\theta - \pi/2| < \pi/4\f$).
*
* Unit: none.
*/
class TCSAutSinPhiMPhisThetaIntegrated: public TCSObservable,
public MathIntegratorModule {
public:
static const std::string PARAMETER_NAME_THETA_LIMIT; ///< Name of parameter to set \f$\theta_{\mathrm{limit}}\f$, which is the limit on \f$\theta\f$ angle integration, defined as \f$|\theta - \pi/2| < \theta_{\mathrm{limit}}\f$. In degrees.
/**
* Unique ID to automatically register the class in the registry.
*/
static const unsigned int classId;
/**
* Constructor.
* @param className Name of class.
*/
TCSAutSinPhiMPhisThetaIntegrated(const std::string &className);
/**
* Destructor.
*/
virtual ~TCSAutSinPhiMPhisThetaIntegrated();
virtual TCSAutSinPhiMPhisThetaIntegrated* clone() const;
virtual void configure(const ElemUtils::Parameters &parameters);
/**
* Get range of theta angle used in the integration.
*/
const std::pair<double, double>& getThetaRange() const;
/**
* Set range of theta angle used in the integration.
*/
void setThetaRange(const std::pair<double, double>& thetaRange);
protected:
/**
* Copy constructor.
* @param other Object to be copied.
*/
TCSAutSinPhiMPhisThetaIntegrated(
const TCSAutSinPhiMPhisThetaIntegrated &other);
virtual PhysicalType<double> computeObservable(
const TCSObservableKinematic& kinematic,
const List<GPDType>& gpdType);
/**
* Functor to perform the integration (polarization + target +).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta1;
/**
* Functor to perform the integration (polarization - target +).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta2;
/**
* Functor to perform the integration (polarization + target -).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta3;
/**
* Functor to perform the integration (polarization - target -).
*/
NumA::FunctionType1D* m_pFunctionToIntegrateObservableTheta4;
/**
* Function to be integrated (polarization + target +).
*/
virtual double functionToIntegrateObservableTheta1(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization - target +).
*/
virtual double functionToIntegrateObservableTheta2(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization + target -).
*/
virtual double functionToIntegrateObservableTheta3(double x,
std::vector<double> params);
/**
* Function to be integrated (polarization - target -).
*/
virtual double functionToIntegrateObservableTheta4(double x,
std::vector<double> params);
/**
* Initialize functors.
*/
virtual void initFunctorsForIntegrations();
std::pair<double, double> m_thetaRange; ///< Range of theta angle used in the integration.
};
} /* namespace PARTONS */
#endif /* TCSAUTSINPHIMPHISTHETAINTEGRATED_H */
......@@ -36,10 +36,10 @@ PhysicalType<double> TCSAutCosPhiMPhis::computeObservable(
NumA::Vector3D(1., 0., 0.), kinematic, gpdType).getValue();
PhysicalType<double> B = m_pProcessModule->compute(-1,
NumA::Vector3D(-1., 0., 0.), kinematic, gpdType).getValue();
NumA::Vector3D(1., 0., 0.), kinematic, gpdType).getValue();
PhysicalType<double> C = m_pProcessModule->compute(1,
NumA::Vector3D(1., 0., 0.), kinematic, gpdType).getValue();
NumA::Vector3D(-1., 0., 0.), kinematic, gpdType).getValue();
PhysicalType<double> D = m_pProcessModule->compute(-1,
NumA::Vector3D(-1., 0., 0.), kinematic, gpdType).getValue();
......
#include "../../../../../../include/partons/modules/observable/TCS/asymmetry/TCSAutCosPhiMPhisThetaIntegrated.h"
#include <ElementaryUtils/parameters/GenericType.h>
#include <ElementaryUtils/string_utils/Formatter.h>
#include <NumA/functor/one_dimension/Functor1D.h>
#include <NumA/integration/one_dimension/Integrator1D.h>
#include <NumA/integration/one_dimension/IntegratorType1D.h>
#include <NumA/linear_algebra/vector/Vector3D.h>
#include "../../../../../../include/partons/beans/observable/ObservableResult.h"
#include "../../../../../../include/partons/beans/observable/TCS/TCSObservableKinematic.h"
#include "../../../../../../include/partons/BaseObjectRegistry.h"
#include "../../../../../../include/partons/FundamentalPhysicalConstants.h"
#include "../../../../../../include/partons/modules/observable/Observable.h"
#include "../../../../../../include/partons/modules/process/TCS/TCSProcessModule.h"
#include "../../../../../../include/partons/utils/type/PhysicalUnit.h"
namespace PARTONS {
const std::string TCSAutCosPhiMPhisThetaIntegrated::PARAMETER_NAME_THETA_LIMIT =
"theta_limit";
const unsigned int TCSAutCosPhiMPhisThetaIntegrated::classId =
BaseObjectRegistry::getInstance()->registerBaseObject(
new TCSAutCosPhiMPhisThetaIntegrated(
"TCSAutCosPhiMPhisThetaIntegrated"));
TCSAutCosPhiMPhisThetaIntegrated::TCSAutCosPhiMPhisThetaIntegrated(
const std::string &className) :
TCSObservable(className), MathIntegratorModule(), m_pFunctionToIntegrateObservableTheta1(
0), m_pFunctionToIntegrateObservableTheta2(0) {
m_thetaRange = std::pair<double, double>(Constant::PI / 4.,
3 * Constant::PI / 4.);
setIntegrator(NumA::IntegratorType1D::DEXP);
initFunctorsForIntegrations();
}
TCSAutCosPhiMPhisThetaIntegrated::TCSAutCosPhiMPhisThetaIntegrated(
const TCSAutCosPhiMPhisThetaIntegrated& other) :
TCSObservable(other), MathIntegratorModule(other), m_pFunctionToIntegrateObservableTheta1(
0), m_pFunctionToIntegrateObservableTheta2(0) {
m_thetaRange = other.m_thetaRange;
initFunctorsForIntegrations();
}
TCSAutCosPhiMPhisThetaIntegrated::~TCSAutCosPhiMPhisThetaIntegrated() {
if (m_pFunctionToIntegrateObservableTheta1) {
delete m_pFunctionToIntegrateObservableTheta1;
m_pFunctionToIntegrateObservableTheta1 = 0;
}
if (m_pFunctionToIntegrateObservableTheta2) {
delete m_pFunctionToIntegrateObservableTheta2;
m_pFunctionToIntegrateObservableTheta2 = 0;
}
if (m_pFunctionToIntegrateObservableTheta3) {
delete m_pFunctionToIntegrateObservableTheta3;
m_pFunctionToIntegrateObservableTheta3 = 0;
}
if (m_pFunctionToIntegrateObservableTheta4) {
delete m_pFunctionToIntegrateObservableTheta4;
m_pFunctionToIntegrateObservableTheta4 = 0;
}
}
void TCSAutCosPhiMPhisThetaIntegrated::initFunctorsForIntegrations() {
m_pFunctionToIntegrateObservableTheta1 =
NumA::Integrator1D::newIntegrationFunctor(this,
&TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta1);
m_pFunctionToIntegrateObservableTheta2 =
NumA::Integrator1D::newIntegrationFunctor(this,
&TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta2);
m_pFunctionToIntegrateObservableTheta3 =
NumA::Integrator1D::newIntegrationFunctor(this,
&TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta3);
m_pFunctionToIntegrateObservableTheta4 =
NumA::Integrator1D::newIntegrationFunctor(this,
&TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta4);
}
TCSAutCosPhiMPhisThetaIntegrated* TCSAutCosPhiMPhisThetaIntegrated::clone() const {
return new TCSAutCosPhiMPhisThetaIntegrated(*this);
}
void TCSAutCosPhiMPhisThetaIntegrated::configure(
const ElemUtils::Parameters &parameters) {
TCSObservable::configure(parameters);
MathIntegratorModule::configureIntegrator(parameters);
if (parameters.isAvailable(
TCSAutCosPhiMPhisThetaIntegrated::PARAMETER_NAME_THETA_LIMIT)) {
PhysicalType<double> limit(parameters.getLastAvailable().toDouble(),
PhysicalUnit::DEG);
if (limit.getValue() < 0. || limit.getValue() > 180.) {
warn(__func__,
ElemUtils::Formatter() << "Illegal value of parameter "
<< TCSAutCosPhiMPhisThetaIntegrated::PARAMETER_NAME_THETA_LIMIT
<< ", " << limit.toString() << ", ignored");
} else {
m_thetaRange =
std::pair<double, double>(
Constant::PI / 2.
- limit.makeSameUnitAs(PhysicalUnit::RAD).getValue(),
Constant::PI / 2.
+ limit.makeSameUnitAs(PhysicalUnit::RAD).getValue());
info(__func__,
ElemUtils::Formatter() << "Parameter "
<< TCSAutCosPhiMPhisThetaIntegrated::PARAMETER_NAME_THETA_LIMIT
<< " changed to " << limit.toString());
}
}
}
double TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta1(
double x, std::vector<double> params) {
TCSObservableKinematic kinematic;
List<GPDType> gpdType;
unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType);
kinematic.setTheta(PhysicalType<double>(x, PhysicalUnit::RAD));
return m_pProcessModule->compute(1, NumA::Vector3D(1., 0., 0.), kinematic,
gpdType).getValue().getValue();
}
double TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta2(
double x, std::vector<double> params) {
TCSObservableKinematic kinematic;
List<GPDType> gpdType;
unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType);
kinematic.setTheta(PhysicalType<double>(x, PhysicalUnit::RAD));
return m_pProcessModule->compute(-1, NumA::Vector3D(1., 0., 0.), kinematic,
gpdType).getValue().getValue();
}
double TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta3(
double x, std::vector<double> params) {
TCSObservableKinematic kinematic;
List<GPDType> gpdType;
unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType);
kinematic.setTheta(PhysicalType<double>(x, PhysicalUnit::RAD));
return m_pProcessModule->compute(1, NumA::Vector3D(-1., 0., 0.), kinematic,
gpdType).getValue().getValue();
}
double TCSAutCosPhiMPhisThetaIntegrated::functionToIntegrateObservableTheta4(
double x, std::vector<double> params) {
TCSObservableKinematic kinematic;
List<GPDType> gpdType;
unserializeKinematicsAndGPDTypesFromStdVector(params, kinematic, gpdType);
kinematic.setTheta(PhysicalType<double>(x, PhysicalUnit::RAD));
return m_pProcessModule->compute(-1, NumA::Vector3D(-1., 0., 0.), kinematic,
gpdType).getValue().getValue();
}
PhysicalType<double> TCSAutCosPhiMPhisThetaIntegrated::computeObservable(
const TCSObservableKinematic& kinematic, const List<GPDType>& gpdType) {
std::vector<double> params = serializeKinematicsAndGPDTypesIntoStdVector(
kinematic, gpdType);
//evaluate
double A = integrate(m_pFunctionToIntegrateObservableTheta1,
m_thetaRange.first, m_thetaRange.second, params);
double B = integrate(m_pFunctionToIntegrateObservableTheta2,
m_thetaRange.first, m_thetaRange.second, params);
double C = integrate(m_pFunctionToIntegrateObservableTheta3,
m_thetaRange.first, m_thetaRange.second, params);
double D = integrate(m_pFunctionToIntegrateObservableTheta4,
m_thetaRange.first, m_thetaRange.second, params);
//combine
if (A + B + C + D == 0.) {
warn(__func__, "Asymmetry denominator is zero");
return PhysicalType<double>(0., PhysicalUnit::NONE);
}
//return
return PhysicalType<double>(((A + B) - (C + D)) / (A + B + C + D),
PhysicalUnit::NONE);
}
const std::pair<double, double>& TCSAutCosPhiMPhisThetaIntegrated::getThetaRange() const {
return m_thetaRange;
}
void TCSAutCosPhiMPhisThetaIntegrated::setThetaRange(
const std::pair<double, double>& thetaRange) {
m_thetaRange = thetaRange;
}
} /* namespace PARTONS */
......@@ -36,10 +36,10 @@ PhysicalType<double> TCSAutSinPhiMPhis::computeObservable(
NumA::Vector3D(0., 1., 0.), kinematic, gpdType).getValue();
PhysicalType<double> B = m_pProcessModule->compute(-1,
NumA::Vector3D(0., -1., 0.), kinematic, gpdType).getValue();
NumA::Vector3D(0., 1., 0.), kinematic, gpdType).getValue();
PhysicalType<double> C = m_pProcessModule->compute(1,
NumA::Vector3D(0., 1., 0.), kinematic, gpdType).getValue();
NumA::Vector3D(0., -1., 0.), kinematic, gpdType).getValue();
PhysicalType<double> D = m_pProcessModule->compute(-1,
NumA::Vector3D(0., -1., 0.), kinematic, gpdType).getValue();
......
#include "../../../../../../include/partons/modules/observable/TCS/asymmetry/TCSAutSinPhiMPhisThetaIntegrated.h"
#include <ElementaryUtils/parameters/GenericType.h>
#include <ElementaryUtils/string_utils/Formatter.h>
#include <NumA/functor/one_dimension/Functor1D.h>
#include <NumA/integration/one_dimension/Integrator1D.h>
#include <NumA/integration/one_dimension/IntegratorType1D.h>
#include <NumA/linear_algebra/vector/Vector3D.h>
#include "../../../../../../include/partons/beans/observable/ObservableResult.h"
#include "../../../../../../include/partons/beans/observable/TCS/TCSObservableKinematic.h"
#include "../../../../../../include/partons/BaseObjectRegistry.h"
#include "../../../../../../include/partons/FundamentalPhysicalConstants.h"
#include "../../../../../../include/partons/modules/observable/Observable.h"
#include "../../../../../../include/partons/modules/process/TCS/TCSProcessModule.h"
#include "../../../../../../include/partons/utils/type/PhysicalUnit.h"
namespace PARTONS {
const std::string TCSAutSinPhiMPhisThetaIntegrated::PARAMETER_NAME_THETA_LIMIT =
"theta_limit";
const unsigned int TCSAutSinPhiMPhisThetaIntegrated::classId =
BaseObjectRegistry::getInstance()->registerBaseObject(
new TCSAutSinPhiMPhisThetaIntegrated(
"TCSAutSinPhiMPhisThetaIntegrated"));
TCSAutSinPhiMPhisThetaIntegrated::TCSAutSinPhiMPhisThetaIntegrated(
const std::string &className) :
TCSObservable(className), MathIntegratorModule(), m_pFunctionToIntegrateObservableTheta1(
0), m_pFunctionToIntegrateObservableTheta2(0) {
m_thetaRange = std::pair<double, double>(Constant::PI / 4.,
3 * Constant::PI / 4.);
setIntegrator(NumA::IntegratorType1D::DEXP);
initFunctorsForIntegrations();
}
TCSAutSinPhiMPhisThetaIntegrated::TCSAutSinPhiMPhisThetaIntegrated(
const TCSAutSinPhiMPhisThetaIntegrated& other) :