NetCharge task with HelperPID: sjena
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / macros / configureNetChargeTrackCut.C
1 AliESDtrackCuts *configureNetChargeTrackCut(Int_t cutMode, Double_t eta, Double_t ptl, Double_t pth) {
2
3   AliESDtrackCuts *trackCuts  = new AliESDtrackCuts("AliESDtrackCuts");
4   trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
5   // trackCuts->SetMinNCrossedRowsTPC(120);
6   // trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
7   trackCuts->SetMaxChi2PerClusterITS(36);
8   trackCuts->SetMaxFractionSharedTPCClusters(0.4);
9   trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
10   Double_t etal = -1*eta;
11   trackCuts->SetEtaRange(etal,eta);
12   trackCuts->SetPtRange(ptl, pth);
13   
14   // Extra
15   trackCuts->SetMinNClustersTPC(70);  
16   trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); 
17   trackCuts->SetRequireITSRefit(kTRUE);                                               // ITS 2010 
18   trackCuts->SetDCAToVertex2D(kFALSE);                                                // VertexConstrained  2010
19   trackCuts->SetRequireSigmaToVertex(kFALSE);                                         // VertexConstrained  2010
20   trackCuts->SetMaxDCAToVertexZ(4);             
21   
22
23
24
25
26
27
28
29
30
31   // TODO: Impliment the Marta's suggestion of Hybrid Like tracks
32
33
34   /*
35
36   // Taken from JET Configure task : 
37   // Magic is done by Marta
38
39   //
40   // Macro to create track cuts for PWG Jet analysis
41   // User can select a specific set by indicating cutMode
42   // cutMode has 8 digits: first 4 digits additional cuts, last 4 digits standard cuts
43   //                       additional cuts are variations of standard cuts (used for hybrid track selection and QA)
44   // Numbering starts from 1000 For standard and additional cut numbers
45
46   AliESDtrackCuts *trackCuts  = new AliESDtrackCuts("AliESDtrackCuts");
47
48   TString tag;
49
50   Int_t mod = 10000;
51
52   Bool_t bStdCutsDefined = kFALSE;
53
54
55   //_____________________________________________________________________
56   //                     STANDARD CUTS
57
58   //Get standard cuts: last 4 digits of cutMode
59   Int_t stdCutMode = cutMode%mod;
60
61   if(stdCutMode == 1000) {
62
63     bStdCutsDefined = kTRUE;
64
65     trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
66     trackCuts->SetMinNCrossedRowsTPC(120);
67     trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
68     trackCuts->SetMaxChi2PerClusterITS(36);
69     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
70     trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
71
72     trackCuts->SetEtaRange(-0.9,0.9);
73     trackCuts->SetPtRange(0.15, 1e10);
74
75     tag = "Global track RAA analysis QM2011 + Chi2ITS<36";
76
77   }
78
79   if(stdCutMode == 1001) {
80
81     bStdCutsDefined = kTRUE;
82
83     // TPC  
84     trackCuts->SetMinNClustersTPC(90);
85     trackCuts->SetMaxChi2PerClusterTPC(4);
86     trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
87     trackCuts->SetAcceptKinkDaughters(kFALSE);
88     trackCuts->SetRequireTPCRefit(kTRUE);
89     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
90     // ITS
91     trackCuts->SetRequireITSRefit(kTRUE);
92     //accept secondaries
93     trackCuts->SetMaxDCAToVertexXY(2.4);
94     trackCuts->SetMaxDCAToVertexZ(3.2);
95     trackCuts->SetDCAToVertex2D(kTRUE);
96     //reject fakes
97     trackCuts->SetMaxChi2PerClusterITS(36);
98
99     trackCuts->SetRequireSigmaToVertex(kFALSE);
100
101     trackCuts->SetEtaRange(-0.9,0.9);
102     trackCuts->SetPtRange(0.15, 100.);
103
104  
105     tag = "Global tracks jet analysis with ITSrefit and NclsIter1=90, noSPD requirement";
106
107   }
108
109   if(stdCutMode == 1002) {
110
111     bStdCutsDefined = kTRUE;
112
113     // TPC  
114     trackCuts->SetMinNClustersTPC(80);
115     trackCuts->SetMaxChi2PerClusterTPC(4);
116     trackCuts->SetAcceptKinkDaughters(kFALSE);
117     trackCuts->SetRequireTPCRefit(kTRUE);
118     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
119     // ITS
120     trackCuts->SetRequireITSRefit(kTRUE);
121     //accept secondaries
122     trackCuts->SetMaxDCAToVertexXY(2.4);
123     trackCuts->SetMaxDCAToVertexZ(3.2);
124     trackCuts->SetDCAToVertex2D(kTRUE);
125     //reject fakes
126     trackCuts->SetMaxChi2PerClusterITS(36);
127
128     trackCuts->SetRequireSigmaToVertex(kFALSE);
129
130     trackCuts->SetEtaRange(-0.9,0.9);
131     trackCuts->SetPtRange(0.15, 100.);
132
133  
134     tag = "Global tracks jet analysis with ITSrefit and Ncls=80, noSPD requirement";
135
136   }
137
138   if(stdCutMode == 1003) {
139
140     bStdCutsDefined = kTRUE;
141
142     // tight global tracks
143     trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE,1);
144     trackCuts->SetMinNClustersTPC(0);
145     trackCuts->SetMinNCrossedRowsTPC(120);
146     trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off
147     trackCuts->SetMaxDCAToVertexXY(2.4);
148     trackCuts->SetMaxDCAToVertexZ(3.2);
149     trackCuts->SetDCAToVertex2D(kTRUE);
150     trackCuts->SetMaxChi2PerClusterITS(36);
151     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
152
153     tag = "Global tracks ITSTPC2010 + NCrossedRows + loose ITS";
154
155   }
156   
157   if(stdCutMode == 1004) {
158
159     bStdCutsDefined = kTRUE;
160
161     // TPC  
162     trackCuts->SetMinNClustersTPC(70);
163     trackCuts->SetMaxChi2PerClusterTPC(4);
164     trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
165     trackCuts->SetAcceptKinkDaughters(kFALSE);
166     trackCuts->SetRequireTPCRefit(kTRUE);
167     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
168     // ITS
169     trackCuts->SetRequireITSRefit(kTRUE);
170     //accept secondaries
171     trackCuts->SetMaxDCAToVertexXY(2.4);
172     trackCuts->SetMaxDCAToVertexZ(3.2);
173     trackCuts->SetDCAToVertex2D(kTRUE);
174     //reject fakes
175     trackCuts->SetMaxChi2PerClusterITS(36);
176
177     trackCuts->SetRequireSigmaToVertex(kFALSE);
178
179     trackCuts->SetEtaRange(-0.9,0.9);
180     trackCuts->SetPtRange(0.15, 100.);
181  
182     tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement";
183
184   }
185   if(stdCutMode == 1005) {
186
187     bStdCutsDefined = kTRUE;
188
189     // TPC  
190     trackCuts->SetMinNClustersTPC(70);
191     trackCuts->SetMaxChi2PerClusterTPC(4);
192     trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
193     trackCuts->SetAcceptKinkDaughters(kFALSE);
194     trackCuts->SetRequireTPCRefit(kTRUE);
195     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
196     // ITS
197     trackCuts->SetRequireITSRefit(kTRUE);
198     //accept secondaries
199     trackCuts->SetMaxDCAToVertexXY(2.4);
200     trackCuts->SetMaxDCAToVertexZ(3.2);
201     trackCuts->SetDCAToVertex2D(kTRUE);
202     //reject fakes
203     trackCuts->SetMaxChi2PerClusterITS(36);
204
205     trackCuts->SetRequireSigmaToVertex(kFALSE);
206
207     trackCuts->SetEtaRange(-0.9,0.9);
208     trackCuts->SetPtRange(0.15, 1E+15.);
209  
210     tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement, no upper pt cut";
211
212   }
213   
214   if(stdCutMode == 1006) {
215
216     bStdCutsDefined = kTRUE;
217
218     // TPC  
219     TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
220     trackCuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
221     trackCuts->SetMinNClustersTPC(70);
222     trackCuts->SetMaxChi2PerClusterTPC(4);
223     trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
224     trackCuts->SetAcceptKinkDaughters(kFALSE);
225     trackCuts->SetRequireTPCRefit(kTRUE);
226     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
227     // ITS
228     trackCuts->SetRequireITSRefit(kTRUE);
229     //accept secondaries
230     trackCuts->SetMaxDCAToVertexXY(2.4);
231     trackCuts->SetMaxDCAToVertexZ(3.2);
232     trackCuts->SetDCAToVertex2D(kTRUE);
233     //reject fakes
234     trackCuts->SetMaxChi2PerClusterITS(36);
235     trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
236
237     trackCuts->SetRequireSigmaToVertex(kFALSE);
238
239     trackCuts->SetEtaRange(-0.9,0.9);
240     trackCuts->SetPtRange(0.15, 1E+15.);
241  
242     tag = "Global tracks jet analysis with ITSrefit and NclsIter1=PtDep, noSPD requirement, no upper pt cut, golden chi2";
243
244   }
245
246   if(stdCutMode == 1007) {
247     
248     bStdCutsDefined = kTRUE;
249     
250     trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1);
251     //accept secondaries
252     trackCuts->SetMaxDCAToVertexXY(2.4);
253     trackCuts->SetMaxDCAToVertexZ(3.2);
254     trackCuts->SetDCAToVertex2D(kTRUE);
255
256     //
257     trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
258
259     trackCuts->SetEtaRange(-0.9,0.9);
260     trackCuts->SetPtRange(0.15, 1E+15.);
261  
262     tag = "Global tracks with AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE)";
263
264   }
265
266   if(stdCutMode == 1008) {
267     
268     bStdCutsDefined = kTRUE;
269     
270     trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1);
271     //accept secondaries
272     trackCuts->SetMaxDCAToVertexXY(2.4);
273     trackCuts->SetMaxDCAToVertexZ(3.2);
274     trackCuts->SetDCAToVertex2D(kTRUE);
275
276     //
277     trackCuts->SetMaxChi2TPCConstrainedGlobal(36);
278     trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
279
280     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
281  
282     tag = "Global tracks 2011 with NCrossedRows cut";
283
284   }
285
286
287   if(stdCutMode == 2000) {
288
289     bStdCutsDefined = kTRUE;
290
291     // TPC  
292     trackCuts->SetMinNClustersTPC(90);
293     trackCuts->SetMaxChi2PerClusterTPC(4);
294     trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
295     trackCuts->SetAcceptKinkDaughters(kFALSE);
296     trackCuts->SetRequireTPCRefit(kTRUE);
297     trackCuts->SetMaxFractionSharedTPCClusters(0.4);
298     //accept secondaries
299     trackCuts->SetMaxDCAToVertexXY(2.4);
300     trackCuts->SetMaxDCAToVertexZ(3.2);
301     trackCuts->SetDCAToVertex2D(kTRUE);
302
303     trackCuts->SetRequireSigmaToVertex(kFALSE);
304
305     trackCuts->SetEtaRange(-0.9,0.9);
306     trackCuts->SetPtRange(0.15, 100.);
307
308  
309     tag = "Global tracks jet analysis, loose cuts, NClsIter1=90, no ITS requirements";
310
311   }
312
313   if(stdCutMode == 2001) {
314
315     bStdCutsDefined = kTRUE;
316
317     trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); 
318     // trackCuts->SetRequireTPCRefit(kTRUE);
319     trackCuts->SetMinNClustersTPC(70);
320
321     trackCuts->SetEtaRange(-0.9,0.9);
322     trackCuts->SetPtRange(0.15, 100.);
323
324  
325     tag = "TPConly track cuts, loose cuts, NCls=70, no ITS requirements";
326
327   }
328
329   if(stdCutMode == 2002) {
330
331     bStdCutsDefined = kTRUE;
332
333     trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); 
334     //  trackCuts->SetRequireTPCRefit(kTRUE);
335     trackCuts->SetMinNClustersTPC(0);
336     trackCuts->SetMinNCrossedRowsTPC(120);
337     trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off  
338
339     trackCuts->SetEtaRange(-0.9,0.9);
340     trackCuts->SetPtRange(0.15, 100.);
341
342  
343     tag = "TPConly track cuts, loose cuts, NCls=70, no ITS requirements";
344
345   }
346
347   if(!bStdCutsDefined) {
348     printf("last 4 digits do not represent a predefined set of standard cuts. Returning 0\n");
349     return 0;
350
351   }
352
353
354   //_____________________________________________________________________
355   //                     ADDITIONAL CUTS
356
357   //Get additional cut mode: first 4 digits of cutMode
358   Int_t addCutMode = (int)((float)cutMode/(float)mod);
359
360   if(addCutMode == 1000) {
361
362     trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
363  
364     tag += " + additonal: SPD any requirement";
365
366   }
367
368   if(addCutMode == 1001) {
369
370     trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
371  
372     tag += " + additional: w/o hits in SPD";
373
374   }
375
376   if(addCutMode == 1002) {
377
378     trackCuts->SetMaxChi2PerClusterITS(1E10);
379
380     tag += " + additional: maxITSChi2=1e10";
381
382   }
383
384   if(addCutMode == 1003) {
385
386     trackCuts->SetMinNClustersTPC(0);
387     trackCuts->SetMinNCrossedRowsTPC(0);
388     trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.);
389
390     tag += " + additional: minClusters=0 minCrossedRows=0 minCrossedRowsOverFindable=0";
391
392   }
393
394   if(addCutMode == 1004) {
395
396     trackCuts->SetRequireITSRefit(kFALSE);
397
398     tag += " + additional: ITSrefit=kFALSE";
399
400   }
401
402   if(addCutMode == 1005) {
403
404     trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
405  
406     tag += " + additional: no SPD requirement (kOff)";
407
408   }
409
410   Printf("Created track cuts for: %s", tag.Data());
411
412
413
414
415
416   */
417
418
419   return trackCuts;
420
421 }