]>
Commit | Line | Data |
---|---|---|
ebad39a9 | 1 | |
2a7c86bc | 2 | |
ebad39a9 | 3 | AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE, |
4 | Bool_t writeMuonAOD=kFALSE, | |
5 | Bool_t writeDimuonAOD=kFALSE, | |
6 | Bool_t usePhysicsSelection=kFALSE) | |
7 | { | |
8 | // Creates a filter task and adds it to the analysis manager. | |
9 | ||
10 | // Get the pointer to the existing analysis manager via the static access method. | |
11 | //============================================================================== | |
12 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
13 | if (!mgr) { | |
14 | ::Error("AddTaskESDFilter", "No analysis manager to connect to."); | |
15 | return NULL; | |
16 | } | |
17 | ||
18 | // This task requires an ESD input handler and an AOD output handler. | |
19 | // Check this using the analysis manager. | |
20 | //=============================================================================== | |
21 | TString type = mgr->GetInputEventHandler()->GetDataType(); | |
22 | if (!type.Contains("ESD")) { | |
23 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler."); | |
24 | return NULL; | |
25 | } | |
26 | // Check if AOD output handler exist. | |
27 | AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler(); | |
28 | if (!aod_h) { | |
29 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler."); | |
30 | return NULL; | |
31 | } | |
32 | // Check if MC handler is connected in case kine filter requested | |
33 | AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler(); | |
34 | if (!mcH && useKineFilter) { | |
35 | ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested"); | |
36 | return NULL; | |
37 | } | |
38 | ||
39 | // Create the task, add it to the manager and configure it. | |
40 | //=========================================================================== | |
41 | // Barrel tracks filter | |
42 | AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter"); | |
3095177c | 43 | |
44 | // Make the AOD a little bit lighter and filtering faster | |
45 | ||
46 | esdfilter->DisableCascades(); | |
47 | // esdfilter->DisableV0s(); | |
48 | esdfilter->DisableKinks(); | |
49 | // esdfilter->DisableTracks(); | |
50 | esdfilter->DisablePmdClusters(); | |
51 | // esdfilter->DisableCaloClusters(); | |
52 | // esdfilter->DisableCells(); | |
53 | esdfilter->DisableTracklets(); | |
54 | ||
55 | ||
ebad39a9 | 56 | mgr->AddTask(esdfilter); |
57 | // Muons | |
48602d36 | 58 | // AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter"); |
59 | // mgr->AddTask(esdmuonfilter); | |
ebad39a9 | 60 | if(usePhysicsSelection){ |
61 | esdfilter->SelectCollisionCandidates(AliVEvent::kAny); | |
48602d36 | 62 | // esdmuonfilter->SelectCollisionCandidates(AliVEvent::kAny); |
ebad39a9 | 63 | } |
64 | ||
65 | // Filtering of MC particles (decays conversions etc) | |
66 | // this task has to go AFTER all other filter tasks | |
67 | // since it fills the AODMC array with all | |
68 | // selected MC Particles, only this way we have the | |
69 | // AODMCparticle information available for following tasks | |
70 | AliAnalysisTaskMCParticleFilter *kinefilter = 0; | |
71 | if (useKineFilter) { | |
72 | kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter"); | |
48602d36 | 73 | if(usePhysicsSelection)kinefilter->SelectCollisionCandidates(AliVEvent::kAny); |
ebad39a9 | 74 | mgr->AddTask(kinefilter); |
75 | } | |
76 | ||
77 | // Cuts on primary tracks | |
78 | AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
79 | ||
80 | // ITS stand-alone tracks | |
81 | AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts"); | |
82 | esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE); | |
83 | ||
84 | // Pixel OR necessary for the electrons | |
85 | AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS"); | |
86 | itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); | |
87 | ||
88 | ||
89 | // PID for the electrons | |
90 | AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts"); | |
91 | electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.); | |
92 | ||
93 | // tighter cuts on primary particles for high pT tracks | |
94 | // take the standard cuts, which include already | |
95 | // ITSrefit and use only primaries... | |
3456f527 | 96 | |
2a7c86bc | 97 | // loose DCA cuts, tight |
98 | AliESDtrackCuts* esdTrackCutsH0 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE,1); | |
99 | ||
100 | esdTrackCutsH0->SetMinNCrossedRowsTPC(120); | |
101 | esdTrackCutsH0->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switsches it off | |
102 | esdTrackCutsH0->SetMaxDCAToVertexXY(2.4); | |
103 | esdTrackCutsH0->SetMaxDCAToVertexZ(3.2); | |
104 | esdTrackCutsH0->SetDCAToVertex2D(kTRUE); | |
105 | esdTrackCutsH0->SetMaxChi2PerClusterITS(32); | |
106 | esdTrackCutsH0->SetPtRange(0.15,1E10); | |
c3ff0a6e | 107 | // switch off ITS cluster requirment as well |
108 | esdTrackCutsH0->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff); | |
109 | // | |
110 | esdTrackCutsH0->SetMaxFractionSharedTPCClusters(0.4); | |
111 | // throw out tracks with too low number of clusters in | |
112 | // the first pass (be consistent with TPC only tracks) | |
113 | // N.B. the number off crossed rows still acts on the tracks after | |
114 | // all iterations if we require tpc standalone, number of clusters | |
115 | // and chi2 TPC cuts act on track after the first iteration | |
116 | esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE); | |
117 | esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass | |
118 | ||
2a7c86bc | 119 | |
120 | // | |
121 | AliESDtrackCuts* esdTrackCutsH1 = new AliESDtrackCuts(*esdTrackCutsH0); | |
122 | esdTrackCutsH1->SetName("loose ITS fake cuts"); | |
123 | esdTrackCutsH1->SetMaxChi2PerClusterITS(1E10); | |
124 | ||
3456f527 | 125 | |
126 | // standard cuts with tight DCA cut | |
127 | AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); | |
f4132e7d | 128 | esdTrackCutsH2->SetPtRange(0.15,1E10); |
3456f527 | 129 | |
130 | // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster | |
131 | // tracks selected by this cut are exclusive to those selected by the previous cut | |
132 | AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); | |
133 | esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); | |
134 | esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst); | |
58a3693a | 135 | |
070f06d2 | 136 | // TPC only tracks |
137 | AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
2a7c86bc | 138 | // esdTrackCutsTPCOnly->SetMinNClustersTPC(70); |
139 | esdTrackCutsTPCOnly->SetMinNCrossedRowsTPC(120); | |
140 | esdTrackCutsTPCOnly->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off | |
c3ff0a6e | 141 | esdTrackCutsTPCOnly->SetMaxFractionSharedTPCClusters(0.4); |
142 | // throw out tracks with too low number of clusters in | |
143 | // the first pass | |
144 | // N.B. the number off crossed rows still acts on the tracks after | |
145 | // all iterations if we require tpc standalone, number of clusters | |
146 | // and chi2 TPC cuts act on track after the first iteration | |
147 | esdTrackCutsTPCOnly->SetRequireTPCStandAlone(kTRUE); | |
148 | esdTrackCutsTPCOnly->SetMinNClustersTPC(80); // <--- first pass | |
149 | ||
150 | ||
070f06d2 | 151 | |
ebad39a9 | 152 | // Compose the filter |
153 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); | |
39e7e8ab | 154 | // 1, 1<<0 |
ebad39a9 | 155 | trackFilter->AddCuts(esdTrackCutsL); |
39e7e8ab | 156 | // 2 1<<1 |
ebad39a9 | 157 | trackFilter->AddCuts(esdTrackCutsITSsa); |
39e7e8ab | 158 | // 4 1<<2 |
ebad39a9 | 159 | trackFilter->AddCuts(itsStrong); |
160 | itsStrong->SetFilterMask(1); // AND with Standard track cuts | |
39e7e8ab | 161 | // 8 1<<3 |
ebad39a9 | 162 | trackFilter->AddCuts(electronID); |
163 | electronID->SetFilterMask(4); // AND with Pixel Cuts | |
39e7e8ab | 164 | // 16 1<<4 |
2a7c86bc | 165 | trackFilter->AddCuts(esdTrackCutsH0); |
39e7e8ab | 166 | // 32 1<<5 |
2a7c86bc | 167 | trackFilter->AddCuts(esdTrackCutsH1); |
39e7e8ab | 168 | // 64 1<<6 |
2a7c86bc | 169 | trackFilter->AddCuts(esdTrackCutsH2); |
39e7e8ab | 170 | // 128 1<<7 |
2a7c86bc | 171 | trackFilter->AddCuts(esdTrackCutsH3); |
070f06d2 | 172 | // 256 1<<8 |
173 | trackFilter->AddCuts(esdTrackCutsTPCOnly); | |
2a7c86bc | 174 | // 512 1<<9 |
175 | trackFilter->AddCuts(esdTrackCutsH0); // add once more for tpc only tracks | |
176 | // 1024 1<<10 | |
177 | trackFilter->AddCuts(esdTrackCutsH1); // add once more for tpc only tracks | |
178 | ||
179 | esdfilter->SetTPCOnlyFilterMask((1<<8)|(1<<9)); // these tracks are written out as TPC only | |
180 | esdfilter->SetHybridFilterMaskITSTPC((1<<4)|(1<<5)); // these global tracks will be marked has hybrid | |
181 | esdfilter->SetHybridFilterMasksTPC(1<<9,1<<10); // arg0, these tpc tracks will be marked as TPC hybrid, in addtion to thos that fail arg1 | |
182 | ||
183 | ||
ebad39a9 | 184 | // Filter with cuts on V0s |
185 | AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts"); | |
186 | esdV0Cuts->SetMinRadius(0.2); | |
187 | esdV0Cuts->SetMaxRadius(200); | |
188 | esdV0Cuts->SetMinDcaPosToVertex(0.05); | |
189 | esdV0Cuts->SetMinDcaNegToVertex(0.05); | |
190 | esdV0Cuts->SetMaxDcaV0Daughters(1.5); | |
191 | esdV0Cuts->SetMinCosinePointingAngle(0.99); | |
192 | AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter"); | |
070f06d2 | 193 | v0Filter->AddCuts(esdV0Cuts); |
ebad39a9 | 194 | |
195 | esdfilter->SetTrackFilter(trackFilter); | |
070f06d2 | 196 | esdfilter->SetV0Filter(v0Filter); |
ebad39a9 | 197 | |
198 | // Enable writing of Muon AODs | |
48602d36 | 199 | // esdmuonfilter->SetWriteMuonAOD(writeMuonAOD); |
ebad39a9 | 200 | |
201 | // Enable writing of Dimuon AODs | |
48602d36 | 202 | // esdmuonfilter->SetWriteDimuonAOD(writeDimuonAOD); |
ebad39a9 | 203 | |
204 | // Create ONLY the output containers for the data produced by the task. | |
205 | // Get and connect other common input/output containers via the manager as below | |
206 | //============================================================================== | |
207 | ||
208 | mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer()); | |
209 | mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer()); | |
210 | ||
211 | ||
212 | // mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer()); | |
213 | if (useKineFilter) { | |
214 | mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer()); | |
215 | mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer()); | |
216 | AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(), | |
217 | AliAnalysisManager::kOutputContainer,"pyxsec_hists.root"); | |
218 | mgr->ConnectOutput (kinefilter, 1,coutputEx); | |
219 | } | |
220 | return esdfilter; | |
221 | } | |
222 |