Resolving the symbols in each library
[u/mrichter/AliRoot.git] / ANALYSIS / examples / AddTaskProducer.C
1 TaskProducer *AddTaskProducer(const char *name)
2 {
3         // pointer to the analysis manager
4         AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5         if (!mgr) {
6                 Error("AddTaskProducer", "No analysis manager to connect to.");
7                 return NULL;
8         }  
9         // create the task
10    TaskProducer *task = new TaskProducer(name);
11    mgr->AddTask(task);
12
13         // connecting the input/output containers
14    TString outfile = mgr->GetCommonFileName();
15    // input data feed
16         AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
17         mgr->ConnectInput (task, 0, cinput0 );
18    // producer output
19         AliAnalysisDataContainer *coutput1  = mgr->CreateContainer(
20                 TString::Format("output_%s", name),
21                 TList::Class(), AliAnalysisManager::kOutputContainer,
22                 TString::Format("%s:output",outfile.Data()));
23         mgr->ConnectOutput(task, 1, coutput1);
24    // exchange output
25         AliAnalysisDataContainer *coutput2  = mgr->CreateContainer(
26                 TString::Format("exchange_%s", name),
27                 TObjArray::Class(), AliAnalysisManager::kExchangeContainer);
28    mgr->ConnectOutput(task, 2, coutput2);
29    return task;
30 }
31      
32