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