Lines getting the matched track moved to a method in AliCalorimeterUtils. Lines copie...
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / macros / AddTaskFemto.C
CommitLineData
782d4b24 1//=============================================================================
2//
3// *** AddTaskFemto.C ***
4//
5// This macro initialize a complete AnalysisTask object for femtoscopy.
6//
7//=============================================================================
8
62e790f1 9AliAnalysisTaskFemto *AddTaskFemto(const char *configMacroName="ConfigFemtoAnalysis.C", const char *configMacroParameters="" )
782d4b24 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"
62e790f1 29 cout << "Found " <<type << " event handler" << endl;
782d4b24 30
31 // C. Create the task, add it to manager.
32 //===========================================================================
d346f8fe 33// gSystem->SetIncludePath("-I$ROOTSYS/include -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_ROOT/include");
817751c7 34
d346f8fe 35 if (TProofMgr::GetListOfManagers()->GetEntries()) {
cad3c335 36// if (dynamic_cast<TProofLite *> gProof) {
37// char *macrocommand[10000];
38// sprintf(macrocommand, ".L %s", configMacroName);
39// gProof->Exec(macrocommand);
40// }
41// else
42 gProof->Load(configMacroName);
d346f8fe 43 }
06b454c7 44 // gROOT->LoadMacro("ConfigFemtoAnalysis.C++");
45
62e790f1 46 AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,configMacroParameters);
782d4b24 47 mgr->AddTask(taskfemto);
48
49 // D. Configure the analysis task. Extra parameters can be used via optional
50 // arguments of the AddTaskXXX() function.
51 //===========================================================================
52
53 // E. Create ONLY the output containers for the data produced by the task.
54 // Get and connect other common input/output containers via the manager as below
55 //==============================================================================
96fe83a3 56 TString outputfile = AliAnalysisManager::GetCommonFileName();
57 outputfile += ":PWG2FEMTO";
782d4b24 58 AliAnalysisDataContainer *cout_femto = mgr->CreateContainer("femtolist", TList::Class(),
96fe83a3 59 AliAnalysisManager::kOutputContainer,outputfile);
60
782d4b24 61
62 mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer());
63 mgr->ConnectOutput(taskfemto, 0, cout_femto);
64
65 // Return task pointer at the end
66 return taskfemto;
67}