Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef GPD_TYPE_H
0002 #define GPD_TYPE_H
0003 
0004 /**
0005  * @file GPDType.h
0006  * @author: Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date 30 July 2014
0008  * @version 1.0
0009  */
0010 
0011 #include <string>
0012 
0013 #include "../List.h"
0014 
0015 namespace ElemUtils {
0016 class Packet;
0017 } /* namespace ElemUtils */
0018 
0019 namespace PARTONS {
0020 
0021 /**
0022  * @class GPDType
0023  *
0024  * @brief Definition of enumeration values for GPD types.
0025  *
0026  * This class defines a set of enumeration values that are used to distinguish between GPD types. In addition, a declared object of this class is always associated to one GPD type (see GPDType::m_type), so member functions can act on it.
0027  */
0028 class GPDType {
0029 
0030 public:
0031 
0032 //    /**
0033 //     * Name of table in the database corresponding to this class.
0034 //     */
0035 //    static const std::string GPD_TYPE_DB_COLUMN_NAME;
0036 
0037     /**
0038      * Definition of enumerate values corresponding to GPD types.
0039      */
0040     enum Type {
0041 
0042         UNDEFINED = 0, //!< Undefined type.
0043 
0044         ALL = 1,     //!< All-like type, useful to indicate all available types.
0045 
0046         H = 2,        //!< Twist-2 GPD \f$H\f$
0047         E = 3,        //!< Twist-2 GPD \f$E\f$
0048         Ht = 4,       //!< Twist-2 GPD \f$\tilde{H}\f$
0049         Et = 5,       //!< Twist-2 GPD \f$\tilde{E}\f$
0050         HTrans = 6,   //!< Twist-2 GPD \f$H_{T}\f$
0051         ETrans = 7,   //!< Twist-2 GPD \f$E_{T}\f$
0052         HtTrans = 8,  //!< Twist-2 GPD \f$\tilde{H}_{T}\f$
0053         EtTrans = 9,  //!< Twist-2 GPD \f$\tilde{E}_{T}\f$
0054         H3p = 10,     //!< Twist-3 GPD \f$H_{3}^{+}\f$
0055         E3p = 11,     //!< Twist-3 GPD \f$E_{3}^{+}\f$
0056         Ht3p = 12,    //!< Twist-3 GPD \f$\tilde{H}_{3}^{+}\f$
0057         Et3p = 13,    //!< Twist-3 GPD \f$\tilde{E}_{3}^{+}\f$
0058         H3m = 14,     //!< Twist-3 GPD \f$H_{3}^{-}\f$
0059         E3m = 15,     //!< Twist-3 GPD \f$E_{3}^{-}\f$
0060         Ht3m = 16,    //!< Twist-3 GPD \f$\tilde{H}_{3}^{-}\f$
0061         Et3m = 17,    //!< Twist-3 GPD \f$\tilde{E}_{3}^{-}\f$
0062 
0063         //Artificial types:
0064 
0065         EbarTrans = 18, //!< \f$2\tilde{H}_{T} + E_{T}\f$
0066         HL = 19, //!< Used in DDVCS to mark CFF longitudinal helicity amplitudes related to GPD H
0067         EL = 20, //!< Used in DDVCS to mark CFF longitudinal helicity amplitudes related to GPD E
0068 
0069         END       //!< End-like type, useful to define loops over all GPD types.
0070     };
0071 
0072     /**
0073      * Default constructor.
0074      */
0075     GPDType();
0076 
0077     /**
0078      * Assignment constructor.
0079      * @param type Type to be assigned.
0080      */
0081     GPDType(Type type);
0082 
0083     /**
0084      * Copy constructor.
0085      * @param other Object to be copied.
0086      */
0087     GPDType(const GPDType &other);
0088 
0089     /**
0090      * Automatic cast to enum.
0091      */
0092     operator Type() const;
0093 
0094     /**
0095      * Get string representation of type being assigned to a declared object of this class.
0096      * @return String representation of assigned type, like "H" for GPDType::H.
0097      */
0098     std::string toString() const;
0099 
0100     /**
0101      * Serialize into given Packet.
0102      * @param packet Target Packet.
0103      */
0104     void serialize(ElemUtils::Packet &packet) const;
0105 
0106     /**
0107      * Retrieve data from given Packet.
0108      * @param packet Input Packet.
0109      */
0110     void unserialize(ElemUtils::Packet &packet);
0111 
0112     /**
0113      * Relation operator that checks if the value of left operand is less than the value of right operand (based on values assigned in the definition of GPDType::Type).
0114      * Used by std::sort function.
0115      * @param other Right hand value.
0116      * @return True if the value of left operand is less than the value of right operand, otherwise false.
0117      */
0118     bool operator <(const GPDType &other) const;
0119 
0120     /**
0121      * Try to match GPD type from given string.
0122      * @param gpdTypeStr String to be matched.
0123      * @return Matched type or GPDType::UNDEFINED if unable to match.
0124      */
0125     static GPDType::Type fromString(const std::string & gpdTypeStr);
0126 
0127     /**
0128      * Try to match list of GPD types from given string. Types should be separated by the pipe symbol, e.g. "H|E|..."
0129      * @param gpdTypeListAsString String to be matched.
0130      * @return List of matched GPDType objects.
0131      */
0132     static List<GPDType> getListOfGPDTypeFromString(
0133             const std::string &gpdTypeListAsString);
0134 
0135     //********************************************************
0136     //*** SETTERS AND GETTERS ********************************
0137     //********************************************************
0138 
0139     /**
0140      * Get type being assigned to a declared object of this class.
0141      */
0142     GPDType::Type getType() const;
0143 
0144     /**
0145      * Assign type to a declared object of this class.
0146      */
0147     void setType(Type type);
0148 
0149 private:
0150 
0151     /**
0152      * Type associated to a declared object of this class.
0153      */
0154     GPDType::Type m_type;
0155 };
0156 
0157 /**
0158  * Stream operator to serialize class into Packet. See also GPDType::serialize().
0159  */
0160 ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, GPDType& gpdType);
0161 
0162 /**
0163  * Stream operator to retrieve class from Packet. See also GPDType::unserialize().
0164  */
0165 ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, GPDType& gpdType);
0166 
0167 } /* namespace PARTONS */
0168 
0169 #endif /* GPD_COMPUTE_TYPE_H */