]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/AntiprotonToProton/AddTaskProtonCorrectionAnalysis.C
Update in cuts for Sigma* and update for lego_train macros (M.Vala)
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / AntiprotonToProton / AddTaskProtonCorrectionAnalysis.C
1 AliProtonCorrectionAnalysisTask* AddTaskProtonCorrectionAnalysis(const char *analysisType="Hybrid",const char *pidMode="Bayesian",Bool_t fIsOn_AliProtonAbsorptionCorrection=kTRUE, Bool_t fIsOn_AliProtonFeedDownAnalysis=kTRUE,Bool_t fIsOn_AliProtonSpectraCorrection=kTRUE)
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   {
10         ::Error("AddTaskProtons", "No analysis manager to connect to.");
11         return NULL;
12   }   
13   
14   // Check the analysis type using the event handlers connected to the analysis manager.
15   //==============================================================================
16   if (!mgr->GetInputEventHandler()) 
17   {
18          ::Error("AddTaskProtons", "This task requires an input event handler");
19         return NULL;
20   }   
21   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
22   gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonCorrectionAnalysisTask.C");
23   AliProtonCorrectionAnalysisTask *taskproton = 0;
24   if (type=="ESD") 
25          taskproton = GetAliProtonCorrectionAnalysisTask("ESD", analysisType, pidMode,fIsOn_AliProtonAbsorptionCorrection, fIsOn_AliProtonFeedDownAnalysis,fIsOn_AliProtonSpectraCorrection);
26   else if (type=="AOD") 
27         taskproton  = GetAliProtonCorrectionAnalysisTask("AOD", analysisType, pidMode,fIsOn_AliProtonAbsorptionCorrection,fIsOn_AliProtonFeedDownAnalysis, fIsOn_AliProtonSpectraCorrection);
28   else 
29         return NULL;
30
31   // Create the task, add it to manager and configure it.
32   //===========================================================================
33
34   mgr->AddTask(taskproton);
35   
36
37   // Create ONLY the output containers for the data produced by the task.
38   // Get and connect other common input/output containers via the manager as below
39   //==============================================================================
40   TString outputFileName = AliAnalysisManager::GetCommonFileName();
41   outputFileName += ":PWG2BaryonRatioProtonCorrectionAnalysisAnalysis";
42   AliAnalysisDataContainer *cout_proton = mgr->CreateContainer("protonProtonCorrectionAnalysis", TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data());
43   mgr->ConnectInput(taskproton, 0, mgr->GetCommonInputContainer());
44   mgr->ConnectOutput(taskproton, 0, cout_proton);
45   
46   // Return task pointer at the end
47   return taskproton;
48 }