Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef COLLINEAR_DISTRIBUTION_TYPE_H
0002 #define COLLINEAR_DISTRIBUTION_TYPE_H
0003 
0004 /**
0005  * @file CollinearDistributionType.h
0006  * @author: Valerio BERTONE (CEA Saclay)
0007  * @date 18 July 2020
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 CollinearDistributionType
0023  *
0024  * @brief Definition of enumeration values for collinear distribution types.
0025  *
0026  * This class defines a set of enumeration values that are used to
0027  distinguish between collinear distributions. In addition, a declared
0028  object of this class is always associated to one
0029  collinear-distribution type (see CollinearDistributionType::m_type),
0030  so member functions can act on it.
0031  */
0032 class CollinearDistributionType {
0033 
0034 public:
0035 
0036     /**
0037      * Name of table in the database corresponding to this class.
0038      */
0039     static const std::string COLLINEAR_DISTRIBUTION_TYPE_DB_COLUMN_NAME;
0040 
0041     /**
0042      * Definition of enumerate values corresponding to
0043      * collinear-distribution types.
0044      */
0045     enum Type {
0046         UNDEFINED = 0,     //!< Undefined type.
0047         ALL = 1,           //!< All-like type, useful to indicate all available types.
0048         UnpolPDF = 2,      //!< Twist-2 collinear unpolarised PDFs
0049         PolPDF = 3,        //!< Twist-2 collinear logitudinally polarised PDFs
0050         TransPDF = 4,      //!< Twist-2 collinear transversely polarised PDFs
0051         UnpolFF = 5,       //!< Twist-2 collinear unpolarised FFs
0052         PolFF = 6,         //!< Twist-2 collinear logitudinally polarised FFs
0053         TransFF = 7,       //!< Twist-2 collinear transversely polarised FFs
0054         END                //!< End-like type, useful to define loops over all types.
0055     };
0056 
0057     /**
0058      * Default constructor.
0059      */
0060     CollinearDistributionType();
0061 
0062     /**
0063      * Assignment constructor.
0064      * @param type Type to be assigned.
0065      */
0066     CollinearDistributionType(Type type);
0067 
0068     /**
0069      * Copy constructor.
0070      * @param other Object to be copied.
0071      */
0072     CollinearDistributionType(const CollinearDistributionType &other);
0073 
0074     /**
0075      * Automatic cast to enum.
0076      */
0077     operator Type() const;
0078 
0079     /**
0080      * Get string representation of type being assigned to a declared object of this class.
0081      * @return String representation of assigned type, like "H" for CollinearDistributionType::H.
0082      */
0083     std::string toString() const;
0084 
0085     /**
0086      * Serialize into given Packet.
0087      * @param packet Target Packet.
0088      */
0089     void serialize(ElemUtils::Packet &packet) const;
0090 
0091     /**
0092      * Retrieve data from given Packet.
0093      * @param packet Input Packet.
0094      */
0095     void unserialize(ElemUtils::Packet &packet);
0096 
0097     /**
0098      * 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 CollinearDistributionType::Type).
0099      * Used by std::sort function.
0100      * @param other Right hand value.
0101      * @return True if the value of left operand is less than the value of right operand, otherwise false.
0102      */
0103     bool operator <(const CollinearDistributionType &other) const;
0104 
0105     /**
0106      * Try to match collinear distribution type from given string.
0107      * @param colldistTypeStr String to be matched.
0108      * @return Matched type or CollinearDistributionType::UNDEFINED if unable to match.
0109      */
0110     static CollinearDistributionType::Type fromString(const std::string & colldistTypeStr);
0111 
0112     /**
0113      * Try to match list of collinear distribution types from given string. Types should be separated by the pipe symbol, e.g. "H|E|..."
0114      * @param colldistTypeListAsString String to be matched.
0115      * @return List of matched CollinearDistributionType objects.
0116      */
0117     static List<CollinearDistributionType> getListOfCollinearDistributionTypeFromString(
0118             const std::string &colldistTypeListAsString);
0119 
0120     //********************************************************
0121     //*** SETTERS AND GETTERS ********************************
0122     //********************************************************
0123 
0124     /**
0125      * Get type being assigned to a declared object of this class.
0126      */
0127     CollinearDistributionType::Type getType() const;
0128 
0129     /**
0130      * Assign type to a declared object of this class.
0131      */
0132     void setType(Type type);
0133 
0134 private:
0135 
0136     /**
0137      * Type associated to a declared object of this class.
0138      */
0139     CollinearDistributionType::Type m_type;
0140 };
0141 
0142 /**
0143  * Stream operator to serialize class into Packet. See also CollinearDistributionType::serialize().
0144  */
0145 ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, CollinearDistributionType& colldistType);
0146 
0147 /**
0148  * Stream operator to retrieve class from Packet. See also CollinearDistributionType::unserialize().
0149  */
0150 ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, CollinearDistributionType& colldistType);
0151 
0152 } /* namespace PARTONS */
0153 
0154 #endif /* COLLINEAR_DISTRIBUTION_TYPE_H */