Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-13 10:29:00

0001 #ifndef ATOOLS_Org_Info_Key_H
0002 #define ATOOLS_Org_Info_Key_H
0003 
0004 #include "ATOOLS/Math/Vector.H"
0005 #include <string>
0006 #include <vector>
0007 #include <iostream>
0008 #include <memory>
0009 
0010 namespace ATOOLS {
0011 
0012   typedef std::vector<double> Double_Container;
0013   typedef std::vector<Vec4D> Vector_Container;
0014 
0015   namespace si {
0016 
0017     enum code {
0018       idle      =  0,
0019       reset     =  1,
0020       dicing    =  2,
0021       generated =  3,
0022       weighting =  4,
0023       weighted  =  5,
0024       error     =  6
0025     };
0026 
0027   }// end of namespace si
0028 
0029   class Integration_Info;
0030 
0031   class Info_Key {
0032   private:
0033 
0034     Integration_Info *p_info;
0035     std::string       m_name, m_info;
0036     
0037     size_t m_valuekey, m_weightkey;
0038 
0039     friend class Integration_Info;
0040 
0041   public:
0042 
0043     // constructors
0044     Info_Key();
0045 
0046     // destructor
0047     ~Info_Key();
0048 
0049     // member functions
0050     void SetInfo(const std::string info);
0051 
0052     // setters
0053     inline si::code SetStatus(const si::code sicode) const;
0054 
0055     // getters
0056     inline const std::string &Name() const;
0057     inline const std::string &Info() const;
0058 
0059     si::code Status() const;
0060 
0061     // member functions
0062     void Assign(const std::string name,const size_t doubles,
0063         const size_t vectors,Integration_Info *const info);
0064     void Assign(const std::string name,
0065                 const size_t doubles,
0066                 const size_t vectors,
0067                 const std::shared_ptr<Integration_Info> &info);
0068 
0069     inline Double_Container &Doubles() const;
0070     inline Vector_Container &Vectors() const;
0071 
0072     inline double        Double(const size_t i) const;
0073     inline ATOOLS::Vec4D Vector(const size_t i) const;
0074     inline double        Weight() const;
0075 
0076     inline bool Assigned() const;
0077 
0078     inline double        &operator[](const size_t i);
0079     inline ATOOLS::Vec4D &operator()(const size_t i);
0080 
0081     inline void operator<<(const double weight);
0082 
0083     inline Info_Key &operator=(const Info_Key &key);
0084     inline bool      operator==(const Info_Key &key);
0085 
0086     friend std::ostream &operator<<(std::ostream &str,const Info_Key &key);
0087 
0088   };// end of class Info_Key
0089 
0090   std::ostream &operator<<(std::ostream &str,const Info_Key &key);
0091 
0092   /*!
0093     \class Info_Key
0094     \brief Handles access to Integration_Info
0095 
0096     This class provides access to Integration_Info which handles value and 
0097     weight storage. Each Info_Key is assigned a reference point in Integration_Info 
0098     during Assign(<name>,<double_size>,<vector_size>,<info>).
0099     In the following the key calls Integration_Info to obtain and to set values
0100     and weights and to test for the status of the corresponding variable (see 
0101     the example below).
0102     \code
0103        class Example_ISR_Channel: public Single_Channel {
0104        private:
0105          double   m_exponent
0106          Info_Key m_spkey, ...;
0107        public:
0108          ...
0109        };
0110 
0111        void Example_ISR_Channel::GeneratePoint(const double *rans)
0112        {
0113          // m_spkey owns three values where m_spkey[0] -> lower limit
0114      //                                 m_spkey[1] -> upper limit
0115      //                                 m_spkey[2] -> value
0116          m_spkey[2]=CE::MasslessPropMomenta(m_exponent,m_spkey[0],m_spkey[1],ran[0]);
0117      ...
0118        }
0119 
0120        void Example_ISR_Channel::GenerateWeight()
0121        {
0122          // operator<<(..) sets the unique weight
0123          m_spkey<<1./CE::MasslessPropWeight(m_exponent,m_spkey[0],m_spkey[1],m_spkey[2]);
0124      ...
0125        }
0126     \endcode
0127   */
0128 
0129 }// end of namespace ATOOLS
0130 
0131 #include "ATOOLS/Org/Info_Key.inl.H"
0132 
0133 #endif