#include "TPythia6.h"
#include "TClonesArray.h"
#include "TMCParticle6.h"
#include "TParticle.h"
TPythia6* TPythia6::fgInstance = 0;
#ifndef WIN32
# define pydiff pydiff_
# define pyevnt pyevnt_
# define pyinit pyinit_
# define pychge pychge_
# define pycomp pycomp_
# define pyedit pyedit_
# define pyexec pyexec_
# define pyhepc pyhepc_
# define pylist pylist_
# define pymass pymass_
# define pyname pyname_
# define pyr pyr_
# define pyrget pyrget_
# define pyrset pyrset_
# define pystat pystat_
# define pytest pytest_
# define pyupda pyupda_
# define py1ent py1ent_
# ifdef PYTHIA6_DOUBLE_UNDERSCORE
# define tpythia6_open_fortran_file tpythia6_open_fortran_file__
# define tpythia6_close_fortran_file tpythia6_close_fortran_file__
# define pythia6_common_address pythia6_common_address__
# elif PYTHIA6_SINGLE_UNDERSCORE
# define tpythia6_open_fortran_file tpythia6_open_fortran_file_
# define tpythia6_close_fortran_file tpythia6_close_fortran_file_
# define pythia6_common_address pythia6_common_address
# else
# define pythia6_common_address pythia6_common_address
# define tpythia6_open_fortran_file tpythia6_open_fortran_file_
# define tpythia6_close_fortran_file tpythia6_close_fortran_file_
# endif
# define type_of_call
#else
# define pydiff PYDIFF
# define pyevnt PYEVNT
# define pyinit PYINIT
# define pychge PYCHGE
# define pycomp PYCOMP
# define pyedit PYEDIT
# define pyexec PYEXEC
# define pyhepc PYHEPC
# define pylist PYLIST
# define pymass PYMASS
# define pyname PYNAME
# define pyr PYR
# define pyrget PYRGET
# define pyrset PYRSET
# define pystat PYSTAT
# define pytest PYTEST
# define pyupda PYUPDA
# define py1ent PY1ENT
# define tpythia6_open_fortran_file TPYTHIA6_OPEN_FORTRAN_FILE
# define tpythia6_close_fortran_file TPYTHIA6_CLOSE_FORTRAN_FILE
# define type_of_call _stdcall
#endif
extern "C" void type_of_call pyevnt();
extern "C" void type_of_call pystat(int *key);
extern "C" void type_of_call pylist(int *key);
extern "C" void type_of_call pyedit(int *medit);
extern "C" void type_of_call pydiff();
extern "C" void type_of_call pyexec();
extern "C" void type_of_call pyhepc(int *mconv);
extern "C" void type_of_call pylist(int *flag);
extern "C" int type_of_call pychge(int *kf);
extern "C" int type_of_call pycomp(int *kf);
extern "C" double type_of_call pymass(int *kf);
extern "C" void type_of_call pyname(int *kf, char *name, Long_t l_name);
extern "C" int type_of_call pyr(int *dummy);
extern "C" int type_of_call pyrget(int *lun, int *move);
extern "C" int type_of_call pyrset(int *lun, int *move);
extern "C" int type_of_call pytest(int *flag);
extern "C" int type_of_call pyupda(int *mupda, int *lun);
extern "C" void type_of_call py1ent(Int_t&, Int_t&, Double_t&, Double_t&, Double_t&);
#ifndef WIN32
extern "C" void type_of_call pyinit(char *frame, char *beam, char *target,
double *win, Long_t l_frame, Long_t l_beam,
Long_t l_target);
#else
extern "C" void type_of_call pyinit(char *frame, Long_t l_frame,
char *beam, Long_t l_beam,
char *target, Long_t l_target,
double *win
);
#endif
extern "C" {
void* pythia6_common_address(const char*);
void type_of_call tpythia6_open_fortran_file(int* lun, char* name, int);
void type_of_call tpythia6_close_fortran_file(int* lun);
}
ClassImp(TPythia6)
TPythia6::TPythia6Cleaner::TPythia6Cleaner() {
}
TPythia6::TPythia6Cleaner::~TPythia6Cleaner() {
if (TPythia6::fgInstance) {
delete TPythia6::fgInstance;
TPythia6::fgInstance = 0;
}
}
TPythia6::TPythia6() : TGenerator("TPythia6","TPythia6") {
if (fgInstance)
Fatal("TPythia6", "There's already an instance of TPythia6");
delete fParticles;
fParticles = new TClonesArray("TMCParticle",50);
fPyjets = (Pyjets_t*) pythia6_common_address("PYJETS");
fPydat1 = (Pydat1_t*) pythia6_common_address("PYDAT1");
fPydat2 = (Pydat2_t*) pythia6_common_address("PYDAT2");
fPydat3 = (Pydat3_t*) pythia6_common_address("PYDAT3");
fPydat4 = (Pydat4_t*) pythia6_common_address("PYDAT4");
fPydatr = (Pydatr_t*) pythia6_common_address("PYDATR");
fPysubs = (Pysubs_t*) pythia6_common_address("PYSUBS");
fPypars = (Pypars_t*) pythia6_common_address("PYPARS");
fPyint1 = (Pyint1_t*) pythia6_common_address("PYINT1");
fPyint2 = (Pyint2_t*) pythia6_common_address("PYINT2");
fPyint3 = (Pyint3_t*) pythia6_common_address("PYINT3");
fPyint4 = (Pyint4_t*) pythia6_common_address("PYINT4");
fPyint5 = (Pyint5_t*) pythia6_common_address("PYINT5");
fPyint6 = (Pyint6_t*) pythia6_common_address("PYINT6");
fPyint7 = (Pyint7_t*) pythia6_common_address("PYINT7");
fPyint8 = (Pyint8_t*) pythia6_common_address("PYINT8");
fPyint9 = (Pyint9_t*) pythia6_common_address("PYINT9");
fPyuppr = (Pyuppr_t*) pythia6_common_address("PYUPPR");
fPymssm = (Pymssm_t*) pythia6_common_address("PYMSSM");
fPyssmt = (Pyssmt_t*) pythia6_common_address("PYSSMT");
fPyints = (Pyints_t*) pythia6_common_address("PYINTS");
fPybins = (Pybins_t*) pythia6_common_address("PYBINS");
}
TPythia6::TPythia6(const TPythia6& p6) :
TGenerator(p6),
fPyjets(p6.fPyjets),
fPydat1(p6.fPydat1),
fPydat2(p6.fPydat2),
fPydat3(p6.fPydat3),
fPydat4(p6.fPydat4),
fPydatr(p6.fPydatr),
fPysubs(p6.fPysubs),
fPypars(p6.fPypars),
fPyint1(p6.fPyint1),
fPyint2(p6.fPyint2),
fPyint3(p6.fPyint3),
fPyint4(p6.fPyint4),
fPyint5(p6.fPyint5),
fPyint6(p6.fPyint6),
fPyint7(p6.fPyint7),
fPyint8(p6.fPyint8),
fPyint9(p6.fPyint9),
fPyuppr(p6.fPyuppr),
fPymssm(p6.fPymssm),
fPyssmt(p6.fPyssmt),
fPyints(p6.fPyints),
fPybins(p6.fPybins)
{ }
TPythia6::~TPythia6()
{
if (fParticles) {
fParticles->Delete();
delete fParticles;
fParticles = 0;
}
}
TPythia6* TPythia6::Instance() {
static TPythia6::TPythia6Cleaner cleaner;
return fgInstance ? fgInstance : (fgInstance=new TPythia6()) ;
}
void TPythia6::GenerateEvent() {
pyevnt();
ImportParticles();
}
void TPythia6::OpenFortranFile(int lun, char* name) {
tpythia6_open_fortran_file(&lun, name, strlen(name));
}
void TPythia6::CloseFortranFile(int lun) {
tpythia6_close_fortran_file(&lun);
}
TObjArray *TPythia6::ImportParticles(Option_t *)
{
fParticles->Clear();
Int_t numpart = fPyjets->N;
TClonesArray &a = *((TClonesArray*)fParticles);
for (Int_t i = 0; i<numpart; i++) {
new(a[i]) TMCParticle(fPyjets->K[0][i] ,
fPyjets->K[1][i] ,
fPyjets->K[2][i] ,
fPyjets->K[3][i] ,
fPyjets->K[4][i] ,
fPyjets->P[0][i] ,
fPyjets->P[1][i] ,
fPyjets->P[2][i] ,
fPyjets->P[3][i] ,
fPyjets->P[4][i] ,
fPyjets->V[0][i] ,
fPyjets->V[1][i] ,
fPyjets->V[2][i] ,
fPyjets->V[3][i] ,
fPyjets->V[4][i]);
}
return fParticles;
}
Int_t TPythia6::ImportParticles(TClonesArray *particles, Option_t *option)
{
if (particles == 0) return 0;
TClonesArray &clonesParticles = *particles;
clonesParticles.Clear();
Int_t numpart = fPyjets->N;
Int_t nparts=0;
if (!strcmp(option,"") || !strcmp(option,"Final")) {
for (Int_t i = 0; i<numpart; i++) {
if (fPyjets->K[0][i] == 1) {
new(clonesParticles[nparts]) TParticle(
fPyjets->K[1][i] ,
fPyjets->K[0][i] ,
fPyjets->K[2][i] ,
-1,
fPyjets->K[3][i] ,
fPyjets->K[4][i] ,
fPyjets->P[0][i] ,
fPyjets->P[1][i] ,
fPyjets->P[2][i] ,
fPyjets->P[3][i] ,
fPyjets->V[0][i] ,
fPyjets->V[1][i] ,
fPyjets->V[2][i] ,
fPyjets->V[3][i]);
nparts++;
}
}
} else if (!strcmp(option,"All")) {
for (Int_t i = 0; i<numpart; i++) {
new(clonesParticles[i]) TParticle(
fPyjets->K[1][i] ,
fPyjets->K[0][i] ,
fPyjets->K[2][i] ,
-1,
fPyjets->K[3][i] ,
fPyjets->K[4][i] ,
fPyjets->P[0][i] ,
fPyjets->P[1][i] ,
fPyjets->P[2][i] ,
fPyjets->P[3][i] ,
fPyjets->V[0][i] ,
fPyjets->V[1][i] ,
fPyjets->V[2][i] ,
fPyjets->V[3][i]);
}
nparts=numpart;
}
return nparts;
}
void TPythia6::Initialize(const char *frame, const char *beam, const char *target, float win)
{
char cframe[4];
strncpy(cframe,frame,4);
char cbeam[8];
strncpy(cbeam,beam,8);
char ctarget[8];
strncpy(ctarget,target,8);
if ( (!strncmp(frame, "CMS" ,3)) &&
(!strncmp(frame, "FIXT" ,4)) &&
(!strncmp(frame, "USER" ,4)) &&
(!strncmp(frame, "FOUR" ,4)) &&
(!strncmp(frame, "FIVE" ,4)) &&
(!strncmp(frame, "NONE" ,4)) ) {
printf("WARNING! In TPythia6:Initialize():\n");
printf(" specified frame=%s is neither of CMS,FIXT,USER,FOUR,FIVE,NONE\n",frame);
printf(" resetting to \"CMS\" .");
sprintf(cframe,"CMS");
}
if ( (!strncmp(beam, "e" ,1)) &&
(!strncmp(beam, "nu_e" ,4)) &&
(!strncmp(beam, "mu" ,2)) &&
(!strncmp(beam, "nu_mu" ,5)) &&
(!strncmp(beam, "tau" ,3)) &&
(!strncmp(beam, "nu_tau" ,6)) &&
(!strncmp(beam, "gamma" ,5)) &&
(!strncmp(beam, "pi" ,2)) &&
(!strncmp(beam, "n" ,1)) &&
(!strncmp(beam, "p" ,1)) &&
(!strncmp(beam, "Lambda" ,6)) &&
(!strncmp(beam, "Sigma" ,5)) &&
(!strncmp(beam, "Xi" ,2)) &&
(!strncmp(beam, "Omega" ,5)) &&
(!strncmp(beam, "pomeron" ,7)) &&
(!strncmp(beam, "reggeon" ,7)) ) {
printf("WARNING! In TPythia6:Initialize():\n");
printf(" specified beam=%s is unrecognized .\n",beam);
printf(" resetting to \"p+\" .");
sprintf(cbeam,"p+");
}
if ( (!strncmp(target, "e" ,1)) &&
(!strncmp(target, "nu_e" ,4)) &&
(!strncmp(target, "mu" ,2)) &&
(!strncmp(target, "nu_mu" ,5)) &&
(!strncmp(target, "tau" ,3)) &&
(!strncmp(target, "nu_tau" ,6)) &&
(!strncmp(target, "gamma" ,5)) &&
(!strncmp(target, "pi" ,2)) &&
(!strncmp(target, "n" ,1)) &&
(!strncmp(target, "p" ,1)) &&
(!strncmp(target, "Lambda" ,6)) &&
(!strncmp(target, "Sigma" ,5)) &&
(!strncmp(target, "Xi" ,2)) &&
(!strncmp(target, "Omega" ,5)) &&
(!strncmp(target, "pomeron" ,7)) &&
(!strncmp(target, "reggeon" ,7)) ){
printf("WARNING! In TPythia6:Initialize():\n");
printf(" specified target=%s is unrecognized.\n",target);
printf(" resetting to \"p+\" .");
sprintf(ctarget,"p+");
}
Pyinit(cframe, cbeam ,ctarget, win);
char atitle[32];
sprintf(atitle," %s-%s at %g GeV",cbeam,ctarget,win);
SetTitle(atitle);
}
void TPythia6::Pyinit(char* frame, char* beam, char* target, double win)
{
Double_t lwin = win;
Long_t s1 = strlen(frame);
Long_t s2 = strlen(beam);
Long_t s3 = strlen(target);
#ifndef WIN32
pyinit(frame,beam,target,&lwin,s1,s2,s3);
#else
pyinit(frame, s1, beam , s2, target, s3, &lwin);
#endif
}
int TPythia6::Pycomp(int kf) {
return pycomp(&kf);
}
void TPythia6::Pyedit(int medit) {
pyedit(&medit);
ImportParticles();
}
void TPythia6::Pydiff() {
pydiff();
}
void TPythia6::Pyevnt() {
pyevnt();
}
void TPythia6::Pyexec() {
pyexec();
}
void TPythia6::Pyhepc(int mconv) {
pyhepc(&mconv);
}
void TPythia6::Pylist(int flag) {
pylist(&flag);
}
void TPythia6::Pyname(int kf, char* name) {
pyname(&kf,name,15);
name[15] = 0;
}
double TPythia6::Pyr(int idummy) {
return pyr(&idummy);
}
void TPythia6::Pyrget(int lun, int move) {
pyrget(&lun,&move);
}
void TPythia6::Pyrset(int lun, int move) {
pyrset(&lun,&move);
}
void TPythia6::Pystat(int flag) {
pystat(&flag);
}
void TPythia6::Pytest(int flag) {
pytest(&flag);
}
void TPythia6::Pyupda(int mupda, int lun) {
pyupda(&mupda,&lun);
}
double TPythia6::Pymass(int kf) {
return pymass(&kf);
}
int TPythia6::Pychge(int kf) {
return pychge(&kf);
}
void TPythia6::Py1ent(Int_t ip, Int_t kf, Double_t pe, Double_t theta, Double_t phi)
{
py1ent(ip, kf, pe, theta, phi);
}
void TPythia6::SetupTest()
{
SetMSEL(0);
SetMSUB(102,1);
SetMSUB(123,1);
SetMSUB(124,1);
SetPMAS(6,1,175.0);
SetPMAS(25,1,300);
SetCKIN(1,290.0);
SetCKIN(2,310.0);
SetMSTP(61, 0);
SetMSTP(71, 0);
SetMSTP(81, 0);
SetMSTP(111, 0);
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.