Added Physiscs selection support to Event Mixing
authormvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Feb 2011 09:33:59 +0000 (09:33 +0000)
committermvala <mvala@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 26 Feb 2011 09:33:59 +0000 (09:33 +0000)
ANALYSIS/EventMixing/AliAnalysisTaskMixInfo.cxx
ANALYSIS/EventMixing/AliMixInfo.cxx
ANALYSIS/EventMixing/AliMixInputEventHandler.cxx
ANALYSIS/EventMixing/AliMixInputEventHandler.h

index 53c0d30..1d1d56d 100644 (file)
@@ -95,8 +95,8 @@ void AliAnalysisTaskMixInfo::UserExec(Option_t *)
             fMixInfo->FillHistogram(AliMixInfo::kMainEvents, mixEH->CurrentBinIndex());
          }
 
-         if (mixEH->CurrentEntryMix() >= 0)
-            AliDebug(AliLog::kDebug + 1, Form("Main %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->CurrentBinIndex(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->NumberMixed()));
+//          if (mixEH->CurrentEntryMix() >= 0)
+         AliDebug(AliLog::kDebug + 1, Form("Main %lld %d [%lld,%lld] %d", mixEH->CurrentEntry(), mixEH->CurrentBinIndex(), mixEH->CurrentEntryMain(), mixEH->CurrentEntryMix(), mixEH->NumberMixed()));
       }
    }
    // Post output data.
index 8132f24..5b93668 100644 (file)
@@ -425,7 +425,7 @@ void AliMixInfo::Add(AliMixInfo *mi)
    // adds AliMixInfo
    //
 
-   AliInfo(Form("Adding %p", mi));
+//    AliInfo(Form("Adding %p", mi));
    if (!mi) return;
    if (!fHistogramList) return;
    TH1I *hMain = GetHistogramByType(kMainEvents);
index cac0cc3..a006027 100644 (file)
@@ -104,22 +104,6 @@ Bool_t AliMixInputEventHandler::Init(TTree *tree, Option_t *opt)
       tree->LoadTree(0);
       fMixIntupHandlerInfoTmp = new AliMixInputHandlerInfo(tree->GetName());
    }
-   // moved to Notify
-//     // adds current file
-//     fMixIntupHandlerInfoTmp->AddTreeToChain(tree->GetTree());
-//     Int_t lastIndex = fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->GetEntries();
-//     TChainElement *che = (TChainElement *)fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->At(lastIndex - 1);
-//     AliMixInputHandlerInfo *mixIHI = 0;
-//     for(Int_t i = 0; i < fInputHandlers.GetEntries(); i++) {
-//       AliDebug(AliLog::kDebug+5, Form("fInputHandlers[%d]", i));
-//       mixIHI = new AliMixInputHandlerInfo(fMixIntupHandlerInfoTmp->GetName(), fMixIntupHandlerInfoTmp->GetTitle());
-//       mixIHI->PrepareEntry(che, -1, InputEventHandler(i),fAnalysisType);
-//       AliDebug(AliLog::kDebug+5, Form("chain[%d]->GetEntries() = %lld", i, mixIHI->GetChain()->GetEntries()));
-//       fMixTrees.Add(mixIHI);
-//     }
-//     AliDebug(AliLog::kDebug+5, Form("fEntryCounter=%lld", fEntryCounter));
-//     if(fEventPool && fEventPool->NeedInit())
-//       fEventPool->Init();
    AliDebug(AliLog::kDebug + 5, Form("->"));
    return kTRUE;
 }
@@ -189,8 +173,7 @@ Bool_t AliMixInputEventHandler::GetEntry()
    // All mixed events are set
    //
    AliDebug(AliLog::kDebug + 5, Form("<-"));
-   // if no event pool MixStd
-//     if (fEventPool && fEventPool->NeedInit()) fEventPool->Init();
+
    if (!fEventPool) {
       MixStd();
    }
@@ -223,6 +206,10 @@ Bool_t AliMixInputEventHandler::MixStd()
    if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
    else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
    if (!inEvHMain) return kFALSE;
+
+   // check for PhysSelection
+   if (!IsEventCurrentSelected()) return kFALSE;
+
    // return in case of 0 entry in full chain
    if (!fEntryCounter) {
       AliDebug(AliLog::kDebug + 3, Form("-> fEntryCounter == 0"));
@@ -281,6 +268,10 @@ Bool_t AliMixInputEventHandler::MixBuffer()
    if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
    else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
    if (!inEvHMain) return kFALSE;
+
+   // check for PhysSelection
+   if (!IsEventCurrentSelected()) return kFALSE;
+
    // find out zero chain entries
    Long64_t zeroChainEntries = fMixIntupHandlerInfoTmp->GetChain()->GetEntries() - inEvHMain->GetTree()->GetTree()->GetEntries();
    // fill entry
@@ -370,6 +361,10 @@ Bool_t AliMixInputEventHandler::MixEventsMoreTimesWithOneEvent()
    if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
    else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
    if (!inEvHMain) return kFALSE;
+
+   // check for PhysSelection
+   if (!IsEventCurrentSelected()) return kFALSE;
+
    // find out zero chain entries
    Long64_t zeroChainEntries = fMixIntupHandlerInfoTmp->GetChain()->GetEntries() - inEvHMain->GetTree()->GetTree()->GetEntries();
    // fill entry
@@ -522,3 +517,17 @@ void AliMixInputEventHandler::SetMixNumber(const Int_t mixNum)
    }
    fMixNumber = mixNum;
 }
+
+Bool_t AliMixInputEventHandler::IsEventCurrentSelected()
+{
+   AliDebug(AliLog::kDebug + 5, Form("<-"));
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+   AliMultiInputEventHandler *mh = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
+   Bool_t isSelected = kTRUE;
+   if (fOfflineTriggerMask && mh->GetEventSelection()) {
+      isSelected = fOfflineTriggerMask & mh->IsEventSelected();
+   }
+   AliDebug(AliLog::kDebug + 1, Form("isSelected=%d", isSelected));
+   AliDebug(AliLog::kDebug + 5, Form("-> %d", isSelected));
+   return isSelected;
+}
index 21bf37f..ecdd348 100644 (file)
@@ -13,6 +13,8 @@
 #include <TObjArray.h>
 #include <TArrayI.h>
 
+#include <AliVEvent.h>
+
 #include "AliMultiInputEventHandler.h"
 
 class TChain;
@@ -61,8 +63,8 @@ public:
    Long64_t                CurrentEntryMix() const { return fCurrentEntryMix; }
    Int_t                   NumberMixed() const { return fNumberMixed; }
 
-
-
+   void                    SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB) {fOfflineTriggerMask = offlineTriggerMask;}
+   Bool_t                  IsEventCurrentSelected();
 protected:
 
    TObjArray               fMixTrees;              // buffer of input handlers
@@ -84,6 +86,8 @@ private:
    Long64_t fCurrentEntryMix;    //! current mixed entry in chain of processed files
    Int_t    fCurrentBinIndex;    //! current bin index
 
+   UInt_t fOfflineTriggerMask;   //  Task processes collision candidates only
+
    virtual Bool_t          MixStd();
    virtual Bool_t          MixBuffer();
    virtual Bool_t          MixEventsMoreTimesWithOneEvent();
@@ -94,7 +98,7 @@ private:
    AliMixInputEventHandler(const AliMixInputEventHandler& handler);
    AliMixInputEventHandler &operator=(const AliMixInputEventHandler &handler);
 
-   ClassDef(AliMixInputEventHandler, 1)
+   ClassDef(AliMixInputEventHandler, 2)
 };
 
 #endif