ROOT logo
// @(#)root/pythia6:$Id: TPythia6.cxx 26122 2008-11-10 15:31:24Z brun $
// Author: Rene Brun   19/10/99

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// TPythia6                                                                   //
//                                                                            //
// TPythia is an interface class to F77 version of Pythia 6.2                 //
// To use this class you must install a version of pythia6.                   //
//   see the installation instructions at                                     //
//       http://root.cern.ch/root/Install.html                                //
//                                                                            // 
// CERNLIB event generators, written by T.Sjostrand.                          //
// For the details about these generators look at Pythia/Jetset manual:       //
//                                                                            //
//******************************************************************************
//**                                                                          **
//**                                                                          **
//**  PPP  Y   Y TTTTT H   H III   A        JJJJ EEEE TTTTT  SSS  EEEE TTTTT  **
//**  P  P  Y Y    T   H   H  I   A A          J E      T   S     E      T    **
//**  PPP    Y     T   HHHHH  I  AAAAA         J EEE    T    SSS  EEE    T    **
//**  P      Y     T   H   H  I  A   A      J  J E      T       S E      T    **
//**  P      Y     T   H   H III A   A       JJ  EEEE   T    SSS  EEEE   T    **
//**                                                                          **
//**                                                                          **
//**              *......*                  Welcome to the Lund Monte Carlo!  **
//**         *:::!!:::::::::::*                                               **
//**      *::::::!!::::::::::::::*            This is PYTHIA version 5.720    **
//**    *::::::::!!::::::::::::::::*        Last date of change: 29 Nov 1995  **
//**   *:::::::::!!:::::::::::::::::*                                         **
//**   *:::::::::!!:::::::::::::::::*         This is JETSET version 7.408    **
//**    *::::::::!!::::::::::::::::*!       Last date of change: 23 Aug 1995  **
//**      *::::::!!::::::::::::::* !!                                         **
//**      !! *:::!!:::::::::::*    !!                 Main author:            **
//**      !!     !* -><- *         !!              Torbjorn Sjostrand         **
//**      !!     !!                !!        Dept. of theoretical physics 2   **
//**      !!     !!                !!              University of Lund         **
//**      !!                       !!                Solvegatan 14A           **
//**      !!        ep             !!             S-223 62 Lund, Sweden       **
//**      !!                       !!          phone: +46 - 46 - 222 48 16    **
//**      !!                 pp    !!          E-mail: torbjorn@thep.lu.se    **
//**      !!   e+e-                !!                                         **
//**      !!                       !!         Copyright Torbjorn Sjostrand    **
//**      !!                                     and CERN, Geneva 1993        **
//**                                                                          **
//**                                                                          **
//** The latest program versions and documentation is found on WWW address    **
//** http://thep.lu.se/tf2/staff/torbjorn/Welcome.html                        **
//**                                                                          **
//** When you cite these programs, priority should always be given to the     **
//** latest published description. Currently this is                          **
//** T. Sjostrand, Computer Physics Commun. 82 (1994) 74.                     **
//** The most recent long description (unpublished) is                        **
//** T. Sjostrand, LU TP 95-20 and CERN-TH.7112/93 (revised August 1995).     **
//** Also remember that the programs, to a large extent, represent original   **
//** physics research. Other publications of special relevance to your        **
//** studies may therefore deserve separate mention.                          **
//**                                                                          **
//**                                                                          **
//******************************************************************************

#include "TPythia6.h"

#include "TClonesArray.h"
#include "TMCParticle.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 pytune pytune_
# 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 pytune PYTUNE
# 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 pytune(int *itune);
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() {
   //utility class to manage the TPythia6 innstance
}

//------------------------------------------------------------------------------
TPythia6::TPythia6Cleaner::~TPythia6Cleaner() {
   //delete the TPythia6 insntance
   if (TPythia6::fgInstance) {
      delete TPythia6::fgInstance;
      TPythia6::fgInstance = 0;
   }
}

