From 096fc967b0559da97302055842181e91fa9c0f18 Mon Sep 17 00:00:00 2001 From: akisiel Date: Thu, 10 Nov 2011 12:16:04 +0000 Subject: [PATCH] AddTaskFemto for train --- PWG2/FEMTOSCOPY/macros/Train/AddTaskFemto.C | 67 +++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 PWG2/FEMTOSCOPY/macros/Train/AddTaskFemto.C diff --git a/PWG2/FEMTOSCOPY/macros/Train/AddTaskFemto.C b/PWG2/FEMTOSCOPY/macros/Train/AddTaskFemto.C new file mode 100644 index 00000000000..0611f5cf891 --- /dev/null +++ b/PWG2/FEMTOSCOPY/macros/Train/AddTaskFemto.C @@ -0,0 +1,67 @@ +//============================================================================= +// +// *** AddTaskFemto.C *** +// +// This macro initialize a complete AnalysisTask object for femtoscopy. +// +//============================================================================= + +AliAnalysisTaskFemto *AddTaskFemto(const char *configMacroName="ConfigFemtoAnalysis.C", const char *configMacroParameters="" ) +{ +// Creates a proton analysis task and adds it to the analysis manager. + + // A. Get the pointer to the existing analysis manager via the static access method. + //============================================================================== + AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); + if (!mgr) { + Error("AddTaskFemto", "No analysis manager to connect to."); + return NULL; + } + + // B. Check the analysis type using the event handlers connected to the analysis + // manager. The availability of MC handler cann also be checked here. + //============================================================================== + if (!mgr->GetInputEventHandler()) { + ::Error("AddTaskFemto", "This task requires an input event handler"); + return NULL; + } + TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" + cout << "Found " <SetIncludePath("-I$ROOTSYS/include -I./PWG2AOD/AOD -I./PWG2femtoscopy/FEMTOSCOPY/AliFemto -I./PWG2femtoscopyUser/FEMTOSCOPY/AliFemtoUser -I$ALICE_ROOT/include"); + + if (TProofMgr::GetListOfManagers()->GetEntries()) { +// if (dynamic_cast gProof) { +// char *macrocommand[10000]; +// sprintf(macrocommand, ".L %s", configMacroName); +// gProof->Exec(macrocommand); +// } +// else + gProof->Load(configMacroName); + } + // gROOT->LoadMacro("ConfigFemtoAnalysis.C++"); + + AliAnalysisTaskFemto *taskfemto = new AliAnalysisTaskFemto("TaskFemto",configMacroName,configMacroParameters); + mgr->AddTask(taskfemto); + + // D. Configure the analysis task. Extra parameters can be used via optional + // arguments of the AddTaskXXX() function. + //=========================================================================== + + // E. Create ONLY the output containers for the data produced by the task. + // Get and connect other common input/output containers via the manager as below + //============================================================================== + TString outputfile = AliAnalysisManager::GetCommonFileName(); + outputfile += ":PWG2FEMTO"; + AliAnalysisDataContainer *cout_femto = mgr->CreateContainer("femtolist", TList::Class(), + AliAnalysisManager::kOutputContainer,outputfile); + + + mgr->ConnectInput(taskfemto, 0, mgr->GetCommonInputContainer()); + mgr->ConnectOutput(taskfemto, 0, cout_femto); + + // Return task pointer at the end + return taskfemto; +} -- 2.43.5