Fix for event mixing, when it was selecting events out of range of multiplicity cut
authormvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Feb 2011 16:30:58 +0000 (16:30 +0000)
committermvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Feb 2011 16:30:58 +0000 (16:30 +0000)
ANALYSIS/EventMixing/AliAnalysisTaskMixInfo.cxx
ANALYSIS/EventMixing/AliMixEventCutObj.cxx
ANALYSIS/EventMixing/AliMixEventPool.cxx

index b54ab7a..53c0d30 100644 (file)
@@ -9,6 +9,7 @@
 //
 
 #include <TList.h>
+#include <TObjString.h>
 
 #include "AliAnalysisManager.h"
 
@@ -17,6 +18,7 @@
 #include "AliMixInfo.h"
 #include "AliMixEventPool.h"
 
+
 ClassImp(AliAnalysisTaskMixInfo)
 
 //________________________________________________________________________
@@ -189,11 +191,9 @@ void AliAnalysisTaskMixInfo::InitMixInfo()
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    AliMultiInputEventHandler *inEvHMain = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
    if (inEvHMain) {
-      //         AliMixEventInputHandler *mixEH = dynamic_cast<AliMixEventInputHandler *>(inEvHMain->MixingHandler());
       AliMixInputEventHandler *mixEH = dynamic_cast<AliMixInputEventHandler *>(inEvHMain->GetFirstMultiInputHandler());
       if (mixEH) {
          fMixInfo = new AliMixInfo("mixInfo", "Mix title");
-//             if(fMixInfo) fMixInfo->SetOutputList(fOutputList);
          AliMixEventPool *evPool = mixEH->GetEventPool();
          if (!evPool) {
             //             TList *list = new TList;
index 618467a..649a14d 100644 (file)
@@ -133,9 +133,11 @@ Int_t AliMixEventCutObj::GetBinNumber(Float_t num) const
    // Returns -1 in case of out of range
    //
    Int_t binNum = 0;
-   for (Float_t i = fCutMin; i <= fCutMax - fCutSmallVal; i += fCutStep) {
+   for (Float_t iCurrent = fCutMin; iCurrent < fCutMax; iCurrent += fCutStep) {
       binNum++;
-      if ((num >= i) && (num <= i + fCutStep - fCutSmallVal)) return binNum;
+      if ((num >= iCurrent) && (num <= iCurrent + fCutStep - fCutSmallVal)) {
+         return binNum;
+      }
    }
    return -1;
 }
index cd7b47d..9052a79 100644 (file)
@@ -124,7 +124,7 @@ void AliMixEventPool::CreateEntryListsRecursivly(Int_t index)
    AliDebug(AliLog::kDebug + 5, "<-");
    AliMixEventCutObj *cut;
    if (index >= 0) {
-      AliDebug(AliLog::kDebug, Form("index = %d", index));
+      AliDebug(AliLog::kDebug + 1, Form("index = %d", index));
       cut = dynamic_cast<AliMixEventCutObj *>(fListOfEventCuts.At(index));
       if (!cut) return;
       cut->Reset();
@@ -133,7 +133,7 @@ void AliMixEventPool::CreateEntryListsRecursivly(Int_t index)
          CreateEntryListsRecursivly(index - 1);
          if (cut->HasMore()) {
             fBinNumber++;
-            AliDebug(AliLog::kDebug, Form("fBinnumber = %d", fBinNumber));
+            AliDebug(AliLog::kDebug + 1, Form("fBinnumber = %d", fBinNumber));
             AddEntryList();
             //                 PrintCurrentCutIntervals();
          }
@@ -156,7 +156,7 @@ TEntryList *AliMixEventPool::AddEntryList()
    }
    TEntryList *el = new TEntryList;
    fListOfEntryList.Add(el);
-   AliDebug(AliLog::kDebug, Form("Number in Entry list -> %lld", el->GetN()));
+   AliDebug(AliLog::kDebug + 1, Form("Number in Entry list -> %lld", el->GetN()));
    AliDebug(AliLog::kDebug + 5, "->");
    return el;
 }
@@ -229,7 +229,7 @@ void AliMixEventPool::SearchIndexRecursive(Int_t num, Int_t *i, Int_t *d, Int_t
    //
    AliDebug(AliLog::kDebug + 5, "<-");
    if (num > 0) {
-      index += (i[num] - 1) * d[num-1];
+      index += (i[num] - 1) * d[num - 1];
       SearchIndexRecursive(num - 1, i, d, index);
    } else {
       index += i[num];
@@ -269,7 +269,7 @@ void AliMixEventPool::SetCutValuesFromBinIndex(Int_t index)
       timesNum = 1;
       for (j = 0; j < numCuts - i - 1; j++) timesNum *= lenght[j];
       indexNum /= timesNum;
-      indexes[numCuts-i-1] = indexNum + 1;
+      indexes[numCuts - i - 1] = indexNum + 1;
       index -= indexNum * timesNum;
       indexNum = index;
    }