Fork me on GitHub

source: svn/trunk/Utilities/HepMC/interface/GenCrossSection.h@ 602

Last change on this file since 602 was 572, checked in by cp3-support, 13 years ago

upgrade HepMC to version 2.06.05

File size: 3.4 KB
RevLine 
[572]1#ifndef HEPMC_GEN_CROSS_SECTION_H
2#define HEPMC_GEN_CROSS_SECTION_H
3
4//--------------------------------------------------------------------------
5//////////////////////////////////////////////////////////////////////////
6// garren@fnal.gov, May 2009
7//
8//////////////////////////////////////////////////////////////////////////
9//--------------------------------------------------------------------------
10
11#include <iostream>
12
13namespace HepMC {
14
15//! The GenCrossSection class stores the generated cross section
16
17///
18/// \class GenCrossSection
19/// HepMC::GenCrossSection is used to store the generated cross section.
20/// This class is meant to be used to pass, on an event by event basis,
21/// the current best guess of the total cross section.
22/// It is expected that the final cross section will be stored elsewhere.
23///
24/// - double cross_section; // cross section in pb
25/// - double cross_section_error; // error associated with this cross section
26///
27/// The units of cross_section and cross_section_error are expected to be pb.
28///
29/// GenCrossSection information will be written if GenEvent contains a pointer
30/// to a valid GenCrossSection object.
31///
32class GenCrossSection {
33
34public:
35 GenCrossSection()
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 ); //!< copy
43
44 void swap( GenCrossSection & other); //!< swap
45 GenCrossSection & operator = ( GenCrossSection const & rhs ); //!< shallow
46 /// check for equality
47 bool operator==( const GenCrossSection& ) const;
48 /// check for inequality
49 bool operator!=( const GenCrossSection& ) const;
50
51
52 // --- accessors:
53
54 /// cross section in pb
55 double cross_section() const { return m_cross_section; }
56 /// error associated with this cross section in pb
57 double cross_section_error() const { return m_cross_section_error; }
58
59 /// True if the cross section has been set. False by default.
60 bool is_set() const { return m_is_set; }
61
62 // --- mutators:
63 /// Set cross section and error in pb
64 void set_cross_section( double xs, double xs_err );
65 /// set cross section in pb
66 void set_cross_section( double );
67 /// set error associated with this cross section in pb
68 void set_cross_section_error( double );
69 /// Clear all GenCrossSection info
70 /// (disables output of GenCrossSection until the cross section is set again)
71 void clear();
72
73 // --- I/O:
74 /// write to an output stream
75 std::ostream & write( std::ostream & ) const;
76 /// read from an input stream
77 std::istream & read( std::istream & );
78
79private: // 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
89inline std::ostream & operator << ( std::ostream & os, GenCrossSection & xs )
90{ return xs.write(os); }
91
92inline std::istream & operator >> ( std::istream & is, GenCrossSection & xs )
93{ return xs.read(is); }
94
95//
96// inline methods
97
98inline void GenCrossSection::set_cross_section( double xs, double xserr ) {
99 set_cross_section(xs);
100 set_cross_section_error(xserr);
101}
102
103inline void GenCrossSection::set_cross_section( double xs )
104{
105 m_cross_section = xs;
106 m_is_set = true;
107}
108
109inline 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
Note: See TracBrowser for help on using the repository browser.