File indexing completed on 2025-02-23 09:21:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #ifdef G4LIB_USE_PYTHIA
0032
0033 # include "HepMCG4PythiaInterface.hh"
0034
0035 # include "HepMC/GenEvent.h"
0036 # include "HepMC/PythiaWrapper6_4.h"
0037 # include "HepMCG4PythiaMessenger.hh"
0038
0039
0040
0041 # define pygive pygive_
0042 # define pyrget pyrget_
0043 # define pyrset pyrset_
0044
0045 extern "C"
0046 {
0047 void pygive(const char*, int);
0048 void pyrget(int*, int*);
0049 void pyrset(int*, int*);
0050 }
0051
0052 void call_pygive(G4String s)
0053 {
0054 pygive(s.c_str(), s.length());
0055 }
0056 void call_pyrget(int a, int b)
0057 {
0058 pyrget(&a, &b);
0059 }
0060 void call_pyrset(int a, int b)
0061 {
0062 pyrset(&a, &b);
0063 }
0064
0065
0066 HepMCG4PythiaInterface::HepMCG4PythiaInterface() : verbose(0), mpylist(0)
0067 {
0068 # ifdef NEED_INITPYDATA
0069 initpydata();
0070
0071
0072
0073 # endif
0074
0075 messenger = new HepMCG4PythiaMessenger(this);
0076 }
0077
0078
0079 HepMCG4PythiaInterface::~HepMCG4PythiaInterface()
0080 {
0081 delete messenger;
0082 }
0083
0084
0085 void HepMCG4PythiaInterface::CallPygive(G4String par)
0086 {
0087 call_pygive(par);
0088 }
0089
0090
0091 void HepMCG4PythiaInterface::CallPyinit(G4String frame, G4String beam, G4String target,
0092 G4double win)
0093 {
0094 call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
0095 }
0096
0097
0098 void HepMCG4PythiaInterface::CallPystat(G4int istat)
0099 {
0100 call_pystat(istat);
0101 }
0102
0103
0104 void HepMCG4PythiaInterface::SetRandomSeed(G4int iseed)
0105 {
0106 pydatr.mrpy[1 - 1] = iseed;
0107 }
0108
0109
0110 void HepMCG4PythiaInterface::CallPyrget(G4int lun, G4int move)
0111 {
0112 call_pyrget(lun, move);
0113 }
0114
0115
0116 void HepMCG4PythiaInterface::CallPyrset(G4int lun, G4int move)
0117 {
0118 call_pyrset(lun, move);
0119 }
0120
0121
0122 void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
0123 {
0124 ostr << "# Pythia random numbers status" << G4endl;
0125 for (G4int j = 0; j < 6; j++) {
0126 ostr << "pydatr.mrpy[" << j << "]= " << pydatr.mrpy[j] << G4endl;
0127 }
0128 for (G4int k = 0; k < 100; k++) {
0129 ostr << "pydatr.rrpy[" << k << "]= " << pydatr.rrpy[k] << G4endl;
0130 }
0131 }
0132
0133
0134 void HepMCG4PythiaInterface::SetUserParameters()
0135 {
0136 G4cout << "set user parameters of PYTHIA common." << G4endl << "nothing to be done in default."
0137 << G4endl;
0138 }
0139
0140
0141 HepMC::GenEvent* HepMCG4PythiaInterface::GenerateHepMCEvent()
0142 {
0143 static G4int nevent = 0;
0144
0145 call_pyevnt();
0146 if (mpylist >= 1 && mpylist <= 3) call_pylist(mpylist);
0147
0148 call_pyhepc(1);
0149
0150 HepMC::GenEvent* evt = hepevtio.read_next_event();
0151 evt->set_event_number(nevent++);
0152 if (verbose > 0) evt->print();
0153
0154 return evt;
0155 }
0156
0157
0158 void HepMCG4PythiaInterface::Print() const
0159 {
0160 G4cout << "PythiaInterface::Print()..." << G4endl;
0161 }
0162
0163 #endif