]>
Commit | Line | Data |
---|---|---|
099d8f33 | 1 | AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE) |
3ef9ce84 | 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) { | |
c85963a0 | 9 | ::Error("AddTaskESDFilter", "No analysis manager to connect to."); |
3ef9ce84 | 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")) { | |
c85963a0 | 18 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler."); |
3ef9ce84 | 19 | return NULL; |
20 | } | |
21 | // Check if AOD output handler exist. | |
22 | AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler(); | |
23 | if (!aod_h) { | |
c85963a0 | 24 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler."); |
3ef9ce84 | 25 | return NULL; |
099d8f33 | 26 | } |
27 | // Check if MC handler is connected in case kine filter requested | |
28 | AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler(); | |
29 | if (!mcH && useKineFilter) { | |
30 | ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested"); | |
31 | return NULL; | |
3ef9ce84 | 32 | } |
33 | ||
099d8f33 | 34 | // Filtering of MC particles (decays conversions etc) |
35 | // this task is also needed to set the MCEventHandler | |
36 | // to the AODHandler, this will not be needed when | |
37 | // AODHandler goes to ANALYSISalice | |
ee75cfc3 | 38 | AliAnalysisTaskMCParticleFilter *kinefilter = 0; |
099d8f33 | 39 | if (useKineFilter) { |
ee75cfc3 | 40 | kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter"); |
099d8f33 | 41 | mgr->AddTask(kinefilter); |
42 | } | |
43 | ||
3ef9ce84 | 44 | // Create the task, add it to the manager and configure it. |
099d8f33 | 45 | //=========================================================================== |
46 | // Barrel tracks filter | |
3ef9ce84 | 47 | AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter"); |
48 | mgr->AddTask(esdfilter); | |
099d8f33 | 49 | // Muons |
50 | AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter"); | |
51 | mgr->AddTask(esdmuonfilter); | |
52 | ||
53 | // Cuts on primary tracks | |
04f2cd11 | 54 | AliESDtrackCuts* esdTrackCutsL = new AliESDtrackCuts("Standard Track Cuts", "ESD Track Cuts"); |
099d8f33 | 55 | esdTrackCutsL->SetMinNClustersTPC(50); |
3ef9ce84 | 56 | esdTrackCutsL->SetMaxChi2PerClusterTPC(3.5); |
3ef9ce84 | 57 | esdTrackCutsL->SetRequireTPCRefit(kTRUE); |
80a77868 | 58 | esdTrackCutsL->SetMaxDCAToVertexXY(2.4); |
59 | esdTrackCutsL->SetMaxDCAToVertexZ(3.2); | |
099d8f33 | 60 | esdTrackCutsL->SetDCAToVertex2D(kTRUE); |
61 | esdTrackCutsL->SetRequireSigmaToVertex(kFALSE); | |
62 | esdTrackCutsL->SetAcceptKinkDaughters(kFALSE); | |
63 | // ITS stand-alone tracks | |
04f2cd11 | 64 | AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts"); |
099d8f33 | 65 | esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE); |
66 | ||
3ef9ce84 | 67 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); |
68 | trackFilter->AddCuts(esdTrackCutsL); | |
099d8f33 | 69 | trackFilter->AddCuts(esdTrackCutsITSsa); |
70 | ||
71 | // Cuts on V0s | |
04f2cd11 | 72 | AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts"); |
099d8f33 | 73 | esdV0Cuts->SetMinRadius(0.2); |
74 | esdV0Cuts->SetMaxRadius(100); | |
75 | esdV0Cuts->SetMinDcaPosToVertex(0.05); | |
76 | esdV0Cuts->SetMinDcaNegToVertex(0.05); | |
77 | esdV0Cuts->SetMaxDcaV0Daughters(0.5); | |
78 | esdV0Cuts->SetMinCosinePointingAngle(0.99); | |
79 | AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter"); | |
80 | v0Filter->AddCuts(esdV0Cuts); | |
81 | ||
3ef9ce84 | 82 | esdfilter->SetTrackFilter(trackFilter); |
099d8f33 | 83 | esdfilter->SetV0Filter(v0Filter); |
3ef9ce84 | 84 | |
85 | ||
86 | // Create ONLY the output containers for the data produced by the task. | |
87 | // Get and connect other common input/output containers via the manager as below | |
88 | //============================================================================== | |
89 | mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer()); | |
90 | mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer()); | |
099d8f33 | 91 | mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer()); |
92 | if (useKineFilter) { | |
93 | mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer()); | |
94 | mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer()); | |
a3b51fd2 | 95 | AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(), |
96 | AliAnalysisManager::kOutputContainer,"pyxsec_hists.root"); | |
84c04254 | 97 | mgr->ConnectOutput (kinefilter, 1,coutputEx); |
099d8f33 | 98 | } |
3ef9ce84 | 99 | return esdfilter; |
100 | } |