36 #ifdef G4LIB_USE_PYTHIA
38 #include "HepMCG4PythiaInterface.hh"
39 #include "HepMCG4PythiaMessenger.hh"
41 #include "HepMC/GenEvent.h"
42 #include "HepMC/PythiaWrapper6_4.h"
45 #define pygive pygive_
46 #define pyrget pyrget_
47 #define pyrset pyrset_
50 void pygive(
const char*,
int);
51 void pyrget(
int*,
int*);
52 void pyrset(
int*,
int*);
55 void call_pygive(G4String s)
57 pygive(s.c_str(), s.length());
59 void call_pyrget(
int a,
int b)
63 void call_pyrset(
int a,
int b)
69 HepMCG4PythiaInterface::HepMCG4PythiaInterface()
70 : verbose(0), mpylist(0)
73 #ifdef NEED_INITPYDATA
80 messenger =
new HepMCG4PythiaMessenger(
this);
84 HepMCG4PythiaInterface::~HepMCG4PythiaInterface()
91 void HepMCG4PythiaInterface::CallPygive(G4String par)
98 void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam,
99 G4String target, G4double win)
102 call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
106 void HepMCG4PythiaInterface::CallPystat(G4int istat)
113 void HepMCG4PythiaInterface::SetRandomSeed(G4int iseed)
116 pydatr.mrpy[1 - 1] = iseed;
120 void HepMCG4PythiaInterface::CallPyrget(G4int lun, G4int move)
123 call_pyrget(lun, move);
127 void HepMCG4PythiaInterface::CallPyrset(G4int lun, G4int move)
130 call_pyrset(lun, move);
134 void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr)
const
137 ostr <<
"# Pythia random numbers status" << G4endl;
138 for (G4int j = 0; j < 6; j++) {
139 ostr <<
"pydatr.mrpy[" << j <<
"]= " << pydatr.mrpy[j] << G4endl;
141 for (G4int k = 0; k < 100; k++) {
142 ostr <<
"pydatr.rrpy[" << k <<
"]= " << pydatr.rrpy[k] << G4endl;
147 void HepMCG4PythiaInterface::SetUserParameters()
150 G4cout <<
"set user parameters of PYTHIA common." << G4endl
151 <<
"nothing to be done in default."
156 HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
159 static G4int nevent = 0;
162 if(mpylist >= 1 && mpylist <= 3) call_pylist(mpylist);
166 HepMC::GenEvent* evt = hepevtio.read_next_event();
167 evt-> set_event_number(nevent++);
168 if(verbose > 0) evt-> print();
174 void HepMCG4PythiaInterface::Print() const
177 G4cout <<
"PythiaInterface::Print()..." << G4endl;