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