]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenCocktail.cxx
electron cut included (Prabhat Ranjan Pujahari <p.pujahari@cern.ch>)
[u/mrichter/AliRoot.git] / EVGEN / AliGenCocktail.cxx
index 800602ed8df2ba787b0b694e2d175ac7d93e0939..2ac18c385f6ae409641bf7dbbf1db06edeef2129 100644 (file)
@@ -64,7 +64,7 @@ AliGenCocktail::~AliGenCocktail()
 }
 
 void AliGenCocktail::
-AddGenerator(AliGenerator *Generator, const char* Name, Float_t RateExp, TFormula* formula)
+AddGenerator(AliGenerator *Generator, const char* Name, Float_t RateExp, TFormula* formula, Int_t ntimes)
 {
 //
 // Add a generator to the list 
@@ -102,7 +102,8 @@ AddGenerator(AliGenerator *Generator, const char* Name, Float_t RateExp, TFormul
 
     AliGenCocktailEntry *entry = 
        new AliGenCocktailEntry(Generator, Name, RateExp);
-    if (formula) entry->SetFormula(formula);    
+    if (formula) entry->SetFormula(formula);  
+    entry->SetNTimes(ntimes);
      fEntries->Add(entry);
      fNGenerators++;
      flnk1 = 0;
@@ -186,7 +187,7 @@ AddGenerator(AliGenerator *Generator, const char* Name, Float_t RateExp, TFormul
        // Loop over generators and generate events
        Int_t igen   = 0;
        while((entry = (AliGenCocktailEntry*)next())) {
-          Int_t ntimes = 1;
+          Int_t ntimes = entry->NTimes();
          if (fUsePerEventRate && (gRandom->Rndm() > entry->Rate())) continue;
          
          igen++;
@@ -233,7 +234,7 @@ AddGenerator(AliGenerator *Generator, const char* Name, Float_t RateExp, TFormul
            }
          gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2), fTime);
          
-         for (Int_t i = 0; i < ntimes; i++) gen->Generate();
+         gen->GenerateN(ntimes);
          entry->SetLast(partArray->GetEntriesFast());
          preventry = entry;
        }