]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ANALYSIS/macros/AddTaskESDFilter.C
Added like-sign 3Prong
[u/mrichter/AliRoot.git] / ANALYSIS / macros / AddTaskESDFilter.C
... / ...
CommitLineData
1AliAnalysisTaskESDfilter *AddTaskESDFilter()
2{
3// Creates a filter task and adds it to the analysis manager.
4
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8 if (!mgr) {
9 ::Error("AddTaskESDFilter", "No analysis manager to connect to.");
10 return NULL;
11 }
12
13 // This task requires an ESD input handler and an AOD output handler.
14 // Check this using the analysis manager.
15 //===============================================================================
16 TString type = mgr->GetInputEventHandler()->GetDataType();
17 if (!type.Contains("ESD")) {
18 ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler.");
19 return NULL;
20 }
21 // Check if AOD output handler exist.
22 AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler();
23 if (!aod_h) {
24 ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler.");
25 return NULL;
26 }
27
28 // Create the task, add it to the manager and configure it.
29 //===========================================================================
30
31 // Set of cuts plugged into the ESD filter
32 AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
33 mgr->AddTask(esdfilter);
34 AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("AliESDtrackCuts", "Loose");
35 esdTrackCutsL->SetMinNClustersTPC(50);
36 esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5);
37 esdTrackCutsL->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);
38 esdTrackCutsL->SetRequireTPCRefit(kTRUE);
39 esdTrackCutsL->SetMinNsigmaToVertex(3);
40 esdTrackCutsL->SetRequireSigmaToVertex(kTRUE);
41 esdTrackCutsL->SetAcceptKingDaughters(kFALSE);
42 //
43 AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
44 trackFilter->AddCuts(esdTrackCutsL);
45 //
46 esdfilter->SetTrackFilter(trackFilter);
47 esdfilter->SetDebugLevel(10);
48
49
50 // Create ONLY the output containers for the data produced by the task.
51 // Get and connect other common input/output containers via the manager as below
52 //==============================================================================
53 mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer());
54 mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer());
55 return esdfilter;
56}
57