New pythia8 version
[u/mrichter/AliRoot.git] / PYTHIA8 / AliDecayerPythia8.cxx
index b8c7590..abfde87 100644 (file)
 // Author: andreas.morsch@cern.ch
 #include <TMath.h>
 #include <TPDGCode.h>
-#include <TPythia8.h>
+#include <TLorentzVector.h>
+#include "AliTPythia8.h"
 #include "AliDecayerPythia8.h"
 #include "ParticleData.h"
 
 ClassImp(AliDecayerPythia8)
 
+Bool_t AliDecayerPythia8::fgInit = kFALSE;
+
 AliDecayerPythia8::AliDecayerPythia8():
-    TPythia8Decayer(),
-    fDecay(kAll),
-    fHeavyFlavour(kTRUE)
+  TVirtualMCDecayer(),
+  fPythia8(new AliTPythia8()),
+  fDebug(0),
+  fDecay(kAll),
+  fHeavyFlavour(kTRUE)
 {
     // Constructor
+   fPythia8->Pythia8()->readString("SoftQCD:elastic = on");
+   fPythia8->Pythia8()->init();
+}
+
+//___________________________________________________________________________
+void AliDecayerPythia8::Decay(Int_t pdg, TLorentzVector* p)
+{
+   // Decay a single particle
+   ClearEvent();
+   AppendParticle(pdg, p);
+   Int_t idPart = fPythia8->Pythia8()->event[0].id();
+   fPythia8->Pythia8()->particleData.mayDecay(idPart,kTRUE);
+   fPythia8->Pythia8()->moreDecays();
+   if (fDebug > 0) fPythia8->EventListing();
+}
+
+//___________________________________________________________________________
+Int_t AliDecayerPythia8::ImportParticles(TClonesArray *particles)
+{
+   //import the decay products into particles array
+   return (fPythia8->ImportParticles(particles, "All"));
+}
+
+
+void AliDecayerPythia8::Init()
+{
+// Initialisation
+//
+    if (!fgInit) {
+       fgInit = kTRUE;
+       // fPythia->SetDecayTable();
+    }
+
+// Switch on heavy flavor decays
+    
+    Int_t j;
+    Int_t heavy[14] = {411, 421, 431, 4122, 4132, 4232, 4332, 511, 521, 531, 5122, 5132, 5232, 5332};
+//    fPythia->ResetDecayTable();
+    for (j=0; j < 14; j++) {
+       if (fDecay == kNoDecayHeavy) {
+           AliTPythia8::Instance()->ReadString(Form("%d:onMode = off", heavy[j]));
+       } else {
+           AliTPythia8::Instance()->ReadString(Form("%d:onMode = on", heavy[j]));
+       }
+    }
+    
+
+//...Switch off decay of pi0, K0S, Lambda, Sigma+-, Xi0-, Omega-.
+    
+    if (fDecay != kNeutralPion) {
+       AliTPythia8::Instance()->ReadString("111:onMode = off");
+    } else {
+       AliTPythia8::Instance()->ReadString("111:onMode = on");
+    }
+
+    AliTPythia8::Instance()->ReadString("310:onMode = off");
+    AliTPythia8::Instance()->ReadString("3112:onMode = off");
+    AliTPythia8::Instance()->ReadString("3212:onMode = off");
+    AliTPythia8::Instance()->ReadString("3222:onMode = off");
+    AliTPythia8::Instance()->ReadString("3312:onMode = off");
+    AliTPythia8::Instance()->ReadString("3322:onMode = off");
+    AliTPythia8::Instance()->ReadString("3334:onMode = off");
+// .. Force decay channels
+    ForceDecay();
 }
 
 void AliDecayerPythia8::ForceDecay()
@@ -41,7 +110,7 @@ void AliDecayerPythia8::ForceDecay()
     if (!fHeavyFlavour) SwitchOffHeavyFlavour();
 //
     Decay_t decay = fDecay;
-    TPythia8::Instance()->ReadString("HadronLevel:Decay = on");
+    AliTPythia8::Instance()->ReadString("HadronLevel:Decay = on");
     
     if (decay == kNoDecayHeavy) return;
 
