AliPhysics  59e0e03 (59e0e03)
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;
31 
32 const Float_t kmInvPipPim_pp7TeV_pass2[nptbins] = {0.00432330, 0.00454560, 0.00481579, 0.00505379, 0.00542286, 0.00602017};
33 const Float_t kmInvPipPim_pp7TeV_pass4[nptbins] = {0.00398116, 0.00412519, 0.00432494, 0.00454682, 0.00486837, 0.00537445};
34 const Float_t kmInvPipPim_pPb[nptbins] = {0.00383156, 0.00394778, 0.00413934, 0.00438431, 0.00480869, 0.00544472};
35 const Float_t kmInvPipPim_LHC10f7a[nptbins] = {0.00398520, 0.00419456, 0.00445022, 0.00462474, 0.00491519, 0.00544176};
36 const Float_t kmInvPipPim_LHC11b2[nptbins] = {0.00385273, 0.00394676, 0.00412335, 0.00420992, 0.00445422, 0.00493645};
37 const Float_t kmInvPipPim_LHC15a2a[nptbins] = {0.00376002, 0.00386896, 0.00399314, 0.00412475, 0.00435170, 0.00466817};
38 const Float_t kmInvPipPim_LHC13d3[nptbins] = {0.00358776, 0.00370684, 0.00383341, 0.00402011, 0.00439230, 0.00489222};
39 
40 const Float_t kmInvPPi_pp7TeV_pass2[nptbins] = {0.00203633, 0.00196967, 0.00196595, 0.00199441, 0.00202691, 0.00211474};
41 const Float_t kmInvPPi_pp7TeV_pass4[nptbins] = {0.00194356, 0.00185442, 0.00184579, 0.00187065, 0.00193578, 0.00210853};
42 const Float_t kmInvPPi_pPb[nptbins] = {0.00214349, 0.00199650, 0.00192680, 0.00192083, 0.00199756, 0.00213533};
43 const Float_t kmInvPPi_LHC10f7a[nptbins] = {0.00190966, 0.00182307, 0.00177527, 0.00183747, 0.00181431, 0.00204811};
44 const Float_t kmInvPPi_LHC11b2[nptbins] = {0.00185630, 0.00180454, 0.00179920, 0.00182468, 0.00189292, 0.00204497};
45 const Float_t kmInvPPi_LHC15a2a[nptbins] = {0.00187642, 0.00175389, 0.00171987, 0.00171276, 0.00180925, 0.00194709};
46 const Float_t kmInvPPi_LHC13d3[nptbins] = {0.00205320, 0.00191146, 0.00179558, 0.00182894, 0.00185072, 0.00208818};
47 
49 
50  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
51  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
52  //default
53  esdTrackCuts->SetRequireTPCRefit(kTRUE);
54  esdTrackCuts->SetRequireITSRefit(kTRUE);
55  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
56  esdTrackCuts->SetMinNClustersTPC(70);
57  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
58  // AliESDtrackCuts::kAny);
59  // default is kBoth, otherwise kAny
60  esdTrackCuts->SetMinDCAToVertexXY(0.);
61  esdTrackCuts->SetPtRange(0.,1.e10);
62  esdTrackCuts->SetEtaRange(-0.8,0.8);
63  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
64 
65 
66  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
67  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
68  //default
69  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
70  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//kTRUE);
71  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
72  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
73  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
74  // AliESDtrackCuts::kAny);
75  // default is kBoth, otherwise kAny
76  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
77  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
78  esdTrackCutsV0daughters->SetEtaRange(-0.8,0.8);
79  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
80 
81  AliRDHFCutsLctoV0* RDHFLctoV0An=new AliRDHFCutsLctoV0();
82  RDHFLctoV0An->SetName("LctoV0AnalysisCuts");
83  RDHFLctoV0An->SetTitle("Analysis cuts for Lc analysis");
84  RDHFLctoV0An->SetKinkRejection(!esdTrackCuts->GetAcceptKinkDaughters());
85  RDHFLctoV0An->AddTrackCuts(esdTrackCuts);
86  RDHFLctoV0An->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
87  RDHFLctoV0An->SetUseTrackSelectionWithFilterBits(kFALSE);//(kTRUE);
88  RDHFLctoV0An->SetTriggerClass("");
89  RDHFLctoV0An->SetTriggerMask(AliVEvent::kINT7);
90  RDHFLctoV0An->SetOptPileup(AliRDHFCuts::kRejectMVPileupEvent); // multi vertexer pileup rejection
91  if (fCollisionSystem==kpPb) {
92  // //
93  // // Trigger selection
94  // //
95  if (fDataType==kData) {
96  RDHFLctoV0An->SetTriggerMask(AliVEvent::kINT7);
97  } else if (fDataType==kLHC13d3) {
98  RDHFLctoV0An->SetTriggerMask(AliVEvent::kINT7 | AliVEvent::kMB);
99  }
100  }
101  RDHFLctoV0An->SetLowPtCut(1.0); // default value 1.0 GeV/c
102  if (fCollisionSystem==kpp7TeV) {
103  RDHFLctoV0An->SetHighPtCut(3.0); // default value 2.5 GeV/c
104  RDHFLctoV0An->SetPidSelectionFlag(4); // 0 -> TOF AND TPC
105  } else if (fCollisionSystem==kpPb) {
106  RDHFLctoV0An->SetHighPtCut(999.); // default value 2.5 GeV/c
107  RDHFLctoV0An->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
108  // 1 -> if (TOF) TOF else TPC w veto
109  // 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}
110  // 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}
111  // 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}
112  // 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}
113  // 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}
114  // 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}
115  // 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}
116  // 9 -> combined: TOF, TPC
117  } else if (fCollisionSystem==kPbPb) {
118  RDHFLctoV0An->SetHighPtCut(999.); // default value 2.5 GeV/c
119  RDHFLctoV0An->SetPidSelectionFlag(10); // 10: -2<tof<3 for pt>3 GeV/c, -3<tpc<2 for pt>4 GeV/c
120  }
121 
122  Float_t* ptbins;
123  ptbins=new Float_t[nptbins+1];
124  ptbins[0]= 2.;
125  ptbins[1]= 3.;
126  ptbins[2]= 4.;
127  ptbins[3]= 5.;
128  ptbins[4]= 6.;
129  ptbins[5]= 8.;
130  ptbins[6]= 12.;
131  RDHFLctoV0An->SetPtBins(nptbins+1,ptbins);
132 
133  const Int_t nvars=21;
134 
135  Float_t** anacutsval;
136  anacutsval=new Float_t*[nvars];
137  for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
138  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
139  anacutsval[0][ipt2]=0.25; // inv. mass if K0S [GeV/c2]
140  anacutsval[1][ipt2]=1.00; // inv. mass if Lambda [GeV/c2]
141  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!!!
142  anacutsval[7][ipt2]=1000.; // dca cascade cut [cm]
143  anacutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
144  anacutsval[9][ipt2]=0.99; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
145  anacutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
146  anacutsval[13][ipt2]=0.005; // mass Lambda/LambdaBar veto [GeV/c2]
147  anacutsval[16][ipt2]=9999; // max cos proton emission angle in Lc CMS max
148  anacutsval[17][ipt2]=-9999; // min cos proton emission angle in Lc CMS max
149  anacutsval[18][ipt2]=-9999; // Re-signed d0 min [cm]
150  anacutsval[19][ipt2]=-9999; // V0 qT/|alpha| min
151  anacutsval[20][ipt2]=0.; // V0 type cut
152  }
153 
154  if (fCollisionSystem==kpp7TeV) {
155  if (fPass==kPass2) {
156  anacutsval[2][0]=0.00500; // inv. mass V0 if K0S [GeV/c2]
157  anacutsval[2][1]=0.00812; // inv. mass V0 if K0S [GeV/c2]
158  anacutsval[2][2]=0.00858; // inv. mass V0 if K0S [GeV/c2]
159  anacutsval[2][3]=0.00900; // inv. mass V0 if K0S [GeV/c2]
160  anacutsval[2][4]=0.01000; // inv. mass V0 if K0S [GeV/c2]
161  anacutsval[2][5]=0.01000; // inv. mass V0 if K0S [GeV/c2]
162  if (fDataType==kLHC10f7a) {
163  for (Int_t ii=0; ii<nptbins; ii++) {
164  if (fChangeK0ScutOnMC) {
165  anacutsval[2][ii]=anacutsval[2][ii]/kmInvPipPim_pp7TeV_pass2[ii]*kmInvPipPim_LHC10f7a[ii]; // inv. mass V0 if K0S [GeV/c2]
167  anacutsval[13][ii]=anacutsval[13][ii]/kmInvPPi_pp7TeV_pass2[ii]*kmInvPPi_LHC10f7a[ii]; // inv. mass Lambda/LambdaBar [GeV/c2]
168  }
169  }
170  }
171  } else if (fDataType==kLHC11b2) {
172  for (Int_t ii=0; ii<nptbins; ii++) {
173  if (fChangeK0ScutOnMC) {
174  anacutsval[2][ii]=anacutsval[2][ii]/kmInvPipPim_pp7TeV_pass2[ii]*kmInvPipPim_LHC11b2[ii]; // inv. mass V0 if K0S [GeV/c2]
176  anacutsval[13][ii]=anacutsval[13][ii]/kmInvPPi_pp7TeV_pass2[ii]*kmInvPPi_LHC11b2[ii]; // inv. mass Lambda/LambdaBar [GeV/c2]
177  }
178  }
179  }
180  }
181 
182  } else if (fPass==kPass4) { // as for pass2 -> not optimized for pass4 data!
183  anacutsval[2][0]=0.00500; // inv. mass V0 if K0S [GeV/c2]
184  anacutsval[2][1]=0.00812; // inv. mass V0 if K0S [GeV/c2]
185  anacutsval[2][2]=0.00858; // inv. mass V0 if K0S [GeV/c2]
186  anacutsval[2][3]=0.00900; // inv. mass V0 if K0S [GeV/c2]
187  anacutsval[2][4]=0.01000; // inv. mass V0 if K0S [GeV/c2]
188  anacutsval[2][5]=0.01000; // inv. mass V0 if K0S [GeV/c2]
189  // just to start to see pass4
190  for (Int_t ii=0; ii<nptbins; ii++) {
191  anacutsval[2][ii]=anacutsval[2][ii]/kmInvPipPim_pp7TeV_pass2[ii]*kmInvPipPim_pp7TeV_pass4[ii]; // inv. mass V0 if K0S [GeV/c2]
192  }
193  anacutsval[13][0]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
194  anacutsval[13][1]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
195  anacutsval[13][2]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
196  anacutsval[13][3]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
197  anacutsval[13][4]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
198  anacutsval[13][5]=0.005; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
199  // just to start to see pass4
200  for (Int_t ii=0; ii<nptbins; ii++) {
201  anacutsval[13][ii]=anacutsval[13][ii]/kmInvPPi_pp7TeV_pass2[ii]*kmInvPPi_pp7TeV_pass4[ii]; // inv. mass V0 if Lambda/LambdaBar [GeV/c2]
202  }
203  if (fDataType==kLHC15a2a) {
204  for (Int_t ii=0; ii<nptbins; ii++) {
205  if (fChangeK0ScutOnMC) {
206  anacutsval[2][ii]=anacutsval[2][ii]/kmInvPipPim_pp7TeV_pass4[ii]*kmInvPipPim_LHC15a2a[ii]; // inv. mass V0 if K0S [GeV/c2]
208  anacutsval[13][ii]=anacutsval[13][ii]/kmInvPPi_pp7TeV_pass4[ii]*kmInvPPi_LHC15a2a[ii]; // inv. mass Lambda/LambdaBar [GeV/c2]
209  }
210  }
211  }
212  }
213  }
214 
215  } else if (fCollisionSystem==kpPb) {
216  anacutsval[2][0]=0.006; // inv. mass V0 if K0S [GeV/c2]
217  anacutsval[2][1]=0.007; // inv. mass V0 if K0S [GeV/c2]
218  anacutsval[2][2]=0.008; // inv. mass V0 if K0S [GeV/c2]
219  anacutsval[2][3]=0.009; // inv. mass V0 if K0S [GeV/c2]
220  anacutsval[2][4]=0.010; // inv. mass V0 if K0S [GeV/c2]
221  anacutsval[2][5]=0.011; // inv. mass V0 if K0S [GeV/c2]
222  if (fDataType==kLHC13d3) {
223  for (Int_t ii=0; ii<nptbins; ii++) {
224  if (fChangeK0ScutOnMC) {
225  anacutsval[2][ii]=anacutsval[2][ii]/kmInvPipPim_pPb[ii]*kmInvPipPim_LHC13d3[ii]; // inv. mass V0 if K0S [GeV/c2]
227  anacutsval[13][ii]=anacutsval[13][ii]/kmInvPPi_pPb[ii]*kmInvPPi_LHC13d3[ii]; // inv. mass Lambda/LambdaBar [GeV/c2]
228  }
229  }
230  }
231  }
232  }
233 
234  if (fCollisionSystem==kpp7TeV) {
235 
236  anacutsval[4][0]=0.6; // pT min bachelor track [GeV/c] // AOD by construction
237  anacutsval[4][1]=0.6; // pT min bachelor track [GeV/c] // AOD by construction
238  anacutsval[4][2]=0.7; // pT min bachelor track [GeV/c] // AOD by construction
239  anacutsval[4][3]=0.7; // pT min bachelor track [GeV/c] // AOD by construction
240  anacutsval[4][4]=0.9; // pT min bachelor track [GeV/c] // AOD by construction
241  anacutsval[4][5]=1.1; // pT min bachelor track [GeV/c] // AOD by construction
242 
243  anacutsval[5][0]=0.2; // pT min V0-positive track [GeV/c]
244  anacutsval[5][1]=0.2; // pT min V0-positive track [GeV/c]
245  anacutsval[5][2]=0.2; // pT min V0-positive track [GeV/c]
246  anacutsval[5][3]=0.2; // pT min V0-positive track [GeV/c]
247  anacutsval[5][4]=0.2; // pT min V0-positive track [GeV/c]
248  anacutsval[5][5]=0.3; // pT min V0-positive track [GeV/c]
249 
250  anacutsval[6][0]=0.2; // pT min V0-negative track [GeV/c]
251  anacutsval[6][1]=0.2; // pT min V0-negative track [GeV/c]
252  anacutsval[6][2]=0.2; // pT min V0-negative track [GeV/c]
253  anacutsval[6][3]=0.2; // pT min V0-negative track [GeV/c]
254  anacutsval[6][4]=0.2; // pT min V0-negative track [GeV/c]
255  anacutsval[6][5]=0.3; // pT min V0-negative track [GeV/c]
256 
257  anacutsval[10][0]=0.05; // d0 max bachelor wrt PV [cm]
258  anacutsval[10][1]=0.05; // d0 max bachelor wrt PV [cm]
259  anacutsval[10][2]=0.10; // d0 max bachelor wrt PV [cm]
260  anacutsval[10][3]=0.10; // d0 max bachelor wrt PV [cm]
261  anacutsval[10][4]=0.10; // d0 max bachelor wrt PV [cm]
262  anacutsval[10][5]=0.10; // d0 max bachelor wrt PV [cm]
263 
264  anacutsval[11][0]=0.05; // d0 max V0 wrt PV [cm]
265  anacutsval[11][1]=0.05; // d0 max V0 wrt PV [cm]
266  anacutsval[11][2]=0.09; // d0 max V0 wrt PV [cm]
267  anacutsval[11][3]=0.09; // d0 max V0 wrt PV [cm]
268  anacutsval[11][4]=999.; // d0 max V0 wrt PV [cm]
269  anacutsval[11][5]=999.; // d0 max V0 wrt PV [cm]
270 
271  anacutsval[14][0]=0.100; // mass Gamma veto [GeV/c2]
272  anacutsval[14][1]=0.100; // mass Gamma veto [GeV/c2]
273  anacutsval[14][2]=0.300; // mass Gamma veto [GeV/c2]
274  anacutsval[14][3]=0.300; // mass Gamma veto [GeV/c2]
275  anacutsval[14][4]=0.300; // mass Gamma veto [GeV/c2]
276  anacutsval[14][5]=0.300; // mass Gamma veto [GeV/c2]
277 
278  anacutsval[15][0]=0.5; // pT min V0 track [GeV/c]
279  anacutsval[15][1]=0.6; // pT min V0 track [GeV/c]
280  anacutsval[15][2]=0.7; // pT min V0 track [GeV/c]
281  anacutsval[15][3]=1.0; // pT min V0 track [GeV/c]
282  anacutsval[15][4]=1.1; // pT min V0 track [GeV/c]
283  anacutsval[15][5]=1.2; // pT min V0 track [GeV/c]
284 
285  } else if (fCollisionSystem==kpPb) {
286 
287  anacutsval[4][0]=0.5; // pT min bachelor track [GeV/c] // AOD by construction
288  anacutsval[4][1]=0.6; // pT min bachelor track [GeV/c] // AOD by construction
289  anacutsval[4][2]=0.7; // pT min bachelor track [GeV/c] // AOD by construction
290  anacutsval[4][3]=0.9; // pT min bachelor track [GeV/c] // AOD by construction
291  anacutsval[4][4]=0.9; // pT min bachelor track [GeV/c] // AOD by construction
292  anacutsval[5][5]=0.9; // pT min bachelor track [GeV/c] // AOD by construction
293 
294  anacutsval[5][0]=0.2; // pT min V0-positive track [GeV/c]
295  anacutsval[5][1]=0.2; // pT min V0-positive track [GeV/c]
296  anacutsval[5][2]=0.2; // pT min V0-positive track [GeV/c]
297  anacutsval[5][3]=0.2; // pT min V0-positive track [GeV/c]
298  anacutsval[5][4]=0.2; // pT min V0-positive track [GeV/c]
299  anacutsval[5][5]=0.3; // pT min V0-positive track [GeV/c]
300 
301  anacutsval[6][0]=0.2; // pT min V0-negative track [GeV/c]
302  anacutsval[6][1]=0.2; // pT min V0-negative track [GeV/c]
303  anacutsval[6][2]=0.2; // pT min V0-negative track [GeV/c]
304  anacutsval[6][3]=0.2; // pT min V0-negative track [GeV/c]
305  anacutsval[6][4]=0.2; // pT min V0-negative track [GeV/c]
306  anacutsval[6][5]=0.3; // pT min V0-negative track [GeV/c]
307 
308  anacutsval[10][0]=0.05; // d0 max bachelor wrt PV [cm]
309  anacutsval[10][1]=0.05; // d0 max bachelor wrt PV [cm]
310  anacutsval[10][2]=0.08; // d0 max bachelor wrt PV [cm]
311  anacutsval[10][3]=0.10; // d0 max bachelor wrt PV [cm]
312  anacutsval[10][4]=0.10; // d0 max bachelor wrt PV [cm]
313  anacutsval[10][5]=0.10; // d0 max bachelor wrt PV [cm]
314 
315  for (Int_t ipt2=0; ipt2<nptbins; ipt2++) anacutsval[11][ipt2]=999.; // d0 max V0 wrt PV [cm]
316 
317  anacutsval[14][0]=0.100; // mass Gamma veto [GeV/c2]
318  anacutsval[14][1]=0.100; // mass Gamma veto [GeV/c2]
319  anacutsval[14][2]=0.100; // mass Gamma veto [GeV/c2]
320  anacutsval[14][3]=0.100; // mass Gamma veto [GeV/c2]
321  anacutsval[14][4]=0.100; // mass Gamma veto [GeV/c2]
322  anacutsval[14][5]=0.100; // mass Gamma veto [GeV/c2]
323 
324  anacutsval[15][0]=0.8; // pT min V0 track [GeV/c]
325  anacutsval[15][1]=0.8; // pT min V0 track [GeV/c]
326  anacutsval[15][2]=0.8; // pT min V0 track [GeV/c]
327  anacutsval[15][3]=1.2; // pT min V0 track [GeV/c]
328  anacutsval[15][4]=1.0; // pT min V0 track [GeV/c]
329  anacutsval[15][5]=1.2; // pT min V0 track [GeV/c]
330 
331  }
332 
333  RDHFLctoV0An->SetCuts(nvars,nptbins,anacutsval);
334 
335  RDHFLctoV0An->SetGetNTPCSigmaCutForPreselection(3);
336  const Int_t nBachelorPbins=2;
337  if (RDHFLctoV0An->GetPidSelectionFlag()==9) {
338  Float_t minCombProb[nBachelorPbins];
339  for (Int_t iBin=0; iBin<nBachelorPbins; iBin++) minCombProb[iBin]=0.;
340  RDHFLctoV0An->SetMinCombinedProbability(nBachelorPbins,minCombProb);
341  Float_t bachelorPlimits[nBachelorPbins+];
342  for (Int_t iBin=0; iBin<nBachelorPbins; iBin++) bachelorPlimits[iBin]=0.;
343  SetBachelorPLimitsForPID(nBachelorPbins,bachelorPlimits);
344  }
345 
346  //pid settings
347  //1. bachelor: default one
348  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
349  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
350  pidObjBachelor->SetSigma(sigmasBac);
351  pidObjBachelor->SetAsym(kFALSE);
352  pidObjBachelor->SetMatch(1);
353  pidObjBachelor->SetTPC(kTRUE);
354  pidObjBachelor->SetTOF(kTRUE);
355  pidObjBachelor->SetTOFdecide(kFALSE);
356  if (RDHFLctoV0An->GetPidSelectionFlag()==9) {
357  pidObjBachelor->SetUseCombined();
358  pidObjBachelor->SetUseDefaultPriors(kTRUE);
359  pidObjBachelor->SetCombDetectors(AliAODPidHF::kTPCTOF);
360  }
361 
362  RDHFLctoV0An->SetPidHF(pidObjBachelor);
363 
364  // uncomment these lines for Baysian PID:
365  // Double_t threshold=0.3;
366  // SetupCombinedPID(RDHFLctoV0An ,threshold);
367  // RDHFLctoV0An ->SetPIDStrategy(AliRDHFCutsLctoV0::kCombined);
368  //
369 
370  //RDHFLc->SetRecoKF(); //set this if you want to recompute the secondary vertex with the KF package
371  //uncomment these lines to apply cuts with the KF package
372  //RDHFLctoV0An->SetCutsStrategy(AliRDHFCutsLctoV0::kKF);
373  //for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
374  // anacutsval[0]=1.; //if <0., no topological constraint
375  // anacutsval[1]=2.; //cut on the Chi2/Ndf
376  // }
377 
378  Bool_t pidflag=kTRUE;
379  RDHFLctoV0An->SetUsePID(pidflag);
380  if(pidflag) cout<<"PID is used"<<endl;
381  else cout<<"PID is not used"<<endl;
382 
383  cout<<"This is the (anal) object I'm going to save:"<<endl;
384  RDHFLctoV0An->PrintAll();
385  TFile* fout;
386  if (fDataType==kData) {
387  fout=new TFile("Lc2pK0SCuts.root","RECREATE");
388  } else {
389  fout=new TFile("Lc2pK0SCuts.root","RECREATE");
390  }
391  fout->cd();
392  RDHFLctoV0An->Write();
393  fout->Close();
394  delete fout;
395 
396  delete pidObjBachelor;
397  //delete RDHFLctoV0An;
398 
399 }
400 
401 
402 //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
403 
405 
406  AliRDHFCutsLctoV0* RDHFLctoV0=new AliRDHFCutsLctoV0();
407  RDHFLctoV0->SetName("loosercuts");
408  RDHFLctoV0->SetTitle("Cuts for significance maximization");
409 
410  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
411  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
412  //default
413  esdTrackCuts->SetRequireTPCRefit(kTRUE);
414  esdTrackCuts->SetMinNClustersTPC(70);
415  esdTrackCuts->SetRequireITSRefit(kFALSE);
416  esdTrackCuts->SetMinNClustersITS(0);
417  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
418  esdTrackCuts->SetMinDCAToVertexXY(0.);
419  esdTrackCuts->SetEtaRange(-0.8,0.8);
420  esdTrackCuts->SetPtRange(0.,1.e10);
421 
422  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
423  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
424  //default
425  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
426  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
427  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);
428  esdTrackCutsV0daughters->SetMinNClustersITS(0);
429  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny); // default is kBoth, otherwise kAny
430  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
431  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
432 
433  RDHFLctoV0->AddTrackCuts(esdTrackCuts);
434 
435  RDHFLctoV0->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
436 
437  RDHFLctoV0->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
438  // 1 -> if (TOF) TOF else TPC w veto
439  // 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}
440  // 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}
441 
442  const Int_t nvars=14;//17-3
443 
444  Float_t* ptbins;
445  ptbins=new Float_t[nptbins+1];
446  ptbins[0]=2.;
447  ptbins[1]=3.;
448  ptbins[2]=4.;
449  ptbins[3]=5.;
450  ptbins[4]=6.;
451  ptbins[5]=8.;
452  ptbins[6]=12.;
453  RDHFLctoV0->SetPtBins(nptbins+1,ptbins);
454 
455  Float_t** rdcutsvalmine;
456  rdcutsvalmine=new Float_t*[nvars];
457  for(Int_t iv=0;iv<nvars;iv++){
458  rdcutsvalmine[iv]=new Float_t[nptbins];
459  }
460 
461  //setting my cut values
462  // inv. mass if K0s [GeV]
463  // inv. mass if Lambda [GeV]
464  // inv. mass V0 if K0S [GeV]
465  // inv. mass V0 if Lambda [GeV]
466  // pT min bachelor track [GeV/c]
467  // pT min V0-positive track [GeV/c]
468  // pT min V0-negative track [GeV/c]
469  // dca cascade cut (cm)
470  // dca V0 cut (nSigmas)
471  // cosPA V0 cut
472  // d0 max bachelor wrt PV [cm]
473  // d0 max V0 wrt PV [cm]
474  // mass K0S veto [GeV/c2]
475  // mass Lambda/LambdaBar veto [GeV/c2]
476  // mass Gamma veto [GeV/c2]
477  // pT min V0 track [GeV/c]
478  Float_t **cutsMatrixLctoV0Stand = new Float_t*[nvars];
479  for(Int_t ic=0;ic<nvars;ic++)
480  cutsMatrixLctoV0Stand[ic]=new Float_t[nptbins];
481  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
482  cutsMatrixLctoV0Stand[ 0][ipt2] =0.0075;
483  cutsMatrixLctoV0Stand[ 1][ipt2] =0.0500;
484  cutsMatrixLctoV0Stand[ 2][ipt2] =0.4;
485  cutsMatrixLctoV0Stand[ 3][ipt2] =0.2;
486  cutsMatrixLctoV0Stand[ 4][ipt2] =0.2;
487  cutsMatrixLctoV0Stand[ 5][ipt2] =1000.;
488  cutsMatrixLctoV0Stand[ 6][ipt2] =1.5;
489  cutsMatrixLctoV0Stand[ 7][ipt2] =0.99;
490  cutsMatrixLctoV0Stand[ 8][ipt2] =0.05;
491  cutsMatrixLctoV0Stand[ 9][ipt2] =0.1;
492  cutsMatrixLctoV0Stand[10][ipt2] =0.0;
493  cutsMatrixLctoV0Stand[11][ipt2] =0.005;
494  cutsMatrixLctoV0Stand[12][ipt2] =0.100;
495  }
496  cutsMatrixLctoV0Stand[13][0]=0.0; // pT min V0 track [GeV/c]
497  cutsMatrixLctoV0Stand[13][1]=0.6; // pT min V0 track [GeV/c]
498  cutsMatrixLctoV0Stand[13][2]=0.8; // pT min V0 track [GeV/c]
499  cutsMatrixLctoV0Stand[13][3]=0.8; // pT min V0 track [GeV/c]
500  cutsMatrixLctoV0Stand[13][4]=0.8; // pT min V0 track [GeV/c]
501  cutsMatrixLctoV0Stand[13][5]=1.0; // pT min V0 track [GeV/c]
502 
503 
504  //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
505  Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
506  for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
507  for (Int_t ibin=0;ibin<nptbins;ibin++){
508  for (Int_t ivar=0; ivar<nvars; ivar++){
509  cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixLctoV0Stand[ibin][ivar];
510  }
511  }
512  RDHFLctoV0->SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
513 
514 
515  Int_t nvarsforopt=RDHFLctoV0->GetNVarsForOpt();
516  Int_t dim=14; //set this!!
517  Bool_t *boolforopt;
518  boolforopt=new Bool_t[nvars];
519  if(dim>nvarsforopt){
520  cout<<"Number of variables for optimization has probably changed, check and edit accordingly"<<endl;
521  return;
522  } else {
523  if(dim==nvarsforopt){
524  boolforopt=RDHFLctoV0->GetVarsForOpt();
525  }else{
526  TString *names;
527  names=new TString[nvars];
528  TString answer="";
529  Int_t checktrue=0;
530  names=RDHFLctoV0->GetVarNames();
531  for(Int_t i=0;i<nvars;i++){
532  cout<<names[i]<<" for opt? (y/n)"<<endl;
533  cin>>answer;
534  if(answer=="y") {
535  boolforopt[i]=kTRUE;
536  checktrue++;
537  }
538  else boolforopt[i]=kFALSE;
539  }
540  if (checktrue!=dim) {
541  cout<<"Error! You set "<<checktrue<<" kTRUE instead of "<<dim<<endl;
542  return;
543  }
544  RDHFLctoV0->SetVarsForOpt(dim,boolforopt);
545  }
546  }
547 
548 
549  Float_t tighterval[dim][nptbins];
550  // 0(2): inv. mass V0 if K0S [GeV]
551  // 1(3): inv. mass V0 if Lambda [GeV]
552  // 2(4): pT min bachelor track [GeV/c]
553  // 3(5): pT min V0-positive track [GeV/c]
554  // 4(6): pT min V0-negative track [GeV/c]
555  // 5(7): dca cascade cut (cm)
556  // 6(8): dca V0 cut (nSigmas)
557  // 7(9): cosPA V0 cut
558  // 8(10): d0 max bachelor wrt PV [cm]
559  // 9(11): d0 max V0 wrt PV [cm]
560  // 10(12): mass K0S veto [GeV/c2]
561  // 11(13): mass Lambda/LambdaBar veto [GeV/c2]
562  // 12(14): mass Gamma veto [GeV/c2]
563  // 13(15): pT min V0 track [GeV/c]
564 
565  // number of steps for each variable is set in the AddTask arguments (default=8)
566  // set this!!
567  for(Int_t ipt=0;ipt<nptbins;ipt++){
568  tighterval[ 0][ipt] =0.075; // inv. mass V0 if K0S [GeV]
569  tighterval[ 1][ipt] =0.040; // inv. mass V0 if Lambda [GeV]
570  tighterval[ 2][ipt] =0.4; // pT min bachelor track [GeV/c]
571  tighterval[ 3][ipt] =0.2; // pT min V0-positive track [GeV/c]
572  tighterval[ 4][ipt] =0.2; // pT min V0-negative track [GeV/c]
573  tighterval[ 5][ipt] =100.; // dca cascade cut (cm)
574  tighterval[ 6][ipt] =1.5; // dca v0 cut
575  tighterval[ 7][ipt] =0.99; // cosPA v0 cut
576  tighterval[ 8][ipt] =0.05; // d0 max bachelor wrt PV [cm]
577  tighterval[ 9][ipt] =0.1; // d0 max V0 wrt PV [cm]
578  tighterval[10][ipt] =0.0; // mass K0S veto [GeV/c2]
579  tighterval[11][ipt] =0.005; // mass Lambda/LambdaBar veto [GeV/c2]
580  tighterval[12][ipt] =0.100; // mass Gamma veto [GeV/c2]
581  }
582  tighterval[13][0]=0.0; // pT min V0 track [GeV/c]
583  tighterval[13][1]=0.6; // pT min V0 track [GeV/c]
584  tighterval[13][2]=0.8; // pT min V0 track [GeV/c]
585  tighterval[13][3]=0.8; // pT min V0 track [GeV/c]
586  tighterval[13][4]=0.8; // pT min V0 track [GeV/c]
587  tighterval[13][5]=0.8; // pT min V0 track [GeV/c]
588 
589  TString name="";
590  Int_t arrdim=dim*nptbins;
591  cout<<"Will save "<<arrdim<<" TParameter<float>"<<endl;
592  TClonesArray max("TParameter<float>",arrdim);
593  for(Int_t ival=0;ival<dim;ival++){
594  for(Int_t jpt=0;jpt<nptbins;jpt++){
595  name=Form("par%dptbin%d",ival,jpt);
596  cout<<"Setting "<<name.Data()<<" to "<<tighterval[ival][jpt]<<endl;
597  new(max[jpt*dim+ival])TParameter<float>(name.Data(),tighterval[ival][jpt]);
598  }
599  }
600 
601  Bool_t flagPID=kFALSE;
602  RDHFLctoV0->SetUsePID(flagPID);
603 
604  RDHFLctoV0->PrintAll();
605  printf("Use PID? %s\n",flagPID ? "yes" : "no");
606 
607  //pid settings
608  //1. bachelor: default one
609  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
610  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
611  pidObjBachelor->SetSigma(sigmasBac);
612  pidObjBachelor->SetAsym(kFALSE);
613  pidObjBachelor->SetMatch(1);
614  pidObjBachelor->SetTPC(kTRUE);
615  pidObjBachelor->SetTOF(kTRUE);
616  pidObjBachelor->SetTOFdecide(kFALSE);
617  RDHFLctoV0->SetPidHF(pidObjBachelor);
618 
619  //Do not recalculate the vertex
620  RDHFLctoV0->SetRemoveDaughtersFromPrim(kFALSE); //activate for pp
621 
622  TString cent="";
623  //centrality selection (Pb-Pb)
624  Float_t minc=20,maxc=80;
625  RDHFLctoV0->SetMinCentrality(minc);
626  RDHFLctoV0->SetMaxCentrality(maxc);
627  cent=Form("%.0f%.0f",minc,maxc);
628  //RDHFLctoV0->SetUseCentrality(AliRDHFCuts::kCentV0M); //kCentOff,kCentV0M,kCentTRK,kCentTKL,kCentCL1,kCentInvalid
629  RDHFLctoV0->SetUseCentrality(AliRDHFCuts::kCentOff); //kCentOff,kCentV0M,kCentTRK,kCentTKL,kCentCL1,kCentInvalid
630 
631  //temporary
632  //RDHFLctoV0->SetFixRefs();
633 
634  TFile* fout=new TFile(Form("cuts4SignifMaxim%s%s%sRecVtx%sPileupRej.root",
635  RDHFLctoV0->GetUseCentrality()==0 ? "pp" : "PbPb",
636  cent.Data(),
637  RDHFLctoV0->GetIsPrimaryWithoutDaughters() ? "" : "No",
638  RDHFLctoV0->GetOptPileUp() ? "" : "No"),"recreate"); //set this!!
639 
640  fout->cd();
641  RDHFLctoV0->Write();
642  max.Write();
643  fout->Close();
644 
645 }
void SetMinCombinedProbability(Int_t nPBins, Float_t *minProb)
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
double Double_t
Definition: External.C:58
Bool_t GetOptPileUp() const
Definition: AliRDHFCuts.h:279
const Float_t kmInvPPi_LHC13d3[nptbins]
const Float_t kmInvPPi_LHC10f7a[nptbins]
const Float_t kmInvPipPim_pp7TeV_pass2[nptbins]
void SetUseCentrality(Int_t flag=1)
void makeInputAliAnalysisTaskSELctoV0bachelor()
Int_t fCollisionSystem
TString * GetVarNames() const
Definition: AliRDHFCuts.h:251
const Float_t kmInvPipPim_LHC13d3[nptbins]
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:215
void SetKinkRejection(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:211
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
const Float_t kmInvPPi_LHC15a2a[nptbins]
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
Bool_t fChangeAlsoLambdaVetoOnMC
const Float_t kmInvPPi_LHC11b2[nptbins]
const Float_t kmInvPipPim_pp7TeV_pass4[nptbins]
int Int_t
Definition: External.C:63
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
void SetMinCentrality(Float_t minCentrality=0.)
Definition: AliRDHFCuts.h:51
float Float_t
Definition: External.C:68
Bool_t * GetVarsForOpt() const
Definition: AliRDHFCuts.h:252
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
void SetGetNTPCSigmaCutForPreselection(Float_t a)
const Float_t kmInvPipPim_LHC11b2[nptbins]
const Float_t kmInvPipPim_LHC15a2a[nptbins]
void makeInputAliAnalysisTaskSESignificanceMaximization()
Int_t GetNVarsForOpt() const
Definition: AliRDHFCuts.h:253
virtual void PrintAll() const
void SetUseTrackSelectionWithFilterBits(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:212
const Float_t kmInvPPi_pp7TeV_pass2[nptbins]
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
void SetMaxCentrality(Float_t maxCentrality=100.)
Definition: AliRDHFCuts.h:52
Bool_t fChangeK0ScutOnMC
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:278
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:209
void SetRemoveDaughtersFromPrim(Bool_t removeDaughtersPrim)
Definition: AliRDHFCuts.h:219
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:207
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
bool Bool_t
Definition: External.C:53
TFile * fout
input train file
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:197
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:280
void SetOptPileup(Int_t opt=0)
Definition: AliRDHFCuts.h:223
void SetPidSelectionFlag(Int_t a)
void SetHighPtCut(Float_t highPtCut)
void SetTriggerMask(ULong64_t mask=0)
Definition: AliRDHFCuts.h:67
const Int_t nptbins
const Float_t kmInvPPi_pp7TeV_pass4[nptbins]
const Float_t kmInvPPi_pPb[nptbins]