1 AliAnalysisTaskESDMCLabelAddition *AddTaskESDMCLabelAddition(Bool_t useKineFilter=kTRUE)
3 // Creates a filter task and adds it to the analysis manager.
4 // This file allows the creation of MC labels (based on the code of Philippe P.)
6 // Get the pointer to the existing analysis manager via the static access method.
7 //==============================================================================
8 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10 ::Error("AddTaskESDMCLabelAddition", "No analysis manager to connect to.");
14 TString type = mgr->GetInputEventHandler()->GetDataType();
15 // Check if MC handler is connected in case kine filter requested
16 AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler();
17 if (!mcH && useKineFilter) {
18 ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested");
23 AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");
24 mgr->AddTask(kinefilter);
28 // Create the task, add it to the manager and configure it.
29 //===========================================================================
30 // Barrel tracks filter
31 AliAnalysisTaskESDMCLabelAddition *ESDMCLabeltask = new AliAnalysisTaskESDMCLabelAddition("ESD MC Labels addition");
32 mgr->AddTask(ESDMCLabeltask);
34 // Create ONLY the output containers for the data produced by the task.
35 // Get and connect other common input/output containers via the manager as below
36 //==============================================================================
37 mgr->ConnectInput (ESDMCLabeltask, 0, mgr->GetCommonInputContainer());
39 return ESDMCLabeltask;