ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
HepMCG4PythiaInterface.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file HepMCG4PythiaInterface.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
28
//
29
//
30
31
#ifdef G4LIB_USE_PYTHIA
32
33
#include "HepMCG4PythiaInterface.hh"
34
#include "HepMCG4PythiaMessenger.hh"
35
36
#include "HepMC/GenEvent.h"
37
#include "HepMC/PythiaWrapper6_4.h"
38
39
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
// additional pythia calls
41
#define pygive pygive_
42
#define pyrget pyrget_
43
#define pyrset pyrset_
44
45
extern
"C"
{
46
void
pygive
(
const
char
*,
int
);
47
void
pyrget
(
int
*,
int
*);
48
void
pyrset
(
int
*,
int
*);
49
}
50
51
void
call_pygive(
G4String
s
) {
pygive
(s.c_str(), s.length()); }
52
void
call_pyrget(
int
a
,
int
b
) {
pyrget
(&a, &b); }
53
void
call_pyrset(
int
a
,
int
b
) {
pyrset
(&a, &b); }
54
55
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
HepMCG4PythiaInterface::HepMCG4PythiaInterface
()
57
: verbose(0), mpylist(0)
58
{
59
#ifdef NEED_INITPYDATA
60
initpydata
();
61
// Some platforms may require the initialization of pythia PYDATA block
62
// data as external - if you get pythia initialization errors try
63
// commenting in/out the below call to initpydata().
64
#endif
65
66
messenger=
new
HepMCG4PythiaMessenger
(
this
);
67
}
68
69
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
HepMCG4PythiaInterface::~HepMCG4PythiaInterface
()
71
{
72
delete
messenger
;
73
}
74
75
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76
void
HepMCG4PythiaInterface::CallPygive
(
G4String
par)
77
{
78
call_pygive(par);
79
}
80
81
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
void
HepMCG4PythiaInterface::CallPyinit
(
G4String
frame,
G4String
beam,
83
G4String
target
,
G4double
win)
84
{
85
call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
86
}
87
88
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89
void
HepMCG4PythiaInterface::CallPystat
(
G4int
istat)
90
{
91
call_pystat(istat);
92
}
93
94
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95
void
HepMCG4PythiaInterface::SetRandomSeed
(
G4int
iseed)
96
{
97
pydatr.mrpy[1-1]= iseed;
98
}
99
100
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101
void
HepMCG4PythiaInterface::CallPyrget
(
G4int
lun,
G4int
move)
102
{
103
call_pyrget(lun, move);
104
}
105
106
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107
void
HepMCG4PythiaInterface::CallPyrset
(
G4int
lun,
G4int
move)
108
{
109
call_pyrset(lun, move);
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
void
HepMCG4PythiaInterface::PrintRandomStatus
(std::ostream& ostr)
const
114
{
115
ostr <<
"# Pythia random numbers status"
<<
G4endl
;
116
for
(
G4int
j=0; j<6; j++) {
117
ostr <<
"pydatr.mrpy["
<< j <<
"]= "
<< pydatr.mrpy[j] <<
G4endl
;
118
}
119
for
(
G4int
k
=0;
k
<100;
k
++) {
120
ostr <<
"pydatr.rrpy["
<<
k
<<
"]= "
<< pydatr.rrpy[
k
] <<
G4endl
;
121
}
122
}
123
124
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125
void
HepMCG4PythiaInterface::SetUserParameters
()
126
{
127
G4cout
<<
"set user parameters of PYTHIA common."
<< G4endl
128
<<
"nothing to be done in default."
129
<<
G4endl
;
130
}
131
132
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133
HepMC::GenEvent*
HepMCG4PythiaInterface::GenerateHepMCEvent
()
134
{
135
static
G4int
nevent
= 0;
// event counter
136
137
call_pyevnt();
// generate one event with Pythia
138
if
(
mpylist
>=1 &&
mpylist
<= 3) call_pylist(
mpylist
);
139
140
call_pyhepc(1);
141
142
HepMC::GenEvent* evt=
hepevtio
.read_next_event();
143
evt-> set_event_number(nevent++);
144
if
(
verbose
>0) evt->
print
();
145
146
return
evt;
147
}
148
149
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
150
void
HepMCG4PythiaInterface::Print
()
const
151
{
152
G4cout
<<
"PythiaInterface::Print()..."
<<
G4endl
;
153
}
154
155
#endif
geant4
tree
geant4-10.6-release
examples
extended
eventgenerator
HepMC
HepMCEx02
src
HepMCG4PythiaInterface.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:04
using
1.8.2 with
ECCE GitHub integration