//------------------------------------------------------------------------------
//  constructor is not supposed to be called from the outside - only
//  Initialize() method
//------------------------------------------------------------------------------
TPythia6::TPythia6() : TGenerator("TPythia6","TPythia6") {
   // TPythia6 constructor: creates a TClonesArray in which it will store all
   // particles. Note that there may be only one functional TPythia6 object
   // at a time, so it's not use to create more than one instance of it.
  
   // Protect against multiple objects.   All access should be via the
   // Instance member function. 
   if (fgInstance) 
      Fatal("TPythia6", "There's already an instance of TPythia6");
  
   delete fParticles; // was allocated as TObjArray in TGenerator

   fParticles = new TClonesArray("TMCParticle",50);

   // initialize common-blocks
   // the functions/subroutines referenced by TPythia6 can be found
   // at ftp://root.cern.ch/root/pythia6.tar.gz
  
   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");
   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),
  fPymssm(p6.fPymssm),
  fPyssmt(p6.fPyssmt),
  fPyints(p6.fPyints),
  fPybins(p6.fPybins)
{ }

//------------------------------------------------------------------------------
TPythia6::~TPythia6()
{
   // Destroys the object, deletes and disposes all TMCParticles currently on list.

   if (fParticles) {
      fParticles->Delete();
      delete fParticles;
      fParticles = 0;
   }
}

//------------------------------------------------------------------------------
TPythia6* TPythia6::Instance() {
   // model of automatic memory cleanup suggested by Jim Kowalkovski:
   // destructor for local static variable `cleaner' is  always called in the end
   // of the job thus deleting the only TPythia6 instance

   static TPythia6::TPythia6Cleaner cleaner;
   return fgInstance ? fgInstance : (fgInstance=new TPythia6()) ;
}





//______________________________________________________________________________
void TPythia6::GenerateEvent() {
   //  generate event and copy the information from /HEPEVT/ to fPrimaries

   pyevnt();
   ImportParticles();
}

//______________________________________________________________________________
void TPythia6::OpenFortranFile(int lun, char* name) {
   //interface with fortran i/o
   tpythia6_open_fortran_file(&lun, name, strlen(name));
}

//______________________________________________________________________________
void TPythia6::CloseFortranFile(int lun) {
   //interface with fortran i/o
   tpythia6_close_fortran_file(&lun);
}


//______________________________________________________________________________
TObjArray *TPythia6::ImportParticles(Option_t *)
{
   // Fills TObjArray fParticles list with particles from common LUJETS
   // Old contents of a list are cleared. This function should be called after
   // any change in common LUJETS, however GetParticles() method  calls it
   // automatically - user don't need to care about it. In case you make a call
   // to LuExec() you must call this method yourself to transfer new data from
   // common LUJETS to the fParticles list.

   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)
{
   //  Default primary creation method. It reads the /HEPEVT/ common block which
   //  has been filled by the GenerateEvent method. If the event generator does
   //  not use the HEPEVT common block, This routine has to be overloaded by
   //  the subclasses.
   //  The function loops on the generated particles and store them in
   //  the TClonesArray pointed by the argument particles.
   //  The default action is to store only the stable particles (ISTHEP = 1)
   //  This can be demanded explicitly by setting the option = "Final"
   //  If the option = "All", all the particles are stored.
   //

   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) {
         //
         //  Use the common block values for the TParticle constructor
         //
         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]);

         //     if(gDebug) printf("%d %d %d! ",i,fPyjets->K[1][i],numpart);
         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)
{
   // Calls PyInit with the same parameters after performing some checking,
   // sets correct title. This method should preferably be called instead of PyInit.
   // PURPOSE: to initialize the generation procedure.
   // ARGUMENTS: See documentation for details.
   //    frame:  - specifies the frame of the experiment:
   //                "CMS","FIXT","USER","FOUR","FIVE","NONE"
   //    beam,
   //    target: - beam and target particles (with additionaly cahrges, tildes or "bar":
   //              e,nu_e,mu,nu_mu,tau,nu_tau,gamma,pi,n,p,Lambda,Sigma,Xi,Omega,
   //              pomeron,reggeon
   //    win:    - related to energy system:
   //              for frame=="CMS" - total energy of system
   //              for frame=="FIXT" - momentum of beam particle
   //              for frame=="USER" - dummy - see documentation.

   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) 
{
   // Calls Pyinit with the same parameters after performing some checking,
   // sets correct title. This method should preferably be called instead of PyInit.
   // PURPOSE: to initialize the generation procedure.
   // ARGUMENTS: See documentation for details.
   //    frame:  - specifies the frame of the experiment:
   //                "CMS","FIXT","USER","FOUR","FIVE","NONE"
   //    beam,
   //    target: - beam and target particles (with additionaly charges,
   //              tildes or "bar":
   //              e,nu_e,mu,nu_mu,tau,nu_tau,gamma,pi,n,p,Lambda,Sigma,Xi,Omega,
   //              pomeron,reggeon
   //    win:    - related to energy system:
   //              for frame=="CMS" - total energy of system
   //              for frame=="FIXT" - momentum of beam particle
   //              for frame=="USER" - dummy - see documentation.

   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) {
   //interface with fortran routine pycomp
   return pycomp(&kf);
}

