]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/RESONANCES/macros/train_old/AddRsnAnalysisTask.C
Macros update (by Massimo)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / train_old / 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 && !isMix) {
47       ::Info("Adding efficiency");
48       gROOT->LoadMacro(Form("%s/AddRsnAnalysisTaskEffPhi.C", path));
49       AddRsnAnalysisTaskEffPhi(options, "tpcpid_tofpid");
50       //AddRsnAnalysisTaskEffPhi(options, "itspid_tpcpid_tofpid");
51    }
52
53    // connect input container according to source choice
54    mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
55
56    // create paths for the output in the common file
57    Char_t commonPath[500];
58    sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
59
60    // create containers for output
61    AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfo", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
62    AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnHist", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
63    mgr->ConnectOutput(task, 1, outputInfo);
64    mgr->ConnectOutput(task, 2, outputHist);
65
66    return kTRUE;
67 }