StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GenCrossSection.h
1 #ifndef HEPMC_GEN_CROSS_SECTION_H
2 #define HEPMC_GEN_CROSS_SECTION_H
3 
4 //--------------------------------------------------------------------------
6 // garren@fnal.gov, May 2009
7 //
9 //--------------------------------------------------------------------------
10 
11 #include <iostream>
12 
13 namespace HepMC {
14 
16 
33 
34 public:
36  : m_cross_section(0),
37  m_cross_section_error(0),
38  m_is_set(false)
39  {}
40  ~GenCrossSection() {}
41 
42  GenCrossSection( GenCrossSection const & orig );
43 
44  void swap( GenCrossSection & other);
46  bool operator==( const GenCrossSection& ) const;
49  bool operator!=( const GenCrossSection& ) const;
50 
51 
52  // --- accessors:
53 
55  double cross_section() const { return m_cross_section; }
57  double cross_section_error() const { return m_cross_section_error; }
58 
60  bool is_set() const { return m_is_set; }
61 
62  // --- mutators:
64  void set_cross_section( double xs, double xs_err );
66  void set_cross_section( double );
68  void set_cross_section_error( double );
71  void clear();
72 
73  // --- I/O:
75  std::ostream & write( std::ostream & ) const;
77  std::istream & read( std::istream & );
78 
79 private: // data members
80  double m_cross_section;
81  double m_cross_section_error;
82  bool m_is_set;
83 
84 };
85 
86 //
87 // streaming I/O
88 
89 inline std::ostream & operator << ( std::ostream & os, GenCrossSection & xs )
90 { return xs.write(os); }
91 
92 inline std::istream & operator >> ( std::istream & is, GenCrossSection & xs )
93 { return xs.read(is); }
94 
95 //
96 // inline methods
97 
98 inline void GenCrossSection::set_cross_section( double xs, double xserr ) {
100  set_cross_section_error(xserr);
101 }
102 
103 inline void GenCrossSection::set_cross_section( double xs )
104 {
105  m_cross_section = xs;
106  m_is_set = true;
107 }
108 
109 inline void GenCrossSection::set_cross_section_error( double xserr )
110 {
111  m_cross_section_error = xserr;
112 }
113 
114 } // HepMC
115 
116 #endif // HEPMC_GEN_CROSS_SECTION_H
void set_cross_section(double xs, double xs_err)
Set cross section and error in pb.
The GenCrossSection class stores the generated cross section.
bool operator==(const GenCrossSection &) const
check for equality
GenCrossSection & operator=(GenCrossSection const &rhs)
std::istream & read(std::istream &)
read from an input stream
bool operator!=(const GenCrossSection &) const
check for inequality
void set_cross_section_error(double)
set error associated with this cross section in pb
std::ostream & write(std::ostream &) const
write to an output stream
double cross_section_error() const
error associated with this cross section in pb
double cross_section() const
cross section in pb
bool is_set() const
True if the cross section has been set. False by default.
void swap(GenCrossSection &other)
swap