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