1 AliAnalysisTaskProtons *AddTaskProtons(Bool_t kAnalyzeMC = kFALSE,
2 const char *analysisType="Hybrid",
3 const char *pidMode="Bayesian")
5 // Creates a proton analysis task and adds it to the analysis manager.
7 // Get the pointer to the existing analysis manager via the static access method.
8 //==============================================================================
9 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
11 ::Error("AddTaskProtons", "No analysis manager to connect to.");
15 // Check the analysis type using the event handlers connected to the analysis manager.
16 //==============================================================================
17 if (!mgr->GetInputEventHandler()) {
18 ::Error("AddTaskProtons", "This task requires an input event handler");
21 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
22 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysis.C");
23 AliProtonAnalysis *pa = 0;
24 if (type=="ESD") pa = GetProtonAnalysisObject("ESD", kAnalyzeMC,
25 analysisType, pidMode);
26 else if (type=="AOD") pa = GetProtonAnalysisObject("AOD", kAnalyzeMC,
27 analysisType, pidMode);
28 else pa = GetProtonAnalysisObject("MC", analysisType, kAnalyzeMC, pidMode);
30 // Create the task, add it to manager and configure it.
31 //===========================================================================
32 AliAnalysisTaskProtons *taskproton = new AliAnalysisTaskProtons("TaskProtons");
33 mgr->AddTask(taskproton);
34 taskproton->SetAnalysisObject(pa);
36 // Create ONLY the output containers for the data produced by the task.
37 // Get and connect other common input/output containers via the manager as below
38 //==============================================================================
39 TString outputFileName = AliAnalysisManager::GetCommonFileName();
40 outputFileName += ":PWG2BaryonRatioAnalysis";
41 AliAnalysisDataContainer *cout_proton = mgr->CreateContainer("outputList", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
42 AliAnalysisDataContainer *cout_proton_QA = mgr->CreateContainer("outputQAList", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
44 mgr->ConnectInput(taskproton, 0, mgr->GetCommonInputContainer());
45 mgr->ConnectOutput(taskproton, 0, cout_proton);
46 mgr->ConnectOutput(taskproton, 1, cout_proton_QA);
48 // Return task pointer at the end