StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Pythia8ToHepMC.h
1 // Pythia8ToHepMC.h is a part of the PYTHIA event generator.
2 // Copyright (C) 2014 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 // Author: Mikhail Kirsanov, Mikhail.Kirsanov@cern.ch
7 // Header file for the Pythia8ToHepMC class,
8 // which converts a PYTHIA event record to the standard HepMC format.
9 
10 #ifndef Pythia8_Pythia8ToHepMC_H
11 #define Pythia8_Pythia8ToHepMC_H
12 
13 #include <vector>
14 #include "HepMC/IO_BaseClass.h"
15 #include "Pythia8/Pythia.h"
16 
17 namespace HepMC {
18 
19 // Forward references to some classes.
20 class GenEvent;
21 class GenVertex;
22 class GenParticle;
23 
24 //==========================================================================
25 
26 // The Pythia8ToHepMC class.
27 
28 class Pythia8ToHepMC : public IO_BaseClass {
29 
30 public:
31 
32  // Constructor and destructor.
33  Pythia8ToHepMC() : m_internal_event_number(0),
34  m_print_inconsistency(true), m_free_parton_warnings(true),
35  m_crash_on_problem(false), m_convert_gluon_to_0(false),
36  m_store_pdf(true), m_store_proc(true), m_store_xsec(true) {;}
37  virtual ~Pythia8ToHepMC() {;}
38 
39  // The recommended method to convert Pythia events into HepMC ones.
40  bool fill_next_event( Pythia8::Pythia& pythia, GenEvent* evt,
41  int ievnum = -1 ) {return fill_next_event( pythia.event, evt,
42  ievnum, &pythia.info, &pythia.settings);}
43 
44  // Alternative method to convert Pythia events into HepMC ones.
45  bool fill_next_event( Pythia8::Event& pyev, GenEvent* evt,
46  int ievnum = -1, Pythia8::Info* pyinfo = 0,
47  Pythia8::Settings* pyset = 0);
48 
49  // Read out values for some switches.
50  bool print_inconsistency() const {return m_print_inconsistency;}
51  bool free_parton_warnings() const {return m_free_parton_warnings;}
52  bool crash_on_problem() const {return m_crash_on_problem;}
53  bool convert_gluon_to_0() const {return m_convert_gluon_to_0;}
54  bool store_pdf() const {return m_store_pdf;}
55  bool store_proc() const {return m_store_proc;}
56  bool store_xsec() const {return m_store_xsec;}
57 
58  // Set values for some switches.
59  void set_print_inconsistency(bool b = true) {m_print_inconsistency = b;}
60  void set_free_parton_warnings(bool b = true) {m_free_parton_warnings = b;}
61  void set_crash_on_problem(bool b = false) {m_crash_on_problem = b;}
62  void set_convert_gluon_to_0(bool b = false) {m_convert_gluon_to_0 = b;}
63  void set_store_pdf(bool b = true) {m_store_pdf = b;}
64  void set_store_proc(bool b = true) {m_store_proc = b;}
65  void set_store_xsec(bool b = true) {m_store_xsec = b;}
66 
67 private:
68 
69  // Following methods are not implemented for this class.
70  virtual bool fill_next_event( GenEvent* ) { return 0; }
71  virtual void write_event( const GenEvent* ) {;}
72 
73  // Use of copy constructor is not allowed.
75 
76  // Data members.
77  int m_internal_event_number;
78  bool m_print_inconsistency, m_free_parton_warnings,
79  m_crash_on_problem, m_convert_gluon_to_0,
80  m_store_pdf, m_store_proc, m_store_xsec;
81 
82 };
83 
84 //==========================================================================
85 
86 } // end namespace HepMC
87 
88 #endif // end Pythia8_Pythia8ToHepMC_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