Correction in TObjArray* AliTPythia8::ImportParticles(Option_t* /* option */)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Oct 2013 13:24:14 +0000 (13:24 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Oct 2013 13:24:14 +0000 (13:24 +0000)
index started at 1

PYTHIA8/AliTPythia8.cxx

index 8c7390f..421c3e6 100644 (file)
@@ -222,17 +222,18 @@ TObjArray* AliTPythia8::ImportParticles(Option_t* /* option */)
 {
    // Import particles from Pythia stack
    fParticles->Clear();
+   Int_t nparts = 0;
    Int_t ioff = 0;
-   Int_t numpart   = fPythia->event.size();
+   fNumberOfParticles  = fPythia->event.size();
    if (fPythia->event[0].id() == 90) {
-     numpart--; 
      ioff = -1;
    }
 
 
    TClonesArray &a = *((TClonesArray*)fParticles);
-   for (Int_t i = 1; i <= numpart; i++) {
-      new(a[i]) TParticle(
+   for (Int_t i = 0; i < fNumberOfParticles; i++) {
+     if (fPythia->event[i].id() == 90) continue;
+      new(a[nparts]) TParticle(
          fPythia->event[i].id(),
          fPythia->event[i].isFinal(),
          fPythia->event[i].mother1()   + ioff,
@@ -247,7 +248,9 @@ TObjArray* AliTPythia8::ImportParticles(Option_t* /* option */)
          fPythia->event[i].yProd(),    // [mm]
          fPythia->event[i].zProd(),    // [mm]
          fPythia->event[i].tProd());   // [mm/c]
+      nparts++;
    }
+   if (ioff == -1) fNumberOfParticles--;
    return fParticles;
 }