]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/test/AddAnalysisTaskRsnTest.C
Invert check for the case that there is no data left in the buffer
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / AddAnalysisTaskRsnTest.C
1 //
2 // This macro serves to add the RSN analysis task to the steering macro.
3 //
4 // Inputs:
5 //   - dataLabel   = a string with informations about the type of data
6 //                   which could be needed to be ported to the config macro
7 //                   to set up some cuts
8 //   - configMacro = macro which configures the analysis; it has *ALWAYS*
9 //                   defined inside a function named 'RsnConfigTask()',
10 //                   whatever the name of the macro itself, whose first two
11 //                   arguments must have to be the task and the 'dataLabel' argument.
12 // 
13 Bool_t AddAnalysisTaskRsnTest
14 (const char *dataLabel, const char *configMacro = "ConfigTaskRsn2010.C")
15 {
16   // retrieve analysis manager
17   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
18
19   // initialize task with all available slots, even if not all of them will be used:
20   AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis");
21   task->SetZeroEventPercentWarning(100.0);
22
23   // load and execute configuration macro
24   gROOT->LoadMacro(configMacro);
25   if (!RsnConfigTask(task, dataLabel)) return kFALSE;
26
27   // add the task to manager
28   mgr->AddTask(task);
29
30   // connect input container according to source choice
31   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
32
33   // create paths for the output in the common file
34   Char_t commonPath[500];
35   sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
36
37   // create containers for output
38   AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
39   AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
40   mgr->ConnectOutput(task, 1, outputInfo);
41   mgr->ConnectOutput(task, 2, outputHist);
42
43   return kTRUE;
44 }