Fork me on GitHub

source: svn/trunk/Utilities/HepMC/interface/PdfInfo.h@ 488

Last change on this file since 488 was 349, checked in by severine ovyn, 16 years ago

first test

File size: 6.2 KB
RevLine 
[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
11namespace 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///
37class PdfInfo {
38
39public:
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
93 // --- mutators:
94 /// set flavour code of first parton
95 void set_id1(const int &i) { m_id1=i; }
96 /// set flavour code of second parton
97 void set_id2(const int &i) { m_id2=i; }
98 /// set LHAPDF set id of first parton
99 void set_pdf_id1(const int &i) { m_pdf_id1=i; }
100 /// set LHAPDF set id of second parton
101 void set_pdf_id2(const int &i) { m_pdf_id2=i; }
102 /// set fraction of beam momentum carried by first parton ("beam side")
103 void set_x1(const double &f) { m_x1=f; }
104 /// set fraction of beam momentum carried by second parton ("target side")
105 void set_x2(const double &f) { m_x2=f; }
106 /// set Q-scale used in evaluation of PDF's (in GeV)
107 void set_scalePDF(const double &f) { m_scalePDF=f; }
108 /// set x*f(x) of first parton
109 void set_pdf1(const double &f) { m_pdf1=f; }
110 /// set x*f(x) of second parton
111 void set_pdf2(const double &f) { m_pdf2=f; }
112
113private: // data members
114 int m_id1;
115 int m_id2;
116 int m_pdf_id1;
117 int m_pdf_id2;
118 double m_x1;
119 double m_x2;
120 double m_scalePDF;
121 double m_pdf1;
122 double m_pdf2;
123
124};
125
126// inline operators
127inline PdfInfo::PdfInfo( int i1, int i2, double x1, double x2,
128 double q, double p1, double p2,
129 int pdf_id1, int pdf_id2 )
130 : m_id1(i1),
131 m_id2(i2),
132 m_pdf_id1(pdf_id1),
133 m_pdf_id2(pdf_id2),
134 m_x1(x1),
135 m_x2(x2),
136 m_scalePDF(q),
137 m_pdf1(p1),
138 m_pdf2(p2)
139 {}
140
141inline PdfInfo::PdfInfo( PdfInfo const & orig )
142 : m_id1(orig.m_id1),
143 m_id2(orig.m_id2),
144 m_pdf_id1(orig.m_pdf_id1),
145 m_pdf_id2(orig.m_pdf_id2),
146 m_x1(orig.m_x1),
147 m_x2(orig.m_x2),
148 m_scalePDF(orig.m_scalePDF),
149 m_pdf1(orig.m_pdf1),
150 m_pdf2(orig.m_pdf2)
151 {}
152
153inline PdfInfo & PdfInfo::operator = ( PdfInfo const & rhs )
154{
155 PdfInfo temp( rhs );
156 swap( temp );
157 return *this;
158}
159
160inline void PdfInfo::swap( PdfInfo & other )
161{
162 std::swap(m_id1, other.m_id1);
163 std::swap(m_id2, other.m_id2);
164 std::swap(m_pdf_id1, other.m_pdf_id1);
165 std::swap(m_pdf_id2, other.m_pdf_id2);
166 std::swap(m_x1, other.m_x1);
167 std::swap(m_x2, other.m_x2);
168 std::swap(m_scalePDF, other.m_scalePDF);
169 std::swap(m_pdf1, other.m_pdf1);
170 std::swap(m_pdf2, other.m_pdf2);
171}
172
173inline bool PdfInfo::operator==( const PdfInfo& a ) const
174{
175 /// equality requires that each member match
176 return ( a.id1() == this->id1()
177 && a.id2() == this->id2()
178 && a.pdf_id1() == this->pdf_id1()
179 && a.pdf_id2() == this->pdf_id2()
180 && a.x1() == this->x1()
181 && a.x2() == this->x2()
182 && a.scalePDF() == this->scalePDF()
183 && a.pdf1() == this->pdf1()
184 && a.pdf2() == this->pdf2() );
185}
186
187inline bool PdfInfo::operator!=( const PdfInfo& a ) const
188{
189 /// any nonmatching member generates inequality
190 return !( a == *this );
191}
192
193} // HepMC
194
195#endif // HEPMC_PDF_INFO_H
Note: See TracBrowser for help on using the repository browser.