@@ -50,411 +119,424 @@ void AliDecayerPythia8::ForceDecay()
     switch (decay) 
     {
     case kHardMuons:
-
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("5132:onMode = off");
-       TPythia8::Instance()->ReadString("5132:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("5232:onMode = off");
-       TPythia8::Instance()->ReadString("5232:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("5332:onMode = off");
-       TPythia8::Instance()->ReadString("5332:onIfAny = 13 443 100443");
-
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAny = 443");
-
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
-
-       TPythia8::Instance()->ReadString("411:onMode = off");
-       TPythia8::Instance()->ReadString("411:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("421:onMode = off");
-       TPythia8::Instance()->ReadString("421:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("431:onMode = off");
-       TPythia8::Instance()->ReadString("431:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4122:onMode = off");
-       TPythia8::Instance()->ReadString("4122:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4132:onMode = off");
-       TPythia8::Instance()->ReadString("4132:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4232:onMode = off");
-       TPythia8::Instance()->ReadString("4232:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4332:onMode = off");
-       TPythia8::Instance()->ReadString("4332:onIfAll = 13");
+//     B0 -> mu X 
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 13 443 100443");
+//     B+/- -> mu X 
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 13 443 100443");
+//     Bs -> mu X 
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 13 443 100443");
+//     Lambda_b -> mu X 
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 13 443 100443");
+//      Sigma_b- -> mu X 
+       AliTPythia8::Instance()->ReadString("5132:onMode = off");
+       AliTPythia8::Instance()->ReadString("5132:onIfAny = 13 443 100443");
+//      Sigma_b0 -> mu X
+       AliTPythia8::Instance()->ReadString("5232:onMode = off");
+       AliTPythia8::Instance()->ReadString("5232:onIfAny = 13 443 100443");
+//      Omega_b  -> mu X
+       AliTPythia8::Instance()->ReadString("5332:onMode = off");
+       AliTPythia8::Instance()->ReadString("5332:onIfAny = 13 443 100443");
+//      Psi' -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAny = 443");
+//      Psi  -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 13 13");
+//      D+/- -> mu X
+       AliTPythia8::Instance()->ReadString("411:onMode = off");
+       AliTPythia8::Instance()->ReadString("411:onIfAll = 13");
+//      D0   -> mu X
+       AliTPythia8::Instance()->ReadString("421:onMode = off");
+       AliTPythia8::Instance()->ReadString("421:onIfAll = 13");
+//      D_s  -> mu X
+       AliTPythia8::Instance()->ReadString("431:onMode = off");
+       AliTPythia8::Instance()->ReadString("431:onIfAll = 13");
+//      Lambda_c -> mu X
+       AliTPythia8::Instance()->ReadString("4122:onMode = off");
+       AliTPythia8::Instance()->ReadString("4122:onIfAll = 13");
+//      Sigma_c  -> mu X
+       AliTPythia8::Instance()->ReadString("4132:onMode = off");
+       AliTPythia8::Instance()->ReadString("4132:onIfAll = 13");
+//      Sigma_c+ -> mu X
+       AliTPythia8::Instance()->ReadString("4232:onMode = off");
+       AliTPythia8::Instance()->ReadString("4232:onIfAll = 13");
+//      Omega_c  -> mu X
+       AliTPythia8::Instance()->ReadString("4332:onMode = off");
+       AliTPythia8::Instance()->ReadString("4332:onIfAll = 13");
 
        break;
    case kChiToJpsiGammaToMuonMuon:
 // Chi_1c  -> J/Psi  Gamma
-       TPythia8::Instance()->ReadString("20443:onMode = off");
-       TPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
+       AliTPythia8::Instance()->ReadString("20443:onMode = off");
+       AliTPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
 // Chi_2c  -> J/Psi  Gamma
-       TPythia8::Instance()->ReadString("445:onMode = off");
-       TPythia8::Instance()->ReadString("445:onIfAll = 443 22");
+       AliTPythia8::Instance()->ReadString("445:onMode = off");
+       AliTPythia8::Instance()->ReadString("445:onIfAll = 443 22");
 // J/Psi -> mu+ mu-
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 13 13");
        break;
     case kChiToJpsiGammaToElectronElectron:
 // Chi_1c  -> J/Psi  Gamma
-       TPythia8::Instance()->ReadString("20443:onMode = off");
-       TPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
+       AliTPythia8::Instance()->ReadString("20443:onMode = off");
+       AliTPythia8::Instance()->ReadString("20443:onIfAll = 443 22");
 // Chi_2c  -> J/Psi  Gamma
-       TPythia8::Instance()->ReadString("445:onMode = off");
-       TPythia8::Instance()->ReadString("445:onIfAll = 443 22");
+       AliTPythia8::Instance()->ReadString("445:onMode = off");
+       AliTPythia8::Instance()->ReadString("445:onIfAll = 443 22");
 // J/Psi -> e+ e-
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 11 11");
        break;
 
     case kBSemiMuonic:
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5132:onMode = off");
-       TPythia8::Instance()->ReadString("5132:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5232:onMode = off");
-       TPythia8::Instance()->ReadString("5232:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5332:onMode = off");
-       TPythia8::Instance()->ReadString("5332:onIfAny = 13");
+//      B0 -> mu X 
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 13");
+//     B+/- -> mu X 
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 13");
+//     B_s -> mu X 
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 13");
+//     Lambda_b -> mu X 
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 13");
+//     Sigma_b -> mu X 
+       AliTPythia8::Instance()->ReadString("5132:onMode = off");
+       AliTPythia8::Instance()->ReadString("5132:onIfAny = 13");
+//     Sigma_b0 -> mu X 
+       AliTPythia8::Instance()->ReadString("5232:onMode = off");
+       AliTPythia8::Instance()->ReadString("5232:onIfAny = 13");
+//     Omega_b  -> mu X 
+       AliTPythia8::Instance()->ReadString("5332:onMode = off");
+       AliTPythia8::Instance()->ReadString("5332:onIfAny = 13");
        break;
     case kSemiMuonic:
-       TPythia8::Instance()->ReadString("411:onMode = off");
-       TPythia8::Instance()->ReadString("411:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("421:onMode = off");
-       TPythia8::Instance()->ReadString("421:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("431:onMode = off");
-       TPythia8::Instance()->ReadString("431:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4122:onMode = off");
-       TPythia8::Instance()->ReadString("4122:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4132:onMode = off");
-       TPythia8::Instance()->ReadString("4132:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4232:onMode = off");
-       TPythia8::Instance()->ReadString("4232:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4332:onMode = off");
-       TPythia8::Instance()->ReadString("4332:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5132:onMode = off");
-       TPythia8::Instance()->ReadString("5132:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5232:onMode = off");
-       TPythia8::Instance()->ReadString("5232:onIfAny = 13");
-
-       TPythia8::Instance()->ReadString("5332:onMode = off");
-       TPythia8::Instance()->ReadString("5332:onIfAny = 13");
+//      D+- -> mu X
+       AliTPythia8::Instance()->ReadString("411:onMode = off");
+       AliTPythia8::Instance()->ReadString("411:onIfAll = 13");
+//      D0  -> mu X
+       AliTPythia8::Instance()->ReadString("421:onMode = off");
+       AliTPythia8::Instance()->ReadString("421:onIfAll = 13");
+//      D_s  -> mu X
+       AliTPythia8::Instance()->ReadString("431:onMode = off");
+       AliTPythia8::Instance()->ReadString("431:onIfAll = 13");
+//      Lambda_c -> mu X
+       AliTPythia8::Instance()->ReadString("4122:onMode = off");
+       AliTPythia8::Instance()->ReadString("4122:onIfAll = 13");
+//      Sigma_c  -> mu X
+       AliTPythia8::Instance()->ReadString("4132:onMode = off");
+       AliTPythia8::Instance()->ReadString("4132:onIfAll = 13");
+//      Sigma  -> mu X
+       AliTPythia8::Instance()->ReadString("4232:onMode = off");
+       AliTPythia8::Instance()->ReadString("4232:onIfAll = 13");
+//      Omega_c  -> mu X
+       AliTPythia8::Instance()->ReadString("4332:onMode = off");
+       AliTPythia8::Instance()->ReadString("4332:onIfAll = 13");
+//      B0       -> mu X
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 13");
+//      B+/-     -> mu X
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 13");
+//      B_s      -> mu X
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 13");
+//      Lambda_c -> mu X
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 13");
+//      Sigma_c  -> mu X
+       AliTPythia8::Instance()->ReadString("5132:onMode = off");
+       AliTPythia8::Instance()->ReadString("5132:onIfAny = 13");
+//      Sigma_c  -> mu X
+       AliTPythia8::Instance()->ReadString("5232:onMode = off");
+       AliTPythia8::Instance()->ReadString("5232:onIfAny = 13");
+//      Omega_c  -> mu X
+       AliTPythia8::Instance()->ReadString("5332:onMode = off");
+       AliTPythia8::Instance()->ReadString("5332:onIfAny = 13");
 
        break;
     case kDiMuon:
-       // Rho
-       TPythia8::Instance()->ReadString("113:onMode = off");
-       TPythia8::Instance()->ReadString("113:onIfAll = 13 13");
-       // Eta
-       TPythia8::Instance()->ReadString("221:onMode = off");
-       TPythia8::Instance()->ReadString("221:onIfAll = 13 13");
-       // omega
-       TPythia8::Instance()->ReadString("223:onMode = off");
-       TPythia8::Instance()->ReadString("223:onIfAll = 13 13");
-       // phi
-       TPythia8::Instance()->ReadString("333:onMode = off");
-       TPythia8::Instance()->ReadString("333:onIfAll = 13 13");
-       // J/Psi
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
-       // Psi'
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
-       // Ups
-       TPythia8::Instance()->ReadString("553:onMode = off");
-       TPythia8::Instance()->ReadString("553:onIfAll = 13 13");
-       // Ups'
-       TPythia8::Instance()->ReadString("100553:onMode = off");
-       TPythia8::Instance()->ReadString("100553:onIfAll = 13 13");
-       // Ups''
-       TPythia8::Instance()->ReadString("200553:onMode = off");
-       TPythia8::Instance()->ReadString("200553:onIfAll = 13 13");
+//      Rho -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("113:onMode = off");
+       AliTPythia8::Instance()->ReadString("113:onIfAll = 13 13");
+//      Eta-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("221:onMode = off");
+       AliTPythia8::Instance()->ReadString("221:onIfAll = 13 13");
+//      omega-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("223:onMode = off");
+       AliTPythia8::Instance()->ReadString("223:onIfAll = 13 13");
+//      phi-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("333:onMode = off");
+       AliTPythia8::Instance()->ReadString("333:onIfAll = 13 13");
+//      J/Psi-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 13 13");
+//      Psi'-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
+//      Ups-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("553:onMode = off");
+       AliTPythia8::Instance()->ReadString("553:onIfAll = 13 13");
+//      Ups'-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100553:onMode = off");
+       AliTPythia8::Instance()->ReadString("100553:onIfAll = 13 13"); 
+//      Ups''-> mu+ mu-
+       AliTPythia8::Instance()->ReadString("200553:onMode = off");
+       AliTPythia8::Instance()->ReadString("200553:onIfAll = 13 13");
        break;
     case kBSemiElectronic:
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5132:onMode = off");
-       TPythia8::Instance()->ReadString("5132:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5232:onMode = off");
-       TPythia8::Instance()->ReadString("5232:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5332:onMode = off");
-       TPythia8::Instance()->ReadString("5332:onIfAny = 11");
+//      B0 - > e+ e-
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 11");
+//      B+- -> e+ e-
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 11");
+//      B_s -> e+ e-
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 11");
+//      Lambda_b -> e+ e-
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 11");
+//      Sigma_b -> e+ e-
+       AliTPythia8::Instance()->ReadString("5132:onMode = off");
+       AliTPythia8::Instance()->ReadString("5132:onIfAny = 11");
+//      Sigma_b -> e+ e-
+       AliTPythia8::Instance()->ReadString("5232:onMode = off");
+       AliTPythia8::Instance()->ReadString("5232:onIfAny = 11");
+//      Omega_b ->e+ e-
+       AliTPythia8::Instance()->ReadString("5332:onMode = off");
+       AliTPythia8::Instance()->ReadString("5332:onIfAny = 11");
        break;
     case kSemiElectronic:
-       TPythia8::Instance()->ReadString("411:onMode = off");
-       TPythia8::Instance()->ReadString("411:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("421:onMode = off");
-       TPythia8::Instance()->ReadString("421:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("431:onMode = off");
-       TPythia8::Instance()->ReadString("431:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("4122:onMode = off");
-       TPythia8::Instance()->ReadString("4122:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("4132:onMode = off");
-       TPythia8::Instance()->ReadString("4132:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("4232:onMode = off");
-       TPythia8::Instance()->ReadString("4232:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("4332:onMode = off");
-       TPythia8::Instance()->ReadString("4332:onIfAll = 11");
-
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5132:onMode = off");
-       TPythia8::Instance()->ReadString("5132:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5232:onMode = off");
-       TPythia8::Instance()->ReadString("5232:onIfAny = 11");
-
-       TPythia8::Instance()->ReadString("5332:onMode = off");
-       TPythia8::Instance()->ReadString("5332:onIfAny = 11");
+//      D+/- -> e X
+       AliTPythia8::Instance()->ReadString("411:onMode = off");
+       AliTPythia8::Instance()->ReadString("411:onIfAll = 11");
+//      D0 -> e X
+       AliTPythia8::Instance()->ReadString("421:onMode = off");
+       AliTPythia8::Instance()->ReadString("421:onIfAll = 11");
+//      D_s ->e X
+       AliTPythia8::Instance()->ReadString("431:onMode = off");
+       AliTPythia8::Instance()->ReadString("431:onIfAll = 11");
+//      Lambda_c -> e X
+       AliTPythia8::Instance()->ReadString("4122:onMode = off");
+       AliTPythia8::Instance()->ReadString("4122:onIfAll = 11");
+//      Sigma_c -> e X
+       AliTPythia8::Instance()->ReadString("4132:onMode = off");
+       AliTPythia8::Instance()->ReadString("4132:onIfAll = 11");
+//      Sigma_c -> e X
+       AliTPythia8::Instance()->ReadString("4232:onMode = off");
+       AliTPythia8::Instance()->ReadString("4232:onIfAll = 11");
+//      Omega_c -> e X
+       AliTPythia8::Instance()->ReadString("4332:onMode = off");
+       AliTPythia8::Instance()->ReadString("4332:onIfAll = 11");
+//      B0 -> e X
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 11");
+//      B+/- -> e X
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 11");
+//      B_s -> e X
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 11");
+//      Lambda_b -> e X
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 11");
+//      Sigma_b -> e X
+       AliTPythia8::Instance()->ReadString("5132:onMode = off");
+       AliTPythia8::Instance()->ReadString("5132:onIfAny = 11");
+//      Sigma_b -> e X
+       AliTPythia8::Instance()->ReadString("5232:onMode = off");
+       AliTPythia8::Instance()->ReadString("5232:onIfAny = 11");
+//      Omega_b -> e X
+       AliTPythia8::Instance()->ReadString("5332:onMode = off");
+       AliTPythia8::Instance()->ReadString("5332:onIfAny = 11");
        break;
     case kDiElectron:
-       // Rho
-       TPythia8::Instance()->ReadString("113:onMode = off");
-       TPythia8::Instance()->ReadString("113:onIfAll = 11 11");
-       // Eta
-       TPythia8::Instance()->ReadString("221:onMode = off");
-       TPythia8::Instance()->ReadString("221:onIfAll = 11 11");
-       // omega
-       TPythia8::Instance()->ReadString("223:onMode = off");
-       TPythia8::Instance()->ReadString("223:onIfAll = 11 11");
-       // phi
-       TPythia8::Instance()->ReadString("333:onMode = off");
-       TPythia8::Instance()->ReadString("333:onIfAll = 11 11");
-       // J/Psi
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
-       // Psi'
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
-       // Ups
-       TPythia8::Instance()->ReadString("553:onMode = off");
-       TPythia8::Instance()->ReadString("553:onIfAll = 11 11");
-       // Ups'
-       TPythia8::Instance()->ReadString("100553:onMode = off");
-       TPythia8::Instance()->ReadString("100553:onIfAll = 11 11");
-       // Ups''
-       TPythia8::Instance()->ReadString("200553:onMode = off");
-       TPythia8::Instance()->ReadString("200553:onIfAll = 11 11");
+//      Rho -> e+e-
+       AliTPythia8::Instance()->ReadString("113:onMode = off");
+       AliTPythia8::Instance()->ReadString("113:onIfAll = 11 11");
+//      Eta -> e+e-
+       AliTPythia8::Instance()->ReadString("221:onMode = off");
+       AliTPythia8::Instance()->ReadString("221:onIfAll = 11 11");
+//      omega -> e+e-
+       AliTPythia8::Instance()->ReadString("223:onMode = off");
+       AliTPythia8::Instance()->ReadString("223:onIfAll = 11 11");
+//      phi -> e+e-
+       AliTPythia8::Instance()->ReadString("333:onMode = off");
+       AliTPythia8::Instance()->ReadString("333:onIfAll = 11 11");
+//      J/Psi -> e+e-
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 11 11");
+//      Psi' -> e+e-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
+//      Ups -> e+e-
+       AliTPythia8::Instance()->ReadString("553:onMode = off");
+       AliTPythia8::Instance()->ReadString("553:onIfAll = 11 11");
+//      Ups' -> e+e-
+       AliTPythia8::Instance()->ReadString("100553:onMode = off");
+       AliTPythia8::Instance()->ReadString("100553:onIfAll = 11 11");
+//      Ups'' -> e+e-
+       AliTPythia8::Instance()->ReadString("200553:onMode = off");
+       AliTPythia8::Instance()->ReadString("200553:onIfAll = 11 11");
        break;
     case kBJpsiDiMuon:
-// B0   -> J/Psi (Psi') X   
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 443 100443");
-// B+/-   -> J/Psi (Psi') X   
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 443 100443");
-// B_s   -> J/Psi (Psi') X   
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 443 100443");
-// Lambda_b -> J/Psi (Psi') X   
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 443 100443");
+//      B0   -> J/Psi (Psi') X   
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 443 100443");
+//      B+/-   -> J/Psi (Psi') X   
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 443 100443");
+//      B_s   -> J/Psi (Psi') X   
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 443 100443");
+//      Lambda_b -> J/Psi (Psi') X   
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 443 100443");
 //
-       // J/Psi
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 13 13");
-       // Psi'
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
+//      J/Psi -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 13 13");
+//      Psi' -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
        break;
     case kBPsiPrimeDiMuon:
-// B0   -> Psi' X   
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 100443");
-// B+/-   -> Psi' X   
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 100443");
-// B_s   -> Psi'  X   
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 100443");
-// Lambda_b -> Psi' X   
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 100443");
+//      B0   -> Psi' X   
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 100443");
+//      B+/-   -> Psi' X   
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 100443");
+//      B_s   -> Psi'  X   
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 100443");
+//      Lambda_b -> Psi' X   
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 100443");
 //
-       // Psi' -> mu+ mu-
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
+//      Psi' -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAll = 13 13");
        break;
     case kBJpsiDiElectron:
-// B0   -> Psi X   
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 443");
-// B+/-   -> Psi X   
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 443");
-// B_s   -> Psi  X   
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 443");
-// Lambda_b -> Psi X   
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 443");
+//      B0   -> Psi X   
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 443");
+//      B+/-   -> Psi X   
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 443");
+//      B_s   -> Psi  X   
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 443");
+//      Lambda_b -> Psi X   
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 443");
 //
-       // Psi -> mu+ mu-
-       TPythia8::Instance()->ReadString("443:onMode = off");
-       TPythia8::Instance()->ReadString("443:onIfAll = 11 11");
+//      Psi -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("443:onMode = off");
+       AliTPythia8::Instance()->ReadString("443:onIfAll = 11 11");
 
        break;
     case kBJpsi:
-// B0   -> Psi X   
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 443");
-// B+/-   -> Psi X   
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 443");
-// B_s   -> Psi  X   
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 443");
-// Lambda_b -> Psi X   
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 443");
+//      B0   -> Psi X   
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 443");
+//      B+/-   -> Psi X   
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 443");
+//      B_s   -> Psi  X   
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 443");
+//      Lambda_b -> Psi X   
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 443");
        break;
     case kBPsiPrimeDiElectron:
-// B0   -> Psi' X   
-       TPythia8::Instance()->ReadString("511:onMode = off");
-       TPythia8::Instance()->ReadString("511:onIfAny = 100443");
-// B+/-   -> Psi' X   
-       TPythia8::Instance()->ReadString("521:onMode = off");
-       TPythia8::Instance()->ReadString("521:onIfAny = 100443");
-// B_s   -> Psi'  X   
-       TPythia8::Instance()->ReadString("531:onMode = off");
-       TPythia8::Instance()->ReadString("531:onIfAny = 100443");
-// Lambda_b -> Psi' X   
-       TPythia8::Instance()->ReadString("5122:onMode = off");
-       TPythia8::Instance()->ReadString("5122:onIfAny = 100443");
+//      B0   -> Psi' X   
+       AliTPythia8::Instance()->ReadString("511:onMode = off");
+       AliTPythia8::Instance()->ReadString("511:onIfAny = 100443");
+//      B+/-   -> Psi' X   
+       AliTPythia8::Instance()->ReadString("521:onMode = off");
+       AliTPythia8::Instance()->ReadString("521:onIfAny = 100443");
+//      B_s   -> Psi'  X   
+       AliTPythia8::Instance()->ReadString("531:onMode = off");
+       AliTPythia8::Instance()->ReadString("531:onIfAny = 100443");
+//      Lambda_b -> Psi' X   
+       AliTPythia8::Instance()->ReadString("5122:onMode = off");
+       AliTPythia8::Instance()->ReadString("5122:onIfAny = 100443");
 //
-       // Psi' -> mu+ mu-
-       TPythia8::Instance()->ReadString("100443:onMode = off");
-       TPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
+//      Psi' -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("100443:onMode = off");
+       AliTPythia8::Instance()->ReadString("100443:onIfAll = 11 11");
        break;
     case kPiToMu:
-       TPythia8::Instance()->ReadString("211:onMode = off");
-       TPythia8::Instance()->ReadString("211:onIfAny = 13");
+//      pi -> mu nu
+       AliTPythia8::Instance()->ReadString("211:onMode = off");
+       AliTPythia8::Instance()->ReadString("211:onIfAny = 13");
        break;
     case kKaToMu:
-       TPythia8::Instance()->ReadString("321:onMode = off");
-       TPythia8::Instance()->ReadString("321:onIfAny = 13");
+//      K -> mu nu
+       AliTPythia8::Instance()->ReadString("321:onMode = off");
+       AliTPythia8::Instance()->ReadString("321:onIfAny = 13");
        break;
     case kAllMuonic:
-       TPythia8::Instance()->ReadString("211:onMode = off");
-       TPythia8::Instance()->ReadString("211:onIfAny = 13");
-       TPythia8::Instance()->ReadString("321:onMode = off");
-       TPythia8::Instance()->ReadString("321:onIfAny = 13");
+//      pi/K -> mu
+       AliTPythia8::Instance()->ReadString("211:onMode = off");
+       AliTPythia8::Instance()->ReadString("211:onIfAny = 13");
+       AliTPythia8::Instance()->ReadString("321:onMode = off");
+       AliTPythia8::Instance()->ReadString("321:onIfAny = 13");
        break;
     case kWToMuon:
-       TPythia8::Instance()->ReadString("24:onMode = off");
-       TPythia8::Instance()->ReadString("24:onIfAny = 13");
+//      W -> mu X
+       AliTPythia8::Instance()->ReadString("24:onMode = off");
+       AliTPythia8::Instance()->ReadString("24:onIfAny = 13");
        break;
     case kWToCharm:
-       TPythia8::Instance()->ReadString("24:onMode = off");
-       TPythia8::Instance()->ReadString("24:onIfAny = 4");
+//      W -> c X
+       AliTPythia8::Instance()->ReadString("24:onMode = off");
+       AliTPythia8::Instance()->ReadString("24:onIfAny = 4");
        break;
     case kWToCharmToMuon:
-       TPythia8::Instance()->ReadString("24:onMode = off");
-       TPythia8::Instance()->ReadString("24:onIfAny = 4");
-       TPythia8::Instance()->ReadString("411:onMode = off");
-       TPythia8::Instance()->ReadString("411:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("421:onMode = off");
-       TPythia8::Instance()->ReadString("421:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("431:onMode = off");
-       TPythia8::Instance()->ReadString("431:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4122:onMode = off");
-       TPythia8::Instance()->ReadString("4122:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4132:onMode = off");
-       TPythia8::Instance()->ReadString("4132:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4232:onMode = off");
-       TPythia8::Instance()->ReadString("4232:onIfAll = 13");
-
-       TPythia8::Instance()->ReadString("4332:onMode = off");
-       TPythia8::Instance()->ReadString("4332:onIfAll = 13");
+//      W -> c X
+       AliTPythia8::Instance()->ReadString("24:onMode = off");
+       AliTPythia8::Instance()->ReadString("24:onIfAny = 4");
+//      D+- -> mu X
+       AliTPythia8::Instance()->ReadString("411:onMode = off");
+       AliTPythia8::Instance()->ReadString("411:onIfAll = 13");
+//      D0 -> mu X
+       AliTPythia8::Instance()->ReadString("421:onMode = off");
+       AliTPythia8::Instance()->ReadString("421:onIfAll = 13");
+//      D_s -> mu X
+       AliTPythia8::Instance()->ReadString("431:onMode = off");
+       AliTPythia8::Instance()->ReadString("431:onIfAll = 13");
+//      Lambda_c -> mu X
+       AliTPythia8::Instance()->ReadString("4122:onMode = off");
+       AliTPythia8::Instance()->ReadString("4122:onIfAll = 13");
+//      Sigma_c -> mu X
+       AliTPythia8::Instance()->ReadString("4132:onMode = off");
+       AliTPythia8::Instance()->ReadString("4132:onIfAll = 13");
+//      Sigma_c -> mu X
+       AliTPythia8::Instance()->ReadString("4232:onMode = off");
+       AliTPythia8::Instance()->ReadString("4232:onIfAll = 13");
+//      Omega_c -> mu X
+       AliTPythia8::Instance()->ReadString("4332:onMode = off");
+       AliTPythia8::Instance()->ReadString("4332:onIfAll = 13");
        break;
     case kZDiMuon:
-       TPythia8::Instance()->ReadString("23:onMode = off");
-       TPythia8::Instance()->ReadString("23:onIfAll = 13 13");
+//      Z -> mu+ mu-
+       AliTPythia8::Instance()->ReadString("23:onMode = off");
+       AliTPythia8::Instance()->ReadString("23:onIfAll = 13 13");
        break;
     case kZDiElectron:
-       TPythia8::Instance()->ReadString("23:onMode = off");
-       TPythia8::Instance()->ReadString("23:onIfAll = 11 11");
+//      Z -> e+ e-
+       AliTPythia8::Instance()->ReadString("23:onMode = off");
+       AliTPythia8::Instance()->ReadString("23:onIfAll = 11 11");
        break;
     case kHadronicD:
        ForceHadronicD(1);
@@ -463,19 +545,30 @@ void AliDecayerPythia8::ForceDecay()
        ForceHadronicD(0);
        break;
     case kPhiKK:
-       TPythia8::Instance()->ReadString("333:onMode = off");
-       TPythia8::Instance()->ReadString("333:onIfAll = 321 321");
+       // Phi-> K+ K-
+       AliTPythia8::Instance()->ReadString("333:onMode = off");
+       AliTPythia8::Instance()->ReadString("333:onIfAll = 321 321");
        break;
     case kOmega:
-       TPythia8::Instance()->ReadString("3334:onMode = off");
-       TPythia8::Instance()->ReadString("3334:onIfAll = 3122 321 ");
+       // Omega -> Lambda K
+       AliTPythia8::Instance()->ReadString("3334:onMode = off");
+       AliTPythia8::Instance()->ReadString("3334:onIfAll = 3122 321 ");
+    case kLambda:
+       // Lambda -> p pi-
+       AliTPythia8::Instance()->ReadString("3122:onMode = off");
+       AliTPythia8::Instance()->ReadString("3122:onIfAll = 2212 211 ");
     case kAll:
        break;
     case kNoDecay:
-       TPythia8::Instance()->ReadString("HadronLevel:Decay = off");
+       AliTPythia8::Instance()->ReadString("HadronLevel:Decay = off");
        break;
     case kNoDecayHeavy:
+    case kNoDecayBeauty:
     case kNeutralPion:
+    case kPsiPrimeJpsiDiElectron: 
+    case kElectronEM:
+    case kGammaEM:
+    case kDiElectronEM:
        break;
     }
 }
@@ -484,18 +577,16 @@ Float_t AliDecayerPythia8::GetPartialBranchingRatio(Int_t ipart)
 {
     // Get the partial branching ration for the forced decay channels
     
-    Pythia8::Pythia* thePythia       = TPythia8::Instance()->Pythia8();
-    Pythia8::ParticleDataTable table = thePythia->particleData;
-    Pythia8::ParticleDataEntry* pd   = table.particleDataPtr(ipart);
-    Pythia8::DecayTable  decays      = pd->decay;
-    
-    
-    Int_t nc = decays.size();
+    Pythia8::Pythia* thePythia       = AliTPythia8::Instance()->Pythia8();
+    Pythia8::ParticleData & table    = thePythia->particleData;
+    Pythia8::ParticleDataEntry* pd   = table.particleDataEntryPtr(ipart);
+
+    Int_t nc = pd->sizeChannels();
     Float_t br = 0.;
 //
 //  Loop over decay channels
     for (Int_t ic = 0; ic < nc; ic++) {
-       Pythia8::DecayChannel& decCh = decays[ic];
+      Pythia8::DecayChannel& decCh = pd->channel(ic);
        for (Int_t i = 0; i < decCh.multiplicity(); i++) {
            br += decCh.bRatio();
        }
@@ -507,10 +598,10 @@ Float_t AliDecayerPythia8::GetPartialBranchingRatio(Int_t ipart)
 Float_t AliDecayerPythia8::GetLifetime(Int_t kf)
 {
     // Return lifetime of particle
-    Pythia8::Pythia* thePythia       = TPythia8::Instance()->Pythia8();
-    Pythia8::ParticleDataTable table = thePythia->particleData;
+    Pythia8::Pythia* thePythia       = AliTPythia8::Instance()->Pythia8();
+    Pythia8::ParticleData& table     = thePythia->particleData;
     Float_t tau = table.tau0(kf);
-    return ( tau);
+    return (tau);
 }
 
 void  AliDecayerPythia8::SwitchOffHeavyFlavour()
@@ -518,11 +609,11 @@ void  AliDecayerPythia8::SwitchOffHeavyFlavour()
     // Switch off heavy flavour production
     //
 // Maximum number of quark flavours used in pdf 
-    TPythia8::Instance()->ReadString("PDFinProcess:nQuarkIn = 3");
+    AliTPythia8::Instance()->ReadString("PDFinProcess:nQuarkIn = 3");
 // Maximum number of flavors that can be used in showers
-    TPythia8::Instance()->ReadString("SpaceShower:nQuarkIn = 3");
-    TPythia8::Instance()->ReadString("TimeShower:nGammaToQuark = 3");
-    TPythia8::Instance()->ReadString("TimeShower:nGluonToQuark = 3");
+    AliTPythia8::Instance()->ReadString("SpaceShower:nQuarkIn = 3");
+    AliTPythia8::Instance()->ReadString("TimeShower:nGammaToQuark = 3");
+    AliTPythia8::Instance()->ReadString("TimeShower:nGluonToQuark = 3");
 }
 
 
@@ -531,41 +622,82 @@ void AliDecayerPythia8::ForceHadronicD(Int_t optUse4Bodies)
 //
 // Force golden D decay modes
 //
-    TPythia8::Instance()->ReadString("313:onMode = off");
-    TPythia8::Instance()->ReadString("313:onIfAll = 321 211");
+    // K* -> K pi
+    AliTPythia8::Instance()->ReadString("313:onMode = off");
+    AliTPythia8::Instance()->ReadString("313:onIfAll = 321 211");
     // for Ds -> Phi pi+
-    TPythia8::Instance()->ReadString("333:onMode = off");
-    TPythia8::Instance()->ReadString("333:onIfAll = 321 321");
+    AliTPythia8::Instance()->ReadString("333:onMode = off");
+    AliTPythia8::Instance()->ReadString("333:onIfAll = 321 321");
     // for D0 -> rho0 pi+ k-
-    TPythia8::Instance()->ReadString("113:onMode = off");
-    TPythia8::Instance()->ReadString("113:onIfAll = 211 211");
+    AliTPythia8::Instance()->ReadString("113:onMode = off");
+    AliTPythia8::Instance()->ReadString("113:onIfAll = 211 211");
     // for Lambda_c -> Delta++ K-
-    TPythia8::Instance()->ReadString("2224:onMode = off");
-    TPythia8::Instance()->ReadString("2224:onIfAll = 2212 211");
-
+    AliTPythia8::Instance()->ReadString("2224:onMode = off");
+    AliTPythia8::Instance()->ReadString("2224:onIfAll = 2212 211");
+    // for Lambda_c -> Lambda(1520) K-
+    AliTPythia8::Instance()->ReadString("3124:onMode = off");
+    AliTPythia8::Instance()->ReadString("3124:onIfAll = 2212 321");
+
+
+    AliTPythia8::Instance()->ReadString("411:onMode = off");
+    AliTPythia8::Instance()->ReadString("421:onMode = off");
+    AliTPythia8::Instance()->ReadString("431:onMode = off");
+    AliTPythia8::Instance()->ReadString("4112:onMode = off");
+    AliTPythia8::Instance()->ReadString("4122:onMode = off");
+
+    // D+/- -> K pi pi 
+    AliTPythia8::Instance()->ReadString("411:onIfMatch = 321 211 211");
+    // D+/- -> K* pi
+    AliTPythia8::Instance()->ReadString("411:onIfMatch = 313 211");
+    // D0 -> K pi
+    AliTPythia8::Instance()->ReadString("421:onIfMatch = 321 211");
 
-    TPythia8::Instance()->ReadString("411:onMode = off");
-    TPythia8::Instance()->ReadString("421:onMode = off");
-    TPythia8::Instance()->ReadString("431:onMode = off");
-    TPythia8::Instance()->ReadString("4112:onMode = off");
-    TPythia8::Instance()->ReadString("4122:onMode = off");
-
-    TPythia8::Instance()->ReadString("411:onIfMatch = 321 211 211");
-    TPythia8::Instance()->ReadString("411:onIfMatch = 313 211");
-
-    TPythia8::Instance()->ReadString("421:onIfMatch = 321 211");
     if (optUse4Bodies) {
-       TPythia8::Instance()->ReadString("421:onIfMatch = 321 211 211 211");
-       TPythia8::Instance()->ReadString("421:onIfMatch = 321 211 113");
+       // D0 -> K pi pi pi
+       AliTPythia8::Instance()->ReadString("421:onIfMatch = 321 211 211 211");
+       // D0 -> K pi rho
+       AliTPythia8::Instance()->ReadString("421:onIfMatch = 321 211 113");
+       // D0 -> K*0 pi pi
+       AliTPythia8::Instance()->ReadString("421:onIfMatch = 313 211 211");
     }
     
-    TPythia8::Instance()->ReadString("431:onIfMatch = 321 313");
-    TPythia8::Instance()->ReadString("431:onIfMatch = 333 211");
-    TPythia8::Instance()->ReadString("431:onIfMatch = 321 313");
+    // D_s -> K K*
+    AliTPythia8::Instance()->ReadString("431:onIfMatch = 321 313");
+    // D_s -> Phi pi
+    AliTPythia8::Instance()->ReadString("431:onIfMatch = 333 211");
+
+    // Lambda_c -> p K*
+    AliTPythia8::Instance()->ReadString("4122:onIfMatch = 2212 313");
+    // Lambda_c -> Delta K
+    AliTPythia8::Instance()->ReadString("4122:onIfMatch = 2224 321");
+    // Lambda_c -> Lambda(1520) pi
+    AliTPythia8::Instance()->ReadString("4122:onIfMatch = 3124 211");
+    // Lambda_c -> p K pi
+    AliTPythia8::Instance()->ReadString("4122:onIfMatch = 2212 321 211");
+    // Lambda_c -> Lambda pi 
+    AliTPythia8::Instance()->ReadString("4122:onIfMatch = 3122 211");
+
+}
+
+//___________________________________________________________________________
+void    AliDecayerPythia8::ReadDecayTable()
+{
+   //to read a decay table (not yet implemented)
+}
+
+
+//___________________________________________________________________________
+void AliDecayerPythia8::AppendParticle(Int_t pdg, TLorentzVector* p)
+{
+   // Append a particle to the stack
+   fPythia8->Pythia8()->event.append(pdg, 11, 0, 0, p->Px(), p->Py(), p->Pz(), p->E(), p->M());   
+}
 
-    TPythia8::Instance()->ReadString("4122:onIfMatch = 2212 313");
-    TPythia8::Instance()->ReadString("4122:onIfMatch = 2224 321");
-    TPythia8::Instance()->ReadString("4122:onIfMatch = 2212 321 211");
 
+//___________________________________________________________________________
+void AliDecayerPythia8::ClearEvent()
+{
+   // Clear the event stack
+   fPythia8->Pythia8()->event.clear();
 }