]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/SPECTRA/macros/AddTaskProtonFeedDownAnalysis.C
Change in the naming scheme
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / macros / AddTaskProtonFeedDownAnalysis.C
CommitLineData
b3360800 1AliProtonFeedDownAnalysisTask* AddTaskProtonFeedDownAnalysis(const char *analysisType="Hybrid",const char *pidMode="Bayesian")
2{
3 // Creates a proton analysis task and adds it to the analysis manager.
4
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8 if (!mgr) {
9 ::Error("AddTaskProtons", "No analysis manager to connect to.");
10 return NULL;
11 }
12
13 // Check the analysis type using the event handlers connected to the analysis manager.
14 //==============================================================================
15 if (!mgr->GetInputEventHandler()) {
16 ::Error("AddTaskProtons", "This task requires an input event handler");
17 return NULL;
18 }
19 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
20 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonFeedDownAnalysis.C");
21 AliProtonFeedDownAnalysis *pa = 0;
22 if (type=="ESD") pa = GetProtonFeedDownAnalysisObject("ESD", analysisType, pidMode);
23 else if (type=="AOD") pa = GetProtonFeedDownAnalysisObject("AOD", analysisType, pidMode);
24 else return NULL;
25
26 // Create the task, add it to manager and configure it.
27 //===========================================================================
28 AliProtonFeedDownAnalysisTask *taskproton = new AliProtonFeedDownAnalysisTask("TaskProtons");
29 mgr->AddTask(taskproton);
30 taskproton->SetAnalysisObject(pa);
31
32 // Create ONLY the output containers for the data produced by the task.
33 // Get and connect other common input/output containers via the manager as below
34 //==============================================================================
d7fff4c6 35 TString outputFileName = AliAnalysisManager::GetCommonFileName();
c3200d84 36 outputFileName += ":PWG2BaryonRatioFeedDownAnalysis";
d7fff4c6 37 AliAnalysisDataContainer *cout_proton = mgr->CreateContainer("protonFeedDown", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
b3360800 38 mgr->ConnectInput(taskproton, 0, mgr->GetCommonInputContainer());
39 mgr->ConnectOutput(taskproton, 0, cout_proton);
40
41 // Return task pointer at the end
42 return taskproton;
43}