]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG3/muondep/AddTaskESDMCLabelAddition.C
Fixing an error in the computation of the efficiency of a whole chamber (Matthieu)
[u/mrichter/AliRoot.git] / PWG3 / muondep / AddTaskESDMCLabelAddition.C
... / ...
CommitLineData
1AliAnalysisTaskESDMCLabelAddition *AddTaskESDMCLabelAddition(Bool_t useKineFilter=kTRUE)
2{
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.)
5
6 // Get the pointer to the existing analysis manager via the static access method.
7 //==============================================================================
8 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 if (!mgr) {
10 ::Error("AddTaskESDMCLabelAddition", "No analysis manager to connect to.");
11 return NULL;
12 }
13
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");
19 return NULL;
20 }
21
22 if (useKineFilter) {
23 AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");
24 mgr->AddTask(kinefilter);
25 }
26
27
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);
33
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());
38
39 return ESDMCLabeltask;
40}