]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/macros/Train/KchKch_MC_ESD/AddTaskFemto.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / Train / KchKch_MC_ESD / AddTaskFemto.C
1 //=============================================================================
2 //
3 // *** AddTaskFemto.C ***
4 //
5 // This macro initialize a complete AnalysisTask object for femtoscopy.
6 //
7 //=============================================================================
8
9 //AliAnalysisTaskFemto *AddTaskFemto(const char *configMacroName="ConfigFemtoAna//lysis.C", const char *configMacroParameters="" )
10
11 AliAnalysisTaskFemto *AddTaskFemto(TString configMacroName, const char *containerName="femtolist", const char *configMacroParameters="" )
12
13 {
14 // Creates a proton analysis task and adds it to the analysis manager.
15   
16   // A. Get the pointer to the existing analysis manager via the static access method.
17   //==============================================================================
18   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19   if (!mgr) {
20     Error("AddTaskFemto", "No analysis manager to connect to.");
21     return NULL;
22   }  
23
24   // B. Check the analysis type using the event handlers connected to the analysis
25   //    manager. The availability of MC handler cann also be checked here.
26   //==============================================================================
27   if (!mgr->GetInputEventHandler()) {
28     ::Error("AddTaskFemto", "This task requires an input event handler");
29     return NULL;
30   }  
31   TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
32   cout << "Found " <<type << " event handler" << endl;
33
34   // C. Create the task, add it to manager.
35   //===========================================================================
36 //  gSystem->SetIncludePath("-I$ROOTSYS/include  -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_ROOT/include");
37
38   if (TProofMgr::GetListOfManagers()->GetEntries()) {
39 //     if (dynamic_cast<TProofLite *> gProof) {
40 //       char *macrocommand[10000];
41 //       sprintf(macrocommand, ".L %s", configMacroName);
42 //       gProof->Exec(macrocommand);
43 //     }
44 //     else
45     gProof->Load(configMacroName);
46   }  
47   //  gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
48
49   //was befere aliroot 5.04.33: AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName);
50   AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,kFALSE);
51   mgr->AddTask(taskfemto);
52
53   // D. Configure the analysis task. Extra parameters can be used via optional
54   // arguments of the AddTaskXXX() function.
55   //===========================================================================
56   
57   // E. Create ONLY the output containers for the data produced by the task.
58   // Get and connect other common input/output containers via the manager as below
59   //==============================================================================
60   TString outputfile = AliAnalysisManager::GetCommonFileName();  
61   outputfile += ":PWG2FEMTO";
62   AliAnalysisDataContainer *cout_femto  = mgr->CreateContainer("femtolist",  TList::Class(),
63                                                                AliAnalysisManager::kOutputContainer,outputfile);
64
65
66    mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
67    mgr->ConnectOutput(taskfemto, 0, cout_femto);
68
69    // Return task pointer at the end
70    return taskfemto;
71 }