Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
HepMCEx02/src/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 // $Id: HepMCG4PythiaInterface.cc 77801 2013-11-28 13:33:20Z gcosmo $
30 //
31 
32 #ifdef G4LIB_USE_PYTHIA
33 
34 #include "HepMCG4PythiaInterface.hh"
35 #include "HepMCG4PythiaMessenger.hh"
36 
37 #include "HepMC/GenEvent.h"
38 #include "HepMC/PythiaWrapper6_4.h"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 // additional pythia calls
42 #define pygive pygive_
43 #define pyrget pyrget_
44 #define pyrset pyrset_
45 
46 extern "C" {
47  void pygive(const char*, int);
48  void pyrget(int*, int*);
49  void pyrset(int*, int*);
50 }
51 
52 void call_pygive(G4String s) { pygive(s.c_str(), s.length()); }
53 void call_pyrget(int a, int b) { pyrget(&a, &b); }
54 void call_pyrset(int a, int b) { pyrset(&a, &b); }
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58  : verbose(0), mpylist(0)
59 {
60 #ifdef NEED_INITPYDATA
61  initpydata();
62  // Some platforms may require the initialization of pythia PYDATA block
63  // data as external - if you get pythia initialization errors try
64  // commenting in/out the below call to initpydata().
65 #endif
66 
67  messenger= new HepMCG4PythiaMessenger(this);
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 {
73  delete messenger;
74 }
75 
76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 {
79  call_pygive(par);
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 {
86  call_pyinit(frame.c_str(), beam.c_str(), target.c_str(), win);
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 {
92  call_pystat(istat);
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
97 {
98  pydatr.mrpy[1-1]= iseed;
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 {
104  call_pyrget(lun, move);
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 {
110  call_pyrset(lun, move);
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 void HepMCG4PythiaInterface::PrintRandomStatus(std::ostream& ostr) const
115 {
116  ostr << "# Pythia random numbers status" << G4endl;
117  for (G4int j=0; j<6; j++) {
118  ostr << "pydatr.mrpy[" << j << "]= " << pydatr.mrpy[j] << G4endl;
119  }
120  for (G4int k=0; k<100; k++) {
121  ostr << "pydatr.rrpy[" << k << "]= " << pydatr.rrpy[k] << G4endl;
122  }
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127 {
128  G4cout << "set user parameters of PYTHIA common." << G4endl
129  << "nothing to be done in default."
130  << G4endl;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 {
136  static G4int nevent= 0; // event counter
137 
138  call_pyevnt(); // generate one event with Pythia
139  if(mpylist >=1 && mpylist<= 3) call_pylist(mpylist);
140 
141  call_pyhepc(1);
142 
143  HepMC::GenEvent* evt= hepevtio.read_next_event();
144  evt-> set_event_number(nevent++);
145  if(verbose>0) evt-> print();
146 
147  return evt;
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
152 {
153  G4cout << "PythiaInterface::Print()..." << G4endl;
154 }
155 
156 #endif
void print(G4double elem)
void CallPygive(G4String par)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
void CallPyinit(G4String frame, G4String beam, G4String target, G4double win)
const XML_Char * target
Definition: expat.h:268
#define G4endl
Definition: G4ios.hh:61
const XML_Char * s
Definition: expat.h:262
double G4double
Definition: G4Types.hh:76
virtual void Print() const
Int_t nevent
void CallPystat(G4int istat)
virtual HepMC::GenEvent * GenerateHepMCEvent()
int G4int
Definition: G4Types.hh:78
void PrintRandomStatus(std::ostream &ostr=G4cout) const
virtual void SetUserParameters()
G4GLOB_DLL std::ostream G4cout
void CallPyrset(G4int lun, G4int move)
void CallPyrget(G4int lun, G4int move)
void SetRandomSeed(G4int iseed)