fNumberMixed(0),
fMixNumber(mixNum),
fUseDefautProcess(kFALSE),
- fUsePreMixEvents(kTRUE),
+ fDoMixExtra(kTRUE),
+ fDoMixIfNotEnoughEvents(kTRUE),
fCurrentEntry(0),
fCurrentEntryMain(0),
fCurrentEntryMix(0),
AliDebug(AliLog::kDebug + 10, "->");
}
-//_____________________________________________________________________________
-AliInputEventHandler *AliMixInputEventHandler::InputEventHandler(const Int_t index)
-{
- //
- // Returns input handler
- //
- AliDebug(AliLog::kDebug + 5, Form("<-"));
- if ((index >= 0) && (index < fBufferSize)) {
- AliMultiInputEventHandler *eh = dynamic_cast<AliMultiInputEventHandler *>(fInputHandlers.At(index));
- if (eh)
- return (AliInputEventHandler *) eh;
-// return (AliInputEventHandler *) eh->InputEventHandler(0);
- else
- return (AliInputEventHandler *) fInputHandlers.At(index);
- }
- AliDebug(AliLog::kDebug + 5, Form("->"));
- return 0;
-}
//_____________________________________________________________________________
void AliMixInputEventHandler::SetInputHandlerForMixing(const AliInputEventHandler *const inHandler)
{
AliDebug(AliLog::kDebug + 5, Form("Adding %d ...", i));
fInputHandlers.Add((AliInputEventHandler *) inHandler->Clone());
}
+
AliDebug(AliLog::kDebug + 5, Form("->"));
}
AliDebug(AliLog::kDebug + 5, Form("->"));
return kFALSE;
}
+
+ if (!fDoMixIfNotEnoughEvents) {
+ fDoMixExtra = kFALSE;
+ AliWarning("fDoMixIfNotEnoughEvents=kTRUE -> setting fDoMixExtra=kFALSE");
+ }
+
// clears array of input handlers
fMixTrees.Clear();
// create AliMixInputHandlerInfo
tree->LoadTree(0);
fMixIntupHandlerInfoTmp = new AliMixInputHandlerInfo(tree->GetName());
}
+
+ AliInputEventHandler *ih = 0;
+ for (Int_t i = 0; i < fInputHandlers.GetEntries(); i++) {
+ ih = (AliInputEventHandler *) fInputHandlers.At(i);
+ ih->SetParentHandler(this);
+// ih->Init(tree,opt);
+ }
+
AliDebug(AliLog::kDebug + 5, Form("->"));
return kTRUE;
}
// Notify(const char*path) is called for all mix input handlers
//
AliDebug(AliLog::kDebug + 5, Form("<- %s", path));
+
+ Bool_t firstRun=(fMixIntupHandlerInfoTmp->GetChain()->GetEntries()<=0);
// adds current file
fMixIntupHandlerInfoTmp->AddTreeToChain(path);
Int_t lastIndex = fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->GetEntries();
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);
+ if (firstRun) mixIHI->PrepareEntry(che, -1, (AliInputEventHandler*)InputEventHandler(i), fAnalysisType);
AliDebug(AliLog::kDebug + 5, Form("chain[%d]->GetEntries() = %lld", i, mixIHI->GetChain()->GetEntries()));
fMixTrees.Add(mixIHI);
}
} else {
AliWarning("Not supported Mixing !!!");
}
+
AliDebug(AliLog::kDebug + 5, Form("->"));
return kTRUE;
}
}
// pre mix evetns
Int_t mixNum = fMixNumber;
- if (fUsePreMixEvents) {
+ if (fDoMixExtra) {
if (fEntryCounter <= 2 * fMixNumber) mixNum = 2 * fMixNumber + 2;
}
// start of
mihi = (AliMixInputHandlerInfo *) fMixTrees.At(0);
TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
if (!te) {
- AliError("te is null. this is error. tell to developer (#1)")
+ AliError("te is null. this is error. tell to developer (#1)");
} else {
- mihi->PrepareEntry(te, entryMix, InputEventHandler(0), fAnalysisType);
+ mihi->PrepareEntry(te, entryMix, (AliInputEventHandler*)InputEventHandler(0), fAnalysisType);
// runs UserExecMix for all tasks
fNumberMixed++;
UserExecMixAllTasks(fEntryCounter, 1, fEntryCounter, entryMixReal, fNumberMixed);
elNum = el->GetN();
if (elNum < fBufferSize + 1) {
UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
- AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (%lld) +++++++++++++++++++", fEntryCounter, elNum));
+ AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (%lld) LESS THEN BUFFER +++++++++++++++++++", fEntryCounter, elNum));
return kTRUE;
}
}
mihi = (AliMixInputHandlerInfo *) fMixTrees.At(counter);
TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
if (!te) {
- AliError("te is null. this is error. tell to developer (#1)")
+ AliError("te is null. this is error. tell to developer (#1)");
} else {
AliDebug(AliLog::kDebug + 3, Form("Preparing InputEventHandler(%d)", counter));
- mihi->PrepareEntry(te, entryMix, InputEventHandler(counter), fAnalysisType);
+ mihi->PrepareEntry(te, entryMix, (AliInputEventHandler*)InputEventHandler(counter), fAnalysisType);
// runs UserExecMix for all tasks
UserExecMixAllTasks(fEntryCounter, idEntryList, fEntryCounter, entryMixReal, counter);
fNumberMixed++;
// return in case of 0 entry in full chain
if (!fEntryCounter) {
// runs UserExecMix for all tasks, if needed
- if (el) UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
- else UserExecMixAllTasks(fEntryCounter, -1, currentMainEntry, -1, 0);
+ if (el && fDoMixIfNotEnoughEvents) {
+ UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ } else {
+ idEntryList = -1;
+ UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ }
AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (fEntryCounter=0, idEntryList=%d) +++++++++++++++++++", fEntryCounter, idEntryList));
return kTRUE;
}
} else {
elNum = el->GetN();
if (elNum < fBufferSize + 1) {
- UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ if (fDoMixIfNotEnoughEvents) {
+ // include main event in to counter in this case (so idEntryList>0)
+ UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ } else {
+ // dont include it in main event counter (idEntryList = -1)
+ idEntryList = -1;
+ UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ }
AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED [FIRST ENTRY in el] (elnum=%lld, idEntryList=%d) +++++++++++++++++++", fEntryCounter, elNum, idEntryList));
return kTRUE;
}
+ if (!fDoMixIfNotEnoughEvents) {
+ if (elNum <= fMixNumber + 1) {
+ UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
+ AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (%lld) NOT ENOUGH EVENTS TO MIX => NEED=%d +++++++++++++++++++", fEntryCounter, elNum, fMixNumber + 1));
+ return kTRUE;
+ }
+ }
}
// pre mix evetns
Int_t mixNum = fMixNumber;
- if (fUsePreMixEvents) {
+ if (fDoMixExtra) {
if (elNum <= 2 * fMixNumber + 1) mixNum = elNum + 1;
}
AliMixInputHandlerInfo *mihi = 0;
entryMixReal = entryMix;
TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
if (!te) {
- AliError("te is null. this is error. tell to developer (#2)")
+ AliError("te is null. this is error. tell to developer (#2)");
} else {
- mihi->PrepareEntry(te, entryMix, InputEventHandler(0), fAnalysisType);
+ mihi->PrepareEntry(te, entryMix, (AliInputEventHandler*)InputEventHandler(0), fAnalysisType);
// runs UserExecMix for all tasks
fNumberMixed++;
UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, entryMixReal, fNumberMixed);
// Sets mix number
//
if (fMixNumber > 1 && fBufferSize > 1) {
- AliWarning("Sleeping 10 sec to show Warning Message ...")
- AliWarning("=========================================================================================");
+ AliWarning("Sleeping 10 sec to show Warning Message ...");
+ AliWarning("=========================================================================================");
AliWarning(Form("BufferSize(%d) higher > 1 and fMixNumber(%d) > 1, which is not supported", fBufferSize, mixNum));
AliWarning("");
AliWarning("\tBufferSize will be set to 1");