Classes for event generation with pythia8
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 20:06:04 +0000 (20:06 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Mar 2008 20:06:04 +0000 (20:06 +0000)
Needs path to pythi8 installation PYTHIA8

PYTHIA6/AliPythia8.cxx [new file with mode: 0644]
PYTHIA6/AliPythia8.h [new file with mode: 0644]
PYTHIA6/TPythia8.cxx [new file with mode: 0644]
PYTHIA6/TPythia8.h [new file with mode: 0644]
PYTHIA6/TPythia8LinkDef.h [new file with mode: 0644]
PYTHIA6/libTPythia8.pkg [new file with mode: 0644]

diff --git a/PYTHIA6/AliPythia8.cxx b/PYTHIA6/AliPythia8.cxx
new file mode 100644 (file)
index 0000000..a30bc01
--- /dev/null
@@ -0,0 +1,834 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+#include <TString.h>
+#include <TVector3.h>
+#include <TMath.h>
+
+#include "AliPythia8.h"
+#include "AliLog.h"
+#include "AliStack.h"
+#include "AliPythiaRndm.h"
+
+
+ClassImp(AliPythia8)
+    
+// Particles produced in string fragmentation point directly to either of the two endpoints
+// of the string (depending in the side they were generated from).
+//    SetMSTU(16,2); // ????
+//  String drawing almost completely minimizes string length.
+//  Probability that an additional interaction gives two gluons
+//  ... with color connection to nearest neighbours
+//    SetPARP(85,0.9);
+//  ... as closed gluon loop
+//    SetPARP(86,0.95);
+// Lambda_FSR scale.
+//     SetPARJ(81, 0.29);
+// Baryon production model
+//     SetMSTJ(12,3); 
+// String fragmentation
+//     SetMSTJ(1,1);  
+// sea quarks can be used for baryon formation
+//      SetMSTP(88,2); 
+// choice of max. virtuality for ISR
+//     SetMSTP(68,1);
+// regularisation scheme of ISR 
+//     SetMSTP(70,2);
+// all resonance decays switched on
+//    SetMSTP(41,1);   
+AliPythia8* AliPythia8::fgAliPythia8=NULL;
+
+AliPythia8::AliPythia8():
+    TPythia8(),
+    AliPythiaBase(),
+    fProcess(kPyMb),
+    fEcms(0.),
+    fStrucFunc(kCTEQ5L)
+{
+// Default Constructor
+//
+//  Set random number
+    if (!AliPythiaRndm::GetPythiaRandom()) 
+       AliPythiaRndm::SetPythiaRandom(GetRandom());
+}
+
+AliPythia8::AliPythia8(const AliPythia8& pythia):
+    TPythia8(), 
+    AliPythiaBase(),
+    fProcess(kPyMb),
+    fEcms(0.),
+    fStrucFunc(kCTEQ5L)
+{
+    // Copy Constructor
+    pythia.Copy(*this);
+}
+
+void AliPythia8::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc)
+{
+// Initialise the process to generate 
+    if (!AliPythiaRndm::GetPythiaRandom()) 
+      AliPythiaRndm::SetPythiaRandom(GetRandom());
+    
+    fProcess   = process;
+    fEcms      = energy;
+    fStrucFunc = strucfunc;
+//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
+    ReadString("111:mayDecay  = off");
+    ReadString("310:mayDecay  = off");
+    ReadString("3122:mayDecay = off");
+    ReadString("3112:mayDecay = off");
+    ReadString("3212:mayDecay = off");
+    ReadString("3222:mayDecay = off");
+    ReadString("3312:mayDecay = off");
+    ReadString("3322:mayDecay = off");
+    ReadString("3334:mayDecay = off");
+    // Select structure function 
+
+    ReadString("PDF:useLHAPDF = on");
+    ReadString(Form("PDF:LHAPDFset = %s", AliStructFuncType::PDFsetName(fStrucFunc).Data()));
+
+    // Particles produced in string fragmentation point directly to either of the two endpoints
+    // of the string (depending in the side they were generated from).
+
+//    SetMSTU(16,2); // ????
+
+//
+// Pythia initialisation for selected processes//
+//
+    switch (process) 
+    {
+    case kPyOldUEQ2ordered:  //Old underlying events with Q2 ordered QCD processes
+//        Multiple interactions on.
+       ReadString("PartonLevel:MI = on");
+// Double Gaussian matter distribution.
+       ReadString("MultipleInteractions:bProfile = 2");
+       ReadString("MultipleInteractions:coreFraction = 0.5");
+       ReadString("MultipleInteractions:coreRadius = 0.4");
+//  pT0.
+       ReadString("MultipleInteractions:pTmin = 2.0");
+//  Reference energy for pT0 and energy rescaling pace.
+       ReadString("MultipleInteractions:ecmRef = 1800.");
+       ReadString("MultipleInteractions:ecmPow = 0.25");
+//  String drawing almost completely minimizes string length.
+//     SetPARP(85,0.9);
+//     SetPARP(86,0.95);
+// ISR and FSR activity.
+// Q^2 scale of the hard scattering
+       ReadString("SigmaProcess:factorMultFac = 4.");
+// Lambda_FSR scale.
+//     SetPARJ(81, 0.29);
+       break;
+    case kPyOldUEQ2ordered2:   
+// Old underlying events with Q2 ordered QCD processes
+// Multiple interactions on.
+       ReadString("PartonLevel:MI = on");
+// Double Gaussian matter distribution.
+       ReadString("MultipleInteractions:bProfile = 2");
+       ReadString("MultipleInteractions:coreFraction = 0.5");
+       ReadString("MultipleInteractions:coreRadius = 0.4");
+// pT0.
+       ReadString("MultipleInteractions:pTmin = 2.0");
+// Reference energy for pT0 and energy rescaling pace.
+       ReadString("MultipleInteractions:ecmRef = 1800.");
+       ReadString("MultipleInteractions:ecmPow = 0.16");
+// String drawing almost completely minimizes string length.
+//     SetPARP(85,0.9);
+//     SetPARP(86,0.95);
+// ISR and FSR activity.
+       ReadString("SigmaProcess:factorMultFac = 4.");
+// Lambda_FSR scale.
+//     SetPARJ(81,0.29);       
+       break;
+    case kPyOldPopcorn:  
+// Old production mechanism: Old Popcorn
+       ReadString("HardQCD:all = on");
+//     SetMSTJ(12,3); 
+// (D=2) Like MSTJ(12)=2 but added prod ofthe 1er rank baryon
+//     SetMSTP(88,2); 
+// (D=1)see can be used to form  baryons (BARYON JUNCTION)
+//     SetMSTJ(1,1);  
+       AtlasTuning();
+       break;
+    case kPyCharm:
+       ReadString("HardQCD:gg2ccbar = on");
+       ReadString("HardQCD:qqbar2ccbar = on");
+//  heavy quark masses
+       ReadString("ParticleData:mcRun = 1.2");
+//
+//    primordial pT
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+       break;
+    case kPyBeauty:
+       ReadString("HardQCD:gg2bbbar = on");
+       ReadString("HardQCD:qqbar2bbbar = on");
+       ReadString("ParticleData:mbRun = 4.75");
+       break;
+    case kPyJpsi:
+// gg->J/Psi g
+       ReadString("Charmonium:gg2QQbar[3S1(1)]g = on");
+       break;
+    case kPyJpsiChi:
+       ReadString("Charmonium:all = on");
+       break;
+    case kPyCharmUnforced:
+// gq->qg   
+       ReadString("HardQCD:gq2qg = on");
+// gg->qq
+       ReadString("HardQCD:gg2qq = on");
+// gg->gg
+       ReadString("HardQCD:gg2gg = on");
+       break;
+    case kPyBeautyUnforced:
+// gq->qg   
+       ReadString("HardQCD:gq2qg = on");
+// gg->qq
+       ReadString("HardQCD:gg2qq = on");
+// gg->gg
+       ReadString("HardQCD:gg2gg = on");
+       break;
+    case kPyMb:
+// Minimum Bias pp-Collisions
+//
+//   
+//      select Pythia min. bias model
+// single diffraction AB-->XB
+       ReadString("SoftQCD:minBias = on");
+       ReadString("SoftQCD:singleDiffractive = on");
+       ReadString("SoftQCD:doubleDiffractive = on");
+       AtlasTuning();
+       break;
+    case kPyMbDefault:
+// Minimum Bias pp-Collisions
+//
+//   
+//      select Pythia min. bias model
+       ReadString("SoftQCD:minBias = on");
+       ReadString("SoftQCD:singleDiffractive = on");
+       ReadString("SoftQCD:doubleDiffractive = on");
+       break;
+    case kPyLhwgMb:
+// Les Houches Working Group 05 Minimum Bias pp-Collisions: hep-ph/0604120
+//  -> Pythia 6.3 or above is needed
+//   
+       ReadString("SoftQCD:minBias = on");
+       ReadString("SoftQCD:singleDiffractive = on");
+       ReadString("SoftQCD:doubleDiffractive = on");
+       ReadString(Form("PDF:LHAPDFset = %s", AliStructFuncType::PDFsetName(kCTEQ6ll).Data()));
+
+//     SetMSTP(68,1);
+//     SetMSTP(70,2);
+//     ReadString("PartonLevel:MI = on");
+// Double Gaussian matter distribution.
+       ReadString("MultipleInteractions:bProfile = 2");
+       ReadString("MultipleInteractions:coreFraction = 0.5");
+       ReadString("MultipleInteractions:coreRadius = 0.5");
+       ReadString("MultipleInteractions:expPow = 0.16");
+       ReadString("MultipleInteractions:pTmin = 2.3");
+//     SetMSTP(88,1);
+//     SetPARP(85,0.9);           // Regulates gluon prod. mechanism
+       break;
+    case kPyMbNonDiffr:
+// Minimum Bias pp-Collisions
+//
+//   
+//      select Pythia min. bias model
+       ReadString("SoftQCD:minBias = on");
+       AtlasTuning();
+       break;
+    case kPyMbMSEL1:
+       ConfigHeavyFlavor();
+// Intrinsic <kT^2>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+// Set Q-quark mass
+       ReadString("ParticleData:mcRun = 1.20");
+       ReadString("ParticleData:mbRun = 4.78");
+// Atlas Tuning
+       AtlasTuning();
+       break;
+    case kPyJets:
+//
+//  QCD Jets
+//
+       ReadString("HardQCD:all = on");
+//
+//  Pythia Tune A (CDF)
+//
+       ReadString("PartonLevel:MI = on");
+       ReadString("MultipleInteractions:pTmin = 2.0");
+       ReadString("MultipleInteractions:pT0Ref = 2.8");
+       ReadString("MultipleInteractions:ecmRef = 1800.");
+       ReadString("MultipleInteractions:expPow = 0.25");
+       ReadString("MultipleInteractions:bProfile = 2");
+       ReadString("MultipleInteractions:coreFraction = 0.16");
+       ReadString("MultipleInteractions:coreRadius = 0.4");
+       ReadString("SigmaProcess:factorMultFac = 2.5");
+//     SetPARP(85,0.90) ;         // Regulates gluon prod. mechanism
+//     SetPARP(86,0.95);          // Regulates gluon prod. mechanism
+       break;
+    case kPyDirectGamma:
+       ReadString("PromptPhoton:all = on");
+       break;
+    case kPyCharmPbPbMNR:
+    case kPyD0PbPbMNR:
+    case kPyDPlusPbPbMNR:
+    case kPyDPlusStrangePbPbMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // c-cbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with Pb-Pb collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
+       ConfigHeavyFlavor();
+      // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.304");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set c-quark mass
+       ReadString("ParticleData:mcRun = 1.20");
+       break;
+    case kPyCharmpPbMNR:
+    case kPyD0pPbMNR:
+    case kPyDPluspPbMNR:
+    case kPyDPlusStrangepPbMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // c-cbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with p-Pb collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
+       ConfigHeavyFlavor();
+      // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.16");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set c-quark mass
+       ReadString("ParticleData:mcRun = 1.20");
+      break;
+    case kPyCharmppMNR:
+    case kPyD0ppMNR:
+    case kPyDPlusppMNR:
+    case kPyDPlusStrangeppMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // c-cbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with pp collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.1GeV. Example in ConfigCharmPPR.C.
+       ConfigHeavyFlavor();
+      // Intrinsic <kT^2>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set c-quark mass
+       ReadString("ParticleData:mcRun = 1.20");
+      break;
+    case kPyCharmppMNRwmi:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // c-cbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with pp collisions
+      // and with kCTEQ5L PDFs.
+      // Added multiple interactions according to ATLAS tune settings.
+      // To get a "reasonable" agreement with MNR results, events have to be 
+      // generated with the minimum ptHard (AliGenPythia::SetPtHard)
+      // set to 2.76 GeV.
+      // To get a "perfect" agreement with MNR results, events have to be 
+      // generated in four ptHard bins with the following relative 
+      // normalizations:
+      // 2.76-3 GeV: 25%
+      //    3-4 GeV: 40%
+      //    4-8 GeV: 29%
+      //     >8 GeV:  6%
+       ConfigHeavyFlavor();
+      // Intrinsic <kT^2>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set c-quark mass
+       ReadString("ParticleData:mcRun = 1.20");
+       AtlasTuning();
+       break;
+    case kPyBeautyPbPbMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // b-bbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with Pb-Pb collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
+       ConfigHeavyFlavor();
+      // QCD scales
+       ReadString("SigmaProcess:factorMultFac = 1.");
+      // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 2.035");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set b-quark mass
+       ReadString("ParticleData:mbRun = 4.75");
+      break;
+    case kPyBeautypPbMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // b-bbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with p-Pb collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
+       ConfigHeavyFlavor();
+      // QCD scales
+       ReadString("SigmaProcess:factorMultFac = 1.");
+      // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.6");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+      // Set b-quark mass
+       ReadString("ParticleData:mbRun = 4.75");
+      break;
+    case kPyBeautyppMNR:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // b-bbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with pp collisions
+      // (AliGenPythia::SetNuclei) and with kCTEQ4L PDFs.
+      // To get a good agreement the minimum ptHard (AliGenPythia::SetPtHard)
+      // has to be set to 2.75GeV. Example in ConfigBeautyPPR.C.
+       ConfigHeavyFlavor();
+       // QCD scales
+       ReadString("SigmaProcess:factorMultFac = 1.");
+       // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.0");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+       // Set b-quark mass
+       ReadString("ParticleData:mbRun = 4.75");
+      break;
+     case kPyBeautyppMNRwmi:
+      // Tuning of Pythia parameters aimed to get a resonable agreement
+      // between with the NLO calculation by Mangano, Nason, Ridolfi for the
+      // b-bbar single inclusive and double differential distributions.
+      // This parameter settings are meant to work with pp collisions
+      // and with kCTEQ5L PDFs.
+      // Added multiple interactions according to ATLAS tune settings.
+      // To get a "reasonable" agreement with MNR results, events have to be 
+      // generated with the minimum ptHard (AliGenPythia::SetPtHard)
+      // set to 2.76 GeV.
+      // To get a "perfect" agreement with MNR results, events have to be 
+      // generated in four ptHard bins with the following relative 
+      // normalizations:
+      // 2.76-4 GeV:  5% 
+      //    4-6 GeV: 31%
+      //    6-8 GeV: 28%
+      //     >8 GeV: 36%
+        ConfigHeavyFlavor();
+        // QCD scales
+        ReadString("SigmaProcess:factorMultFac = 1.");
+        // Intrinsic <kT>
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString("Beams:primordialKThard = 1.0");
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+       // Set b-quark mass
+       ReadString("ParticleData:mbRun = 4.75");
+       AtlasTuning();
+       break; 
+    case kPyW:
+       //Inclusive production of W+/-
+       //f fbar -> W+ 
+       ReadString("WeakSingleBoson:ffbar2W = on");
+       // Initial/final parton shower on (Pythia default)
+       // With parton showers on we are generating "W inclusive process"
+       ReadString("PartonLevel:ISR = on");
+       ReadString("PartonLevel:FSR = on");
+       break;  
+    case kPyZ:
+       //Inclusive production of Z
+       //f fbar -> Z/gamma
+       ReadString("WeakSingleBoson:ffbar2gmZ = on");
+        //only Z included, not gamma 
+       ReadString("WeakZ0:gmZmode = 2");
+       // Initial/final parton shower on (Pythia default)
+       // With parton showers on we are generating "Z inclusive process"
+       ReadString("PartonLevel:ISR = on");
+       ReadString("PartonLevel:FSR = on");
+       break;  
+    }
+//
+//  Initialize PYTHIA
+//    SetMSTP(41,1);   // all resonance decays switched on
+    Initialize(2212, 2212, fEcms);
+}
+
+void AliPythia8::SetNuclei(Int_t /*a1*/, Int_t /*a2*/)
+{
+// Treat protons as inside nuclei with mass numbers a1 and a2  
+//    The MSTP array in the PYPARS common block is used to enable and 
+//    select the nuclear structure functions. 
+//    MSTP(52)  : (D=1) choice of proton and nuclear structure-function library
+//            =1: internal PYTHIA acording to MSTP(51) 
+//            =2: PDFLIB proton  s.f., with MSTP(51)  = 1000xNGROUP+NSET
+//    If the following mass number both not equal zero, nuclear corrections of the stf are used.
+//    MSTP(192) : Mass number of nucleus side 1
+//    MSTP(193) : Mass number of nucleus side 2
+//    SetMSTP(52,2);
+//    SetMSTP(192, a1);
+//    SetMSTP(193, a2);  
+}
+       
+
+AliPythia8* AliPythia8::Instance()
+{ 
+// Set random number generator 
+    if (fgAliPythia8) {
+       return fgAliPythia8;
+    } else {
+       fgAliPythia8 = new AliPythia8();
+       return fgAliPythia8;
+    }
+}
+
+void AliPythia8::PrintParticles()
+{ 
+// Print list of particl properties
+    ReadString("Main:showAllParticleData");
+}
+
+void  AliPythia8::ResetDecayTable()
+{
+//  Set default values for pythia decay switches
+//    Int_t i;
+//    for (i = 1; i <  501; i++) SetMDCY(i,1,fDefMDCY[i]);
+//    for (i = 1; i < 2001; i++) SetMDME(i,1,fDefMDME[i]);
+}
+
+void  AliPythia8::SetDecayTable()
+{
+//  Set default values for pythia decay switches
+//
+//    Int_t i;
+//    for (i = 1; i <  501; i++) fDefMDCY[i] = GetMDCY(i,1);
+//    for (i = 1; i < 2001; i++) fDefMDME[i] = GetMDME(i,1);
+}
+
+void  AliPythia8::Pyclus(Int_t& njet)
+{
+//  Call Pythia clustering algorithm
+//
+    Bool_t ok = fClusterJet.analyze(Pythia8()->event, fYScale, fPtScale, fNJetMin, fNJetMax);
+    njet = 0;
+    if (ok) njet = fClusterJet.size();
+}
+
+void  AliPythia8::Pycell(Int_t& njet)
+{
+//  Call Pythia jet reconstruction algorithm
+//
+    Bool_t ok = fCellJet.analyze(Pythia8()->event, fMinEtJet, fRJet, fEtSeed);
+    njet = 0;
+    if (ok) njet = fCellJet.size();
+}
+
+void AliPythia8::GetJet(Int_t i, Float_t& px, Float_t& py, Float_t& pz, Float_t& e)
+{
+    // Get jet number i
+    Float_t et = fCellJet.eT(i);
+    px = et * TMath::Cos(fCellJet.phiWeighted(i));
+    py = et * TMath::Sin(fCellJet.phiWeighted(i));
+    pz = et * TMath::SinH(fCellJet.etaWeighted(i));
+    e  = et * TMath::CosH(fCellJet.etaWeighted(i));
+}
+
+void AliPythia8::GenerateEvent()
+{
+    // Generate one event
+    TPythia8::GenerateEvent();
+}
+
+void AliPythia8::GenerateMIEvent()
+{
+    // New multiple interaction scenario
+    AliWarning("Not implemented. No event will be generated");
+}
+
+void AliPythia8::PrintStatistics()
+{
+    // End of run statistics
+    TPythia8::PrintStatistics();
+}
+
+void AliPythia8::EventListing()
+{
+    // End of run statistics
+    TPythia8::EventListing();
+}
+
+Int_t AliPythia8::ProcessCode()
+{
+    // Returns the subprocess code for the current event
+    return Pythia8()->info.codeSub();
+}
+
+void AliPythia8::ConfigHeavyFlavor()
+{
+    //
+    // Default configuration for Heavy Flavor production
+    //
+    // All QCD processes
+    //
+    ReadString("HardQCD:all = on");
+
+    // No multiple interactions
+    ReadString("PartonLevel:MI = off");
+    ReadString("MultipleInteractions:pTmin = 0.0");
+    ReadString("MultipleInteractions:pT0Ref = 0.0");
+
+    // Initial/final parton shower on (Pythia default)
+    ReadString("PartonLevel:ISR = on");
+    ReadString("PartonLevel:FSR = on");
+    
+    // 2nd order alpha_s
+    ReadString("SigmaProcess:alphaSorder = 2");
+
+    // QCD scales 
+    ReadString("SigmaProcess:renormScale2 = 2");
+    ReadString("SigmaProcess:renormMultFac = 1.");
+}
+
+void AliPythia8::AtlasTuning()
+{
+    //
+    // Configuration for the ATLAS tuning
+    ReadString(Form("PDF:LHAPDFset = %s", AliStructFuncType::PDFsetName(kCTEQ5L).Data()));
+    ReadString("PartonLevel:MI = on");
+    ReadString("MultipleInteractions:pTmin = 1.9");
+    ReadString("MultipleInteractions:pT0Ref = 1.8");
+    ReadString("MultipleInteractions:ecmRef = 1000.");
+    ReadString("MultipleInteractions:expPow = 0.16");
+    ReadString("MultipleInteractions:bProfile = 2");
+    ReadString("MultipleInteractions:coreFraction = 0.16");
+    ReadString("MultipleInteractions:coreRadius = 0.5");
+//     SetPARP(85,0.33);          // Regulates gluon prod. mechanism
+//     SetPARP(86,0.66);          // Regulates gluon prod. mechanism
+    ReadString("SigmaProcess:factorMultFac = 1.");
+}
+
+void AliPythia8::SetPtHardRange(Float_t ptmin, Float_t ptmax)
+{
+    // Set the pt hard range
+    ReadString(Form("PhaseSpace:pTHatMin = %13.3f", ptmin));
+    ReadString(Form("PhaseSpace:pTHatMax = %13.3f", ptmax));
+}
+
+void AliPythia8::SetYHardRange(Float_t /*ymin*/, Float_t /*ymax*/)
+{
+    // Set the y hard range
+    printf("YHardRange not implemented in Pythia8 !!!\n");
+    
+}
+
+
+void AliPythia8::SetFragmentation(Int_t flag)
+{
+    // Switch fragmentation on/off
+    if (flag) {
+       ReadString("HadronLevel:Hadronize = on");
+    } else {
+       ReadString("HadronLevel:Hadronize = off");
+    }
+}
+
+void AliPythia8::SetInitialAndFinalStateRadiation(Int_t flag1, Int_t flag2)
+{
+//  initial state radiation    
+    if (flag1) {
+       ReadString("PartonLevel:ISR = on");
+    } else {
+       ReadString("PartonLevel:ISR = off");
+    }
+// final state radiation    
+    if (flag2) {
+       ReadString("PartonLevel:FSR = on");
+    } else {
+       ReadString("PartonLevel:FSR = off");
+    }
+}
+
+void AliPythia8::SetIntrinsicKt(Float_t kt)
+{
+       ReadString("Beams:primordialKT = on");
+       ReadString("Beams:primordialKTsoft = 0.");
+       ReadString(Form("Beams:primordialKThard = %13.3f", kt));
+       ReadString("Beams:halfScaleForKT = 0.");
+       ReadString("Beams:halfMassForKT = 0.");
+}
+
+void AliPythia8::SwitchHFOff()
+{
+    // Switch off heavy flavor
+    // Maximum number of quark flavours used in pdf 
+    ReadString("PDFinProcess:nQuarkIn = 3");
+    // Maximum number of flavors that can be used in showers
+    ReadString("TimeShower:nGluonToQuark = 3");
+    ReadString("SpaceShower:nQuarkIn = 3");
+    
+
+}
+
+void AliPythia8::SetPycellParameters(Float_t etaMax, Int_t nEta, Int_t nPhi,
+                                      Float_t thresh, Float_t etseed, Float_t minet, Float_t r)
+{
+// Set pycell parameters
+    fCellJet  = Pythia8::CellJet( etaMax, nEta, nPhi, 2, 0, 0., 0., thresh);
+    fEtSeed   = etseed;
+    fMinEtJet = minet;
+    fRJet     = r;
+}
+
+void AliPythia8::ModifiedSplitting()
+{
+//
+// We have to see how to implement this in Pythia8 !!!
+//
+    // Modified splitting probability as a model for quenching
+//    SetPARJ(200, 0.8);
+//    SetMSTJ(41, 1);  // QCD radiation only
+//    SetMSTJ(42, 2);  // angular ordering
+//    SetMSTJ(44, 2);  // option to run alpha_s
+//    SetMSTJ(47, 0);  // No correction back to hard scattering element
+//    SetMSTJ(50, 0);  // No coherence in first branching
+//    SetPARJ(82, 1.); // Cut off for parton showers
+}
+
+    
+void AliPythia8::InitQuenching(Float_t /*cMin*/, Float_t /*cMax*/, Float_t /*k*/, Int_t /*iECMethod*/, Float_t /*zmax*/, Int_t /*ngmax*/)
+{
+    //
+    //
+    AliWarning("Not implemented !");
+}
+
+void AliPythia8::SwitchHadronisationOff()
+{
+    // Switch off hadronisation
+    ReadString("HadronLevel:Hadronize = off");
+}
+
+void AliPythia8::SwitchHadronisationOn()
+{
+    // Switch on hadronisarion
+    ReadString("HadronLevel:Hadronize = on");
+}
+
+
+void AliPythia8::GetXandQ(Float_t& x1, Float_t& x2, Float_t& q)
+{
+    // Get x1, x2 and Q for this event
+    
+    q  = Pythia8()->info.QFac();
+    x1 = Pythia8()->info.x1();
+    x2 = Pythia8()->info.x2();
+    
+}
+
+Float_t AliPythia8::GetXSection()
+{
+    // Get the total cross-section
+    return Pythia8()->info.sigmaGen();
+}
+
+Float_t AliPythia8::GetPtHard()
+{
+    // Get the pT hard for this event
+    return Pythia8()->info.pTHat();
+}
+
+
+
+
+AliPythia8& AliPythia8::operator=(const  AliPythia8& rhs)
+{
+// Assignment operator
+    rhs.Copy(*this);
+    return *this;
+}
+
+ void AliPythia8::Copy(TObject&) const
+{
+    //
+    // Copy 
+    //
+    Fatal("Copy","Not implemented!\n");
+}
+
+//
+// To be implemented
+//
+void AliPythia8::SetNumberOfParticles(Int_t /*i*/)
+{
+    AliWarning("Not implemented");
+}
+
+void AliPythia8::EditEventList(Int_t /*i*/)
+{
+    AliWarning("Not implemented");
+}
+
+void AliPythia8::Pyquen(Double_t /*a*/, Int_t /*b*/, Double_t /*c*/)
+{
+    AliWarning("Cannot be used with Pythia8");
+}
+
+void AliPythia8::HadronizeEvent()
+{
+    // Needs access to HadronLevel ?
+    AliWarning("Not yet implemented");
+}
+
+void AliPythia8::GetQuenchingParameters(Double_t& /*xp*/, Double_t& /*yp*/, Double_t* /*z[4]*/)
+{
+    AliWarning("Not yet implemented");
+}
+
+void AliPythia8::LoadEvent(AliStack* /*stack*/, Int_t /*flag*/, Int_t /*reHadr*/)
+{
+    AliWarning("Not yet implemented");
+}
diff --git a/PYTHIA6/AliPythia8.h b/PYTHIA6/AliPythia8.h
new file mode 100644 (file)
index 0000000..87f2ba6
--- /dev/null
@@ -0,0 +1,113 @@
+#ifndef ALIPYTHIA8_H
+#define ALIPYTHIA8_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliPythia.h,v 1.22 2007/10/09 08:43:24 morsch Exp $ */
+
+#include <TPythia8.h>
+#include "../../pythia8100/include/Analysis.h"
+#include <AliPythiaBase.h>
+
+class AliStack;
+class AliPythia8 : public TPythia8, public AliPythiaBase
+{
+
+ public:
+    AliPythia8();
+    AliPythia8(const AliPythia8& pythia);
+    virtual ~AliPythia8() {;}
+    virtual Int_t Version() {return (8);}
+    // convert to compressed code and print result (for debugging only)
+    virtual Int_t CheckedLuComp(Int_t /*kf*/) {return -1;}
+    // Pythia initialisation for selected processes
+    virtual void  ProcInit (Process_t process, Float_t energy, StrucFunc_t strucfunc);
+    virtual void  GenerateEvent();
+    virtual void  GenerateMIEvent();
+    virtual void  HadronizeEvent();
+    virtual Int_t GetNumberOfParticles() {return GetN();}
+    virtual void  SetNumberOfParticles(Int_t i);
+    virtual void  EditEventList(Int_t i);
+    virtual void  PrintStatistics();
+    virtual void  EventListing();    
+    virtual Int_t GetParticles(TClonesArray *particles) {return ImportParticles(particles, "All");}
+    // Treat protons as inside nuclei
+    virtual void  SetNuclei(Int_t a1, Int_t a2);
+    // Print particle properties
+    virtual void PrintParticles();
+    // Reset the decay table
+    virtual void ResetDecayTable();
+    //
+    // Common Physics Configuration
+    virtual void SetPtHardRange(Float_t ptmin, Float_t ptmax);
+    virtual void SetYHardRange(Float_t ymin, Float_t ymax);
+    virtual void SetFragmentation(Int_t flag);
+    virtual void SetInitialAndFinalStateRadiation(Int_t flag1, Int_t flag2);
+    virtual void SetIntrinsicKt(Float_t kt);
+    virtual void SwitchHFOff();
+    virtual void SetPycellParameters(Float_t etamax, Int_t neta, Int_t nphi,
+                                    Float_t thresh, Float_t etseed, Float_t minet, Float_t r);
+    virtual void GetJet(Int_t i, Float_t& px, Float_t& py, Float_t& pz, Float_t& e);
+    virtual void ModifiedSplitting();
+    virtual void InitQuenching(Float_t bmin, Float_t bmax, Float_t k,
+                              Int_t iECMethod, Float_t zmax = 0.97,
+                              Int_t ngmax = 30);
+    virtual void SwitchHadronisationOff();
+    virtual void SwitchHadronisationOn();
+    //
+    // Common Getters
+    virtual void    GetXandQ(Float_t& x1, Float_t& x2, Float_t& q);
+    virtual Float_t GetXSection();
+    virtual Float_t GetPtHard();
+    //
+    //
+    virtual void  SetDecayTable();
+    virtual void  Pystat(Int_t /*i*/){;}
+    virtual void  Pylist(Int_t /*i*/){;}
+    virtual Int_t ProcessCode();
+    virtual void  Pycell(Int_t& nclus);
+    virtual void  Pyclus(Int_t& nclus);
+    virtual void  Pyshow(Int_t /*ip1*/, Int_t /*ip2*/, Double_t /*qmax*/) {;}
+    virtual void  Pyrobo(Int_t /*imi*/, Int_t /*ima*/, Double_t /*the*/,
+                        Double_t /*phi*/, Double_t /*bex*/, Double_t /*bey*/, Double_t /*bez*/) {;}
+    static  AliPythia8* Instance();
+    virtual void Quench() {;}
+    // Assignment Operator
+    AliPythia8 & operator=(const AliPythia8 & rhs);
+    void Copy(TObject&) const;
+    //
+    // Not yet implemented
+    //
+    virtual void Pyquen(Double_t, Int_t, Double_t);
+    virtual void Pyexec() {;}
+    virtual void GetQuenchingParameters(Double_t& xp, Double_t& yp, Double_t z[4]);
+    virtual void LoadEvent(AliStack* stack, Int_t flag, Int_t reHadr);
+    virtual void ConfigHeavyFlavor();
+    virtual void AtlasTuning();
+ protected:
+    Process_t             fProcess;           // Process type
+    Float_t               fEcms;              // Centre of mass energy
+    StrucFunc_t           fStrucFunc;         // Structure function
+    Int_t                 fDefMDCY[501];      //  ! Default decay switches per particle
+    Int_t                 fDefMDME[2001];     //  ! Default decay switches per mode
+    Double_t              fZQuench[4];        //  ! Quenching fractions for this even
+    Pythia8::CellJet      fCellJet;           //  ! Cell jet object
+    Float_t               fEtSeed;            //  ! Et seed for cell jets 
+    Float_t               fMinEtJet;          //  ! Min jet et 
+    Float_t               fRJet;              //  ! Radius for cell jets
+    Pythia8::ClusterJet   fClusterJet;        //  ! Cluster jet object
+    Float_t               fYScale;            //  ! cut-off joining scale
+    Float_t               fPtScale;           //  ! cut-off joining scale
+    Int_t                 fNJetMin;           //  ! min. number of jets
+    Int_t                 fNJetMax;           //  ! max. number of jets
+    static AliPythia8*    fgAliPythia8;       //    Pointer to single instance
+
+    ClassDef(AliPythia8, 1) //ALICE UI to PYTHIA8
+};
+
+#endif
+
+
+
+
+
diff --git a/PYTHIA6/TPythia8.cxx b/PYTHIA6/TPythia8.cxx
new file mode 100644 (file)
index 0000000..345643f
--- /dev/null
@@ -0,0 +1,250 @@
+// @(#)root/pythia8:$Name$:$Id$
+// Author: Andreas Morsch   27/10/2007
+
+/*************************************************************************
+ * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+// TPythia8                                                                   //
+//                                                                            //
+// TPythia is an interface class to C++ version of Pythia 8.1                 //
+// event generators, written by T.Sjostrand.                                  //
+////////////////////////////////////////////////////////////////////////////////
+/*
+*------------------------------------------------------------------------------------*
+ |                                                                                    |
+ |  *------------------------------------------------------------------------------*  |
+ |  |                                                                              |  |
+ |  |                                                                              |  |
+ |  |   PPP   Y   Y  TTTTT  H   H  III    A      Welcome to the Lund Monte Carlo!  |  |
+ |  |   P  P   Y Y     T    H   H   I    A A     This is PYTHIA version 8.100      |  |
+ |  |   PPP     Y      T    HHHHH   I   AAAAA    Last date of change: 20 Oct 2007  |  |
+ |  |   P       Y      T    H   H   I   A   A                                      |  |
+ |  |   P       Y      T    H   H  III  A   A    Now is 27 Oct 2007 at 18:26:53    |  |
+ |  |                                                                              |  |
+ |  |   Main author: Torbjorn Sjostrand; CERN/PH, CH-1211 Geneva, Switzerland,     |  |
+ |  |     and Department of Theoretical Physics, Lund University, Lund, Sweden;    |  |
+ |  |     phone: + 41 - 22 - 767 82 27; e-mail: torbjorn@thep.lu.se                |  |
+ |  |   Author: Stephen Mrenna; Computing Division, Simulations Group,             |  |
+ |  |     Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA;   |  |
+ |  |     phone: + 1 - 630 - 840 - 2556; e-mail: mrenna@fnal.gov                   |  |
+ |  |   Author: Peter Skands; CERN/PH, CH-1211 Geneva, Switzerland,                |  |
+ |  |     and Theoretical Physics Department,                                      |  |
+ |  |     Fermi National Accelerator Laboratory, MS 106, Batavia, IL 60510, USA;   |  |
+ |  |     phone: + 41 - 22 - 767 24 59; e-mail: skands@fnal.gov                    |  |
+ |  |                                                                              |  |
+ |  |   The main program reference is the 'Brief Introduction to PYTHIA 8.1',      |  |
+ |  |   T. Sjostrand, S. Mrenna and P. Skands, arXiv:0710.3820                     |  |
+ |  |                                                                              |  |
+ |  |   The main physics reference is the 'PYTHIA 6.4 Physics and Manual',         |  |
+ |  |   T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 [hep-ph/0603175]. |  |
+ |  |                                                                              |  |
+ |  |   An archive of program versions and documentation is found on the web:      |  |
+ |  |   http://www.thep.lu.se/~torbjorn/Pythia.html                                |  |
+ |  |                                                                              |  |
+ |  |   This program is released under the GNU General Public Licence version 2.   |  |
+ |  |   Please respect the MCnet Guidelines for Event Generator Authors and Users. |  |
+ |  |                                                                              |  |
+ |  |   Disclaimer: this program comes without any guarantees.                     |  |
+ |  |   Beware of errors and use common sense when interpreting results.           |  |
+ |  |                                                                              |  |
+ |  |   Copyright (C) 2007 Torbjorn Sjostrand                                      |  |
+ |  |                                                                              |  |
+ |  |                                                                              |  |
+ |  *------------------------------------------------------------------------------*  |
+ |                                                                                    |
+ *------------------------------------------------------------------------------------*
+*/
+
+
+
+#include "TPythia8.h"
+
+#include <TClonesArray.h>
+#include <TParticle.h>
+#include <Pythia.h>
+
+ClassImp(TPythia8)
+
+TPythia8*  TPythia8::fgInstance = 0;
+
+TPythia8::TPythia8():
+    TGenerator("TPythia8", "TPythia8"),
+    fPythia(0),
+    fNumberOfParticles(0)
+{
+    // Constructor
+    if (fgInstance) 
+       Fatal("TPythia8", "There's already an instance of TPythia8");
+  
+    delete fParticles; // was allocated as TObjArray in TGenerator
+    
+    fParticles = new TClonesArray("TParticle",50);
+    fPythia    = new Pythia8::Pythia();
+}
+
+TPythia8::~TPythia8()
+{
+    // Destructor
+    if (fParticles) {
+       fParticles->Delete();
+       delete fParticles;
+       fParticles = 0;
+    }
+    delete fPythia;
+}
+
+TPythia8* TPythia8::Instance() {
+   // Return an instance of TPythia8
+    return fgInstance ? fgInstance : (fgInstance = new TPythia8()) ;
+}
+
+Bool_t TPythia8::Initialize(Int_t  idAin, Int_t idBin, Double_t ecms)
+{
+    // Initialization
+    AddParticlesToPdgDataBase();
+    return fPythia->init(idAin, idBin, ecms);
+}
+
+void TPythia8::GenerateEvent()
+{
+    // Generate the next event
+    fPythia->next();
+    fNumberOfParticles  = fPythia->event.size() - 1;
+    ImportParticles();
+}
+
+Int_t TPythia8::ImportParticles(TClonesArray *particles, Option_t *option)
+{
+    // Import particles from Pythia stack
+    if (particles == 0) return 0;
+    TClonesArray &clonesParticles = *particles;
+    clonesParticles.Clear();
+    Int_t nparts=0;
+    Int_t i;
+    if (!strcmp(option,"") || !strcmp(option,"Final")) {
+       for (i = 1; i <= fNumberOfParticles; i++) {
+           if (fPythia->event[i].isFinal()) {
+               new(clonesParticles[nparts]) TParticle(
+                   fPythia->event[i].id(),
+                   fPythia->event[i].isFinal(),
+                   fPythia->event[i].mother1()   - 1,
+                   fPythia->event[i].mother2()   - 1,
+                   fPythia->event[i].daughter1() - 1,
+                   fPythia->event[i].daughter2() - 1,
+                   fPythia->event[i].px(),     // [GeV/c]
+                   fPythia->event[i].py(),     // [GeV/c]
+                   fPythia->event[i].pz(),     // [GeV/c]
+                   fPythia->event[i].e(),      // [GeV]
+                   fPythia->event[i].xProd(),  // [mm]
+                   fPythia->event[i].yProd(),  // [mm]
+                   fPythia->event[i].zProd(),  // [mm]
+                   fPythia->event[i].tProd()); // [mm/c] 
+               nparts++;
+           } // final state partice
+       } // particle loop
+    } else if (!strcmp(option,"All")) {
+       for (i = 1; i <= fNumberOfParticles; i++) {
+           new(clonesParticles[nparts]) TParticle(
+               fPythia->event[i].id(),
+               fPythia->event[i].isFinal(),
+               fPythia->event[i].mother1()   - 1,
+               fPythia->event[i].mother2()   - 1,
+               fPythia->event[i].daughter1() - 1 ,
+               fPythia->event[i].daughter2() - 1,
+               fPythia->event[i].px(),       // [GeV/c]
+               fPythia->event[i].py(),       // [GeV/c]
+               fPythia->event[i].pz(),       // [GeV/c]
+               fPythia->event[i].e(),        // [GeV]
+               fPythia->event[i].xProd(),    // [mm]
+               fPythia->event[i].yProd(),    // [mm]
+               fPythia->event[i].zProd(),    // [mm]
+               fPythia->event[i].tProd());   // [mm/c]
+           nparts++;
+       } // particle loop      
+    }
+    return nparts;
+}
+
+TObjArray* TPythia8::ImportParticles(Option_t* /* option */)
+{
+    // 
+    // Import particles from Pythia stack
+    fParticles->Clear();
+    Int_t numpart   = fPythia->event.size() - 1;
+    TClonesArray &a = *((TClonesArray*)fParticles);
+    for (Int_t i = 1; i <= numpart; i++) {
+       new(a[i]) TParticle(
+           fPythia->event[i].id(),
+           fPythia->event[i].isFinal(),
+           fPythia->event[i].mother1()   - 1,
+           fPythia->event[i].mother2()   - 1,
+           fPythia->event[i].daughter1() - 1,
+           fPythia->event[i].daughter2() - 1,
+           fPythia->event[i].px(),       // [GeV/c]
+           fPythia->event[i].py(),       // [GeV/c]
+           fPythia->event[i].pz(),       // [GeV/c]
+           fPythia->event[i].e(),        // [GeV]
+           fPythia->event[i].xProd(),    // [mm]
+           fPythia->event[i].yProd(),    // [mm]
+           fPythia->event[i].zProd(),    // [mm]
+           fPythia->event[i].tProd());   // [mm/c]
+    }
+    return fParticles;
+}
+
+Int_t TPythia8::GetN() const
+{
+// Initialization
+    return (fPythia->event.size() - 1);
+}
+
+void TPythia8::ReadString(char* string) const
+{
+    // Configuration
+    fPythia->readString(string);
+}
+
+
+void TPythia8::PrintStatistics() const
+{
+    // Print end of run statistics
+    fPythia->statistics();
+}
+
+void TPythia8::EventListing() const
+{
+    // Event listing
+    fPythia->event.list();
+}
+
+
+void TPythia8::AddParticlesToPdgDataBase()
+{
+// Add some pythia specific particle code to the data base    
+
+    TDatabasePDG *pdgDB = TDatabasePDG::Instance();
+    pdgDB->AddParticle("string","string", 0, kTRUE,
+                      0, 0, "QCD string", 90);
+    pdgDB->AddParticle("rho_diff0", "rho_diff0", 0, kTRUE,
+                      0, 0, "QCD diffr. state", 9900110);
+    pdgDB->AddParticle("pi_diffr+", "pi_diffr+", 0, kTRUE,
+                      0, 1, "QCD diffr. state", 9900210);
+    pdgDB->AddParticle("omega_di", "omega_di", 0, kTRUE,
+                      0, 0, "QCD diffr. state", 9900220);
+    pdgDB->AddParticle("phi_diff","phi_diff", 0, kTRUE,
+                      0, 0, "QCD diffr. state", 9900330);
+    pdgDB->AddParticle("J/psi_di", "J/psi_di", 0, kTRUE,
+                      0, 0, "QCD diffr. state", 9900440);
+    pdgDB->AddParticle("n_diffr0","n_diffr0",0,kTRUE,
+                      0, 0, "QCD diffr. state", 9902110);
+    pdgDB->AddParticle("p_diffr+","p_diffr+", 0, kTRUE,
+                      0, 1, "QCD diffr. state", 9902210);
+}
diff --git a/PYTHIA6/TPythia8.h b/PYTHIA6/TPythia8.h
new file mode 100644 (file)
index 0000000..e63a687
--- /dev/null
@@ -0,0 +1,107 @@
+// @(#)root/pythia8:$Name$:$Id$
+// Author: Andreas Morsch   27/10/2007
+
+/*************************************************************************
+ * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
+ * All rights reserved.                                                  *
+ *                                                                       *
+ * For the licensing terms see $ROOTSYS/LICENSE.                         *
+ * For the list of contributors see $ROOTSYS/README/CREDITS.             *
+ *************************************************************************/
+
+#ifndef PYTHIA_TPythia8
+#define PYTHIA_TPythia8
+
+////////////////////////////////////////////////////////////////////////////////
+//                                                                            //
+// TPythia8                                                                   //
+//                                                                            //
+// TPythia is an interface class to C++ version of Pythia 8.1                 //
+// event generators, written by T.Sjostrand.                                  //
+////////////////////////////////////////////////////////////////////////////////
+/*
+*------------------------------------------------------------------------------------*
+ |                                                                                    |
+ |  *------------------------------------------------------------------------------*  |
+ |  |                                                                              |  |
+ |  |                                                                              |  |
+ |  |   PPP   Y   Y  TTTTT  H   H  III    A      Welcome to the Lund Monte Carlo!  |  |
+ |  |   P  P   Y Y     T    H   H   I    A A     This is PYTHIA version 8.100      |  |
+ |  |   PPP     Y      T    HHHHH   I   AAAAA    Last date of change: 20 Oct 2007  |  |
+ |  |   P       Y      T    H   H   I   A   A                                      |  |
+ |  |   P       Y      T    H   H  III  A   A    Now is 27 Oct 2007 at 18:26:53    |  |
+ |  |                                                                              |  |
+ |  |   Main author: Torbjorn Sjostrand; CERN/PH, CH-1211 Geneva, Switzerland,     |  |
+ |  |     and Department of Theoretical Physics, Lund University, Lund, Sweden;    |  |
+ |  |     phone: + 41 - 22 - 767 82 27; e-mail: torbjorn@thep.lu.se                |  |
+ |  |   Author: Stephen Mrenna; Computing Division, Simulations Group,             |  |
+ |  |     Fermi National Accelerator Laboratory, MS 234, Batavia, IL 60510, USA;   |  |
+ |  |     phone: + 1 - 630 - 840 - 2556; e-mail: mrenna@fnal.gov                   |  |
+ |  |   Author: Peter Skands; CERN/PH, CH-1211 Geneva, Switzerland,                |  |
+ |  |     and Theoretical Physics Department,                                      |  |
+ |  |     Fermi National Accelerator Laboratory, MS 106, Batavia, IL 60510, USA;   |  |
+ |  |     phone: + 41 - 22 - 767 24 59; e-mail: skands@fnal.gov                    |  |
+ |  |                                                                              |  |
+ |  |   The main program reference is the 'Brief Introduction to PYTHIA 8.1',      |  |
+ |  |   T. Sjostrand, S. Mrenna and P. Skands, arXiv:0710.3820                     |  |
+ |  |                                                                              |  |
+ |  |   The main physics reference is the 'PYTHIA 6.4 Physics and Manual',         |  |
+ |  |   T. Sjostrand, S. Mrenna and P. Skands, JHEP05 (2006) 026 [hep-ph/0603175]. |  |
+ |  |                                                                              |  |
+ |  |   An archive of program versions and documentation is found on the web:      |  |
+ |  |   http://www.thep.lu.se/~torbjorn/Pythia.html                                |  |
+ |  |                                                                              |  |
+ |  |   This program is released under the GNU General Public Licence version 2.   |  |
+ |  |   Please respect the MCnet Guidelines for Event Generator Authors and Users. |  |
+ |  |                                                                              |  |
+ |  |   Disclaimer: this program comes without any guarantees.                     |  |
+ |  |   Beware of errors and use common sense when interpreting results.           |  |
+ |  |                                                                              |  |
+ |  |   Copyright (C) 2007 Torbjorn Sjostrand                                      |  |
+ |  |                                                                              |  |
+ |  |                                                                              |  |
+ |  *------------------------------------------------------------------------------*  |
+ |                                                                                    |
+ *------------------------------------------------------------------------------------*
+*/
+
+
+
+#include <TGenerator.h>
+#include "Pythia.h"
+
+
+class Pythia;
+class TClonesArray;
+class TObjArray;
+
+class TPythia8 : public TGenerator
+{
+ protected:
+    static  TPythia8       *fgInstance;             //! singleton instance
+    Pythia8::Pythia        *fPythia;                //! The pythia instance
+    Int_t                   fNumberOfParticles;     //! Number of particles
+public:
+   TPythia8();
+   virtual ~TPythia8();
+   static TPythia8        *Instance();
+   Pythia8::Pythia        *Pythia8() {return fPythia;}
+   //
+   // Interface
+   virtual void            GenerateEvent();
+   virtual Int_t           ImportParticles(TClonesArray *particles, Option_t *option="");
+   virtual TObjArray      *ImportParticles(Option_t *option="");
+   //
+   // Others
+   void                    ReadString(char* string) const;
+   Bool_t                  Initialize(Int_t  idAin, Int_t idBin, Double_t ecms);
+   void                    PrintStatistics()        const;
+   void                    EventListing()           const;
+   Int_t                   GetN()                   const;
+ private:
+   void                    AddParticlesToPdgDataBase();
+   //   
+   ClassDef(TPythia8, 1)   // TGenerator implementation of Pythia8
+};
+
+#endif
diff --git a/PYTHIA6/TPythia8LinkDef.h b/PYTHIA6/TPythia8LinkDef.h
new file mode 100644 (file)
index 0000000..96bfff5
--- /dev/null
@@ -0,0 +1,10 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#ifdef WITHPYTHIA8
+#pragma link C++ class TPythia8+;
+#pragma link C++ class AliPythia8+;
+#endif
+#endif
diff --git a/PYTHIA6/libTPythia8.pkg b/PYTHIA6/libTPythia8.pkg
new file mode 100644 (file)
index 0000000..19e4355
--- /dev/null
@@ -0,0 +1,8 @@
+ifneq ($(PYTHIA8),)
+       SRCS= TPythia8.cxx AliPythia8.cxx
+       HDRS:= $(SRCS:.cxx=.h) 
+
+       DHDR:= TPythia8LinkDef.h        
+       CINTFLAGS += -DWITHPYTHIA8      
+       EINCLUDE:= $(PYTHIA8)/include
+endif