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