]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/train/AddRsnAnalysisTask.C
First version of tasks for central train
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / AddRsnAnalysisTask.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 AddRsnAnalysisTask
14 (
15    Bool_t      isMC,
16    Bool_t      isMix,
17    const char *options,
18    const char *path     = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train",
19    const char *taskName = "RSNtask"
20 )
21 {
22    // retrieve analysis manager
23    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
24
25    // create the task and connect with physics selection
26    AliRsnAnalysisTask *task = new AliRsnAnalysisTask(taskName);
27    task->SetZeroEventPercentWarning(100.0);
28    task->SelectCollisionCandidates();
29    task->SetMixing(isMix);
30    ::Info("AddRsnAnalysisTask.C", "Mixing: %s", (task->IsMixing() ? "YES" : "NO"));
31    ::Info("AddRsnAnalysisTask.C", "MC:     %s", (isMC ? "YES" : "NO"));
32
33    // add the task to manager
34    mgr->AddTask(task);
35    
36    // add the event computations with the options to eventually select centrality cut
37    gROOT->LoadMacro(Form("%s/AddRsnEventComputations.C", path));
38    AddRsnEventComputations(isMC, options);
39    
40    // add all configs for phi
41    gROOT->LoadMacro(Form("%s/RsnConfigPhi.C", path));
42    RsnConfigPhi(isMC, "tpcpid_tofpid", path, taskName);
43    //RsnConfigPhi(isMC, "itspid_tpcpid_tofpid", path, taskName);
44    
45    // in case of MC, add efficiency tasks
46    if (isMC) {
47       gROOT->LoadMacro(Form("%s/AddRsnAnalysisTaskEffPhi.C", path));
48       AddRsnAnalysisTaskEffPhi("tpcpid_tofpid");
49       //AddRsnAnalysisTaskEffPhi("itspid_tpcpid_tofpid");
50    }
51
52    // connect input container according to source choice
53    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
54
55    // create paths for the output in the common file
56    Char_t commonPath[500];
57    sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
58
59    // create containers for output
60    AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
61    AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
62    mgr->ConnectOutput(task, 1, outputInfo);
63    mgr->ConnectOutput(task, 2, outputHist);
64
65    return kTRUE;
66 }