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