[349] | 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 | : m_id1(0),
|
---|
| 45 | m_id2(0),
|
---|
| 46 | m_pdf_id1(0),
|
---|
| 47 | m_pdf_id2(0),
|
---|
| 48 | m_x1(0),
|
---|
| 49 | m_x2(0),
|
---|
| 50 | m_scalePDF(0),
|
---|
| 51 | m_pdf1(0),
|
---|
| 52 | m_pdf2(0)
|
---|
| 53 | {}
|
---|
| 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 | ~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 | int id1() const { return m_id1; }
|
---|
| 76 | /// flavour code of second parton
|
---|
| 77 | int id2() const { return m_id2; }
|
---|
| 78 | /// LHAPDF set id of first parton
|
---|
| 79 | int pdf_id1() const { return m_pdf_id1; }
|
---|
| 80 | /// LHAPDF set id of second parton
|
---|
| 81 | int pdf_id2() const { return m_pdf_id2; }
|
---|
| 82 | /// fraction of beam momentum carried by first parton ("beam side")
|
---|
| 83 | double x1() const { return m_x1; }
|
---|
| 84 | /// fraction of beam momentum carried by second parton ("target side")
|
---|
| 85 | double x2() const { return m_x2; }
|
---|
| 86 | /// Q-scale used in evaluation of PDF's (in GeV)
|
---|
| 87 | double scalePDF() const { return m_scalePDF; }
|
---|
| 88 | /// PDF (id1, x1, Q) - x*f(x)
|
---|
| 89 | double pdf1() const { return m_pdf1; }
|
---|
| 90 | /// PDF (id2, x2, Q) - x*f(x)
|
---|
| 91 | double pdf2() const { return m_pdf2; }
|
---|
| 92 |
|
---|
[572] | 93 | /// verify that the instance contains non-zero information
|
---|
| 94 | bool is_valid() const;
|
---|
| 95 |
|
---|
[349] | 96 | // --- mutators:
|
---|
| 97 | /// set flavour code of first parton
|
---|
| 98 | void set_id1(const int &i) { m_id1=i; }
|
---|
| 99 | /// set flavour code of second parton
|
---|
| 100 | void set_id2(const int &i) { m_id2=i; }
|
---|
| 101 | /// set LHAPDF set id of first parton
|
---|
| 102 | void set_pdf_id1(const int &i) { m_pdf_id1=i; }
|
---|
| 103 | /// set LHAPDF set id of second parton
|
---|
| 104 | void set_pdf_id2(const int &i) { m_pdf_id2=i; }
|
---|
| 105 | /// set fraction of beam momentum carried by first parton ("beam side")
|
---|
| 106 | void set_x1(const double &f) { m_x1=f; }
|
---|
| 107 | /// set fraction of beam momentum carried by second parton ("target side")
|
---|
| 108 | void set_x2(const double &f) { m_x2=f; }
|
---|
| 109 | /// set Q-scale used in evaluation of PDF's (in GeV)
|
---|
| 110 | void set_scalePDF(const double &f) { m_scalePDF=f; }
|
---|
| 111 | /// set x*f(x) of first parton
|
---|
| 112 | void set_pdf1(const double &f) { m_pdf1=f; }
|
---|
| 113 | /// set x*f(x) of second parton
|
---|
| 114 | 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 |
|
---|
[572] | 129 | // Free Functions
|
---|
| 130 |
|
---|
| 131 | // IO
|
---|
| 132 | std::ostream & operator << (std::ostream &, PdfInfo const *);
|
---|
| 133 | std::istream & operator >> (std::istream &, PdfInfo *);
|
---|
| 134 |
|
---|
[349] | 135 | // inline operators
|
---|
| 136 | inline PdfInfo::PdfInfo( int i1, int i2, double x1, double x2,
|
---|
| 137 | double q, double p1, double p2,
|
---|
| 138 | int pdf_id1, int pdf_id2 )
|
---|
| 139 | : m_id1(i1),
|
---|
| 140 | m_id2(i2),
|
---|
| 141 | m_pdf_id1(pdf_id1),
|
---|
| 142 | m_pdf_id2(pdf_id2),
|
---|
| 143 | m_x1(x1),
|
---|
| 144 | m_x2(x2),
|
---|
| 145 | m_scalePDF(q),
|
---|
| 146 | m_pdf1(p1),
|
---|
| 147 | m_pdf2(p2)
|
---|
| 148 | {}
|
---|
| 149 |
|
---|
| 150 | inline PdfInfo::PdfInfo( PdfInfo const & orig )
|
---|
| 151 | : m_id1(orig.m_id1),
|
---|
| 152 | m_id2(orig.m_id2),
|
---|
| 153 | m_pdf_id1(orig.m_pdf_id1),
|
---|
| 154 | m_pdf_id2(orig.m_pdf_id2),
|
---|
| 155 | m_x1(orig.m_x1),
|
---|
| 156 | m_x2(orig.m_x2),
|
---|
| 157 | m_scalePDF(orig.m_scalePDF),
|
---|
| 158 | m_pdf1(orig.m_pdf1),
|
---|
| 159 | m_pdf2(orig.m_pdf2)
|
---|
| 160 | {}
|
---|
| 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 |
|
---|
[572] | 202 | inline bool PdfInfo::is_valid() const
|
---|
| 203 | {
|
---|
| 204 | if( m_id1 != 0 ) return true;
|
---|
| 205 | if( m_id2 != 0 ) return true;
|
---|
| 206 | if( m_pdf_id1 != 0 ) return true;
|
---|
| 207 | if( m_pdf_id2 != 0 ) return true;
|
---|
| 208 | if( m_x1 != 0 ) return true;
|
---|
| 209 | if( m_x2 != 0 ) return true;
|
---|
| 210 | if( m_scalePDF != 0 ) return true;
|
---|
| 211 | if( m_pdf1 != 0 ) return true;
|
---|
| 212 | if( m_pdf2 != 0 ) return true;
|
---|
| 213 | return false;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
[349] | 216 | } // HepMC
|
---|
| 217 |
|
---|
| 218 | #endif // HEPMC_PDF_INFO_H
|
---|