StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
HepMCInterface.h
1 // HepMCInterface.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2012 Mikhail Kirsanov, Torbjorn Sjostrand.
3 // PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
4 // Please respect the MCnet Guidelines, see GUIDELINES for details.
5 
6 // Header file for I_Pythia8 class,
7 // which converts a PYTHIA event record to the standard HepMC format.
8 
9 #ifndef Pythia8_HepMCInterface_H
10 #define Pythia8_HepMCInterface_H
11 
12 #include <set>
13 #include <vector>
14 #include "HepMC/IO_BaseClass.h"
15 #include "Pythia.h"
16 
17 namespace HepMC {
18 
19 // Forward references to some classes.
20 class GenEvent;
21 class GenVertex;
22 class GenParticle;
23 class ParticleDataTable;
24 
25 //==========================================================================
26 
27 // The I_Pythia8 class.
28 
29 class I_Pythia8 : public IO_BaseClass {
30 
31 public:
32 
33  // Constructor and destructor.
34  I_Pythia8();
35  virtual ~I_Pythia8();
36 
37  // The key methods to convert Pythia events into HepMC ones.
38  bool fill_next_event( Pythia8::Event& pyev, GenEvent* evt,
39  int ievnum = -1 );
40  bool fill_next_event( Pythia8::Pythia& pythia, GenEvent* evt,
41  int ievnum = -1, bool convertGluonTo0 = false );
42  void put_pdf_info( GenEvent* evt, Pythia8::Pythia& pythia,
43  bool convertGluonTo0 = false );
44 
45  // Read out values for some switches.
46  bool trust_both_mothers_and_daughters() const;
47  bool trust_mothers_before_daughters() const;
48  bool print_inconsistency_errors() const;
49 
50  // Set values for some switches.
51  void set_trust_mothers_before_daughters( bool b = true );
52  void set_trust_both_mothers_and_daughters( bool b = false );
53  void set_print_inconsistency_errors( bool b = true );
54  void set_crash_on_problem( bool b = false );
55  void set_freepartonwarnings( bool b = true );
56  void set_convert_to_mev( bool b = false );
57 
58 private:
59 
60  // Following are not (yet?) implemented for this class.
61  virtual bool fill_next_event( GenEvent* ) { return 0; }
62  virtual void write_event( const GenEvent* ) {;}
63  virtual void write_particle_data_table( const ParticleDataTable* ) {}
64  virtual bool fill_particle_data_table( ParticleDataTable* ) { return 0; }
65 
66  // Use of copy constructor is not allowed
67  I_Pythia8( const I_Pythia8& ) : IO_BaseClass() {}
68 
69  // Data members.
70  bool m_trust_mothers_before_daughters;
71  bool m_trust_both_mothers_and_daughters;
72  bool m_print_inconsistency_errors;
73  bool m_crash_on_problem;
74  bool m_freepartonwarnings;
75  bool m_convert_to_mev;
76  double m_mom_scale_factor;
77  int m_internal_event_number;
78 
79 };
80 
81 // Inline access methods.
82 
83 inline bool I_Pythia8::trust_both_mothers_and_daughters() const
84  { return m_trust_both_mothers_and_daughters; }
85 
86 inline bool I_Pythia8::trust_mothers_before_daughters() const
87  { return m_trust_mothers_before_daughters; }
88 
89 inline bool I_Pythia8::print_inconsistency_errors() const
90  { return m_print_inconsistency_errors; }
91 
92 inline void I_Pythia8::set_trust_both_mothers_and_daughters( bool b )
93  { m_trust_both_mothers_and_daughters = b; }
94 
95 inline void I_Pythia8::set_trust_mothers_before_daughters( bool b )
96  { m_trust_mothers_before_daughters = b; }
97 
98 inline void I_Pythia8::set_print_inconsistency_errors( bool b )
99  { m_print_inconsistency_errors = b; }
100 
101 inline void I_Pythia8::set_crash_on_problem( bool b )
102  { m_crash_on_problem = b; }
103 
104 inline void I_Pythia8::set_convert_to_mev( bool b )
105  { m_convert_to_mev = b; m_mom_scale_factor = (b) ? 1000. : 1.; }
106 
107 inline void I_Pythia8::set_freepartonwarnings( bool b )
108  { m_freepartonwarnings = b; }
109 
110 //==========================================================================
111 
112 } // end namespace HepMC
113 
114 #endif // end Pythia8_HepMCInterface_H
The GenEvent class is the core of HepMC.
Definition: GenEvent.h:155
all input/output classes inherit from IO_BaseClass
Definition: IO_BaseClass.h:34