ROOT logo
// @(#)root/pythia8:$Name$:$Id$
// Author: Andreas Morsch   04/07/2008

/**************************************************************************
 * Copyright(c) 1998-2008, 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.                  *
 **************************************************************************/

#include "TLorentzVector.h"
#include "TPythia8.h"
#include "TPythia8Decayer.h"

ClassImp(TPythia8Decayer)

//___________________________________________________________________________
TPythia8Decayer::TPythia8Decayer():
  fPythia8(new TPythia8()),
  fDebug(0)
{
   //constructor
   fPythia8->Pythia8()->readString("SoftQCD:elastic = on");
   fPythia8->Pythia8()->init();
}

//___________________________________________________________________________
void TPythia8Decayer::Init()
{
   // Initialize the decayer
}

//___________________________________________________________________________
void TPythia8Decayer::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 TPythia8Decayer::ImportParticles(TClonesArray *particles)
{
   //import the decay products into particles array
   return (fPythia8->ImportParticles(particles, "All"));
}

//___________________________________________________________________________
void TPythia8Decayer::SetForceDecay(Int_t /*type*/)
{
   // Set forced decay mode
   printf("SetForceDecay not yet implemented !\n");
}
//___________________________________________________________________________
void TPythia8Decayer::ForceDecay()
{
   // ForceDecay not yet implemented
   printf("ForceDecay not yet implemented !\n");
}
//___________________________________________________________________________
Float_t TPythia8Decayer::GetPartialBranchingRatio(Int_t /*ipart*/)
{
   return 0.0;
}
//___________________________________________________________________________
Float_t TPythia8Decayer::GetLifetime(Int_t pdg) 
{
   //return lifetime in seconds of teh particle with PDG number pdg
   return (fPythia8->Pythia8()->particleData.tau0(pdg) * 3.3333e-12) ;
}

//___________________________________________________________________________
void    TPythia8Decayer::ReadDecayTable()
{
   //to read a decay table (not yet implemented)
}


//___________________________________________________________________________
void TPythia8Decayer::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());   
}


//___________________________________________________________________________
void TPythia8Decayer::ClearEvent()
{
   // Clear the event stack
   fPythia8->Pythia8()->event.clear();
}

 TPythia8Decayer.cxx:1
 TPythia8Decayer.cxx:2
 TPythia8Decayer.cxx:3
 TPythia8Decayer.cxx:4
 TPythia8Decayer.cxx:5
 TPythia8Decayer.cxx:6
 TPythia8Decayer.cxx:7
 TPythia8Decayer.cxx:8
 TPythia8Decayer.cxx:9
 TPythia8Decayer.cxx:10
 TPythia8Decayer.cxx:11
 TPythia8Decayer.cxx:12
 TPythia8Decayer.cxx:13
 TPythia8Decayer.cxx:14
 TPythia8Decayer.cxx:15
 TPythia8Decayer.cxx:16
 TPythia8Decayer.cxx:17
 TPythia8Decayer.cxx:18
 TPythia8Decayer.cxx:19
 TPythia8Decayer.cxx:20
 TPythia8Decayer.cxx:21
 TPythia8Decayer.cxx:22
 TPythia8Decayer.cxx:23
 TPythia8Decayer.cxx:24
 TPythia8Decayer.cxx:25
 TPythia8Decayer.cxx:26
 TPythia8Decayer.cxx:27
 TPythia8Decayer.cxx:28
 TPythia8Decayer.cxx:29
 TPythia8Decayer.cxx:30
 TPythia8Decayer.cxx:31
 TPythia8Decayer.cxx:32
 TPythia8Decayer.cxx:33
 TPythia8Decayer.cxx:34
 TPythia8Decayer.cxx:35
 TPythia8Decayer.cxx:36
 TPythia8Decayer.cxx:37
 TPythia8Decayer.cxx:38
 TPythia8Decayer.cxx:39
 TPythia8Decayer.cxx:40
 TPythia8Decayer.cxx:41
 TPythia8Decayer.cxx:42
 TPythia8Decayer.cxx:43
 TPythia8Decayer.cxx:44
 TPythia8Decayer.cxx:45
 TPythia8Decayer.cxx:46
 TPythia8Decayer.cxx:47
 TPythia8Decayer.cxx:48
 TPythia8Decayer.cxx:49
 TPythia8Decayer.cxx:50
 TPythia8Decayer.cxx:51
 TPythia8Decayer.cxx:52
 TPythia8Decayer.cxx:53
 TPythia8Decayer.cxx:54
 TPythia8Decayer.cxx:55
 TPythia8Decayer.cxx:56
 TPythia8Decayer.cxx:57
 TPythia8Decayer.cxx:58
 TPythia8Decayer.cxx:59
 TPythia8Decayer.cxx:60
 TPythia8Decayer.cxx:61
 TPythia8Decayer.cxx:62
 TPythia8Decayer.cxx:63
 TPythia8Decayer.cxx:64
 TPythia8Decayer.cxx:65
 TPythia8Decayer.cxx:66
 TPythia8Decayer.cxx:67
 TPythia8Decayer.cxx:68
 TPythia8Decayer.cxx:69
 TPythia8Decayer.cxx:70
 TPythia8Decayer.cxx:71
 TPythia8Decayer.cxx:72
 TPythia8Decayer.cxx:73
 TPythia8Decayer.cxx:74
 TPythia8Decayer.cxx:75
 TPythia8Decayer.cxx:76
 TPythia8Decayer.cxx:77
 TPythia8Decayer.cxx:78
 TPythia8Decayer.cxx:79
 TPythia8Decayer.cxx:80
 TPythia8Decayer.cxx:81
 TPythia8Decayer.cxx:82
 TPythia8Decayer.cxx:83
 TPythia8Decayer.cxx:84
 TPythia8Decayer.cxx:85
 TPythia8Decayer.cxx:86
 TPythia8Decayer.cxx:87
 TPythia8Decayer.cxx:88
 TPythia8Decayer.cxx:89
 TPythia8Decayer.cxx:90
 TPythia8Decayer.cxx:91
 TPythia8Decayer.cxx:92
 TPythia8Decayer.cxx:93
 TPythia8Decayer.cxx:94
 TPythia8Decayer.cxx:95
 TPythia8Decayer.cxx:96
 TPythia8Decayer.cxx:97
 TPythia8Decayer.cxx:98
 TPythia8Decayer.cxx:99
 TPythia8Decayer.cxx:100
 TPythia8Decayer.cxx:101
 TPythia8Decayer.cxx:102
 TPythia8Decayer.cxx:103
 TPythia8Decayer.cxx:104
 TPythia8Decayer.cxx:105