]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGenCocktailEventHeader.cxx
Calculate the total number of produced and stored particles.
[u/mrichter/AliRoot.git] / STEER / AliGenCocktailEventHeader.cxx
index dc2db6a660a0a65a7bca8ff08f7e690fb4cec427..7fff01cc78c822a1a9bc7e4bda716be78f51c4c7 100644 (file)
@@ -58,9 +58,22 @@ void AliGenCocktailEventHeader::AddHeader(AliGenEventHeader* header)
     fHeaders->Add(header);
 }
 
+Int_t AliGenCocktailEventHeader::CalcNProduced()
+{
+    // Calculate the total number of produced and stored particles
+    TIter next(fHeaders);
+    AliGenEventHeader *entry;
+    //
+    Int_t np = 0;
+    while((entry = (AliGenEventHeader*)next())) {np += (entry->NProduced());}
+    fNProduced = np;
+    return (np);
+}
+
 AliGenCocktailEventHeader& AliGenCocktailEventHeader::operator=(const  AliGenCocktailEventHeader& rhs)
 {
 // Assignment operator
     rhs.Copy(*this); 
     return (*this);
 }
+