]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenPileup.cxx
include added.
[u/mrichter/AliRoot.git] / EVGEN / AliGenPileup.cxx
index 3073da705b101f7cd1c75e445ac9cffc0811e0a3..0d973159bebe5c7a4fb7e44e43717ba577e18382 100644 (file)
@@ -150,16 +150,18 @@ void AliGenPileup::Generate()
   Int_t *nIntBC = new Int_t[3*AliTriggerBCMask::kNBits];
   Int_t *indexBC = new Int_t[3*AliTriggerBCMask::kNBits];
   Int_t nTotBC = 0;
-  for(Int_t iBC = 0; iBC <  AliTriggerBCMask::kNBits; iBC++) {
+  while (nTotBC == 0) {
+    for(Int_t iBC = 0; iBC <  AliTriggerBCMask::kNBits; iBC++) {
 
-    if (!fBCMask.GetMask(iBC)) continue;
+      if (!fBCMask.GetMask(iBC)) continue;
 
-    Int_t nInteractions = gRandom->Poisson(rate);
-    if (nInteractions == 0) continue;
+      Int_t nInteractions = gRandom->Poisson(rate);
+      if (nInteractions == 0) continue;
 
-    nIntBC[nTotBC] = nInteractions;
-    indexBC[nTotBC] = iBC;
-    nTotBC++;
+      nIntBC[nTotBC] = nInteractions;
+      indexBC[nTotBC] = iBC;
+      nTotBC++;
+    }
   }
 
   // Select the bunch crossing for triggered event
@@ -168,7 +170,7 @@ void AliGenPileup::Generate()
   // generated within this bc (only in case
   // the user disabled the generation of the trigger
   // interaction)
-  if (fGenTrig) nIntBC[iTrgBC]--;
+  if (!fGenTrig) nIntBC[iTrgBC]--;
 
   // Remove bunch crossings outside pileup
   // time window
@@ -208,7 +210,7 @@ void AliGenPileup::Generate()
 
   // Loop over the generated collision times, call the generator
   // and correct the partcile times in the stack
-  AliStack *stack = AliRunLoader::GetRunLoader()->Stack();
+  AliStack *stack = AliRunLoader::Instance()->Stack();
   Int_t lastpart=0;
   entry->SetFirst(lastpart);