![]() |
HepMC Reference DocumentationHepMC |
00001 #ifndef HEPMC_GEN_CROSS_SECTION_H 00002 #define HEPMC_GEN_CROSS_SECTION_H 00003 00004 //-------------------------------------------------------------------------- 00006 // garren@fnal.gov, May 2009 00007 // 00009 //-------------------------------------------------------------------------- 00010 00011 #include <iostream> 00012 00013 namespace HepMC { 00014 00016 00032 class GenCrossSection { 00033 00034 public: 00035 GenCrossSection() 00036 : m_cross_section(0), 00037 m_cross_section_error(0), 00038 m_is_set(false) 00039 {} 00040 ~GenCrossSection() {} 00041 00042 GenCrossSection( GenCrossSection const & orig ); 00043 00044 void swap( GenCrossSection & other); 00045 GenCrossSection & operator = ( GenCrossSection const & rhs ); 00046 00047 bool operator==( const GenCrossSection& ) const; 00049 bool operator!=( const GenCrossSection& ) const; 00050 00051 00052 // --- accessors: 00053 00055 double cross_section() const { return m_cross_section; } 00057 double cross_section_error() const { return m_cross_section_error; } 00058 00060 bool is_set() const { return m_is_set; } 00061 00062 // --- mutators: 00064 void set_cross_section( double xs, double xs_err ); 00066 void set_cross_section( double ); 00068 void set_cross_section_error( double ); 00071 void clear(); 00072 00073 // --- I/O: 00075 std::ostream & write( std::ostream & ) const; 00077 std::istream & read( std::istream & ); 00078 00079 private: // data members 00080 double m_cross_section; 00081 double m_cross_section_error; 00082 bool m_is_set; 00083 00084 }; 00085 00086 // 00087 // streaming I/O 00088 00089 inline std::ostream & operator << ( std::ostream & os, GenCrossSection & xs ) 00090 { return xs.write(os); } 00091 00092 inline std::istream & operator >> ( std::istream & is, GenCrossSection & xs ) 00093 { return xs.read(is); } 00094 00095 // 00096 // inline methods 00097 00098 inline void GenCrossSection::set_cross_section( double xs, double xserr ) { 00099 set_cross_section(xs); 00100 set_cross_section_error(xserr); 00101 } 00102 00103 inline void GenCrossSection::set_cross_section( double xs ) 00104 { 00105 m_cross_section = xs; 00106 m_is_set = true; 00107 } 00108 00109 inline void GenCrossSection::set_cross_section_error( double xserr ) 00110 { 00111 m_cross_section_error = xserr; 00112 } 00113 00114 } // HepMC 00115 00116 #endif // HEPMC_GEN_CROSS_SECTION_H