add header files
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / TrackCuts.C
CommitLineData
6b91e8c0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// macro for a predefined set of track cuts
17// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
7aea16ca 19#if !defined(__CINT__) || defined(__MAKECINT__)
20#include <Riostream.h>
21#include <AliESDtrackCuts.h>
22#include <TString.h>
23#include "AliAnalysisTaskB2.h"
24#endif
25
6b91e8c0 26void AddNSigmaCuts(AliESDtrackCuts* trkCuts, Float_t maxNSigma=3)
27{
28//
29// nsigma cuts
30//
31 trkCuts->SetRequireSigmaToVertex(kTRUE);
32 trkCuts->SetMaxNsigmaToVertex(maxNSigma);
33}
34
35void AddDCACuts(AliESDtrackCuts* trkCuts, Float_t maxDCAxy=1.5, Float_t maxDCAz=2)
36{
37//
38// DCA cuts
39//
40 trkCuts->SetMaxDCAToVertexXY(maxDCAxy);
41 trkCuts->SetMaxDCAToVertexZ(maxDCAz);
42}
43
b3f10f7e 44AliESDtrackCuts* TrackCuts(AliAnalysisTaskB2* task, const TString& trksel, Double_t maxDCAxy, Double_t maxDCAz, Double_t maxNSigma, Bool_t xrows, Int_t minTPCnClsOrXRows, Double_t maxEta)
6b91e8c0 45{
46//
47// Create an AliESDtrackCuts from a predefined set
48//
49 AliESDtrackCuts* trkCuts = new AliESDtrackCuts("AliESDtrackCuts");
50
51 trkCuts->SetEtaRange(-maxEta, maxEta);
52 trkCuts->SetPtRange(0.15, 100.);
53 trkCuts->SetAcceptKinkDaughters(kFALSE);
54
55 // ITS
56 trkCuts->SetRequireITSRefit(kTRUE);
57 trkCuts->SetMinNClustersITS(2);
58 trkCuts->SetMaxChi2PerClusterITS(36);
59
60 // TPC
61 trkCuts->SetRequireTPCRefit(kTRUE);
b3f10f7e 62 if(xrows)
63 {
64 trkCuts->SetMinNCrossedRowsTPC(minTPCnClsOrXRows);
65 trkCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
66 }
67 else
68 {
69 trkCuts->SetMinNClustersTPC(minTPCnClsOrXRows);
70 }
6b91e8c0 71 trkCuts->SetMaxChi2PerClusterTPC(4.);
b3f10f7e 72 //trkCuts->SetMaxChi2TPCConstrainedGlobal(36);
6b91e8c0 73
b3f10f7e 74 TString tracksel = trksel;
6b91e8c0 75 tracksel.ToLower();
76
00c94a91 77 Int_t clusterCut = (xrows) ? 1 : 0;
78
6b91e8c0 79 if(tracksel == "its_tpc_nsigma")
80 {
81 AddNSigmaCuts(trkCuts, maxNSigma);
82 }
47bb775c 83 else if(tracksel == "its_tpc_nsigma_spd1")
6b91e8c0 84 {
85 AddNSigmaCuts(trkCuts, maxNSigma);
86 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
87 }
47bb775c 88 else if(tracksel == "its_tpc_nsigma_spd")
89 {
90 AddNSigmaCuts(trkCuts, maxNSigma);
91 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
92 }
6b91e8c0 93 else if(tracksel == "its_tpc_dca")
94 {
95 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
96 }
47bb775c 97 else if(tracksel == "its_tpc_dca_spd1")
6b91e8c0 98 {
99 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
100 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
101 }
47bb775c 102 else if(tracksel == "its_tpc_dca_spd")
103 {
104 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
105 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
106 }
6b91e8c0 107 else if(tracksel == "its_tpc_tof_nsigma")
108 {
109 AddNSigmaCuts(trkCuts, maxNSigma);
110 task->SetTOFmatch(1);
111 }
47bb775c 112 else if(tracksel == "its_tpc_tof_nsigma_spd1")
6b91e8c0 113 {
114 AddNSigmaCuts(trkCuts, maxNSigma);
115 task->SetTOFmatch(1);
116 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
117 }
47bb775c 118 else if(tracksel == "its_tpc_tof_nsigma_spd")
119 {
120 AddNSigmaCuts(trkCuts, maxNSigma);
121 task->SetTOFmatch(1);
122 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
123 }
6b91e8c0 124 else if(tracksel == "its_tpc_tof_dca")
125 {
126 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
127 task->SetTOFmatch(1);
128 }
47bb775c 129 else if(tracksel == "its_tpc_tof_dca_spd1")
6b91e8c0 130 {
131 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
132 task->SetTOFmatch(1);
133 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kFirst);
134 }
47bb775c 135 else if(tracksel == "its_tpc_tof_dca_spd")
136 {
137 AddDCACuts(trkCuts,maxDCAxy,maxDCAz);
138 task->SetTOFmatch(1);
139 trkCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
140 }
6b91e8c0 141 else if(tracksel == "std_its_tpc_2009") // pp data 2009
142 {
143 delete trkCuts;
7aea16ca 144 return AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(1);
6b91e8c0 145 }
6b91e8c0 146 else if(tracksel == "std_its_tpc_2010") // pp data 2010
147 {
148 delete trkCuts;
0e7094df 149 return AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(1, clusterCut);
6b91e8c0 150 }
b3f10f7e 151 else if(tracksel == "std_its_tpc_2011") // pp data 2011
152 {
153 delete trkCuts;
0e7094df 154 return AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(1, clusterCut);
b3f10f7e 155 }
6b91e8c0 156 else
157 {
158 std::cerr << "Warning: no track selection criteria selected" << std::endl;
159 }
160
161 return trkCuts;
162}