Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:51:43

0001 #ifndef KINEMATIC_UTILS_H
0002 #define KINEMATIC_UTILS_H
0003 
0004 /**
0005  * @file KinematicUtils.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date November 27, 2015
0008  * @version 1.0
0009  */
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 #include "../utils/type/PhysicalUnit.h"
0015 #include "collinear_distribution/CollinearDistributionKinematic.h"
0016 #include "convol_coeff_function/DDVCS/DDVCSConvolCoeffFunctionKinematic.h"
0017 #include "convol_coeff_function/DVCS/DVCSConvolCoeffFunctionKinematic.h"
0018 #include "convol_coeff_function/DVMP/DVMPConvolCoeffFunctionKinematic.h"
0019 #include "convol_coeff_function/TCS/TCSConvolCoeffFunctionKinematic.h"
0020 #include "gpd/GPDKinematic.h"
0021 #include "List.h"
0022 #include "observable/DDVCS/DDVCSObservableKinematic.h"
0023 #include "observable/DVCS/DVCSObservableKinematic.h"
0024 #include "observable/DVMP/DVMPObservableKinematic.h"
0025 #include "observable/TCS/TCSObservableKinematic.h"
0026 
0027 namespace PARTONS {
0028 
0029 /**
0030  * @class KinematicUtils
0031  *
0032  * @brief Set of utilization tools to handle kinematic-like classes.
0033  *
0034  * This class is used as a container for utilization tools to handle kinematic-like classes.
0035  * It provides in particular tools to parse text files in order to create a set of kinematic-like objects.
0036  */
0037 class KinematicUtils: public BaseObject {
0038 
0039 public:
0040 
0041     /**
0042      * Default constructor.
0043      */
0044     KinematicUtils();
0045 
0046     /**
0047      * Destructor.
0048      */
0049     virtual ~KinematicUtils();
0050 
0051     /**
0052      * Parse a text file in order to retrieve a list of GPDKinematic objects.
0053      * The parsed file should display separate lines of the form "x | xi | t | MuF2 | MuR2".
0054      * @param filePath Path to file to be parsed.
0055      * @return List of extracted GPDKinematic objects.
0056      */
0057     List<GPDKinematic> getGPDKinematicFromFile(const std::string &filePath);
0058 
0059     /**
0060      * Parse a text file in order to retrieve a list of CollienearDistributionKinematic objects.
0061      * The parsed file should display separate lines of the form "x | MuF2 | MuR2".
0062      * @param filePath Path to file to be parsed.
0063      * @return List of extracted GPDKinematic objects.
0064      */
0065     List<CollinearDistributionKinematic> getCollinearDistributionKinematicFromFile(const std::string &filePath);
0066 
0067     /**
0068      * Parse a text file in order to retrieve a list of DVCSConvolCoeffFunctionKinematic objects.
0069      * The parsed file should display separate lines of the form "xi | t | Q2 | MuF2 | MuR2".
0070      * @param filePath Path to file to be parsed.
0071      * @return List of extracted DVCSConvolCoeffFunctionKinematic objects.
0072      */
0073     List<DVCSConvolCoeffFunctionKinematic> getDVCSCCFKinematicFromFile(
0074             const std::string &filePath);
0075 
0076     /**
0077      * Parse a text file in order to retrieve a list of TCSConvolCoeffFunctionKinematic objects.
0078      * The parsed file should display separate lines of the form "xi | t | Q2' | MuF2 | MuR2".
0079      * @param filePath Path to file to be parsed.
0080      * @return List of extracted TCSConvolCoeffFunctionKinematic objects.
0081      */
0082     List<TCSConvolCoeffFunctionKinematic> getTCSCCFKinematicFromFile(
0083             const std::string &filePath);
0084 
0085     /**
0086      * Parse a text file in order to retrieve a list of DVMPConvolCoeffFunctionKinematic objects.
0087      * The parsed file should display separate lines of the form "xi | t | Q2 | MuF2 | MuR2 | mesonType | mesonPolarization".
0088      * @param filePath Path to file to be parsed.
0089      * @return List of extracted DVMPConvolCoeffFunctionKinematic objects.
0090      */
0091     List<DVMPConvolCoeffFunctionKinematic> getDVMPCCFKinematicFromFile(
0092             const std::string &filePath);
0093 
0094     /**
0095      * Parse a text file in order to retrieve a list of DDVCSConvolCoeffFunctionKinematic objects.
0096      * The parsed file should display separate lines of the form "xi | t | Q2 | Q2 | MuF2 | MuR2".
0097      * @param filePath Path to file to be parsed.
0098      * @return List of extracted DDVCSConvolCoeffFunctionKinematic objects.
0099      */
0100     List<DDVCSConvolCoeffFunctionKinematic> getDDVCSCCFKinematicFromFile(
0101             const std::string &filePath);
0102 
0103     /**
0104      * Parse a text file in order to retrieve a list of ObservableKinematic objects.
0105      * The parsed file should display separate lines of the form "xB | t | Q2 | E | phi".
0106      * @param filePath Path to file to be parsed.
0107      * @return List of extracted ObservableKinematic objects.
0108      */
0109     List<DVCSObservableKinematic> getDVCSObservableKinematicFromFile(
0110             const std::string &filePath);
0111 
0112     /**
0113      * Parse a text file in order to retrieve a list of ObservableKinematic objects.
0114      * The parsed file should display separate lines of the form "t | Q2' | E | phi | theta | MLepton".
0115      * @param filePath Path to file to be parsed.
0116      * @return List of extracted ObservableKinematic objects.
0117      */
0118     List<TCSObservableKinematic> getTCSObservableKinematicFromFile(
0119             const std::string &filePath);
0120 
0121     /**
0122      * Parse a text file in order to retrieve a list of ObservableKinematic objects.
0123      * The parsed file should display separate lines of the form "xB | t | Q2 | E | phi | mesonType".
0124      * @param filePath Path to file to be parsed.
0125      * @return List of extracted ObservableKinematic objects.
0126      */
0127     List<DVMPObservableKinematic> getDVMPObservableKinematicFromFile(
0128             const std::string &filePath);
0129 
0130     /**
0131      * Parse a text file in order to retrieve a list of ObservableKinematic objects.
0132      * The parsed file should display separate lines of the form "xB | t | Q2 | Q2 | E | phi | phiL | thetaL".
0133      * @param filePath Path to file to be parsed.
0134      * @return List of extracted ObservableKinematic objects.
0135      */
0136     List<DDVCSObservableKinematic> getDDVCSObservableKinematicFromFile(
0137             const std::string &filePath);
0138 
0139 private:
0140 
0141     /**
0142      * Throw a custom error.
0143      * @param funcName Name of function where the error has appeared.
0144      * @param msg User readable message to be thrown.
0145      */
0146     void error(const std::string &funcName, const std::string &msg);
0147 
0148     /**
0149      * Throw an error when unable to open a file.
0150      * @param funcName Name of function where the error has appeared.
0151      * @param msg User readable message to be thrown.
0152      */
0153     void errorCannotOpenFile(const std::string &funcName,
0154             const std::string &msg);
0155 
0156     /**
0157      * Check if content of a file is empty. If yes, throw an error.
0158      * @param funcName Name of function where the check is performed.
0159      * @param kinematicString Content of file.
0160      * @param filePath Path to file.
0161      */
0162     void checkEmptyInputFile(const std::string &funcName,
0163             const std::vector<std::string> &kinematicString,
0164             const std::string &filePath);
0165 
0166     /**
0167      * Return vector containing units according to a give string.
0168      * @param funcName Name of function to throw error if needed.
0169      * @param line Input line.
0170      * @return Vector containing returned units.
0171      */
0172     std::vector<PhysicalUnit> getUnitsFromInputFileLine(
0173             const std::string &funcName, const std::string &line) const;
0174 };
0175 
0176 } /* namespace PARTONS */
0177 
0178 #endif /* KINEMATICUTILS_H_ */