LCOV - code coverage report
Current view: top level - TEvtGen/HepMC - PdfInfo.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 50 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 25 0.0 %

          Line data    Source code
       1             : //--------------------------------------------------------------------------
       2             : #ifndef HEPMC_PDF_INFO_H
       3             : #define HEPMC_PDF_INFO_H
       4             : 
       5             : //////////////////////////////////////////////////////////////////////////
       6             : // garren@fnal.gov, July 2006
       7             : //
       8             : // Additional PDF information
       9             : //////////////////////////////////////////////////////////////////////////
      10             : 
      11             : namespace HepMC {
      12             : 
      13             : //! The PdfInfo class stores PDF information
      14             : 
      15             : ///
      16             : /// \class  PdfInfo
      17             : /// HepMC::PdfInfo stores additional PDF information for a GenEvent.
      18             : /// Creation and use of this information is optional. 
      19             : ///
      20             : ///   - int id1;        // flavour code of first parton
      21             : ///   - int id2;        // flavour code of second parton 
      22             : ///   - int pdf_id1;    // LHAPDF set id of first parton (zero by default)
      23             : ///   - int pdf_id2;    // LHAPDF set id of second parton  (zero by default)
      24             : ///   - double x1;      // fraction of beam momentum carried by first parton ("beam side") 
      25             : ///   - double x2;      // fraction of beam momentum carried by second parton ("target side") 
      26             : ///   - double scalePDF;  //  Q-scale used in evaluation of PDF's   (in GeV) 
      27             : ///   - double pdf1;    // PDF (id1, x1, Q) 
      28             : ///   - double pdf2;    // PDF (id2, x2, Q)   
      29             : /// 
      30             : /// Input parton flavour codes id1 & id2 are expected to obey the 
      31             : /// PDG code conventions, especially g = 21.
      32             : /// 
      33             : /// The contents of pdf1 and pdf2 are expected to be x*f(x).
      34             : /// The LHAPDF set ids are the entries in the first column of
      35             : /// http:///projects.hepforge.org/lhapdf/PDFsets.index
      36             : ///
      37             : class PdfInfo {
      38             : 
      39             : public:
      40             :   // ---  birth/death:
      41             :   //
      42             :   /// default constructor
      43             :   PdfInfo()
      44           0 :     : m_id1(0), 
      45           0 :       m_id2(0),
      46           0 :       m_pdf_id1(0),
      47           0 :       m_pdf_id2(0),
      48           0 :       m_x1(0),
      49           0 :       m_x2(0),
      50           0 :       m_scalePDF(0),
      51           0 :       m_pdf1(0),
      52           0 :       m_pdf2(0)
      53           0 :     {}
      54             : 
      55             :   /// all values EXCEPT pdf_id1 and pdf_id2 must be provided
      56             :   PdfInfo( int i1, int i2, double x1, double x2,
      57             :            double q, double p1, double p2,
      58             :            int pdf_id1 = 0, int pdf_id2 = 0 );
      59             : 
      60           0 :   ~PdfInfo() {}
      61             :     
      62             :   // ---  copying:
      63             :   //
      64             :   PdfInfo( PdfInfo const & orig );  //!< copy constructor
      65             :   PdfInfo &  operator = ( PdfInfo const & rhs ); //!< make a copy
      66             :   void swap( PdfInfo & other );     //!< swap two PdfInfo objects
      67             : 
      68             :   // ---  equivalence:
      69             :   //
      70             :   bool    operator==( const PdfInfo& ) const; //!< check for equality
      71             :   bool    operator!=( const PdfInfo& ) const; //!< check for inequality
      72             : 
      73             :   // ---  accessors:
      74             :     /// flavour code of first parton
      75           0 :     int   id1()                   const { return m_id1; }
      76             :     /// flavour code of second parton 
      77           0 :     int   id2()                   const { return m_id2; }
      78             :     /// LHAPDF set id of first parton
      79           0 :     int   pdf_id1()                   const { return m_pdf_id1; }
      80             :     /// LHAPDF set id of second parton
      81           0 :     int   pdf_id2()                   const { return m_pdf_id2; }
      82             :     /// fraction of beam momentum carried by first parton ("beam side") 
      83           0 :     double x1()                   const { return m_x1; } 
      84             :     /// fraction of beam momentum carried by second parton ("target side") 
      85           0 :     double x2()                   const { return m_x2; }
      86             :     ///  Q-scale used in evaluation of PDF's   (in GeV) 
      87           0 :     double scalePDF()             const { return m_scalePDF;  }
      88             :     /// PDF (id1, x1, Q) - x*f(x)
      89           0 :     double pdf1()                 const { return m_pdf1; }
      90             :     /// PDF (id2, x2, Q) - x*f(x)
      91           0 :     double pdf2()                 const { return m_pdf2; }
      92             : 
      93             :     /// verify that the instance contains non-zero information
      94             :     bool  is_valid()                     const;
      95             : 
      96             :   // ---  mutators:
      97             :     /// set flavour code of first parton
      98           0 :     void   set_id1(const int &i)              { m_id1=i; }
      99             :     /// set flavour code of second parton 
     100           0 :     void   set_id2(const int &i)              { m_id2=i; }
     101             :     /// set LHAPDF set id of first parton
     102           0 :     void   set_pdf_id1(const int &i)              { m_pdf_id1=i; }
     103             :     /// set LHAPDF set id of second parton 
     104           0 :     void   set_pdf_id2(const int &i)              { m_pdf_id2=i; }
     105             :     /// set fraction of beam momentum carried by first parton ("beam side") 
     106           0 :     void   set_x1(const double &f)            { m_x1=f; }
     107             :     /// set fraction of beam momentum carried by second parton ("target side") 
     108           0 :     void   set_x2(const double &f)            { m_x2=f; }
     109             :     /// set Q-scale used in evaluation of PDF's   (in GeV) 
     110           0 :     void   set_scalePDF(const double &f)      { m_scalePDF=f;  }
     111             :     /// set x*f(x) of first parton
     112           0 :     void   set_pdf1(const double &f)          { m_pdf1=f; }
     113             :     /// set x*f(x) of second parton
     114           0 :     void   set_pdf2(const double &f)          { m_pdf2=f; }
     115             : 
     116             : private: // data members
     117             :     int   m_id1; 
     118             :     int   m_id2; 
     119             :     int   m_pdf_id1; 
     120             :     int   m_pdf_id2; 
     121             :     double m_x1;
     122             :     double m_x2;
     123             :     double m_scalePDF; 
     124             :     double m_pdf1;
     125             :     double m_pdf2;
     126             : 
     127             : };
     128             : 
     129             : // Free Functions
     130             : 
     131             : // IO
     132             : std::ostream & operator << (std::ostream &, PdfInfo const *);
     133             : std::istream & operator >> (std::istream &, PdfInfo *);
     134             : 
     135             : // inline operators
     136             : inline PdfInfo::PdfInfo( int i1, int i2, double xin1, double xin2,
     137             :                          double q, double p1, double p2,
     138             :                          int pid1, int pid2 )
     139             :     : m_id1(i1), 
     140             :       m_id2(i2),
     141             :       m_pdf_id1(pid1),
     142             :       m_pdf_id2(pid2),
     143             :       m_x1(xin1),
     144             :       m_x2(xin2),
     145             :       m_scalePDF(q),
     146             :       m_pdf1(p1),
     147             :       m_pdf2(p2)
     148             :    {}
     149             : 
     150             : inline PdfInfo::PdfInfo( PdfInfo const & orig )
     151           0 :     : m_id1(orig.m_id1), 
     152           0 :       m_id2(orig.m_id2),
     153           0 :       m_pdf_id1(orig.m_pdf_id1), 
     154           0 :       m_pdf_id2(orig.m_pdf_id2),
     155           0 :       m_x1(orig.m_x1),
     156           0 :       m_x2(orig.m_x2),
     157           0 :       m_scalePDF(orig.m_scalePDF),
     158           0 :       m_pdf1(orig.m_pdf1),
     159           0 :       m_pdf2(orig.m_pdf2)
     160           0 :    {}
     161             : 
     162             : inline PdfInfo &  PdfInfo::operator = ( PdfInfo const & rhs ) 
     163             : {
     164             :   PdfInfo temp( rhs );
     165             :   swap( temp );
     166             :   return *this;
     167             : }
     168             : 
     169             : inline void PdfInfo::swap( PdfInfo & other ) 
     170             : {
     171             :   std::swap(m_id1, other.m_id1); 
     172             :   std::swap(m_id2, other.m_id2);
     173             :   std::swap(m_pdf_id1, other.m_pdf_id1); 
     174             :   std::swap(m_pdf_id2, other.m_pdf_id2);
     175             :   std::swap(m_x1, other.m_x1);
     176             :   std::swap(m_x2, other.m_x2);
     177             :   std::swap(m_scalePDF, other.m_scalePDF);
     178             :   std::swap(m_pdf1, other.m_pdf1);
     179             :   std::swap(m_pdf2, other.m_pdf2);
     180             : }
     181             : 
     182             : inline bool    PdfInfo::operator==( const PdfInfo& a ) const
     183             : {
     184             :     /// equality requires that each member match
     185             :     return (    a.id1() == this->id1() 
     186             :              && a.id2() == this->id2() 
     187             :              && a.pdf_id1() == this->pdf_id1() 
     188             :              && a.pdf_id2() == this->pdf_id2() 
     189             :              && a.x1() == this->x1() 
     190             :              && a.x2() == this->x2()
     191             :              && a.scalePDF() == this->scalePDF() 
     192             :              && a.pdf1() == this->pdf1()
     193             :              && a.pdf2() == this->pdf2() );
     194             : }
     195             : 
     196             : inline bool    PdfInfo::operator!=( const PdfInfo& a ) const
     197             : {
     198             :     /// any nonmatching member generates inequality
     199             :     return !( a == *this );
     200             : }
     201             : 
     202             : inline bool  PdfInfo::is_valid() const
     203             : {
     204           0 :     if( m_id1 != 0 ) return true;
     205           0 :     if( m_id2 != 0 ) return true;
     206           0 :     if( m_pdf_id1 != 0 ) return true;
     207           0 :     if( m_pdf_id2 != 0 ) return true;
     208           0 :     if( m_x1 != 0 ) return true;
     209           0 :     if( m_x2 != 0 ) return true;
     210           0 :     if( m_scalePDF != 0 ) return true;
     211           0 :     if( m_pdf1 != 0 ) return true;
     212           0 :     if( m_pdf2 != 0 ) return true;
     213           0 :     return false;
     214           0 : }
     215             : 
     216             : } // HepMC
     217             : 
     218             : #endif  // HEPMC_PDF_INFO_H

Generated by: LCOV version 1.11