]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/macros/AddTaskFemto.C
AddTask macro for Femto code
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / macros / AddTaskFemto.C
1 //=============================================================================
2 //
3 // *** AddTaskFemto.C ***
4 //
5 // This macro initialize a complete AnalysisTask object for femtoscopy.
6 //
7 //=============================================================================
8
9 AliAnalysisTaskFemto *AddTaskFemto()
10 {
11 // Creates a proton analysis task and adds it to the analysis manager.
12   
13   // A. Get the pointer to the existing analysis manager via the static access method.
14   //==============================================================================
15   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16   if (!mgr) {
17     Error("AddTaskFemto", "No analysis manager to connect to.");
18     return NULL;
19   }  
20
21   // B. Check the analysis type using the event handlers connected to the analysis
22   //    manager. The availability of MC handler cann also be checked here.
23   //==============================================================================
24   if (!mgr->GetInputEventHandler()) {
25     ::Error("AddTaskFemto", "This task requires an input event handler");
26     return NULL;
27   }  
28   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
29
30   // C. Create the task, add it to manager.
31   //===========================================================================
32   gSystem->SetIncludePath("-I$ROOTSYS/include  -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_ROOT/include");
33   gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
34   AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto");
35   mgr->AddTask(taskfemto);
36
37   // D. Configure the analysis task. Extra parameters can be used via optional
38   // arguments of the AddTaskXXX() function.
39   //===========================================================================
40   
41   // E. Create ONLY the output containers for the data produced by the task.
42   // Get and connect other common input/output containers via the manager as below
43   //==============================================================================
44   AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist",  TList::Class(),
45                                                                AliAnalysisManager::kOutputContainer,"Femto.ESD.root");
46
47    mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
48    mgr->ConnectOutput(taskfemto, 0, cout_femto);
49
50    // Return task pointer at the end
51    return taskfemto;
52 }