Fixes from Coverity(15969,15968,15967,15964,15963,15962,15961,10283)
[u/mrichter/AliRoot.git] / ANALYSIS / EventMixing / AliMixInputEventHandler.cxx
CommitLineData
b425275c 1//
2// Class AliMixEventInputHandler
3//
4// Mixing input handler prepare N events before UserExec
5// TODO example
6// author:
7// Martin Vala (martin.vala@cern.ch)
8//
9
10#include <TFile.h>
11#include <TChain.h>
12#include <TEntryList.h>
13#include <TChainElement.h>
14#include <TSystem.h>
15
16#include "AliLog.h"
17#include "AliAnalysisManager.h"
18#include "AliInputEventHandler.h"
19
20#include "AliMixEventPool.h"
21#include "AliMixInputEventHandler.h"
22#include "AliMixInputHandlerInfo.h"
23
24#include "AliAnalysisTaskSE.h"
25
26ClassImp(AliMixInputEventHandler)
27
28AliMixInputEventHandler::AliMixInputEventHandler(const Int_t size, const Int_t mixNum): AliMultiInputEventHandler(size),
29 fMixTrees(),
30 fTreeMap(size > 0 ? size : 1),
31 fMixIntupHandlerInfoTmp(0),
32 fEntryCounter(0),
33 fEventPool(0),
34 fNumberMixed(0),
35 fMixNumber(mixNum),
36 fUseDefautProcess(kFALSE),
37 fUsePreMixEvents(kTRUE),
38 fCurrentEntry(0),
39 fCurrentEntryMain(0),
40 fCurrentEntryMix(0),
41 fCurrentBinIndex(-1)
42{
43 //
44 // Default constructor.
45 //
46 AliDebug(AliLog::kDebug + 10, "<-");
47 fMixTrees.SetOwner(kTRUE);
48 SetMixNumber(mixNum);
49 AliDebug(AliLog::kDebug + 10, "->");
50}
51
52//_____________________________________________________________________________
53AliInputEventHandler *AliMixInputEventHandler::InputEventHandler(const Int_t index)
54{
55 //
56 // Returns input handler
57 //
58 AliDebug(AliLog::kDebug + 5, Form("<-"));
59 if ((index >= 0) && (index < fBufferSize)) {
60 AliMultiInputEventHandler *eh = dynamic_cast<AliMultiInputEventHandler *>(fInputHandlers.At(index));
61 if (eh)
62 return (AliInputEventHandler *) eh;
63// return (AliInputEventHandler *) eh->InputEventHandler(0);
64 else
65 return (AliInputEventHandler *) fInputHandlers.At(index);
66 }
67 AliDebug(AliLog::kDebug + 5, Form("->"));
68 return 0;
69}
70//_____________________________________________________________________________
71void AliMixInputEventHandler::SetInputHandlerForMixing(const AliInputEventHandler *const inHandler)
72{
73 //
74 // Create N (fBufferSize) copies of input handler
75 //
76 AliDebug(AliLog::kDebug + 5, Form("<-"));
77 fInputHandlers.Clear();
78 AliDebug(AliLog::kDebug + 5, Form("Creating %d input event handlers ...", fBufferSize));
79 for (Int_t i = 0; i < fBufferSize; i++) {
80 AliDebug(AliLog::kDebug + 5, Form("Adding %d ...", i));
81 fInputHandlers.Add((AliInputEventHandler *) inHandler->Clone());
82 }
83 AliDebug(AliLog::kDebug + 5, Form("->"));
84}
85
86//_____________________________________________________________________________
87Bool_t AliMixInputEventHandler::Init(TTree *tree, Option_t *opt)
88{
89 //
90 // Init(const char*path) is called for all mix input handlers.
91 // Create event pool if needed
92 //
93 AliDebug(AliLog::kDebug + 5, Form("<- %p %s", (void *)tree, opt));
94 fAnalysisType = opt;
95 if (!tree) {
96 AliDebug(AliLog::kDebug + 5, Form("->"));
97 return kFALSE;
98 }
99 // clears array of input handlers
100 fMixTrees.Clear();
101 // create AliMixInputHandlerInfo
102 if (!fMixIntupHandlerInfoTmp) {
103 // loads first file TChain (tree)
104 tree->LoadTree(0);
105 fMixIntupHandlerInfoTmp = new AliMixInputHandlerInfo(tree->GetName());
106 }
107 // moved to Notify
108// // adds current file
109// fMixIntupHandlerInfoTmp->AddTreeToChain(tree->GetTree());
110// Int_t lastIndex = fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->GetEntries();
111// TChainElement *che = (TChainElement *)fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->At(lastIndex - 1);
112// AliMixInputHandlerInfo *mixIHI = 0;
113// for(Int_t i = 0; i < fInputHandlers.GetEntries(); i++) {
114// AliDebug(AliLog::kDebug+5, Form("fInputHandlers[%d]", i));
115// mixIHI = new AliMixInputHandlerInfo(fMixIntupHandlerInfoTmp->GetName(), fMixIntupHandlerInfoTmp->GetTitle());
116// mixIHI->PrepareEntry(che, -1, InputEventHandler(i),fAnalysisType);
117// AliDebug(AliLog::kDebug+5, Form("chain[%d]->GetEntries() = %lld", i, mixIHI->GetChain()->GetEntries()));
118// fMixTrees.Add(mixIHI);
119// }
120// AliDebug(AliLog::kDebug+5, Form("fEntryCounter=%lld", fEntryCounter));
121// if(fEventPool && fEventPool->NeedInit())
122// fEventPool->Init();
123 AliDebug(AliLog::kDebug + 5, Form("->"));
124 return kTRUE;
125}
126//_____________________________________________________________________________
127Bool_t AliMixInputEventHandler::Notify()
128{
129 //
130 // Notify() is called for all mix input handlers
131 //
132 AliDebug(AliLog::kDebug + 5, Form("<-"));
133 if (fUseDefautProcess) {
134 AliDebug(AliLog::kDebug, Form("-> SKIPPED"));
135 return AliMultiInputEventHandler::Notify();
136 }
137 AliDebug(AliLog::kDebug + 5, Form("->"));
138 return kTRUE;
139}
140
141//_____________________________________________________________________________
142Bool_t AliMixInputEventHandler::Notify(const char *path)
143{
144 //
145 // Notify(const char*path) is called for all mix input handlers
146 //
147 AliDebug(AliLog::kDebug + 5, Form("<- %s", path));
148 // adds current file
149 fMixIntupHandlerInfoTmp->AddTreeToChain(path);
150 Int_t lastIndex = fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->GetEntries();
151 TChainElement *che = (TChainElement *)fMixIntupHandlerInfoTmp->GetChain()->GetListOfFiles()->At(lastIndex - 1);
152 AliMixInputHandlerInfo *mixIHI = 0;
153 for (Int_t i = 0; i < fInputHandlers.GetEntries(); i++) {
154 AliDebug(AliLog::kDebug + 5, Form("fInputHandlers[%d]", i));
155 mixIHI = new AliMixInputHandlerInfo(fMixIntupHandlerInfoTmp->GetName(), fMixIntupHandlerInfoTmp->GetTitle());
156 mixIHI->PrepareEntry(che, -1, InputEventHandler(i), fAnalysisType);
157 AliDebug(AliLog::kDebug + 5, Form("chain[%d]->GetEntries() = %lld", i, mixIHI->GetChain()->GetEntries()));
158 fMixTrees.Add(mixIHI);
159 }
160 AliDebug(AliLog::kDebug + 5, Form("fEntryCounter=%lld", fEntryCounter));
161 if (fEventPool && fEventPool->NeedInit())
162 fEventPool->Init();
163 if (fUseDefautProcess) {
164 AliDebug(AliLog::kDebug, Form("-> SKIPPED"));
165 return AliMultiInputEventHandler::Notify(path);
166 }
167 AliDebug(AliLog::kDebug + 5, Form("->"));
168 return kTRUE;
169}
170
171//_____________________________________________________________________________
172Bool_t AliMixInputEventHandler::BeginEvent(Long64_t entry)
173{
174 //
175 // BeginEvent(Long64_t entry) is called for all mix input handlers
176 //
177 AliDebug(AliLog::kDebug + 5, Form("-> %lld", entry));
178 if (fUseDefautProcess) {
179 AliDebug(AliLog::kDebug, Form("-> SKIPPED"));
180 AliMultiInputEventHandler::BeginEvent(entry);/* return GetEntry();*/
181 }
182 AliDebug(AliLog::kDebug + 5, Form("->"));
183 return kTRUE;
184}
185//_____________________________________________________________________________
186Bool_t AliMixInputEventHandler::GetEntry()
187{
188 //
189 // All mixed events are set
190 //
191 AliDebug(AliLog::kDebug + 5, Form("<-"));
192 // if no event pool MixStd
193// if (fEventPool && fEventPool->NeedInit()) fEventPool->Init();
194 if (!fEventPool) {
195 MixStd();
196 }
197 // if buffer size is higher then 1
198 else if (fBufferSize > 1) {
199 MixBuffer();
200 }
201 // if mix number is higher then 0 and buffer size is 1
202 else if (fMixNumber > 0) {
203 MixEventsMoreTimesWithOneEvent();
204 } else {
205 AliWarning("Not supported Mixing !!!");
206 }
207 AliDebug(AliLog::kDebug + 5, Form("->"));
208 return kTRUE;
209}
210
211//_____________________________________________________________________________
212Bool_t AliMixInputEventHandler::MixStd()
213{
214 //
215 // Mix std - No event pool
216 //
217 AliDebug(AliLog::kDebug + 5, Form("<-"));
218 AliDebug(AliLog::kDebug + 1, "Mix method");
219 // get correct handler
220 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
221 AliMultiInputEventHandler *mh = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
222 AliInputEventHandler *inEvHMain = 0;
223 if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
224 else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
225 if (!inEvHMain) return kFALSE;
226 // return in case of 0 entry in full chain
227 if (!fEntryCounter) {
228 AliDebug(AliLog::kDebug + 3, Form("-> fEntryCounter == 0"));
229 // runs UserExecMix for all tasks (kFALSE means that UserExecMix is not called)
230 UserExecMixAllTasks(fEntryCounter, 1, fEntryCounter, -1, 0);
231 return kTRUE;
232 }
233 // pre mix evetns
234 Int_t mixNum = fMixNumber;
235 if (fUsePreMixEvents) {
236 if (fEntryCounter <= 2 * fMixNumber) mixNum = 2 * fMixNumber + 2;
237 }
238 // start of
239 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ BEGIN SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
240 // reset mix number
241 fNumberMixed = 0;
242 AliMixInputHandlerInfo *mihi = 0;
243 Long64_t entryMix = 0, entryMixReal = 0;
244 Int_t counter = 0;
245 for (counter = 0; counter < mixNum; counter++) {
246 entryMix = fEntryCounter - 1 - counter ;
247 AliDebug(AliLog::kDebug + 5, Form("Handler[%d] entryMix %lld ", counter, entryMix));
248 if (entryMix < 0) break;
249 entryMixReal = entryMix;
250 mihi = (AliMixInputHandlerInfo *) fMixTrees.At(0);
251 TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
252 if (!te) {
253 AliError("te is null. this is error. tell to developer (#1)")
254 } else {
255 mihi->PrepareEntry(te, entryMix, InputEventHandler(0), fAnalysisType);
256 // runs UserExecMix for all tasks
257 fNumberMixed++;
258 UserExecMixAllTasks(fEntryCounter, 1, fEntryCounter, entryMixReal, fNumberMixed);
259 InputEventHandler(0)->FinishEvent();
260 }
261 }
262 AliDebug(AliLog::kDebug + 3, Form("fEntryCounter=%lld fMixEventNumber=%d", fEntryCounter, fNumberMixed));
263 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
264 AliDebug(AliLog::kDebug + 5, Form("->"));
265 AliDebug(AliLog::kDebug + 5, Form("->"));
266 return kTRUE;
267}
268
269//_____________________________________________________________________________
270Bool_t AliMixInputEventHandler::MixBuffer()
271{
272 //
273 // Mix in event buffer
274 //
275 AliDebug(AliLog::kDebug + 5, Form("<-"));
276 AliDebug(AliLog::kDebug + 1, "Mix method");
277 // get correct handler
278 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
279 AliMultiInputEventHandler *mh = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
280 AliInputEventHandler *inEvHMain = 0;
281 if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
282 else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
283 if (!inEvHMain) return kFALSE;
284 // find out zero chain entries
285 Long64_t zeroChainEntries = fMixIntupHandlerInfoTmp->GetChain()->GetEntries() - inEvHMain->GetTree()->GetTree()->GetEntries();
286 // fill entry
287 Long64_t currentMainEntry = inEvHMain->GetTree()->GetTree()->GetReadEntry() + zeroChainEntries;
288 // fills entry
289 if (fEventPool && inEvHMain) fEventPool->AddEntry(currentMainEntry, inEvHMain->GetEvent());
290 // start of
291 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ BEGIN SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
292 // reset mix number
293 fNumberMixed = 0;
294 Long64_t elNum = 0;
295 TEntryList *el = 0;
296 Int_t idEntryList = -1;
297 if (fEventPool) el = fEventPool->FindEntryList(inEvHMain->GetEvent(), idEntryList);
298 // return in case of 0 entry in full chain
299 if (!fEntryCounter) {
300 AliDebug(AliLog::kDebug + 3, Form("-> fEntryCounter == 0"));
301 // runs UserExecMix for all tasks (kFALSE means that UserExecMix is not called)
302 UserExecMixAllTasks(fEntryCounter, idEntryList, fEntryCounter, -1, 0);
303 return kTRUE;
304 }
305 if (!el) {
306 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (el null) +++++++++++++++++++", fEntryCounter));
307 UserExecMixAllTasks(fEntryCounter, -1, fEntryCounter, -1, 0);
308 return kTRUE;
309 } else {
310 elNum = el->GetN();
311 if (elNum < fBufferSize + 1) {
312 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (%lld) +++++++++++++++++++", fEntryCounter, elNum));
313 return kTRUE;
314 }
315 }
316 AliMixInputHandlerInfo *mihi = 0;
317 Long64_t entryMix = 0, entryMixReal = 0;
318 Int_t counter = 0;
319 AliInputEventHandler *eh = 0;
320 TObjArrayIter next(&fInputHandlers);
321 while ((eh = (AliInputEventHandler *) next())) {
781b6757 322 if (!eh) continue;
b425275c 323 if (fEventPool && fEventPool->GetListOfEventCuts()->GetEntries() > 0) {
324 entryMix = -1;
325 if (elNum >= fBufferSize) {
326 Long64_t entryInEntryList = elNum - 2 - counter;
327 if (entryInEntryList < 0) break;
328 entryMix = el->GetEntry(entryInEntryList);
329 }
330 }
331 AliDebug(AliLog::kDebug + 5, Form("Handler[%d] entryMix %lld ", counter, entryMix));
332 if (entryMix < 0) {
333 UserExecMixAllTasks(fEntryCounter, -1, currentMainEntry, -1, 0);
334 break;
335 }
336 entryMixReal = entryMix;
337 mihi = (AliMixInputHandlerInfo *) fMixTrees.At(counter);
338 TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
339 if (!te) {
340 AliError("te is null. this is error. tell to developer (#1)")
341 } else {
342 AliDebug(AliLog::kDebug + 3, Form("Preparing InputEventHandler(%d)", counter));
343 mihi->PrepareEntry(te, entryMix, InputEventHandler(counter), fAnalysisType);
344 // runs UserExecMix for all tasks
345 UserExecMixAllTasks(fEntryCounter, idEntryList, fEntryCounter, entryMixReal, counter);
346 fNumberMixed++;
347 }
348 counter++;
349 }
350 AliDebug(AliLog::kDebug + 3, Form("fEntryCounter=%lld fMixEventNumber=%d", fEntryCounter, fNumberMixed));
351 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
352 AliDebug(AliLog::kDebug + 5, Form("->"));
353 AliDebug(AliLog::kDebug + 5, Form("->"));
354 return kTRUE;
355}
356
357//_____________________________________________________________________________
358Bool_t AliMixInputEventHandler::MixEventsMoreTimesWithOneEvent()
359{
360 //
361 // Mix in history with one event in buffer
362 //
363 AliDebug(AliLog::kDebug + 5, "<-");
364 AliDebug(AliLog::kDebug + 1, "Mix method");
365 // get correct handler
366 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
367 AliMultiInputEventHandler *mh = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
368 AliInputEventHandler *inEvHMain = 0;
369 if (mh) inEvHMain = dynamic_cast<AliInputEventHandler *>(mh->GetFirstInputEventHandler());
370 else inEvHMain = dynamic_cast<AliInputEventHandler *>(mgr->GetInputEventHandler());
371 if (!inEvHMain) return kFALSE;
372 // find out zero chain entries
373 Long64_t zeroChainEntries = fMixIntupHandlerInfoTmp->GetChain()->GetEntries() - inEvHMain->GetTree()->GetTree()->GetEntries();
374 // fill entry
375 Long64_t currentMainEntry = inEvHMain->GetTree()->GetTree()->GetReadEntry() + zeroChainEntries;
376 if (fEventPool && inEvHMain) fEventPool->AddEntry(currentMainEntry, inEvHMain->GetEvent());
377 // start of
378 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ BEGIN SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
379 // reset mix number
380 fNumberMixed = 0;
381 Long64_t elNum = 0;
382 Int_t idEntryList = -1;
383 TEntryList *el = 0;
384 if (fEventPool) el = fEventPool->FindEntryList(inEvHMain->GetEvent(), idEntryList);
385 // return in case of 0 entry in full chain
386 if (!fEntryCounter) {
387 // runs UserExecMix for all tasks (kFALSE means that UserExecMix is not called)
388 UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
389 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (fEntryCounter=0, idEntryList=%d) +++++++++++++++++++", fEntryCounter, idEntryList));
390 return kTRUE;
391 }
392 if (!el) {
393 if (fEventPool) {
394 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED (el null, idEntryList=%d) +++++++++++++++++++", fEntryCounter, idEntryList));
395 UserExecMixAllTasks(fEntryCounter, -1, currentMainEntry, -1, 0);
396 return kTRUE;
397 }
398 } else {
399 elNum = el->GetN();
400 if (elNum < fBufferSize + 1) {
401 UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, -1, 0);
402 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld SKIPPED [FIRST ENTRY in el] (elnum=%lld, idEntryList=%d) +++++++++++++++++++", fEntryCounter, elNum, idEntryList));
403 return kTRUE;
404 }
405 }
406 // pre mix evetns
407 Int_t mixNum = fMixNumber;
408 if (fUsePreMixEvents) {
409 if (elNum <= 2 * fMixNumber + 1) mixNum = elNum + 1;
410 }
411 AliMixInputHandlerInfo *mihi = 0;
412 Long64_t entryMix = 0, entryMixReal = 0;
413 Int_t counter = 0;
414 mihi = (AliMixInputHandlerInfo *) fMixTrees.At(0);
415 // fills num for main events
416 for (counter = 0; counter < mixNum; counter++) {
417 Long64_t entryInEntryList = elNum - 2 - counter;
418 AliDebug(AliLog::kDebug + 3, Form("entryInEntryList=%lld", entryInEntryList));
419 if (entryInEntryList < 0) break;
420 entryMix = el->GetEntry(entryInEntryList);
421 AliDebug(AliLog::kDebug + 3, Form("entryMix=%lld", entryMix));
422 if (entryMix < 0) break;
423 entryMixReal = entryMix;
424 TChainElement *te = fMixIntupHandlerInfoTmp->GetEntryInTree(entryMix);
425 if (!te) {
426 AliError("te is null. this is error. tell to developer (#2)")
427 } else {
428 mihi->PrepareEntry(te, entryMix, InputEventHandler(0), fAnalysisType);
429 // runs UserExecMix for all tasks
430 fNumberMixed++;
431 UserExecMixAllTasks(fEntryCounter, idEntryList, currentMainEntry, entryMixReal, fNumberMixed);
432 InputEventHandler(0)->FinishEvent();
433 }
434 }
435 AliDebug(AliLog::kDebug + 3, Form("fEntryCounter=%lld fMixEventNumber=%d", fEntryCounter, fNumberMixed));
436 AliDebug(AliLog::kDebug + 3, Form("++++++++++++++ END SETUP EVENT %lld +++++++++++++++++++", fEntryCounter));
437 AliDebug(AliLog::kDebug + 5, Form("->"));
438 AliDebug(AliLog::kDebug + 5, Form("->"));
439 return kTRUE;
440}
441
442//_____________________________________________________________________________
443Bool_t AliMixInputEventHandler::MixEventsMoreTimesWithBuffer()
444{
445 //
446 // Mix more events in buffer with mixing with history
447 //
448 AliWarning("Not implemented");
449 return kFALSE;
450}
451
452//_____________________________________________________________________________
453Bool_t AliMixInputEventHandler::FinishEvent()
454{
455 //
456 // FinishEvent() is called for all mix input handlers
457 //
458 AliDebug(AliLog::kDebug + 5, Form("<-"));
459 AliMultiInputEventHandler::FinishEvent();
460 fEntryCounter++;
461 AliDebug(AliLog::kDebug + 5, Form("->"));
462 return kTRUE;
463}
464
465//_____________________________________________________________________________
466void AliMixInputEventHandler::AddInputEventHandler(AliVEventHandler*)
467{
468 //
469 // AddInputEventHandler will not be used
470 //
471 AliWarning("Function AddInputEventHandler is disabled for AliMixEventInputHandler !!!");
472 AliWarning("Use AliMixEventInputHandler::SetInputHandlerForMixing instead. Exiting ...");
473}
474
475//_____________________________________________________________________________
476void AliMixInputEventHandler::UserExecMixAllTasks(Long64_t entryCounter, Int_t idEntryList, Long64_t entryMainReal, Long64_t entryMixReal, Int_t numMixed)
477{
478 //
479 // Execute all task and sets mixing parameters
480 //
481 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
482 AliAnalysisTaskSE *mixTask = 0;
483 TObjArrayIter next(mgr->GetTasks());
484 while ((mixTask = (AliAnalysisTaskSE *) next())) {
485 if (dynamic_cast<AliAnalysisTaskSE *>(mixTask)) {
486 AliDebug(AliLog::kDebug, Form("%s %lld %d [%lld,%lld] %d", mixTask->GetName(), entryCounter, numMixed, entryMainReal, entryMixReal, idEntryList));
487// mixTask->SetCurrentBinIndex(idEntryList);
488// mixTask->SetCurrentEntry(entryCounter);
489// mixTask->SetCurrentEntryMain(entryMainReal);
490// mixTask->SetCurrentEntryMix(entryMixReal);
491// mixTask->SetNumberMixed(numMixed);
492 fCurrentEntry = idEntryList;
493 fCurrentEntryMain = entryCounter;
494 fCurrentEntryMix = entryMainReal;
495 fCurrentBinIndex = entryMixReal;
496
497 if (entryMixReal > -1) mixTask->UserExecMix("");
498 }
499 }
500}
501
502//_____________________________________________________________________________
503void AliMixInputEventHandler::SetMixNumber(const Int_t mixNum)
504{
505 //
506 // Sets mix number
507 //
508 if (fMixNumber > 1 && fBufferSize > 1) {
509 AliWarning("Sleeping 10 sec to show Warning Message ...")
510 AliWarning("=========================================================================================");
511 AliWarning(Form("BufferSize(%d) higher > 1 and fMixNumber(%d) > 1, which is not supported", fBufferSize, mixNum));
512 AliWarning("");
513 AliWarning("\tBufferSize will be set to 1");
514 AliWarning("");
515 AliWarning("Hints:");
516 AliWarning("");
517 AliWarning("\t1.If you want to use buffer do:");
518 AliWarning(Form("\t\tAliMixInputEventHandler *mixH = new AliMixInputEventHandler(%d,1)", fBufferSize));
519 AliWarning("");
520 AliWarning("\t2.If you want to use mix more time with buffer size 1, then do:");
521 AliWarning(Form("\t\tAliMixInputEventHandler *mixH = new AliMixInputEventHandler(1,%d)", mixNum));
522 AliWarning("");
523 AliWarning("=========================================================================================");
524 gSystem->Sleep(10000);
525 fBufferSize = 1;
526 }
527 fMixNumber = mixNum;
528}