Event mixing is now working propertly with buffersize > 1 + Mixing info fixed
authormvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Apr 2012 15:26:13 +0000 (15:26 +0000)
committermvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Apr 2012 15:26:13 +0000 (15:26 +0000)
ANALYSIS/EventMixing/AliAnalysisTaskMixInfo.cxx
ANALYSIS/EventMixing/AliMixInfo.cxx
ANALYSIS/EventMixing/AliMixInputEventHandler.cxx

index 507729f..2cfcd64 100644 (file)
@@ -116,7 +116,15 @@ void AliAnalysisTaskMixInfo::UserExecMix(Option_t *)
    if (!fInputEHMix) return;
 
    // fills bin index (even when it is -1, so we know out of range combinations)
-   if (fMixInfo) fMixInfo->FillHistogram(AliMixInfo::kMixedEvents, fInputEHMix->CurrentBinIndex());
+   if (fMixInfo) {
+      if (fInputEHMix->CurrentBinIndex()==-1) {
+         fMixInfo->FillHistogram(AliMixInfo::kMixedEvents, fInputEHMix->CurrentBinIndex());
+      } else {
+         for(Int_t iBuff=0; iBuff<fInputEHMix->BufferSize(); iBuff++) {
+            fMixInfo->FillHistogram(AliMixInfo::kMixedEvents, fInputEHMix->CurrentBinIndex());
+         }
+      }
+   }
 
    // just test
    if (fInputEHMix->CurrentEntryMix() < 0) {
index 24de78e..75fd320 100644 (file)
@@ -185,6 +185,7 @@ void AliMixInfo::Draw(Option_t *option)
    AliMixEventPool *evPool = (AliMixEventPool *) GetEventPool("mixEventPool");
    if (evPool) {
       Int_t mixNum = evPool->GetMixNumber();
+      Int_t bufferSize = evPool->GetBufferSize();
 //         hOK = (TH1I *) hMain->Clone();
 //         hBad = (TH1I *) hMain->Clone();
       if (!hMixInfo2D) hMixInfo2D = new TH2I("hMixInfo2D", "hMixInfo2D", hMain->GetXaxis()->GetNbins() + 1, hMain->GetXaxis()->GetXmin() - 1, hMain->GetXaxis()->GetXmax(), 1, 0, 1);
@@ -193,7 +194,7 @@ void AliMixInfo::Draw(Option_t *option)
             hMixInfo2D->SetBinContent(iBin + 1, 1, 1);
          } else if (!hMain->GetBinContent(iBin) && !hMix->GetBinContent(iBin)) {
             hMixInfo2D->SetBinContent(iBin + 1, 1, 2);
-         } else if (hMix->GetBinContent(iBin) == mixNum * hMain->GetBinContent(iBin)) {
+         } else if (hMix->GetBinContent(iBin) == mixNum * bufferSize * hMain->GetBinContent(iBin)) {
             hMixInfo2D->SetBinContent(iBin + 1, 1, 4);
          } else {
             hMixInfo2D->SetBinContent(iBin + 1, 1, 3);
index 3294e24..6220343 100644 (file)
@@ -341,12 +341,16 @@ Bool_t AliMixInputEventHandler::MixBuffer()
       } else {
          AliDebug(AliLog::kDebug + 3, Form("Preparing InputEventHandler(%d)", counter));
          mihi->PrepareEntry(te, entryMix, (AliInputEventHandler *)InputEventHandler(counter), fAnalysisType);
-         // runs UserExecMix for all tasks
-         UserExecMixAllTasks(fEntryCounter, idEntryList, fEntryCounter, entryMixReal, counter);
          fNumberMixed++;
       }
       counter++;
    }
+
+   if (fNumberMixed == fBufferSize) {
+      // runs UserExecMix for all tasks
+      UserExecMixAllTasks(fEntryCounter, idEntryList, fEntryCounter, entryMixReal, counter);
+   }
+   
    AliDebug(AliLog::kDebug + 3, Form("fEntryCounter=%lld fMixEventNumber=%d", fEntryCounter, fNumberMixed));
    AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
    AliDebug(AliLog::kDebug + 5, Form("->"));