Use ParticlesImport with TParticle instead than TMCParticle
[u/mrichter/AliRoot.git] / EVGEN / AliGenPythia.cxx
index 150901cf8d31a9f95770db998cea051928fc4374..2329c4dcc7eaf84338ce4866fddc27bec8f8f722 100644 (file)
@@ -1,6 +1,5 @@
 #include "AliGenerator.h"
 #include "AliGenPythia.h"
-#include "TGeant3.h"
 #include "AliRun.h"
 #include "AliPythia.h"
 #include <TDirectory.h>
@@ -112,13 +111,13 @@ void AliGenPythia::Init()
 
 void AliGenPythia::Generate()
 {
-    AliMC* pMC = AliMC::GetMC();
 
     Float_t polar[3] =   {0,0,0};
     Float_t origin[3]=   {0,0,0};
     Float_t origin_p[3]= {0,0,0};
     Float_t origin0[3]=  {0,0,0};
     Float_t p[3], p_p[4], random[6];
+    static TClonesArray *particles;
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
     
@@ -128,11 +127,13 @@ void AliGenPythia::Generate()
     Int_t nt_p=0;
     Int_t jev=0;
     Int_t j;
+
+    if(!particles) particles=new TClonesArray("TParticle",1000);
     
     fTrials=0;
     for (j=0;j<3;j++) origin0[j]=fOrigin[j];
     if(fVertexSmear==perEvent) {
-       pMC->Rndm(random,6);
+       gMC->Rndm(random,6);
        for (j=0;j<3;j++) {
            origin0[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
@@ -148,7 +149,7 @@ void AliGenPythia::Generate()
     {
        fPythia->PyEvnt();
        fTrials++;
-       TObjArray* particles = fPythia->ImportParticles();
+       fPythia->ImportParticles(particles);
        Int_t np = particles->GetEntriesFast();
        printf("\n **************************************************%d\n",np);
        Int_t nc=0;