void TPythia6::Pyedit(int medit) {
   //interface with fortran routine pyedit
   pyedit(&medit);
   ImportParticles();
}

void TPythia6::Pydiff() {
   //interface with fortran routine pydiff
   pydiff();
}

void TPythia6::Pyevnt() {
   //interface with fortran routine pyevnt
   pyevnt();
}

void TPythia6::Pyexec() {
   //interface with fortran routine pyexec
   pyexec();
}

void TPythia6::Pyhepc(int mconv) {
   //interface with fortran routine pyhepc
   pyhepc(&mconv);
}

void TPythia6::Pylist(int flag) {
   //interface with fortran routine pylist
   pylist(&flag);
}

void TPythia6::Pyname(int kf, char* name) {
   //Note that the array name must be dimensioned in the calling program
   //to at least name[16]
   
   pyname(&kf,name,15);
   // cut trailing blanks to get C string
   name[15] = 0;
   //for (int i=15; (i>=0) && (name[i] == ' '); i--) {
   //  name[i] = 0;
   // }
}

double TPythia6::Pyr(int idummy) {
   //interface with fortran routine pyr
   return pyr(&idummy);
}

void TPythia6::Pyrget(int lun, int move) {
   //interface with fortran routine pyrget
   pyrget(&lun,&move);
}

void TPythia6::Pyrset(int lun, int move) {
   //interface with fortran routine pyrset
   pyrset(&lun,&move);
}

void TPythia6::Pystat(int flag) {
   //interface with fortran routine pystat
   pystat(&flag);
}

void TPythia6::Pytest(int flag) {
   //interface with fortran routine pytest
   pytest(&flag);
}

void TPythia6::Pytune(int itune) {
   //interface with fortran routine pytune
   pytune(&itune);
}

void TPythia6::Pyupda(int mupda, int lun) {
   //interface with fortran routine pyupda
   pyupda(&mupda,&lun);
}

double TPythia6::Pymass(int kf) {
   //interface with fortran routine pymass
   return pymass(&kf);
}

int TPythia6::Pychge(int kf) {
   //interface with fortran routine pychge
   return pychge(&kf);
}

//______________________________________________________________________________
void TPythia6::Py1ent(Int_t ip, Int_t kf, Double_t pe, Double_t theta, Double_t phi)
{
   // Add one entry to the event record, i.e. either a parton or a
   // particle. 
   //
   //  IP:   normally line number for the parton/particle. There are two
   //        exceptions:
   // 
   //        If IP = 0: line number 1 is used and PYEXEC is called. 
   //        If IP < 0: line -IP is used, with status code K(-IP,2)=2
   //                   rather than 1; thus a parton system may be built
   //                   up by filling all but the last parton of the
   //                   system with IP < 0.   
   //  KF:   parton/particle flavour code (PDG code)
   //  PE:   parton/particle energy. If PE is smaller than the mass,
   //        the parton/particle is taken to be at rest.  
   //  THETA:
   //  PHI:  polar and azimuthal angle for the momentum vector of the
   //        parton/particle. 
   py1ent(ip, kf, pe, theta, phi);
}


