StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PdfInfo.h
1 //--------------------------------------------------------------------------
2 #ifndef HEPMC_PDF_INFO_H
3 #define HEPMC_PDF_INFO_H
4 
6 // garren@fnal.gov, July 2006
7 //
8 // Additional PDF information
10 
11 namespace HepMC {
12 
14 
37 class PdfInfo {
38 
39 public:
40  // --- birth/death:
41  //
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 
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 );
65  PdfInfo & operator = ( PdfInfo const & rhs );
66  void swap( PdfInfo & other );
67 
68  // --- equivalence:
69  //
70  bool operator==( const PdfInfo& ) const;
71  bool operator!=( const PdfInfo& ) const;
72 
73  // --- accessors:
75  int id1() const { return m_id1; }
77  int id2() const { return m_id2; }
79  int pdf_id1() const { return m_pdf_id1; }
81  int pdf_id2() const { return m_pdf_id2; }
83  double x1() const { return m_x1; }
85  double x2() const { return m_x2; }
87  double scalePDF() const { return m_scalePDF; }
89  double pdf1() const { return m_pdf1; }
91  double pdf2() const { return m_pdf2; }
92 
94  bool is_valid() const;
95 
96  // --- mutators:
98  void set_id1(const int &i) { m_id1=i; }
100  void set_id2(const int &i) { m_id2=i; }
102  void set_pdf_id1(const int &i) { m_pdf_id1=i; }
104  void set_pdf_id2(const int &i) { m_pdf_id2=i; }
106  void set_x1(const double &f) { m_x1=f; }
108  void set_x2(const double &f) { m_x2=f; }
110  void set_scalePDF(const double &f) { m_scalePDF=f; }
112  void set_pdf1(const double &f) { m_pdf1=f; }
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 
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  : 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 {
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 {
199  return !( a == *this );
200 }
201 
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 
216 } // HepMC
217 
218 #endif // HEPMC_PDF_INFO_H
void swap(PdfInfo &other)
swap two PdfInfo objects
Definition: PdfInfo.h:169
int id1() const
flavour code of first parton
Definition: PdfInfo.h:75
PdfInfo()
default constructor
Definition: PdfInfo.h:43
double pdf1() const
PDF (id1, x1, Q) - x*f(x)
Definition: PdfInfo.h:89
bool operator!=(const PdfInfo &) const
check for inequality
Definition: PdfInfo.h:196
void set_x1(const double &f)
set fraction of beam momentum carried by first parton (&quot;beam side&quot;)
Definition: PdfInfo.h:106
double x1() const
fraction of beam momentum carried by first parton (&quot;beam side&quot;)
Definition: PdfInfo.h:83
void set_pdf_id2(const int &i)
set LHAPDF set id of second parton
Definition: PdfInfo.h:104
PdfInfo & operator=(PdfInfo const &rhs)
make a copy
Definition: PdfInfo.h:162
void set_scalePDF(const double &f)
set Q-scale used in evaluation of PDF&#39;s (in GeV)
Definition: PdfInfo.h:110
bool operator==(const PdfInfo &) const
check for equality
Definition: PdfInfo.h:182
double pdf2() const
PDF (id2, x2, Q) - x*f(x)
Definition: PdfInfo.h:91
double x2() const
fraction of beam momentum carried by second parton (&quot;target side&quot;)
Definition: PdfInfo.h:85
void set_x2(const double &f)
set fraction of beam momentum carried by second parton (&quot;target side&quot;)
Definition: PdfInfo.h:108
void set_pdf1(const double &f)
set x*f(x) of first parton
Definition: PdfInfo.h:112
int pdf_id2() const
LHAPDF set id of second parton.
Definition: PdfInfo.h:81
void set_pdf_id1(const int &i)
set LHAPDF set id of first parton
Definition: PdfInfo.h:102
void set_pdf2(const double &f)
set x*f(x) of second parton
Definition: PdfInfo.h:114
int pdf_id1() const
LHAPDF set id of first parton.
Definition: PdfInfo.h:79
void set_id1(const int &i)
set flavour code of first parton
Definition: PdfInfo.h:98
double scalePDF() const
Q-scale used in evaluation of PDF&#39;s (in GeV)
Definition: PdfInfo.h:87
int id2() const
flavour code of second parton
Definition: PdfInfo.h:77
void set_id2(const int &i)
set flavour code of second parton
Definition: PdfInfo.h:100
bool is_valid() const
verify that the instance contains non-zero information
Definition: PdfInfo.h:202
The PdfInfo class stores PDF information.
Definition: PdfInfo.h:37