|
|
|||
File indexing completed on 2026-06-02 08:51:43
0001 #ifndef POLARIZATION_TYPE_H 0002 #define POLARIZATION_TYPE_H 0003 0004 /** 0005 * @file PolarizationType.h 0006 * @author Pawel Sznajder (NCBJ) 0007 * @date 23 April 2019 0008 * @version 1.0 0009 */ 0010 0011 #include <string> 0012 0013 namespace ElemUtils { 0014 class Packet; 0015 } /* namespace ElemUtils */ 0016 0017 namespace PARTONS { 0018 0019 /** 0020 * @class PolarizationType 0021 * 0022 * @brief Definition of enumeration values for meson polarization state. 0023 * 0024 * This class defines a set of enumeration values that are used to distinguish between meson polarization state. In addition, a declared object of this class is always associated to one meson type (see PolarizationType::m_type), so member functions can act on it. 0025 */ 0026 class PolarizationType { 0027 0028 public: 0029 0030 /** 0031 * Definition of enumerate values corresponding to meson polarization state. 0032 */ 0033 enum Type { 0034 0035 UNDEFINED = 0, //!< Undefined type. 0036 0037 LIN_LONG_PLUS = 1, //!< Linear longitudinal (along z-axis) +. 0038 LIN_LONG_MINUS = 2, //!< Linear longitudinal (along z-axis) -. 0039 LIN_TRANS_X_PLUS = 3, //!< Linear transverse (along x-axis) +. 0040 LIN_TRANS_X_MINUS = 4, //!< Linear transverse (along x-axis) -. 0041 LIN_TRANS_Y_PLUS = 5, //!< Linear transverse (along y-axis) +. 0042 LIN_TRANS_Y_MINUS = 6, //!< Linear transverse (along y-axis)-+. 0043 CIR_L = 7, //!< Circular left. 0044 CIR_R = 8, //!< Circular right. 0045 }; 0046 0047 /** 0048 * Default constructor. 0049 */ 0050 PolarizationType(); 0051 0052 /** 0053 * Assignment constructor. 0054 * @param type Type to be assigned. 0055 */ 0056 PolarizationType(Type type); 0057 0058 /** 0059 * Copy constructor. 0060 * @param other Object to be copied. 0061 */ 0062 PolarizationType(const PolarizationType &other); 0063 0064 /** 0065 * Automatic cast to enum. 0066 */ 0067 operator Type() const; 0068 0069 /** 0070 * Get string representation of type being assigned to a declared object of this class. 0071 * @return String representation of assigned type. 0072 */ 0073 std::string toString() const; 0074 0075 /** 0076 * Serialize into given Packet. 0077 * @param packet Target Packet. 0078 */ 0079 void serialize(ElemUtils::Packet &packet) const; 0080 0081 /** 0082 * Retrieve data from given Packet. 0083 * @param packet Input Packet. 0084 */ 0085 void unserialize(ElemUtils::Packet &packet); 0086 0087 /** 0088 * 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 PolarizationType::Type). 0089 * Used by std::sort function. 0090 * @param other Right hand value. 0091 * @return True if the value of left operand is less than the value of right operand, otherwise false. 0092 */ 0093 bool operator <(const PolarizationType &other) const; 0094 0095 /** 0096 * Try to match meson polarization from given string. 0097 * @param polarizationTypeStr String to be matched. 0098 * @return Matched type or PolarizationType::UNDEFINED if unable to match. 0099 */ 0100 static PolarizationType::Type fromString( 0101 const std::string & polarizationTypeStr); 0102 0103 //******************************************************** 0104 //*** SETTERS AND GETTERS ******************************** 0105 //******************************************************** 0106 0107 /** 0108 * Get type being assigned to a declared object of this class. 0109 */ 0110 PolarizationType::Type getType() const; 0111 0112 /** 0113 * Assign type to a declared object of this class. 0114 */ 0115 void setType(Type type); 0116 0117 double pol_vectors_product(PolarizationType::Type Pol1, PolarizationType::Type Pol2){ 0118 if( (Pol1 != LIN_TRANS_X_PLUS && Pol1 != LIN_TRANS_Y_PLUS) || (Pol2 != LIN_TRANS_X_PLUS && Pol2 != LIN_TRANS_Y_PLUS)) return 0.; 0119 else if (Pol1 == Pol2) return -1.; 0120 else return 0.; 0121 // product of polarization vectors corresponding to polarizations Pol1 and Pol2 0122 // for now, I consider only +x and +y polarizations 0123 } 0124 0125 double pol_projected_on_x(PolarizationType::Type Pol){ 0126 if(Pol== LIN_TRANS_X_PLUS) return 1.; 0127 else return 0.; 0128 // projection of the polarization vector on the x axis. 0129 // for now, only the +x or +y polarizations are under consideration 0130 } 0131 0132 private: 0133 0134 /** 0135 * Type associated to a declared object of this class. 0136 */ 0137 PolarizationType::Type m_type; 0138 }; 0139 0140 /** 0141 * Stream operator to serialize class into Packet. See also PolarizationType::serialize(). 0142 */ 0143 ElemUtils::Packet& operator <<(ElemUtils::Packet& packet, 0144 PolarizationType& polarizationType); 0145 0146 /** 0147 * Stream operator to retrieve class from Packet. See also PolarizationType::unserialize(). 0148 */ 0149 ElemUtils::Packet& operator >>(ElemUtils::Packet& packet, 0150 PolarizationType& polarizationType); 0151 0152 } /* namespace PARTONS */ 0153 0154 #endif /* POLARIZATION_TYPE_H */ 0155
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|