//______________________________________________________________________________
void TPythia6::SetupTest()
{
   // Exemplary setup of Pythia parameters:
   // Switches on processes 102,123,124 (Higgs generation) and switches off
   // interactions, fragmentation, ISR, FSR...

   SetMSEL(0);            // full user controll;

   SetMSUB(102,1);        // g + g -> H0
   SetMSUB(123,1);        // f + f' -> f + f' + H0
   SetMSUB(124,1);        // f + f' -> f" + f"' + H0


   SetPMAS(6,1,175.0);   // mass of TOP
   SetPMAS(25,1,300);    // mass of Higgs


   SetCKIN(1,290.0);     // range of allowed mass
   SetCKIN(2,310.0);

   SetMSTP(61,  0);      // switch off ISR
   SetMSTP(71,  0);      // switch off FSR
   SetMSTP(81,  0);      // switch off multiple interactions
   SetMSTP(111, 0);      // switch off fragmentation/decay
}
 TPythia6.cxx:1
 TPythia6.cxx:2
 TPythia6.cxx:3
 TPythia6.cxx:4
 TPythia6.cxx:5
 TPythia6.cxx:6
 TPythia6.cxx:7
 TPythia6.cxx:8
 TPythia6.cxx:9
 TPythia6.cxx:10
 TPythia6.cxx:11
 TPythia6.cxx:12
 TPythia6.cxx:13
 TPythia6.cxx:14
 TPythia6.cxx:15
 TPythia6.cxx:16
 TPythia6.cxx:17
 TPythia6.cxx:18
 TPythia6.cxx:19
 TPythia6.cxx:20
 TPythia6.cxx:21
 TPythia6.cxx:22
 TPythia6.cxx:23
 TPythia6.cxx:24
 TPythia6.cxx:25
 TPythia6.cxx:26
 TPythia6.cxx:27
 TPythia6.cxx:28
 TPythia6.cxx:29
 TPythia6.cxx:30
 TPythia6.cxx:31
 TPythia6.cxx:32
 TPythia6.cxx:33
 TPythia6.cxx:34
 TPythia6.cxx:35
 TPythia6.cxx:36
 TPythia6.cxx:37
 TPythia6.cxx:38
 TPythia6.cxx:39
 TPythia6.cxx:40
 TPythia6.cxx:41
 TPythia6.cxx:42
 TPythia6.cxx:43
 TPythia6.cxx:44
 TPythia6.cxx:45
 TPythia6.cxx:46
 TPythia6.cxx:47
 TPythia6.cxx:48
 TPythia6.cxx:49
 TPythia6.cxx:50
 TPythia6.cxx:51
 TPythia6.cxx:52
 TPythia6.cxx:53
 TPythia6.cxx:54
 TPythia6.cxx:55
 TPythia6.cxx:56
 TPythia6.cxx:57
 TPythia6.cxx:58
 TPythia6.cxx:59
 TPythia6.cxx:60
 TPythia6.cxx:61
 TPythia6.cxx:62
 TPythia6.cxx:63
 TPythia6.cxx:64
 TPythia6.cxx:65
 TPythia6.cxx:66
 TPythia6.cxx:67
 TPythia6.cxx:68
 TPythia6.cxx:69
 TPythia6.cxx:70
 TPythia6.cxx:71
 TPythia6.cxx:72
 TPythia6.cxx:73
 TPythia6.cxx:74
 TPythia6.cxx:75
 TPythia6.cxx:76
 TPythia6.cxx:77
 TPythia6.cxx:78
 TPythia6.cxx:79
 TPythia6.cxx:80
 TPythia6.cxx:81
 TPythia6.cxx:82
 TPythia6.cxx:83
 TPythia6.cxx:84
 TPythia6.cxx:85
 TPythia6.cxx:86
 TPythia6.cxx:87
 TPythia6.cxx:88
 TPythia6.cxx:89
 TPythia6.cxx:90
 TPythia6.cxx:91
 TPythia6.cxx:92
 TPythia6.cxx:93
 TPythia6.cxx:94
 TPythia6.cxx:95
 TPythia6.cxx:96
 TPythia6.cxx:97
 TPythia6.cxx:98
 TPythia6.cxx:99
 TPythia6.cxx:100
 TPythia6.cxx:101
 TPythia6.cxx:102
 TPythia6.cxx:103
 TPythia6.cxx:104
 TPythia6.cxx:105
 TPythia6.cxx:106
 TPythia6.cxx:107
 TPythia6.cxx:108
 TPythia6.cxx:109
 TPythia6.cxx:110
 TPythia6.cxx:111
 TPythia6.cxx:112
 TPythia6.cxx:113
 TPythia6.cxx:114
 TPythia6.cxx:115
 TPythia6.cxx:116
 TPythia6.cxx:117
 TPythia6.cxx:118
 TPythia6.cxx:119
 TPythia6.cxx:120
 TPythia6.cxx:121
 TPythia6.cxx:122
 TPythia6.cxx:123
 TPythia6.cxx:124
 TPythia6.cxx:125
 TPythia6.cxx:126
 TPythia6.cxx:127
 TPythia6.cxx:128
 TPythia6.cxx:129
 TPythia6.cxx:130
 TPythia6.cxx:131
 TPythia6.cxx:132
 TPythia6.cxx:133
 TPythia6.cxx:134
 TPythia6.cxx:135
 TPythia6.cxx:136
 TPythia6.cxx:137
 TPythia6.cxx:138
 TPythia6.cxx:139
 TPythia6.cxx:140
 TPythia6.cxx:141
 TPythia6.cxx:142
 TPythia6.cxx:143
 TPythia6.cxx:144
 TPythia6.cxx:145
 TPythia6.cxx:146
 TPythia6.cxx:147
 TPythia6.cxx:148
 TPythia6.cxx:149
 TPythia6.cxx:150
 TPythia6.cxx:151
 TPythia6.cxx:152
 TPythia6.cxx:153
 TPythia6.cxx:154
 TPythia6.cxx:155
 TPythia6.cxx:156
 TPythia6.cxx:157
 TPythia6.cxx:158
 TPythia6.cxx:159
 TPythia6.cxx:160
 TPythia6.cxx:161
 TPythia6.cxx:162
 TPythia6.cxx:163
 TPythia6.cxx:164
 TPythia6.cxx:165
 TPythia6.cxx:166
 TPythia6.cxx:167
 TPythia6.cxx:168
 TPythia6.cxx:169
 TPythia6.cxx:170
 TPythia6.cxx:171
 TPythia6.cxx:172
 TPythia6.cxx:173
 TPythia6.cxx:174
 TPythia6.cxx:175
 TPythia6.cxx:176
 TPythia6.cxx:177
 TPythia6.cxx:178
 TPythia6.cxx:179
 TPythia6.cxx:180
 TPythia6.cxx:181
 TPythia6.cxx:182
 TPythia6.cxx:183
 TPythia6.cxx:184
 TPythia6.cxx:185
 TPythia6.cxx:186
 TPythia6.cxx:187
 TPythia6.cxx:188
 TPythia6.cxx:189
 TPythia6.cxx:190
 TPythia6.cxx:191
 TPythia6.cxx:192
 TPythia6.cxx:193
 TPythia6.cxx:194
 TPythia6.cxx:195
 TPythia6.cxx:196
 TPythia6.cxx:197
 TPythia6.cxx:198
 TPythia6.cxx:199
 TPythia6.cxx:200
 TPythia6.cxx:201
 TPythia6.cxx:202
 TPythia6.cxx:203
 TPythia6.cxx:204
 TPythia6.cxx:205
 TPythia6.cxx:206
 TPythia6.cxx:207
 TPythia6.cxx:208
 TPythia6.cxx:209
 TPythia6.cxx:210
 TPythia6.cxx:211
 TPythia6.cxx:212
 TPythia6.cxx:213
 TPythia6.cxx:214
 TPythia6.cxx:215
 TPythia6.cxx:216
 TPythia6.cxx:217
 TPythia6.cxx:218
 TPythia6.cxx:219
 TPythia6.cxx:220
 TPythia6.cxx:221
 TPythia6.cxx:222
 TPythia6.cxx:223
 TPythia6.cxx:224
 TPythia6.cxx:225
 TPythia6.cxx:226
 TPythia6.cxx:227
 TPythia6.cxx:228
 TPythia6.cxx:229
 TPythia6.cxx:230
 TPythia6.cxx:231
 TPythia6.cxx:232
 TPythia6.cxx:233
 TPythia6.cxx:234
 TPythia6.cxx:235
 TPythia6.cxx:236
 TPythia6.cxx:237
 TPythia6.cxx:238
 TPythia6.cxx:239
 TPythia6.cxx:240
 TPythia6.cxx:241
 TPythia6.cxx:242
 TPythia6.cxx:243
 TPythia6.cxx:244
 TPythia6.cxx:245
 TPythia6.cxx:246
 TPythia6.cxx:247
 TPythia6.cxx:248
 TPythia6.cxx:249
 TPythia6.cxx:250
 TPythia6.cxx:251
 TPythia6.cxx:252
 TPythia6.cxx:253
 TPythia6.cxx:254
 TPythia6.cxx:255
 TPythia6.cxx:256
 TPythia6.cxx:257
 TPythia6.cxx:258
 TPythia6.cxx:259
 TPythia6.cxx:260
 TPythia6.cxx:261
 TPythia6.cxx:262
 TPythia6.cxx:263
 TPythia6.cxx:264
 TPythia6.cxx:265
 TPythia6.cxx:266
 TPythia6.cxx:267
 TPythia6.cxx:268
 TPythia6.cxx:269
 TPythia6.cxx:270
 TPythia6.cxx:271
 TPythia6.cxx:272
 TPythia6.cxx:273
 TPythia6.cxx:274
 TPythia6.cxx:275
 TPythia6.cxx:276
 TPythia6.cxx:277
 TPythia6.cxx:278
 TPythia6.cxx:279
 TPythia6.cxx:280
 TPythia6.cxx:281
 TPythia6.cxx:282
 TPythia6.cxx:283
 TPythia6.cxx:284
 TPythia6.cxx:285
 TPythia6.cxx:286
 TPythia6.cxx:287
 TPythia6.cxx:288
 TPythia6.cxx:289
 TPythia6.cxx:290
 TPythia6.cxx:291
 TPythia6.cxx:292
 TPythia6.cxx:293
 TPythia6.cxx:294
 TPythia6.cxx:295
 TPythia6.cxx:296
 TPythia6.cxx:297
 TPythia6.cxx:298
 TPythia6.cxx:299
 TPythia6.cxx:300
 TPythia6.cxx:301
 TPythia6.cxx:302
 TPythia6.cxx:303
 TPythia6.cxx:304
 TPythia6.cxx:305
 TPythia6.cxx:306
 TPythia6.cxx:307
 TPythia6.cxx:308
 TPythia6.cxx:309
 TPythia6.cxx:310
 TPythia6.cxx:311
 TPythia6.cxx:312
 TPythia6.cxx:313
 TPythia6.cxx:314
 TPythia6.cxx:315
 TPythia6.cxx:316
 TPythia6.cxx:317
 TPythia6.cxx:318
 TPythia6.cxx:319
 TPythia6.cxx:320
 TPythia6.cxx:321
 TPythia6.cxx:322
 TPythia6.cxx:323
 TPythia6.cxx:324
 TPythia6.cxx:325
 TPythia6.cxx:326
 TPythia6.cxx:327
 TPythia6.cxx:328
 TPythia6.cxx:329
 TPythia6.cxx:330
 TPythia6.cxx:331
 TPythia6.cxx:332
 TPythia6.cxx:333
 TPythia6.cxx:334
 TPythia6.cxx:335
 TPythia6.cxx:336
 TPythia6.cxx:337
 TPythia6.cxx:338
 TPythia6.cxx:339
 TPythia6.cxx:340
 TPythia6.cxx:341
 TPythia6.cxx:342
 TPythia6.cxx:343
 TPythia6.cxx:344
 TPythia6.cxx:345
 TPythia6.cxx:346
 TPythia6.cxx:347
 TPythia6.cxx:348
 TPythia6.cxx:349
 TPythia6.cxx:350
 TPythia6.cxx:351
 TPythia6.cxx:352
 TPythia6.cxx:353
 TPythia6.cxx:354
 TPythia6.cxx:355
 TPythia6.cxx:356
 TPythia6.cxx:357
 TPythia6.cxx:358
 TPythia6.cxx:359
 TPythia6.cxx:360
 TPythia6.cxx:361
 TPythia6.cxx:362
 TPythia6.cxx:363
 TPythia6.cxx:364
 TPythia6.cxx:365
 TPythia6.cxx:366
 TPythia6.cxx:367
 TPythia6.cxx:368
 TPythia6.cxx:369
 TPythia6.cxx:370
 TPythia6.cxx:371
 TPythia6.cxx:372
 TPythia6.cxx:373
 TPythia6.cxx:374
 TPythia6.cxx:375
 TPythia6.cxx:376
 TPythia6.cxx:377
 TPythia6.cxx:378
 TPythia6.cxx:379
 TPythia6.cxx:380
 TPythia6.cxx:381
 TPythia6.cxx:382
 TPythia6.cxx:383
 TPythia6.cxx:384
 TPythia6.cxx:385
 TPythia6.cxx:386
 TPythia6.cxx:387
 TPythia6.cxx:388
 TPythia6.cxx:389
 TPythia6.cxx:390
 TPythia6.cxx:391
 TPythia6.cxx:392
 TPythia6.cxx:393
 TPythia6.cxx:394
 TPythia6.cxx:395
 TPythia6.cxx:396
 TPythia6.cxx:397
 TPythia6.cxx:398
 TPythia6.cxx:399
 TPythia6.cxx:400
 TPythia6.cxx:401
 TPythia6.cxx:402
 TPythia6.cxx:403
 TPythia6.cxx:404
 TPythia6.cxx:405
 TPythia6.cxx:406
 TPythia6.cxx:407
 TPythia6.cxx:408
 TPythia6.cxx:409
 TPythia6.cxx:410
 TPythia6.cxx:411
 TPythia6.cxx:412
 TPythia6.cxx:413
 TPythia6.cxx:414
 TPythia6.cxx:415
 TPythia6.cxx:416
 TPythia6.cxx:417
 TPythia6.cxx:418
 TPythia6.cxx:419
 TPythia6.cxx:420
 TPythia6.cxx:421
 TPythia6.cxx:422
 TPythia6.cxx:423
 TPythia6.cxx:424
 TPythia6.cxx:425
 TPythia6.cxx:426
 TPythia6.cxx:427
 TPythia6.cxx:428
 TPythia6.cxx:429
 TPythia6.cxx:430
 TPythia6.cxx:431
 TPythia6.cxx:432
 TPythia6.cxx:433
 TPythia6.cxx:434
 TPythia6.cxx:435
 TPythia6.cxx:436
 TPythia6.cxx:437
 TPythia6.cxx:438
 TPythia6.cxx:439
 TPythia6.cxx:440
 TPythia6.cxx:441
 TPythia6.cxx:442
 TPythia6.cxx:443
 TPythia6.cxx:444
 TPythia6.cxx:445
 TPythia6.cxx:446
 TPythia6.cxx:447
 TPythia6.cxx:448
 TPythia6.cxx:449
 TPythia6.cxx:450
 TPythia6.cxx:451
 TPythia6.cxx:452
 TPythia6.cxx:453
 TPythia6.cxx:454
 TPythia6.cxx:455
 TPythia6.cxx:456
 TPythia6.cxx:457
 TPythia6.cxx:458
 TPythia6.cxx:459
 TPythia6.cxx:460
 TPythia6.cxx:461
 TPythia6.cxx:462
 TPythia6.cxx:463
 TPythia6.cxx:464
 TPythia6.cxx:465
 TPythia6.cxx:466
 TPythia6.cxx:467
 TPythia6.cxx:468
 TPythia6.cxx:469
 TPythia6.cxx:470
 TPythia6.cxx:471
 TPythia6.cxx:472
 TPythia6.cxx:473
 TPythia6.cxx:474
 TPythia6.cxx:475
 TPythia6.cxx:476
 TPythia6.cxx:477
 TPythia6.cxx:478
 TPythia6.cxx:479
 TPythia6.cxx:480
 TPythia6.cxx:481
 TPythia6.cxx:482
 TPythia6.cxx:483
 TPythia6.cxx:484
 TPythia6.cxx:485
 TPythia6.cxx:486
 TPythia6.cxx:487
 TPythia6.cxx:488
 TPythia6.cxx:489
 TPythia6.cxx:490
 TPythia6.cxx:491
 TPythia6.cxx:492
 TPythia6.cxx:493
 TPythia6.cxx:494
 TPythia6.cxx:495
 TPythia6.cxx:496
 TPythia6.cxx:497
 TPythia6.cxx:498
 TPythia6.cxx:499
 TPythia6.cxx:500
 TPythia6.cxx:501
 TPythia6.cxx:502
 TPythia6.cxx:503
 TPythia6.cxx:504
 TPythia6.cxx:505
 TPythia6.cxx:506
 TPythia6.cxx:507
 TPythia6.cxx:508
 TPythia6.cxx:509
 TPythia6.cxx:510
 TPythia6.cxx:511
 TPythia6.cxx:512
 TPythia6.cxx:513
 TPythia6.cxx:514
 TPythia6.cxx:515
 TPythia6.cxx:516
 TPythia6.cxx:517
 TPythia6.cxx:518
 TPythia6.cxx:519
 TPythia6.cxx:520
 TPythia6.cxx:521
 TPythia6.cxx:522
 TPythia6.cxx:523
 TPythia6.cxx:524
 TPythia6.cxx:525
 TPythia6.cxx:526
 TPythia6.cxx:527
 TPythia6.cxx:528
 TPythia6.cxx:529
 TPythia6.cxx:530
 TPythia6.cxx:531
 TPythia6.cxx:532
 TPythia6.cxx:533
 TPythia6.cxx:534
 TPythia6.cxx:535
 TPythia6.cxx:536
 TPythia6.cxx:537
 TPythia6.cxx:538
 TPythia6.cxx:539
 TPythia6.cxx:540
 TPythia6.cxx:541
 TPythia6.cxx:542
 TPythia6.cxx:543
 TPythia6.cxx:544
 TPythia6.cxx:545
 TPythia6.cxx:546
 TPythia6.cxx:547
 TPythia6.cxx:548
 TPythia6.cxx:549
 TPythia6.cxx:550
 TPythia6.cxx:551
 TPythia6.cxx:552
 TPythia6.cxx:553
 TPythia6.cxx:554
 TPythia6.cxx:555
 TPythia6.cxx:556
 TPythia6.cxx:557
 TPythia6.cxx:558
 TPythia6.cxx:559
 TPythia6.cxx:560
 TPythia6.cxx:561
 TPythia6.cxx:562
 TPythia6.cxx:563
 TPythia6.cxx:564
 TPythia6.cxx:565
 TPythia6.cxx:566
 TPythia6.cxx:567
 TPythia6.cxx:568
 TPythia6.cxx:569
 TPythia6.cxx:570
 TPythia6.cxx:571
 TPythia6.cxx:572
 TPythia6.cxx:573
 TPythia6.cxx:574
 TPythia6.cxx:575
 TPythia6.cxx:576
 TPythia6.cxx:577
 TPythia6.cxx:578
 TPythia6.cxx:579
 TPythia6.cxx:580
 TPythia6.cxx:581
 TPythia6.cxx:582
 TPythia6.cxx:583
 TPythia6.cxx:584
 TPythia6.cxx:585
 TPythia6.cxx:586
 TPythia6.cxx:587
 TPythia6.cxx:588
 TPythia6.cxx:589
 TPythia6.cxx:590
 TPythia6.cxx:591
 TPythia6.cxx:592
 TPythia6.cxx:593
 TPythia6.cxx:594
 TPythia6.cxx:595
 TPythia6.cxx:596
 TPythia6.cxx:597
 TPythia6.cxx:598
 TPythia6.cxx:599
 TPythia6.cxx:600
 TPythia6.cxx:601
 TPythia6.cxx:602
 TPythia6.cxx:603
 TPythia6.cxx:604
 TPythia6.cxx:605
 TPythia6.cxx:606
 TPythia6.cxx:607
 TPythia6.cxx:608
 TPythia6.cxx:609
 TPythia6.cxx:610
 TPythia6.cxx:611
 TPythia6.cxx:612
 TPythia6.cxx:613
 TPythia6.cxx:614
 TPythia6.cxx:615
 TPythia6.cxx:616
 TPythia6.cxx:617
 TPythia6.cxx:618
 TPythia6.cxx:619
 TPythia6.cxx:620
 TPythia6.cxx:621
 TPythia6.cxx:622
 TPythia6.cxx:623
 TPythia6.cxx:624
 TPythia6.cxx:625
 TPythia6.cxx:626
 TPythia6.cxx:627
 TPythia6.cxx:628
 TPythia6.cxx:629
 TPythia6.cxx:630
 TPythia6.cxx:631
 TPythia6.cxx:632
 TPythia6.cxx:633
 TPythia6.cxx:634
 TPythia6.cxx:635
 TPythia6.cxx:636
 TPythia6.cxx:637
 TPythia6.cxx:638
 TPythia6.cxx:639
 TPythia6.cxx:640
 TPythia6.cxx:641
 TPythia6.cxx:642
 TPythia6.cxx:643
 TPythia6.cxx:644
 TPythia6.cxx:645
 TPythia6.cxx:646
 TPythia6.cxx:647
 TPythia6.cxx:648
 TPythia6.cxx:649
 TPythia6.cxx:650
 TPythia6.cxx:651
 TPythia6.cxx:652
 TPythia6.cxx:653
 TPythia6.cxx:654
 TPythia6.cxx:655
 TPythia6.cxx:656
 TPythia6.cxx:657
 TPythia6.cxx:658
 TPythia6.cxx:659
 TPythia6.cxx:660
 TPythia6.cxx:661
 TPythia6.cxx:662
 TPythia6.cxx:663
 TPythia6.cxx:664
 TPythia6.cxx:665
 TPythia6.cxx:666
 TPythia6.cxx:667
 TPythia6.cxx:668
 TPythia6.cxx:669
 TPythia6.cxx:670