65e273c4 |
1 | |
2 | Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdFilter); |
3 | Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdFilter); |
4 | Bool_t enableTPCOnlyAODTracksLocalFlag=kFALSE; |
5 | |
6 | |
79bd4a7a |
7 | AliAnalysisTaskESDfilter *AddTaskESDFilter(Bool_t useKineFilter=kTRUE, |
8 | Bool_t writeMuonAOD=kFALSE, |
daf100e1 |
9 | Bool_t writeDimuonAOD=kFALSE, |
4354b266 |
10 | Bool_t usePhysicsSelection=kFALSE, |
bd625b5b |
11 | Bool_t useCentralityTask=kFALSE, /*obsolete*/ |
4354b266 |
12 | Int_t tofTimeZeroType=AliESDpid::kTOF_T0, |
13 | Bool_t enableTPCOnlyAODTracks=kFALSE, |
14 | Bool_t disableCascades=kFALSE, |
65e273c4 |
15 | Bool_t disableKinks=kFALSE, Int_t runFlag = 1100) |
3ef9ce84 |
16 | { |
65e273c4 |
17 | // Creates a filter task and adds it to the analysis manager. |
3ef9ce84 |
18 | // Get the pointer to the existing analysis manager via the static access method. |
19 | //============================================================================== |
20 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); |
21 | if (!mgr) { |
c85963a0 |
22 | ::Error("AddTaskESDFilter", "No analysis manager to connect to."); |
3ef9ce84 |
23 | return NULL; |
24 | } |
25 | |
26 | // This task requires an ESD input handler and an AOD output handler. |
27 | // Check this using the analysis manager. |
28 | //=============================================================================== |
29 | TString type = mgr->GetInputEventHandler()->GetDataType(); |
30 | if (!type.Contains("ESD")) { |
c85963a0 |
31 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an ESD input handler."); |
3ef9ce84 |
32 | return NULL; |
33 | } |
34 | // Check if AOD output handler exist. |
35 | AliAODHandler *aod_h = (AliAODHandler*)mgr->GetOutputEventHandler(); |
36 | if (!aod_h) { |
c85963a0 |
37 | ::Error("AddTaskESDFilter", "ESD filtering task needs the manager to have an AOD output handler."); |
3ef9ce84 |
38 | return NULL; |
099d8f33 |
39 | } |
40 | // Check if MC handler is connected in case kine filter requested |
41 | AliMCEventHandler *mcH = (AliMCEventHandler*)mgr->GetMCtruthEventHandler(); |
42 | if (!mcH && useKineFilter) { |
43 | ::Error("AddTaskESDFilter", "No MC handler connected while kine filtering requested"); |
44 | return NULL; |
3ef9ce84 |
45 | } |
46 | |
47 | // Create the task, add it to the manager and configure it. |
099d8f33 |
48 | //=========================================================================== |
49 | // Barrel tracks filter |
3ef9ce84 |
50 | AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter"); |
26917b0b |
51 | esdfilter->SetTimeZeroType(tofTimeZeroType); |
4354b266 |
52 | if (disableCascades) esdfilter->DisableCascades(); |
53 | if (disableKinks) esdfilter->DisableKinks(); |
c7ef1c47 |
54 | |
55 | mgr->AddTask(esdfilter); |
56 | |
099d8f33 |
57 | // Muons |
14d6fad5 |
58 | Bool_t onlyMuon=kTRUE; |
59 | Bool_t keepAllEvents=kTRUE; |
60 | Int_t mcMode=(useKineFilter ? 2 : 0); // use 1 instead of 2 to get all MC information instead of just ancestors of mu tracks |
61 | AliAnalysisTaskESDMuonFilter *esdmuonfilter = new AliAnalysisTaskESDMuonFilter("ESD Muon Filter",onlyMuon,keepAllEvents,mcMode); |
099d8f33 |
62 | mgr->AddTask(esdmuonfilter); |
daf100e1 |
63 | if(usePhysicsSelection){ |
0c6c629b |
64 | esdfilter->SelectCollisionCandidates(AliVEvent::kAny); |
65 | esdmuonfilter->SelectCollisionCandidates(AliVEvent::kAny); |
daf100e1 |
66 | } |
3827f93a |
67 | |
68 | // Filtering of MC particles (decays conversions etc) |
69 | // this task has to go AFTER all other filter tasks |
70 | // since it fills the AODMC array with all |
71 | // selected MC Particles, only this way we have the |
72 | // AODMCparticle information available for following tasks |
73 | AliAnalysisTaskMCParticleFilter *kinefilter = 0; |
74 | if (useKineFilter) { |
75 | kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter"); |
76 | mgr->AddTask(kinefilter); |
77 | } |
78 | |
65e273c4 |
79 | enableTPCOnlyAODTracksLocalFlag = enableTPCOnlyAODTracks; |
80 | if((runFlag/100)==10){ |
81 | AddTrackCutsLHC10h(esdfilter); |
82 | } |
83 | else { |
84 | // default 11h |
85 | AddTrackCutsLHC11h(esdfilter); |
86 | } |
87 | |
88 | // Filter with cuts on V0s |
89 | AliESDv0Cuts* esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts"); |
90 | esdV0Cuts->SetMinRadius(0.2); |
91 | esdV0Cuts->SetMaxRadius(200); |
92 | esdV0Cuts->SetMinDcaPosToVertex(0.05); |
93 | esdV0Cuts->SetMinDcaNegToVertex(0.05); |
94 | esdV0Cuts->SetMaxDcaV0Daughters(1.5); |
95 | esdV0Cuts->SetMinCosinePointingAngle(0.99); |
96 | AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter"); |
97 | v0Filter->AddCuts(esdV0Cuts); |
98 | |
99 | esdfilter->SetV0Filter(v0Filter); |
100 | |
101 | // Enable writing of Muon AODs |
102 | esdmuonfilter->SetWriteMuonAOD(writeMuonAOD); |
103 | |
104 | // Enable writing of Dimuon AODs |
105 | esdmuonfilter->SetWriteDimuonAOD(writeDimuonAOD); |
106 | |
107 | // Create ONLY the output containers for the data produced by the task. |
108 | // Get and connect other common input/output containers via the manager as below |
109 | //============================================================================== |
110 | mgr->ConnectInput (esdfilter, 0, mgr->GetCommonInputContainer()); |
111 | mgr->ConnectOutput (esdfilter, 0, mgr->GetCommonOutputContainer()); |
112 | mgr->ConnectInput (esdmuonfilter, 0, mgr->GetCommonInputContainer()); |
113 | if (useKineFilter) { |
114 | mgr->ConnectInput (kinefilter, 0, mgr->GetCommonInputContainer()); |
115 | mgr->ConnectOutput (kinefilter, 0, mgr->GetCommonOutputContainer()); |
116 | AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(), |
117 | AliAnalysisManager::kOutputContainer,"pyxsec_hists.root"); |
118 | mgr->ConnectOutput (kinefilter, 1,coutputEx); |
119 | } |
120 | return esdfilter; |
121 | } |
122 | |
123 | |
124 | |
125 | |
126 | Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdfilter){ |
127 | |
128 | Printf("%s%d: Creating Track Cuts for LH10h",(char*)__FILE__,__LINE__); |
129 | |
130 | // Cuts on primary tracks |
131 | AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
132 | |
133 | // ITS stand-alone tracks |
134 | AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts"); |
135 | esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE); |
136 | |
137 | // Pixel OR necessary for the electrons |
138 | AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS"); |
139 | itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); |
140 | |
141 | |
142 | // PID for the electrons |
143 | AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts"); |
144 | electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.); |
145 | |
146 | // tighter cuts on primary particles for high pT tracks |
147 | // take the standard cuts, which include already |
148 | // ITSrefit and use only primaries... |
149 | |
150 | // ITS cuts for new jet analysis |
151 | // gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C"); |
152 | // AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006); |
153 | |
154 | AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts"); |
155 | |
156 | TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x"); |
157 | jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.); |
158 | jetCuts1006->SetMinNClustersTPC(70); |
159 | jetCuts1006->SetMaxChi2PerClusterTPC(4); |
160 | jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 |
161 | jetCuts1006->SetAcceptKinkDaughters(kFALSE); |
162 | jetCuts1006->SetRequireTPCRefit(kTRUE); |
163 | jetCuts1006->SetMaxFractionSharedTPCClusters(0.4); |
164 | // ITS |
165 | jetCuts1006->SetRequireITSRefit(kTRUE); |
166 | //accept secondaries |
167 | jetCuts1006->SetMaxDCAToVertexXY(2.4); |
168 | jetCuts1006->SetMaxDCAToVertexZ(3.2); |
169 | jetCuts1006->SetDCAToVertex2D(kTRUE); |
170 | //reject fakes |
171 | jetCuts1006->SetMaxChi2PerClusterITS(36); |
172 | jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36); |
173 | |
174 | jetCuts1006->SetRequireSigmaToVertex(kFALSE); |
175 | |
176 | jetCuts1006->SetEtaRange(-0.9,0.9); |
177 | jetCuts1006->SetPtRange(0.15, 1E+15.); |
178 | |
179 | AliESDtrackCuts* esdTrackCutsHG0 = jetCuts1006->Clone("JetCuts10001006"); |
180 | esdTrackCutsHG0->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); |
181 | |
182 | |
183 | // throw out tracks with too low number of clusters in |
184 | // the first pass (be consistent with TPC only tracks) |
185 | // N.B. the number off crossed rows still acts on the tracks after |
186 | // all iterations if we require tpc standalone, number of clusters |
187 | // and chi2 TPC cuts act on track after the first iteration |
188 | // esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE); |
189 | // esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass |
190 | |
191 | |
192 | // the complement to the one with SPD requirement |
193 | // AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006); |
194 | AliESDtrackCuts* esdTrackCutsHG1 = jetCuts1006->Clone("JetCuts10011006"); |
195 | esdTrackCutsHG1->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); |
196 | |
197 | // the tracks that must not be taken pass this cut and |
198 | // non HGC1 and HG |
199 | // AliESDtrackCuts* esdTrackCutsHG2 = CreateTrackCutsPWGJE(10021006); |
200 | AliESDtrackCuts* esdTrackCutsHG2 = jetCuts1006->Clone("JetCuts10021006"); |
201 | esdTrackCutsHG2->SetMaxChi2PerClusterITS(1E10); |
202 | |
203 | |
204 | // standard cuts also used in R_AA analysis |
205 | // "Global track RAA analysis QM2011 + Chi2ITS<36"; |
206 | // AliESDtrackCuts* esdTrackCutsH2 = CreateTrackCutsPWGJE(1000); |
207 | AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1); |
208 | esdTrackCutsH2->SetMinNCrossedRowsTPC(120); |
209 | esdTrackCutsH2->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8); |
210 | esdTrackCutsH2->SetMaxChi2PerClusterITS(36); |
211 | esdTrackCutsH2->SetMaxFractionSharedTPCClusters(0.4); |
212 | esdTrackCutsH2->SetMaxChi2TPCConstrainedGlobal(36); |
213 | |
214 | esdTrackCutsH2->SetEtaRange(-0.9,0.9); |
215 | esdTrackCutsH2->SetPtRange(0.15, 1e10); |
216 | |
217 | |
218 | // AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006); |
219 | AliESDtrackCuts* esdTrackCutsGCOnly = jetCuts1006->Clone("JetCuts10041006"); |
220 | esdTrackCutsGCOnly->SetRequireITSRefit(kFALSE); |
221 | |
222 | |
223 | |
224 | // TPC only tracks |
225 | AliESDtrackCuts* esdTrackCutsTPCCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
226 | esdTrackCutsTPCCOnly->SetMinNClustersTPC(70); |
227 | |
228 | // Compose the filter |
229 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); |
230 | // 1, 1<<0 |
231 | trackFilter->AddCuts(esdTrackCutsL); |
232 | // 2 1<<1 |
233 | trackFilter->AddCuts(esdTrackCutsITSsa); |
234 | // 4 1<<2 |
235 | trackFilter->AddCuts(itsStrong); |
236 | itsStrong->SetFilterMask(1); // AND with Standard track cuts |
237 | // 8 1<<3 |
238 | trackFilter->AddCuts(electronID); |
239 | electronID->SetFilterMask(4); // AND with Pixel Cuts |
240 | // 16 1<<4 |
241 | trackFilter->AddCuts(esdTrackCutsHG0); |
242 | // 32 1<<5 |
243 | trackFilter->AddCuts(esdTrackCutsHG1); |
244 | // 64 1<<6 |
245 | trackFilter->AddCuts(esdTrackCutsHG2); |
246 | // 128 1<<7 |
247 | trackFilter->AddCuts(esdTrackCutsTPCCOnly); // add QM TPC only track cuts |
248 | if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128); |
249 | // 256 1<<8 |
250 | trackFilter->AddCuts(esdTrackCutsGCOnly); |
251 | // 512 1<<9 |
252 | AliESDtrackCuts* esdTrackCutsHG1_tmp = new AliESDtrackCuts(*esdTrackCutsHG1); // avoid double delete |
253 | trackFilter->AddCuts(esdTrackCutsHG1_tmp); // add once more for tpc only tracks |
254 | // 1024 1<<10 |
255 | trackFilter->AddCuts(esdTrackCutsH2); // add r_aa cuts |
256 | |
257 | |
258 | |
259 | esdfilter->SetGlobalConstrainedFilterMask(1<<8|1<<9); // these tracks are written out as global constrained tracks |
260 | esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<4)); // these normal global tracks will be marked as hybrid |
d8831c42 |
261 | esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement |
65e273c4 |
262 | // esdfilter->SetTPCConstrainedFilterMask(1<<11); // these tracks are written out as tpc constrained tracks |
263 | |
264 | esdfilter->SetTrackFilter(trackFilter); |
265 | return kTRUE; |
266 | |
267 | } |
268 | |
269 | |
270 | |
271 | Bool_t AddTrackCutsLHC11h(AliAnalysisTaskESDfilter* esdfilter){ |
272 | |
273 | |
274 | Printf("%s%d: Creating Track Cuts LHC11h",(char*)__FILE__,__LINE__); |
275 | |
276 | // Cuts on primary tracks |
31a3bbb0 |
277 | AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
a550fcbd |
278 | |
099d8f33 |
279 | // ITS stand-alone tracks |
04f2cd11 |
280 | AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts"); |
31a3bbb0 |
281 | esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE); |
099d8f33 |
282 | |
a550fcbd |
283 | // Pixel OR necessary for the electrons |
284 | AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS"); |
285 | itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); |
286 | |
287 | |
288 | // PID for the electrons |
289 | AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts"); |
290 | electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.); |
291 | |
103431ad |
292 | // standard cuts with very loose DCA |
0914b519 |
293 | AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE); |
cfd26fc5 |
294 | esdTrackCutsH->SetMaxDCAToVertexXY(2.4); |
295 | esdTrackCutsH->SetMaxDCAToVertexZ(3.2); |
296 | esdTrackCutsH->SetDCAToVertex2D(kTRUE); |
cfd26fc5 |
297 | |
103431ad |
298 | // standard cuts with tight DCA cut |
0914b519 |
299 | AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(); |
103431ad |
300 | |
301 | // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster |
302 | // tracks selected by this cut are exclusive to those selected by the previous cut |
0914b519 |
303 | AliESDtrackCuts* esdTrackCutsH3 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(); |
103431ad |
304 | esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); |
305 | esdTrackCutsH3->SetClusterRequirementITS(AliESDtrackCuts::kSDD, AliESDtrackCuts::kFirst); |
cfd26fc5 |
306 | |
4dae02e3 |
307 | // TPC only tracks: Optionally enable the writing of TPConly information |
308 | // constrained to SPD vertex in the filter below |
309 | AliESDtrackCuts* esdTrackCutsTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
b7cce158 |
310 | // The following line is needed for 2010 PbPb reprocessing and pp, but not for 2011 PbPb |
311 | //esdTrackCutsTPCOnly->SetMinNClustersTPC(70); |
a550fcbd |
312 | |
0914b519 |
313 | // Extra cuts for hybrids |
314 | // first the global tracks we want to take |
315 | AliESDtrackCuts* esdTrackCutsHTG = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE); |
316 | esdTrackCutsHTG->SetName("Global Hybrid tracks, loose DCA"); |
317 | esdTrackCutsHTG->SetMaxDCAToVertexXY(2.4); |
318 | esdTrackCutsHTG->SetMaxDCAToVertexZ(3.2); |
319 | esdTrackCutsHTG->SetDCAToVertex2D(kTRUE); |
320 | esdTrackCutsHTG->SetMaxChi2TPCConstrainedGlobal(36); |
321 | |
322 | // Than the complementary tracks which will be stored as global |
323 | // constraint, complement is done in the ESDFilter task |
324 | AliESDtrackCuts* esdTrackCutsHTGC = new AliESDtrackCuts(*esdTrackCutsHTG); |
325 | esdTrackCutsHTGC->SetName("Global Constraint Hybrid tracks, loose DCA no it requirement"); |
326 | esdTrackCutsHTGC->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kOff); |
50a15d74 |
327 | esdTrackCutsHTGC->SetRequireITSRefit(kFALSE); |
0914b519 |
328 | |
ba206921 |
329 | // standard cuts with tight DCA cut, using cluster cut instead of crossed rows (a la 2010 default) |
330 | AliESDtrackCuts* esdTrackCutsH2Cluster = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE, 0); |
331 | |
a550fcbd |
332 | // Compose the filter |
3ef9ce84 |
333 | AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter"); |
0914b519 |
334 | // 1, 1<<0 |
3ef9ce84 |
335 | trackFilter->AddCuts(esdTrackCutsL); |
0914b519 |
336 | // 2, 1<<1 |
099d8f33 |
337 | trackFilter->AddCuts(esdTrackCutsITSsa); |
0914b519 |
338 | // 4, 1<<2 |
a550fcbd |
339 | trackFilter->AddCuts(itsStrong); |
340 | itsStrong->SetFilterMask(1); // AND with Standard track cuts |
0914b519 |
341 | // 8, 1<<3 |
a550fcbd |
342 | trackFilter->AddCuts(electronID); |
343 | electronID->SetFilterMask(4); // AND with Pixel Cuts |
0914b519 |
344 | // 16, 1<<4 |
cfd26fc5 |
345 | trackFilter->AddCuts(esdTrackCutsH); |
0914b519 |
346 | // 32, 1<<5 |
103431ad |
347 | trackFilter->AddCuts(esdTrackCutsH2); |
0914b519 |
348 | // 64, 1<<6 |
103431ad |
349 | trackFilter->AddCuts(esdTrackCutsH3); |
4dae02e3 |
350 | // 128 , 1 << 7 |
351 | trackFilter->AddCuts(esdTrackCutsTPCOnly); |
65e273c4 |
352 | if(enableTPCOnlyAODTracksLocalFlag)esdfilter->SetTPCOnlyFilterMask(128); |
0914b519 |
353 | // 256, 1 << 8 Global Hybrids |
354 | trackFilter->AddCuts(esdTrackCutsHTG); |
355 | esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<8)); // these normal global tracks will be marked as hybrid |
356 | // 512, 1<< 9 GlobalConstraint Hybrids |
357 | trackFilter->AddCuts(esdTrackCutsHTGC); |
358 | esdfilter->SetGlobalConstrainedFilterMask(1<<9); // these tracks are written out as global constrained tracks |
359 | esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement |
8b47ec90 |
360 | // 1024, 1<< 10 // tight DCA cuts |
ba206921 |
361 | trackFilter->AddCuts(esdTrackCutsH2Cluster); |
3ef9ce84 |
362 | esdfilter->SetTrackFilter(trackFilter); |
3ef9ce84 |
363 | |
65e273c4 |
364 | return kTRUE; |
365 | |
366 | } |