]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/macros/makeTFile4CutsLctoV0bachelor.C
New methods for tagging decay channels
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / makeTFile4CutsLctoV0bachelor.C
CommitLineData
992ba7d8 1#include <Riostream.h>
2#include <TFile.h>
3#include <AliRDHFCutsLctoV0.h>
4#include <AliAODPidHF.h>
5#include <TClonesArray.h>
6#include <TParameter.h>
7#include <TF1.h>
8
9
10//Use:
11//Set hard coded commentet with //set this!!
12// root[] .L makeInput...C++
13// root[] makeInputAliAnalysisTaskSE...()
14//similar macros for D mesons as well as for Lc->3prongs
15
16//Author: Annalisa De Caro - decaro@sa.infn.it
17
18
19//macro to make a .root file which contains an AliRDHFCutsLctoV0 for AliAnalysisTaskSELc2pK0S task
20
21void makeInputAliAnalysisTaskSELctoV0bachelor(){
22
23 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
24 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
25 //default
26 esdTrackCuts->SetRequireTPCRefit(kTRUE);
27 esdTrackCuts->SetRequireITSRefit(kTRUE);
60ea16ec 28 esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
992ba7d8 29 esdTrackCuts->SetMinNClustersTPC(70);
60ea16ec 30 //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
31 // AliESDtrackCuts::kAny);
992ba7d8 32 // default is kBoth, otherwise kAny
33 esdTrackCuts->SetMinDCAToVertexXY(0.);
ff12b981 34 esdTrackCuts->SetPtRange(0.,1.e10);
a578b2da 35 esdTrackCuts->SetEtaRange(-0.8,0.8);
60ea16ec 36 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
992ba7d8 37
e7af8919 38
e7af8919 39 AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
40 esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
41 //default
42 esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
60ea16ec 43 esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//kTRUE);
44 esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
e7af8919 45 esdTrackCutsV0daughters->SetMinNClustersTPC(70);
60ea16ec 46 //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
47 // AliESDtrackCuts::kAny);
e7af8919 48 // default is kBoth, otherwise kAny
49 esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
50 esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
a578b2da 51 esdTrackCutsV0daughters->SetEtaRange(-0.8,0.8);
60ea16ec 52 esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
e7af8919 53
992ba7d8 54 AliRDHFCutsLctoV0* RDHFLctoV0An=new AliRDHFCutsLctoV0();
55 RDHFLctoV0An->SetName("LctoV0AnalysisCuts");
56 RDHFLctoV0An->SetTitle("Analysis cuts for Lc analysis");
60b29186 57 RDHFLctoV0An->SetKinkRejection(!esdTrackCuts->GetAcceptKinkDaughters());
992ba7d8 58 RDHFLctoV0An->AddTrackCuts(esdTrackCuts);
e7af8919 59 RDHFLctoV0An->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
60b29186 60 RDHFLctoV0An->SetUseTrackSelectionWithFilterBits(kTRUE);
a578b2da 61 RDHFLctoV0An->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
60ea16ec 62 // 1 -> if (TOF) TOF else TPC w veto
a578b2da 63 // 2 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else (p>=2.5) {if (TOF) -2s<TOF<3s AND TPC@3s}
64 // 3 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else if (2.5<=p<3) {if (TOF) -2s<TOF<3s AND TPC@3s} else (p>=3) {if (TOF) -2s<TOF<3s AND -3s<TPC<2s}
e7af8919 65
60b29186 66 const Int_t nptbins=14;
ff12b981 67 RDHFLctoV0An->SetNPtBins(nptbins);
68
992ba7d8 69 Float_t* ptbins;
70 ptbins=new Float_t[nptbins+1];
a578b2da 71 ptbins[0]= 0.;
72 ptbins[1]= 1.;
73 ptbins[2]= 2.;
74 ptbins[3]= 3.;
75 ptbins[4]= 4.;
76 ptbins[5]= 5.;
77 ptbins[6]= 6.;
60b29186 78 ptbins[7]= 7.;
79 ptbins[8]= 8.;
80 ptbins[9]= 9.;
81 ptbins[10]=10.;
82 ptbins[11]=12.;
83 ptbins[12]=17.;
84 ptbins[13]=25.;
85 ptbins[14]=35.;
992ba7d8 86 RDHFLctoV0An->SetPtBins(nptbins+1,ptbins);
87
a578b2da 88 const Int_t nvars=17;
992ba7d8 89
992ba7d8 90 Float_t** anacutsval;
91 anacutsval=new Float_t*[nvars];
92 for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
93 for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
e7af8919 94 anacutsval[0][ipt2]=0.25; // inv. mass if K0S [GeV/c2]
95 anacutsval[1][ipt2]=0.25; // inv. mass if Lambda [GeV/c2]
60b29186 96 anacutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2] ---> WE ARE SEARCHING Lc -> p+K0S, so cut on m(Lambda) has to be leave as it was at filtering level!!!
a578b2da 97 anacutsval[5][ipt2]=0.2; // pT min V0-positive track [GeV/c]
98 anacutsval[6][ipt2]=0.2; // pT min V0-negative track [GeV/c]
99 anacutsval[7][ipt2]=1000.; // dca cascade cut [cm]
100 anacutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
60b29186 101 anacutsval[11][ipt2]=0.09; // d0 max V0 wrt PV [cm]
a578b2da 102 anacutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
103 anacutsval[13][ipt2]=0.005; // mass Lambda/LambdaBar veto [GeV/c2]
60b29186 104 anacutsval[14][ipt2]=0.300; // mass Gamma veto [GeV/c2]
a578b2da 105 anacutsval[16][ipt2]=0.; // V0 type cut
992ba7d8 106 }
a578b2da 107
60b29186 108 anacutsval[2][0]=0.00346*2.; // inv. mass V0 if K0S [GeV/c2]
109 anacutsval[2][1]=0.00360*2.; // inv. mass V0 if K0S [GeV/c2]
110 anacutsval[2][2]=0.00385*2.; // inv. mass V0 if K0S [GeV/c2]
111 anacutsval[2][3]=0.00406*2.; // inv. mass V0 if K0S [GeV/c2]
112 anacutsval[2][4]=0.00429*2.; // inv. mass V0 if K0S [GeV/c2]
113 anacutsval[2][5]=0.00450*2.; // inv. mass V0 if K0S [GeV/c2]
114 anacutsval[2][6]=0.00450*2.; // inv. mass V0 if K0S [GeV/c2]
115 anacutsval[2][7]=0.00450*2.; // inv. mass V0 if K0S [GeV/c2]
116 anacutsval[2][8]=0.00520*2.; // inv. mass V0 if K0S [GeV/c2]
117 anacutsval[2][9]=0.00520*2.; // inv. mass V0 if K0S [GeV/c2]
118 anacutsval[2][10]=0.00520*2.;// inv. mass V0 if K0S [GeV/c2]
119 anacutsval[2][11]=0.00520*2.;// inv. mass V0 if K0S [GeV/c2]
120 anacutsval[2][12]=0.00520*2.;// inv. mass V0 if K0S [GeV/c2]
121 anacutsval[2][13]=0.00520*2.;// inv. mass V0 if K0S [GeV/c2]
122
123 anacutsval[4][0]=0.6; // pT min bachelor track [GeV/c] // AOD by construction
124 anacutsval[4][1]=0.5; // pT min bachelor track [GeV/c] // AOD by construction
125 anacutsval[4][2]=0.6; // pT min bachelor track [GeV/c] // AOD by construction
126 anacutsval[4][3]=0.7; // pT min bachelor track [GeV/c] // AOD by construction
127 anacutsval[4][4]=0.8; // pT min bachelor track [GeV/c] // AOD by construction
128 anacutsval[4][5]=0.9; // pT min bachelor track [GeV/c] // AOD by construction
129 anacutsval[4][6]=1.0; // pT min bachelor track [GeV/c] // AOD by construction
130 anacutsval[4][7]=1.2; // pT min bachelor track [GeV/c] // AOD by construction
131 anacutsval[4][8]=1.4; // pT min bachelor track [GeV/c] // AOD by construction
132 anacutsval[4][9]=1.7; // pT min bachelor track [GeV/c] // AOD by construction
133 anacutsval[4][10]=2.0; // pT min bachelor track [GeV/c] // AOD by construction
134 anacutsval[4][11]=2.0; // pT min bachelor track [GeV/c] // AOD by construction
135 anacutsval[4][12]=2.0; // pT min bachelor track [GeV/c] // AOD by construction
136 anacutsval[4][13]=2.0; // pT min bachelor track [GeV/c] // AOD by construction
137
138 anacutsval[9][0]=0.994; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
139 anacutsval[9][1]=0.994; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
140 anacutsval[9][2]=0.998; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
141 anacutsval[9][3]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
142 anacutsval[9][4]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
143 anacutsval[9][5]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
144 anacutsval[9][6]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
145 anacutsval[9][7]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
146 anacutsval[9][8]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
147 anacutsval[9][9]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
148 anacutsval[9][10]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
149 anacutsval[9][11]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
150 anacutsval[9][12]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
151 anacutsval[9][13]=0.999; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
152
153 anacutsval[10][0]=0.05; // d0 max bachelor wrt PV [cm]
154 anacutsval[10][1]=0.04; // d0 max bachelor wrt PV [cm]
155 anacutsval[10][2]=0.03; // d0 max bachelor wrt PV [cm]
156 anacutsval[10][3]=0.05; // d0 max bachelor wrt PV [cm]
157 anacutsval[10][4]=0.05; // d0 max bachelor wrt PV [cm]
158 anacutsval[10][5]=0.02; // d0 max bachelor wrt PV [cm]
159 anacutsval[10][6]=0.02; // d0 max bachelor wrt PV [cm]
160 anacutsval[10][7]=0.02; // d0 max bachelor wrt PV [cm]
161 anacutsval[10][8]=0.02; // d0 max bachelor wrt PV [cm]
162 anacutsval[10][9]=0.02; // d0 max bachelor wrt PV [cm]
163 anacutsval[10][10]=0.02; // d0 max bachelor wrt PV [cm]
164 anacutsval[10][11]=0.02; // d0 max bachelor wrt PV [cm]
165 anacutsval[10][12]=0.02; // d0 max bachelor wrt PV [cm]
166 anacutsval[10][13]=0.02; // d0 max bachelor wrt PV [cm]
167
168
169 anacutsval[15][0]=0.5; // pT min V0 track [GeV/c]
a578b2da 170 anacutsval[15][1]=0.6; // pT min V0 track [GeV/c]
60b29186 171 anacutsval[15][2]=0.7; // pT min V0 track [GeV/c]
172 anacutsval[15][3]=0.7; // pT min V0 track [GeV/c]
a578b2da 173 anacutsval[15][4]=0.8; // pT min V0 track [GeV/c]
60b29186 174 anacutsval[15][5]=0.9; // pT min V0 track [GeV/c]
a578b2da 175 anacutsval[15][6]=1.0; // pT min V0 track [GeV/c]
176 anacutsval[15][7]=1.0; // pT min V0 track [GeV/c]
60b29186 177 anacutsval[15][8]=1.2; // pT min V0 track [GeV/c]
178 anacutsval[15][9]=1.2; // pT min V0 track [GeV/c]
179 anacutsval[15][10]=1.2; // pT min V0 track [GeV/c]
180 anacutsval[15][11]=1.2; // pT min V0 track [GeV/c]
181 anacutsval[15][12]=1.2; // pT min V0 track [GeV/c]
182 anacutsval[15][13]=1.2; // pT min V0 track [GeV/c]
183
a578b2da 184
185
992ba7d8 186 RDHFLctoV0An->SetCuts(nvars,nptbins,anacutsval);
187
188
189 //RDHFLc->SetRecoKF(); //set this if you want to recompute the secondary vertex with the KF package
190
191 //pid settings
192 //1. bachelor: default one
193 AliAODPidHF* pidObjBachelor = new AliAODPidHF();
194 Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
195 pidObjBachelor->SetSigma(sigmasBac);
196 pidObjBachelor->SetAsym(kFALSE);
197 pidObjBachelor->SetMatch(1);
198 pidObjBachelor->SetTPC(kTRUE);
199 pidObjBachelor->SetTOF(kTRUE);
200 pidObjBachelor->SetTOFdecide(kFALSE);
60ea16ec 201
992ba7d8 202 RDHFLctoV0An->SetPidHF(pidObjBachelor);
203
204 //2. V0pos
205 AliAODPidHF* pidObjV0pos = new AliAODPidHF();
206 Double_t sigmasV0pos[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
207 pidObjV0pos->SetSigma(sigmasV0pos);
208 pidObjV0pos->SetAsym(kFALSE);
209 pidObjV0pos->SetMatch(1);
210 pidObjV0pos->SetTPC(kTRUE);
211 pidObjV0pos->SetTOF(kTRUE);
212 pidObjV0pos->SetTOFdecide(kFALSE);
60ea16ec 213
e7af8919 214 RDHFLctoV0An->SetPidV0pos(pidObjV0pos);
992ba7d8 215
216 //2. V0neg
217 AliAODPidHF* pidObjV0neg = new AliAODPidHF();
218 Double_t sigmasV0neg[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
219 pidObjV0neg->SetSigma(sigmasV0neg);
220 pidObjV0neg->SetAsym(kFALSE);
221 pidObjV0neg->SetMatch(1);
222 pidObjV0neg->SetTPC(kTRUE);
223 pidObjV0neg->SetTOF(kTRUE);
224 pidObjV0neg->SetTOFdecide(kFALSE);
60ea16ec 225
e7af8919 226 RDHFLctoV0An->SetPidV0neg(pidObjV0neg);
992ba7d8 227
228
229 // uncomment these lines for Baysian PID:
230 // Double_t threshold=0.3;
231 // SetupCombinedPID(RDHFLctoV0An ,threshold);
232 // RDHFLctoV0An ->SetPIDStrategy(AliRDHFCutsLctoV0::kCombined);
233 //
234
235
236 //uncomment these lines to apply cuts with the KF package
237 //RDHFLctoV0An->SetCutsStrategy(AliRDHFCutsLctoV0::kKF);
238 //for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
a578b2da 239 // anacutsval[0]=1.; //if <0., no topological constraint
240 // anacutsval[1]=2.; //cut on the Chi2/Ndf
992ba7d8 241 // }
242
243 Bool_t pidflag=kTRUE;
244 RDHFLctoV0An->SetUsePID(pidflag);
245 if(pidflag) cout<<"PID is used"<<endl;
246 else cout<<"PID is not used"<<endl;
247
60b29186 248 cout<<"This is the (anal) object I'm going to save:"<<endl;
992ba7d8 249 RDHFLctoV0An->PrintAll();
60ea16ec 250 TFile* fout=new TFile("Lc2pK0SCuts.root","RECREATE");
992ba7d8 251 fout->cd();
992ba7d8 252 RDHFLctoV0An->Write();
253 fout->Close();
254 delete fout;
255
256 delete pidObjBachelor;
257 delete pidObjV0neg;
258 delete pidObjV0pos;
60b29186 259 //delete RDHFLctoV0An;
992ba7d8 260
261}
262
263
264//macro to make a .root file (for significance maximization) which contains an AliRDHFCutsLctoV0 with loose set of cuts and TParameter with the tighest value of these cuts
265
266void makeInputAliAnalysisTaskSESignificanceMaximization(){
267
268 AliRDHFCutsLctoV0* RDHFLctoV0=new AliRDHFCutsLctoV0();
269 RDHFLctoV0->SetName("loosercuts");
270 RDHFLctoV0->SetTitle("Cuts for significance maximization");
271
272 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
273 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
274 //default
275 esdTrackCuts->SetRequireTPCRefit(kTRUE);
276 esdTrackCuts->SetMinNClustersTPC(70);
a578b2da 277 esdTrackCuts->SetRequireITSRefit(kFALSE);
278 esdTrackCuts->SetMinNClustersITS(0);
279 //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
992ba7d8 280 esdTrackCuts->SetMinDCAToVertexXY(0.);
60b29186 281 esdTrackCuts->SetEtaRange(-0.8,0.8);
282 esdTrackCuts->SetPtRange(0.,1.e10);
992ba7d8 283
e7af8919 284 AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
285 esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
286 //default
287 esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
e7af8919 288 esdTrackCutsV0daughters->SetMinNClustersTPC(70);
a578b2da 289 esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);
290 esdTrackCutsV0daughters->SetMinNClustersITS(0);
291 //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); // default is kBoth, otherwise kAny
e7af8919 292 esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
293 esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
294
992ba7d8 295 RDHFLctoV0->AddTrackCuts(esdTrackCuts);
296
e7af8919 297 RDHFLctoV0->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
298
a578b2da 299 RDHFLctoV0->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
60ea16ec 300 // 1 -> if (TOF) TOF else TPC w veto
a578b2da 301 // 2 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else (p>=2.5) {if (TOF) -2s<TOF<3s AND TPC@3s}
302 // 3 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else if (2.5<=p<3) {if (TOF) -2s<TOF<3s AND TPC@3s} else (p>=3) {if (TOF) -2s<TOF<3s AND -3s<TPC<2s}
e7af8919 303
a578b2da 304 const Int_t nvars=14;
992ba7d8 305
a578b2da 306 const Int_t nptbins=9;
307 Float_t* ptbins;
308 ptbins=new Float_t[nptbins+1];
309 ptbins[0]= 0.;
310 ptbins[1]= 1.;
311 ptbins[2]= 2.;
312 ptbins[3]= 3.;
313 ptbins[4]= 4.;
314 ptbins[5]= 5.;
315 ptbins[6]= 6.;
316 ptbins[7]= 8.;
317 ptbins[8]=12.;
318 ptbins[9]=99999999.;
992ba7d8 319 RDHFLctoV0->SetPtBins(nptbins+1,ptbins);
320
321 Float_t** rdcutsvalmine;
322 rdcutsvalmine=new Float_t*[nvars];
323 for(Int_t iv=0;iv<nvars;iv++){
324 rdcutsvalmine[iv]=new Float_t[nptbins];
325 }
326
327 //setting my cut values
328 // inv. mass if K0s [GeV]
329 // inv. mass if Lambda [GeV]
330 // inv. mass V0 if K0S [GeV]
331 // inv. mass V0 if Lambda [GeV]
332 // pT min bachelor track [GeV/c]
333 // pT min V0-positive track [GeV/c]
334 // pT min V0-negative track [GeV/c]
335 // dca cascade cut (cm)
a578b2da 336 // dca V0 cut (nSigmas)
337 // cosPA V0 cut
338 // d0 max bachelor wrt PV [cm]
339 // d0 max V0 wrt PV [cm]
340 // mass K0S veto [GeV/c2]
341 // mass Lambda/LambdaBar veto [GeV/c2]
342 // mass Gamma veto [GeV/c2]
343 // pT min V0 track [GeV/c]
344 Float_t **cutsMatrixLctoV0Stand = new Float_t*[nvars];
345 for(Int_t ic=0;ic<nvars;ic++)
346 cutsMatrixLctoV0Stand[ic]=new Float_t[nptbins];
347 for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
348 cutsMatrixLctoV0Stand[0][ipt2] =0.0075;
349 cutsMatrixLctoV0Stand[1][ipt2] =0.0030;
350 cutsMatrixLctoV0Stand[2][ipt2] =0.4;
351 cutsMatrixLctoV0Stand[3][ipt2] =0.2;
352 cutsMatrixLctoV0Stand[4][ipt2] =0.2;
353 cutsMatrixLctoV0Stand[5][ipt2] =1000.;
354 cutsMatrixLctoV0Stand[6][ipt2] =1.5;
355 cutsMatrixLctoV0Stand[7][ipt2] =0.99;
356 cutsMatrixLctoV0Stand[8][ipt2] =0.05;
357 cutsMatrixLctoV0Stand[9][ipt2] =0.1;
358 cutsMatrixLctoV0Stand[10][ipt2] =0.0;
359 cutsMatrixLctoV0Stand[11][ipt2] =0.005;
360 cutsMatrixLctoV0Stand[12][ipt2] =0.100;
361 }
362 cutsMatrixLctoV0Stand[0][13]=0.0; // pT min V0 track [GeV/c]
363 cutsMatrixLctoV0Stand[1][13]=0.6; // pT min V0 track [GeV/c]
364 cutsMatrixLctoV0Stand[2][13]=0.8; // pT min V0 track [GeV/c]
365 cutsMatrixLctoV0Stand[3][13]=0.8; // pT min V0 track [GeV/c]
366 cutsMatrixLctoV0Stand[4][13]=0.8; // pT min V0 track [GeV/c]
367 cutsMatrixLctoV0Stand[5][13]=1.0; // pT min V0 track [GeV/c]
368 cutsMatrixLctoV0Stand[6][13]=1.0; // pT min V0 track [GeV/c]
369 cutsMatrixLctoV0Stand[7][13]=1.0; // pT min V0 track [GeV/c]
370 cutsMatrixLctoV0Stand[8][13]=0.0; // pT min V0 track [GeV/c]
371 cutsMatrixLctoV0Stand[9][13]=0.0; // pT min V0 track [GeV/c]
372
992ba7d8 373
374 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
375 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
376 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
377 for (Int_t ibin=0;ibin<nptbins;ibin++){
378 for (Int_t ivar=0; ivar<nvars; ivar++){
379 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixLctoV0Stand[ibin][ivar];
380 }
381 }
382 RDHFLctoV0->SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
383
384
385 Int_t nvarsforopt=RDHFLctoV0->GetNVarsForOpt();
a578b2da 386 Int_t dim=14; //set this!!
992ba7d8 387 Bool_t *boolforopt;
388 boolforopt=new Bool_t[nvars];
389 if(dim>nvarsforopt){
390 cout<<"Number of variables for optimization has probably changed, check and edit accordingly"<<endl;
391 return;
392 } else {
393 if(dim==nvarsforopt){
394 boolforopt=RDHFLctoV0->GetVarsForOpt();
395 }else{
396 TString *names;
397 names=new TString[nvars];
398 TString answer="";
399 Int_t checktrue=0;
400 names=RDHFLctoV0->GetVarNames();
401 for(Int_t i=0;i<nvars;i++){
402 cout<<names[i]<<" for opt? (y/n)"<<endl;
403 cin>>answer;
404 if(answer=="y") {
405 boolforopt[i]=kTRUE;
406 checktrue++;
407 }
408 else boolforopt[i]=kFALSE;
409 }
410 if (checktrue!=dim) {
411 cout<<"Error! You set "<<checktrue<<" kTRUE instead of "<<dim<<endl;
412 return;
413 }
414 RDHFLctoV0->SetVarsForOpt(dim,boolforopt);
415 }
416 }
417
418
419 Float_t tighterval[dim][nptbins];
420 // 0(2): inv. mass V0 if K0S [GeV]
421 // 1(3): inv. mass V0 if Lambda [GeV]
422 // 2(4): pT min bachelor track [GeV/c]
423 // 3(5): pT min V0-positive track [GeV/c]
424 // 4(6): pT min V0-negative track [GeV/c]
425 // 5(7): dca cascade cut (cm)
a578b2da 426 // 6(8): dca V0 cut (nSigmas)
427 // 7(9): cosPA V0 cut
428 // 8(10): d0 max bachelor wrt PV [cm]
429 // 9(11): d0 max V0 wrt PV [cm]
430 // 10(12): mass K0S veto [GeV/c2]
431 // 11(13): mass Lambda/LambdaBar veto [GeV/c2]
432 // 12(14): mass Gamma veto [GeV/c2]
433 // 13(15): pT min V0 track [GeV/c]
992ba7d8 434
435 // number of steps for each variable is set in the AddTask arguments (default=8)
436 // set this!!
437 for(Int_t ipt=0;ipt<nptbins;ipt++){
a578b2da 438 tighterval[0][ipt] =0.075; // inv. mass V0 if K0S [GeV]
439 tighterval[1][ipt] =0.040; // inv. mass V0 if Lambda [GeV]
440 tighterval[2][ipt] =0.4; // pT min bachelor track [GeV/c]
441 tighterval[3][ipt] =0.2; // pT min V0-positive track [GeV/c]
442 tighterval[4][ipt] =0.2; // pT min V0-negative track [GeV/c]
443 tighterval[5][ipt] =100.; // dca cascade cut (cm)
444 tighterval[6][ipt] =1.5; // dca v0 cut
445 tighterval[7][ipt] =0.99; // cosPA v0 cut
446 tighterval[8][ipt] =0.05; // d0 max bachelor wrt PV [cm]
447 tighterval[9][ipt] =0.1; // d0 max V0 wrt PV [cm]
448 tighterval[10][ipt] =0.0; // mass K0S veto [GeV/c2]
449 tighterval[11][ipt] =0.005; // mass Lambda/LambdaBar veto [GeV/c2]
450 tighterval[12][ipt] =0.100; // mass Gamma veto [GeV/c2]
992ba7d8 451 }
a578b2da 452 tighterval[0][13]=0.0; // pT min V0 track [GeV/c]
453 tighterval[1][13]=0.6; // pT min V0 track [GeV/c]
454 tighterval[2][13]=0.8; // pT min V0 track [GeV/c]
455 tighterval[3][13]=0.8; // pT min V0 track [GeV/c]
456 tighterval[4][13]=0.8; // pT min V0 track [GeV/c]
457 tighterval[5][13]=1.0; // pT min V0 track [GeV/c]
458 tighterval[6][13]=1.0; // pT min V0 track [GeV/c]
459 tighterval[7][13]=1.0; // pT min V0 track [GeV/c]
460 tighterval[8][13]=0.0; // pT min V0 track [GeV/c]
461 tighterval[9][13]=0.0; // pT min V0 track [GeV/c]
992ba7d8 462
463 TString name="";
464 Int_t arrdim=dim*nptbins;
465 cout<<"Will save "<<arrdim<<" TParameter<float>"<<endl;
466 TClonesArray max("TParameter<float>",arrdim);
467 for(Int_t ival=0;ival<dim;ival++){
468 for(Int_t jpt=0;jpt<nptbins;jpt++){
469 name=Form("par%dptbin%d",ival,jpt);
470 cout<<"Setting "<<name.Data()<<" to "<<tighterval[ival][jpt]<<endl;
471 new(max[jpt*dim+ival])TParameter<float>(name.Data(),tighterval[ival][jpt]);
472 }
473 }
474
475 Bool_t flagPID=kFALSE;
476 RDHFLctoV0->SetUsePID(flagPID);
477
478 RDHFLctoV0->PrintAll();
479 printf("Use PID? %s\n",flagPID ? "yes" : "no");
480
481 //pid settings
482 //1. bachelor: default one
483 AliAODPidHF* pidObjBachelor = new AliAODPidHF();
484 Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
485 pidObjBachelor->SetSigma(sigmasBac);
486 pidObjBachelor->SetAsym(kFALSE);
487 pidObjBachelor->SetMatch(1);
488 pidObjBachelor->SetTPC(kTRUE);
489 pidObjBachelor->SetTOF(kTRUE);
490 pidObjBachelor->SetTOFdecide(kFALSE);
491 RDHFLctoV0->SetPidHF(pidObjBachelor);
492
493 //2. V0pos
494 AliAODPidHF* pidObjV0pos = new AliAODPidHF();
495 Double_t sigmasV0pos[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
496 pidObjV0pos->SetSigma(sigmasV0pos);
497 pidObjV0pos->SetAsym(kFALSE);
498 pidObjV0pos->SetMatch(1);
499 pidObjV0pos->SetTPC(kTRUE);
500 pidObjV0pos->SetTOF(kTRUE);
501 pidObjV0pos->SetTOFdecide(kFALSE);
e7af8919 502 RDHFLctoV0->SetPidV0pos(pidObjV0pos);
992ba7d8 503
504 //2. V0neg
505 AliAODPidHF* pidObjV0neg = new AliAODPidHF();
506 Double_t sigmasV0neg[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
507 pidObjV0neg->SetSigma(sigmasV0neg);
508 pidObjV0neg->SetAsym(kFALSE);
509 pidObjV0neg->SetMatch(1);
510 pidObjV0neg->SetTPC(kTRUE);
511 pidObjV0neg->SetTOF(kTRUE);
512 pidObjV0neg->SetTOFdecide(kFALSE);
e7af8919 513 RDHFLctoV0->SetPidV0neg(pidObjV0neg);
992ba7d8 514
515 //activate pileup rejection (for pp)
516 //RDHFLctoV0->SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
517
518 //Do not recalculate the vertex
519 RDHFLctoV0->SetRemoveDaughtersFromPrim(kFALSE); //activate for pp
520
521 TString cent="";
522 //centrality selection (Pb-Pb)
523 Float_t minc=20,maxc=80;
524 RDHFLctoV0->SetMinCentrality(minc);
525 RDHFLctoV0->SetMaxCentrality(maxc);
526 cent=Form("%.0f%.0f",minc,maxc);
527 //RDHFLctoV0->SetUseCentrality(AliRDHFCuts::kCentV0M); //kCentOff,kCentV0M,kCentTRK,kCentTKL,kCentCL1,kCentInvalid
528 RDHFLctoV0->SetUseCentrality(AliRDHFCuts::kCentOff); //kCentOff,kCentV0M,kCentTRK,kCentTKL,kCentCL1,kCentInvalid
529
530 //temporary
531 //RDHFLctoV0->SetFixRefs();
532
533 TFile* fout=new TFile(Form("cuts4SignifMaxim%s%s%sRecVtx%sPileupRej.root",
534 RDHFLctoV0->GetUseCentrality()==0 ? "pp" : "PbPb",
535 cent.Data(),
536 RDHFLctoV0->GetIsPrimaryWithoutDaughters() ? "" : "No",
537 RDHFLctoV0->GetOptPileUp() ? "" : "No"),"recreate"); //set this!!
538
539 fout->cd();
540 RDHFLctoV0->Write();
541 max.Write();
542 fout->Close();
543
544}