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

add demonstration of units

parent da154290
#none|GeV2|GeV2|GeV2|GeV2
0.2|-0.1|2.|2.|2.
0.3|-0.1|2.|2.|2.
#none|none|GeV2|GeV2|GeV2
0.1|0.2|-0.1|2.|2.
0.2|0.2|-0.1|2.|2.
#none|GeV2|GeV2|GeV|deg
0.1|-0.1|2.|20.|6.
0.2|-0.1|2.|20.|6.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--
This scenario demonstrates a simple task as the evaluation of GPD model in a single kinematic point. The result of this scenario is printed out to the standard output. These are the values for all defined in the model GPDs, including singlet and non-singlet combinations for quarks.
-->
<!-- Scenario starts here -->
<!-- For your convenience and for bookkeeping provide creation date and unique description -->
<scenario date="2017-07-18" description="GPD evaluation for single kinematics example">
<!-- First task: evaluate GPD model for a single kinematics -->
<!-- Indicate service and its methods to be used and indicate if the result should be stored in the database -->
<task service="GPDService" method="computeSingleKinematic" storeInDB="0">
<!-- Define GPD kinematics -->
<kinematics type="GPDKinematic">
<param name="x" value="0.1" />
<param name="xi" value="0.2" />
<param name="t" value="-100000" />
<param name="t_unit" value="MeV2" />
<param name="MuF2" value="2." />
<param name="MuR2" value="2." />
</kinematics>
<!-- Define physics assumptions -->
<computation_configuration>
<!-- Select GPD model -->
<module type="GPDModule" name="GPDGK16">
</module>
</computation_configuration>
</task>
<!-- Second task: print results of the last computation into standard output -->
<task service="GPDService" method="printResults">
</task>
</scenario>
......@@ -89,4 +89,9 @@ void makeUseOfGPDEvolution();
*/
void selectSpecificGPDTypes();
/**
* This function demonstrates the usage of units.
*/
void demonstrateUnits();
#endif /* INCLUDE_EXAMPLES_H_ */
......@@ -33,6 +33,8 @@
#include <partons/services/GPDService.h>
#include <partons/services/ObservableService.h>
#include <partons/ServiceObjectRegistry.h>
#include <partons/utils/type/PhysicalType.h>
#include <partons/utils/type/PhysicalUnit.h>
void computeSingleKinematicsForGPD() {
......@@ -538,3 +540,45 @@ void selectSpecificGPDTypes() {
pGPDModel, 0);
pGPDModel = 0;
}
void demonstrateUnits() {
// Retrieve GPD service
PARTONS::GPDService* pGPDService =
PARTONS::Partons::getInstance()->getServiceObjectRegistry()->getGPDService();
// Create GPD module with the BaseModuleFactory
PARTONS::GPDModule* pGPDModel =
PARTONS::Partons::getInstance()->getModuleObjectFactory()->newGPDModule(
PARTONS::GPDGK16::classId);
// Kinematics
PARTONS::PhysicalType<double> x(0.1, PARTONS::PhysicalUnit::NONE);
PARTONS::PhysicalType<double> xi(0.2, PARTONS::PhysicalUnit::NONE);
PARTONS::PhysicalType<double> t(-0.1, PARTONS::PhysicalUnit::GEV2);
PARTONS::PhysicalType<double> muF2(2., PARTONS::PhysicalUnit::GEV2);
PARTONS::PhysicalType<double> muR2(2., PARTONS::PhysicalUnit::GEV2);
PARTONS::PhysicalType<double> tInMeV2_a = t.makeSameUnitAs(
PARTONS::PhysicalUnit::MEV2);
PARTONS::PhysicalType<double> tInMeV2_b = t;
tInMeV2_b.makeSameUnitAs(tInMeV2_a);
// Create a GPDKinematic(x, xi, t, MuF2, MuR2) to compute
PARTONS::GPDKinematic gpdKinematic(x, xi, tInMeV2_a, muF2, muF2);
// Run computation
PARTONS::GPDResult gpdResult = pGPDService->computeSingleKinematic(
gpdKinematic, pGPDModel);
// Print results
PARTONS::Partons::getInstance()->getLoggerManager()->info("main", __func__,
gpdResult.toString());
// Remove pointer references
// Module pointers are managed by PARTONS
PARTONS::Partons::getInstance()->getModuleObjectFactory()->updateModulePointerReference(
pGPDModel, 0);
pGPDModel = 0;
}
Markdown is supported
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