1010
1111// / \author R+Preghenella - August 2017
1212
13+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
14+
1315#include " Generators/GeneratorHepMC.h"
1416#include " HepMC/ReaderAscii.h"
1517#include " HepMC/ReaderAsciiHepMC2.h"
2729#undef DEBUG
2830#endif
2931
32+ #else
33+
34+ #include " Generators/GeneratorHepMC.h"
35+ #include " HepMC3/ReaderAscii.h"
36+ #include " HepMC3/ReaderAsciiHepMC2.h"
37+ #include " HepMC3/GenEvent.h"
38+ #include " HepMC3/GenParticle.h"
39+ #include " HepMC3/GenVertex.h"
40+ #include " HepMC3/FourVector.h"
41+ #include " TParticle.h"
42+
43+ #endif
44+
3045#include " FairLogger.h"
3146#include " FairPrimaryGenerator.h"
3247#include < cmath>
@@ -44,7 +59,11 @@ GeneratorHepMC::GeneratorHepMC()
4459{
4560 /* * default constructor **/
4661
62+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
4763 mEvent = new HepMC::GenEvent ();
64+ #else
65+ mEvent = new HepMC3::GenEvent ();
66+ #endif
4867 mInterface = reinterpret_cast <void *>(mEvent );
4968 mInterfaceName = " hepmc" ;
5069}
@@ -56,7 +75,11 @@ GeneratorHepMC::GeneratorHepMC(const Char_t* name, const Char_t* title)
5675{
5776 /* * constructor **/
5877
78+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
5979 mEvent = new HepMC::GenEvent ();
80+ #else
81+ mEvent = new HepMC3::GenEvent ();
82+ #endif
6083 mInterface = reinterpret_cast <void *>(mEvent );
6184 mInterfaceName = " hepmc" ;
6285}
@@ -89,7 +112,11 @@ Bool_t GeneratorHepMC::generateEvent()
89112 if (mReader ->failed ())
90113 return kFALSE ;
91114 /* * set units to desired output **/
115+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
92116 mEvent ->set_units (HepMC::Units::GEV , HepMC::Units::MM );
117+ #else
118+ mEvent ->set_units (HepMC3::Units::GEV , HepMC3::Units::MM );
119+ #endif
93120
94121 /* * success **/
95122 return kTRUE ;
@@ -163,10 +190,18 @@ Bool_t GeneratorHepMC::Init()
163190 switch (mVersion ) {
164191 case 2 :
165192 mStream .close ();
193+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
166194 mReader = new HepMC::ReaderAsciiHepMC2 (mFileName );
195+ #else
196+ mReader = new HepMC3::ReaderAsciiHepMC2 (mFileName );
197+ #endif
167198 break ;
168199 case 3 :
200+ #ifdef GENERATORS_WITH_HEPMC3_DEPRECATED
169201 mReader = new HepMC::ReaderAscii (mStream );
202+ #else
203+ mReader = new HepMC3::ReaderAscii (mStream );
204+ #endif
170205 break ;
171206 default :
172207 LOG (FATAL ) << " Unsupported HepMC version: " << mVersion << std::endl;
0 commit comments