Make the macros run for PROOF and PROOFLite
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / macros / Train / PWG2Train2 / ConfigFemtoAnalysis.C
1 /*********************************************************************
2  *                                                                   *
3  * ConfigFemtoAnalysis.C - configuration macro for the femtoscopic   *
4  * analysis, to be run in the analysis train.                        *
5  * Assumed input data: large (>10M) sample of MC pp events           *
6  * Inluded analysis:                                                 *
7  *    - positive pion HBT, 3 kt bins, 1D+3D functions                *
8  *    - negative pion HBT, 3 kt bins, 1D+3D functions                *
9  *    - positive kaon HBT, 1 kt bin,  1D+3D functions                *
10  *                                                                   *
11  * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                         *
12  *                                                                   *
13  *********************************************************************/
14
15 #include "AliFemtoManager.h"
16 #include "AliFemtoEventReaderESDChain.h"
17 #include "AliFemtoEventReaderESDChainKine.h"
18 #include "AliFemtoSimpleAnalysis.h"
19 #include "AliFemtoBasicEventCut.h"
20 #include "AliFemtoESDTrackCut.h"
21 #include "AliFemtoCorrFctn.h"
22 #include "AliFemtoCutMonitorParticleYPt.h"
23 #include "AliFemtoCutMonitorParticleVertPos.h"
24 #include "AliFemtoCutMonitorParticleMomRes.h"
25 #include "AliFemtoCutMonitorEventMult.h"
26 #include "AliFemtoCutMonitorEventVertex.h"
27 #include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
28 #include "AliFemtoQinvCorrFctn.h"
29 #include "AliFemtoShareQualityCorrFctn.h"
30 #include "AliFemtoTPCInnerCorrFctn.h"
31 #include "AliFemtoVertexMultAnalysis.h"
32 #include "AliFemtoCorrFctn3DSpherical.h"
33 #include "AliFemtoChi2CorrFctn.h"
34 #include "AliFemtoCorrFctnTPCNcls.h"
35 #include "AliFemtoModelBPLCMSCorrFctn.h"
36 #include "AliFemtoModelCorrFctn3DSpherical.h"
37 #include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
38 #include "AliFemtoModelGausRinvFreezeOutGenerator.h"
39 #include "AliFemtoModelManager.h"
40 #include "AliFemtoModelWeightGeneratorBasic.h"
41 #include "AliFemtoModelWeightGeneratorLednicky.h"
42 #include "AliFemtoCorrFctnDirectYlm.h"
43 #include "AliFemtoModelCorrFctnDirectYlm.h"
44 #include "AliFemtoModelCorrFctnSource.h"
45 #include "AliFemtoCutMonitorParticlePtPDG.h"
46 #include "AliFemtoKTPairCut.h"
47
48 //________________________________________________________________________
49 AliFemtoManager* ConfigFemtoAnalysis() {
50
51   double PionMass = 0.13956995;
52   double KaonMass = 0.493677;
53   
54   AliFemtoEventReaderESDChainKine* Reader=new AliFemtoEventReaderESDChainKine();
55   Reader->SetConstrained(true);
56   Reader->SetUseTPCOnly(false);
57
58   AliFemtoManager* Manager=new AliFemtoManager();
59   Manager->SetEventReader(Reader);
60         
61   // *** Begin pion-pion (positive) analysis ***
62
63   AliFemtoVertexMultAnalysis *anpip = new AliFemtoVertexMultAnalysis(3, -15.6, 15.6, 5, 2, 200);
64   anpip->SetNumEventsToMix(10);
65   anpip->SetMinSizePartCollection(2);
66
67   AliFemtoBasicEventCut* mecpip = new AliFemtoBasicEventCut();
68   mecpip->SetEventMult(2,100000);
69   mecpip->SetVertZPos(-1000,1000);
70         
71   AliFemtoESDTrackCut* dtcpip = new AliFemtoESDTrackCut();
72   dtcpip->SetPidProbPion(0.2,1.001);
73   dtcpip->SetPidProbMuon(0.0,1.0);
74   dtcpip->SetPidProbKaon(0.0,1.0);
75   dtcpip->SetPidProbProton(0.0,1.0);
76   dtcpip->SetCharge(1.0);
77   dtcpip->SetPt(0.15,0.5);
78   dtcpip->SetMass(PionMass);
79   // Track quality cuts
80   dtcpip->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
81   //  dtcpip->SetStatus(AliESDtrack::kTPCrefit);
82   dtcpip->SetminTPCncls(50);
83   dtcpip->SetRemoveKinks(kTRUE);
84   dtcpip->SetLabel(kFALSE);
85   dtcpip->SetMaxITSChiNdof(2.5);
86   dtcpip->SetMaxTPCChiNdof(3.0);
87   dtcpip->SetMaxImpactXY(3.0);
88   dtcpip->SetMaxImpactZ(3.0);
89
90   AliFemtoCutMonitorParticleYPt *cutPassYPtpip = new AliFemtoCutMonitorParticleYPt("cutPasspip", 0.13957);
91   AliFemtoCutMonitorParticleYPt *cutFailYPtpip = new AliFemtoCutMonitorParticleYPt("cutFailpip", 0.13957);
92   dtcpip->AddCutMonitor(cutPassYPtpip, cutFailYPtpip);
93
94   AliFemtoCutMonitorEventMult *cutPassEvMpip = new AliFemtoCutMonitorEventMult("cutPasspip");
95   AliFemtoCutMonitorEventMult *cutFailEvMpip = new AliFemtoCutMonitorEventMult("cutFailpip");
96   mecpip->AddCutMonitor(cutPassEvMpip, cutFailEvMpip);
97
98   AliFemtoCutMonitorEventVertex *cutPassEvVpip = new AliFemtoCutMonitorEventVertex("cutPasspip");
99   AliFemtoCutMonitorEventVertex *cutFailEvVpip = new AliFemtoCutMonitorEventVertex("cutFailpip");
100   mecpip->AddCutMonitor(cutPassEvVpip, cutFailEvVpip);
101
102   AliFemtoShareQualityTPCEntranceSepPairCut *sqpcpip = new AliFemtoShareQualityTPCEntranceSepPairCut();
103   sqpcpip->SetShareQualityMax(0.0);
104   sqpcpip->SetShareFractionMax(0.02);
105   sqpcpip->SetRemoveSameLabel(kFALSE);
106   sqpcpip->SetTPCEntranceSepMinimum(2.0);
107
108   anpip->SetEventCut(mecpip);
109   anpip->SetFirstParticleCut(dtcpip);
110   anpip->SetSecondParticleCut(dtcpip);
111   anpip->SetPairCut(sqpcpip);
112
113   AliFemtoCorrFctn3DSpherical *cqsphpip = new AliFemtoCorrFctn3DSpherical("cqsphpip",60,0.0,0.3, 12, 12);
114
115   AliFemtoShareQualityCorrFctn *csqqinvpip= new AliFemtoShareQualityCorrFctn("sqqinvcfpip",40,0.0,0.4);
116
117   // Intrdouce kT binning
118   AliFemtoKTPairCut *ktpairkT1pip = new AliFemtoKTPairCut(0.1,0.27);
119   AliFemtoKTPairCut *ktpairkT2pip = new AliFemtoKTPairCut(0.27,0.37);
120   AliFemtoKTPairCut *ktpairkT3pip = new AliFemtoKTPairCut(0.37,0.52);
121
122   AliFemtoCorrFctnDirectYlm *cylmkT1pip = new AliFemtoCorrFctnDirectYlm("cylmkT1pip",3,60,0.0,0.3);
123   cylmkT1pip->SetPairSelectionCut(ktpairkT1pip);
124   anpip->AddCorrFctn(cylmkT1pip);
125     
126   AliFemtoCorrFctnDirectYlm *cylmkT2pip = new AliFemtoCorrFctnDirectYlm("cylmkT2pip",3,60,0.0,0.3);
127   cylmkT2pip->SetPairSelectionCut(ktpairkT2pip);
128   anpip->AddCorrFctn(cylmkT2pip);
129     
130   AliFemtoCorrFctnDirectYlm *cylmkT3pip = new AliFemtoCorrFctnDirectYlm("cylmkT3pip",3,60,0.0,0.3);
131   cylmkT3pip->SetPairSelectionCut(ktpairkT3pip);
132   anpip->AddCorrFctn(cylmkT3pip);
133
134   AliFemtoQinvCorrFctn *cqinvkt1pip = new AliFemtoQinvCorrFctn("qinvcfkt1pip", 100,0.0,1.0);
135   cqinvkt1pip->SetPairSelectionCut(ktpairkT1pip);
136   anpip->AddCorrFctn(cqinvkt1pip);
137
138   AliFemtoQinvCorrFctn *cqinvkt2pip = new AliFemtoQinvCorrFctn("qinvcfkt2pip", 100,0.0,1.0);
139   cqinvkt2pip->SetPairSelectionCut(ktpairkT2pip);
140   anpip->AddCorrFctn(cqinvkt2pip);
141
142   AliFemtoQinvCorrFctn *cqinvkt3pip = new AliFemtoQinvCorrFctn("qinvcfkt3pip", 100,0.0,1.0);
143   cqinvkt3pip->SetPairSelectionCut(ktpairkT3pip);
144   anpip->AddCorrFctn(cqinvkt3pip);
145
146   AliFemtoChi2CorrFctn *cchiqinvpip= new AliFemtoChi2CorrFctn("chicfpip",40,0.0,0.4);
147   AliFemtoCorrFctnTPCNcls *cqtpcnclspip = new AliFemtoCorrFctnTPCNcls("cqtpcnclspip",40,0.0,0.4);
148
149   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt1pip;
150   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt2pip;
151   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt3pip;
152   AliFemtoModelCorrFctn *c1dpipip;
153   AliFemtoModelCorrFctn3DSpherical *c3dmsphpip;
154
155   // Setting up the model calculation
156   // First create the freeze-out generator
157   AliFemtoModelGausLCMSFreezeOutGenerator *tFreezepip = new AliFemtoModelGausLCMSFreezeOutGenerator();
158   tFreezepip->SetSizeOut(1.8*TMath::Sqrt(2.0));                                                
159   tFreezepip->SetSizeSide(1.3*TMath::Sqrt(2.0));                                               
160   tFreezepip->SetSizeLong(1.6*TMath::Sqrt(2.0));                                                
161
162   // And the weight generator                                                                    
163   AliFemtoModelWeightGeneratorBasic *tWeightpip = new AliFemtoModelWeightGeneratorBasic();
164   tWeightpip->SetPairType(AliFemtoModelWeightGenerator::PionPlusPionPlus());
165
166   // Create a manager that will connect it                                                                                                               
167   AliFemtoModelManager *tModelManagerpip = new AliFemtoModelManager();
168   tModelManagerpip->AcceptFreezeOutGenerator(tFreezepip);
169   tModelManagerpip->AcceptWeightGenerator(tWeightpip);
170   tModelManagerpip->CreateCopyHiddenInfo(kFALSE);
171
172   c3dsmallkt1pip = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt2pip",30, 0.0, 0.3);
173   c3dsmallkt1pip->SetSpecificPairCut(ktpairkT2pip);
174   c3dsmallkt1pip->ConnectToManager(tModelManagerpip);
175
176   c3dsmallkt2pip = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt1pip",30, 0.0, 0.3);
177   c3dsmallkt2pip->SetSpecificPairCut(ktpairkT1pip);
178   c3dsmallkt2pip->ConnectToManager(tModelManagerpip);
179
180   c3dsmallkt3pip = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt3pip",30, 0.0, 0.3);
181   c3dsmallkt3pip->SetSpecificPairCut(ktpairkT3pip);
182   c3dsmallkt3pip->ConnectToManager(tModelManagerpip);
183
184   c1dpipip = new AliFemtoModelCorrFctn("c1dpipip",100,0.0,1.0);
185   c1dpipip->ConnectToManager(tModelManagerpip);
186
187   c3dmsphpip = new AliFemtoModelCorrFctn3DSpherical("c3dmsphpip",60, 0.0, 0.3, 12,12);
188   c3dmsphpip->ConnectToManager(tModelManagerpip);
189
190   AliFemtoModelCorrFctnDirectYlm *cmylmkt1pip = new AliFemtoModelCorrFctnDirectYlm("mcylmkt1pip",3,60,0.0,0.3);
191   cmylmkt1pip->SetPairSelectionCut(ktpairkT1pip);
192   cmylmkt1pip->ConnectToManager(tModelManagerpip);
193   anpip->AddCorrFctn(cmylmkt1pip);
194
195   AliFemtoModelCorrFctnDirectYlm *cmylmkt2pip = new AliFemtoModelCorrFctnDirectYlm("mcylmkt2pip",3,60,0.0,0.3);
196   cmylmkt2pip->SetPairSelectionCut(ktpairkT2pip);
197   cmylmkt2pip->ConnectToManager(tModelManagerpip);
198   anpip->AddCorrFctn(cmylmkt2pip);
199
200   AliFemtoModelCorrFctnDirectYlm *cmylmkt3pip = new AliFemtoModelCorrFctnDirectYlm("mcylmkt3pip",3,60,0.0,0.3);
201   cmylmkt3pip->SetPairSelectionCut(ktpairkT3pip);
202   cmylmkt3pip->ConnectToManager(tModelManagerpip);
203   anpip->AddCorrFctn(cmylmkt3pip);
204
205   //###
206   anpip->AddCorrFctn(cqsphpip);
207  
208   anpip->AddCorrFctn(csqqinvpip);
209   anpip->AddCorrFctn(cchiqinvpip);
210   anpip->AddCorrFctn(cqtpcnclspip);
211   anpip->AddCorrFctn(c3dsmallkt1pip);
212   anpip->AddCorrFctn(c3dsmallkt2pip);
213   anpip->AddCorrFctn(c3dsmallkt3pip);
214   anpip->AddCorrFctn(c1dpipip);
215   anpip->AddCorrFctn(c3dmsphpip);
216
217   Manager->AddAnalysis(anpip);  
218
219   // *** End pion-pion (positive) analysis
220
221   // *** Begin pion-pion (negative) analysis ***
222
223   AliFemtoVertexMultAnalysis *anpim = new AliFemtoVertexMultAnalysis(3, -15.6, 15.6, 5, 2, 200);
224   anpim->SetNumEventsToMix(10);
225   anpim->SetMinSizePartCollection(2);
226
227   AliFemtoBasicEventCut* mecpim = new AliFemtoBasicEventCut();
228   mecpim->SetEventMult(2,100000);
229   mecpim->SetVertZPos(-1000,1000);
230         
231   AliFemtoESDTrackCut* dtcpim = new AliFemtoESDTrackCut();
232   dtcpim->SetPidProbPion(0.2,1.001);
233   dtcpim->SetPidProbMuon(0.0,1.0);
234   dtcpim->SetPidProbKaon(0.0,1.0);
235   dtcpim->SetPidProbProton(0.0,1.0);
236   dtcpim->SetCharge(1.0);
237   dtcpim->SetPt(0.15,0.5);
238   dtcpim->SetMass(PionMass);
239   // Track quality cuts
240   dtcpim->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
241   //  dtcpim->SetStatus(AliESDtrack::kTPCrefit);
242   dtcpim->SetminTPCncls(50);
243   dtcpim->SetRemoveKinks(kTRUE);
244   dtcpim->SetLabel(kFALSE);
245   dtcpim->SetMaxITSChiNdof(2.5);
246   dtcpim->SetMaxTPCChiNdof(3.0);
247   dtcpim->SetMaxImpactXY(3.0);
248   dtcpim->SetMaxImpactZ(3.0);
249
250   AliFemtoCutMonitorParticleYPt *cutPassYPtpim = new AliFemtoCutMonitorParticleYPt("cutPasspim", 0.13957);
251   AliFemtoCutMonitorParticleYPt *cutFailYPtpim = new AliFemtoCutMonitorParticleYPt("cutFailpim", 0.13957);
252   dtcpim->AddCutMonitor(cutPassYPtpim, cutFailYPtpim);
253
254   AliFemtoCutMonitorEventMult *cutPassEvMpim = new AliFemtoCutMonitorEventMult("cutPasspim");
255   AliFemtoCutMonitorEventMult *cutFailEvMpim = new AliFemtoCutMonitorEventMult("cutFailpim");
256   mecpim->AddCutMonitor(cutPassEvMpim, cutFailEvMpim);
257
258   AliFemtoCutMonitorEventVertex *cutPassEvVpim = new AliFemtoCutMonitorEventVertex("cutPasspim");
259   AliFemtoCutMonitorEventVertex *cutFailEvVpim = new AliFemtoCutMonitorEventVertex("cutFailpim");
260   mecpim->AddCutMonitor(cutPassEvVpim, cutFailEvVpim);
261
262   AliFemtoShareQualityTPCEntranceSepPairCut *sqpcpim = new AliFemtoShareQualityTPCEntranceSepPairCut();
263   sqpcpim->SetShareQualityMax(0.0);
264   sqpcpim->SetShareFractionMax(0.02);
265   sqpcpim->SetRemoveSameLabel(kFALSE);
266   sqpcpim->SetTPCEntranceSepMinimum(2.0);
267
268   anpim->SetEventCut(mecpim);
269   anpim->SetFirstParticleCut(dtcpim);
270   anpim->SetSecondParticleCut(dtcpim);
271   anpim->SetPairCut(sqpcpim);
272
273   AliFemtoCorrFctn3DSpherical *cqsphpim = new AliFemtoCorrFctn3DSpherical("cqsphpim",60,0.0,0.3, 12, 12);
274
275   AliFemtoShareQualityCorrFctn *csqqinvpim= new AliFemtoShareQualityCorrFctn("sqqinvcfpim",40,0.0,0.4);
276
277   // Intrdouce kT binning
278   AliFemtoKTPairCut *ktpairkT1pim = new AliFemtoKTPairCut(0.1,0.27);
279   AliFemtoKTPairCut *ktpairkT2pim = new AliFemtoKTPairCut(0.27,0.37);
280   AliFemtoKTPairCut *ktpairkT3pim = new AliFemtoKTPairCut(0.37,0.52);
281
282   AliFemtoCorrFctnDirectYlm *cylmkT1pim = new AliFemtoCorrFctnDirectYlm("cylmkT1pim",3,60,0.0,0.3);
283   cylmkT1pim->SetPairSelectionCut(ktpairkT1pim);
284   anpim->AddCorrFctn(cylmkT1pim);
285     
286   AliFemtoCorrFctnDirectYlm *cylmkT2pim = new AliFemtoCorrFctnDirectYlm("cylmkT2pim",3,60,0.0,0.3);
287   cylmkT2pim->SetPairSelectionCut(ktpairkT2pim);
288   anpim->AddCorrFctn(cylmkT2pim);
289     
290   AliFemtoCorrFctnDirectYlm *cylmkT3pim = new AliFemtoCorrFctnDirectYlm("cylmkT3pim",3,60,0.0,0.3);
291   cylmkT3pim->SetPairSelectionCut(ktpairkT3pim);
292   anpim->AddCorrFctn(cylmkT3pim);
293
294   AliFemtoQinvCorrFctn *cqinvkt1pim = new AliFemtoQinvCorrFctn("qinvcfkt1pim", 100,0.0,1.0);
295   cqinvkt1pim->SetPairSelectionCut(ktpairkT1pim);
296   anpim->AddCorrFctn(cqinvkt1pim);
297
298   AliFemtoQinvCorrFctn *cqinvkt2pim = new AliFemtoQinvCorrFctn("qinvcfkt2pim", 100,0.0,1.0);
299   cqinvkt2pim->SetPairSelectionCut(ktpairkT2pim);
300   anpim->AddCorrFctn(cqinvkt2pim);
301
302   AliFemtoQinvCorrFctn *cqinvkt3pim = new AliFemtoQinvCorrFctn("qinvcfkt3pim", 100,0.0,1.0);
303   cqinvkt3pim->SetPairSelectionCut(ktpairkT3pim);
304   anpim->AddCorrFctn(cqinvkt3pim);
305
306   AliFemtoChi2CorrFctn *cchiqinvpim= new AliFemtoChi2CorrFctn("chicfpim",40,0.0,0.4);
307   AliFemtoCorrFctnTPCNcls *cqtpcnclspim = new AliFemtoCorrFctnTPCNcls("cqtpcnclspim",40,0.0,0.4);
308
309   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt1pim;
310   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt2pim;
311   AliFemtoModelBPLCMSCorrFctn *c3dsmallkt3pim;
312   AliFemtoModelCorrFctn *c1dpimip;
313   AliFemtoModelCorrFctn3DSpherical *c3dmsphpim;
314
315   // Setting up the model calculation
316   // First create the freeze-out generator
317   AliFemtoModelGausLCMSFreezeOutGenerator *tFreezepim = new AliFemtoModelGausLCMSFreezeOutGenerator();
318   tFreezepim->SetSizeOut(1.8*TMath::Sqrt(2.0));                                                
319   tFreezepim->SetSizeSide(1.3*TMath::Sqrt(2.0));                                               
320   tFreezepim->SetSizeLong(1.6*TMath::Sqrt(2.0));                                                
321
322   // And the weight generator                                                                    
323   AliFemtoModelWeightGeneratorBasic *tWeightpim = new AliFemtoModelWeightGeneratorBasic();
324   tWeightpim->SetPairType(AliFemtoModelWeightGenerator::PionPlusPionPlus());
325
326   // Create a manager that will connect it                                                                                                               
327   AliFemtoModelManager *tModelManagerpim = new AliFemtoModelManager();
328   tModelManagerpim->AcceptFreezeOutGenerator(tFreezepim);
329   tModelManagerpim->AcceptWeightGenerator(tWeightpim);
330   tModelManagerpim->CreateCopyHiddenInfo(kFALSE);
331
332   c3dsmallkt1pim = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt2pim",30, 0.0, 0.3);
333   c3dsmallkt1pim->SetSpecificPairCut(ktpairkT2pim);
334   c3dsmallkt1pim->ConnectToManager(tModelManagerpim);
335
336   c3dsmallkt2pim = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt1pim",30, 0.0, 0.3);
337   c3dsmallkt2pim->SetSpecificPairCut(ktpairkT1pim);
338   c3dsmallkt2pim->ConnectToManager(tModelManagerpim);
339
340   c3dsmallkt3pim = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkt3pim",30, 0.0, 0.3);
341   c3dsmallkt3pim->SetSpecificPairCut(ktpairkT3pim);
342   c3dsmallkt3pim->ConnectToManager(tModelManagerpim);
343
344   c1dpimip = new AliFemtoModelCorrFctn("c1dpimip",100,0.0,1.0);
345   c1dpimip->ConnectToManager(tModelManagerpim);
346
347   c3dmsphpim = new AliFemtoModelCorrFctn3DSpherical("c3dmsphpim",60, 0.0, 0.3, 12,12);
348   c3dmsphpim->ConnectToManager(tModelManagerpim);
349
350   AliFemtoModelCorrFctnDirectYlm *cmylmkt1pim = new AliFemtoModelCorrFctnDirectYlm("mcylmkt1pim",3,60,0.0,0.3);
351   cmylmkt1pim->SetPairSelectionCut(ktpairkT1pim);
352   cmylmkt1pim->ConnectToManager(tModelManagerpim);
353   anpim->AddCorrFctn(cmylmkt1pim);
354
355   AliFemtoModelCorrFctnDirectYlm *cmylmkt2pim = new AliFemtoModelCorrFctnDirectYlm("mcylmkt2pim",3,60,0.0,0.3);
356   cmylmkt2pim->SetPairSelectionCut(ktpairkT2pim);
357   cmylmkt2pim->ConnectToManager(tModelManagerpim);
358   anpim->AddCorrFctn(cmylmkt2pim);
359
360   AliFemtoModelCorrFctnDirectYlm *cmylmkt3pim = new AliFemtoModelCorrFctnDirectYlm("mcylmkt3pim",3,60,0.0,0.3);
361   cmylmkt3pim->SetPairSelectionCut(ktpairkT3pim);
362   cmylmkt3pim->ConnectToManager(tModelManagerpim);
363   anpim->AddCorrFctn(cmylmkt3pim);
364
365   //###
366   anpim->AddCorrFctn(cqsphpim);
367  
368   anpim->AddCorrFctn(csqqinvpim);
369   anpim->AddCorrFctn(cchiqinvpim);
370   anpim->AddCorrFctn(cqtpcnclspim);
371   anpim->AddCorrFctn(c3dsmallkt1pim);
372   anpim->AddCorrFctn(c3dsmallkt2pim);
373   anpim->AddCorrFctn(c3dsmallkt3pim);
374   anpim->AddCorrFctn(c1dpimip);
375   anpim->AddCorrFctn(c3dmsphpim);
376
377   Manager->AddAnalysis(anpim);  
378
379   // *** End pion-pion (negative) analysis
380
381   // *** Begin Kaon-Kaon (positive) analysis
382   AliFemtoVertexMultAnalysis *ankp = new AliFemtoVertexMultAnalysis(18, -15.6, 15.6, 1, 2, 20000);
383   ankp->SetNumEventsToMix(5);
384   ankp->SetMinSizePartCollection(2);
385
386   AliFemtoBasicEventCut* meckp = new AliFemtoBasicEventCut();
387   meckp->SetEventMult(1,100000);
388   meckp->SetVertZPos(-1000,1000);
389         
390   AliFemtoESDTrackCut* dtckp = new AliFemtoESDTrackCut();
391   dtckp->SetPidProbKaon(0.7,1.001);
392   dtckp->SetPidProbMuon(0.0,0.5);
393   dtckp->SetPidProbPion(0.0,0.5);
394   dtckp->SetPidProbProton(0.0,0.5);
395   dtckp->SetCharge(1.0);
396   dtckp->SetMostProbableKaon();
397   dtckp->SetPt(0.15,2.0);
398   dtckp->SetMass(KaonMass);
399   // Track quality cuts
400   dtckp->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
401   //dtckp->SetStatus(AliESDtrack::kTPCrefit);
402   //  dtckp->SetminTPCclsF(95);
403   dtckp->SetminTPCncls(50);
404   dtckp->SetRemoveKinks(kTRUE);
405   dtckp->SetLabel(kFALSE);
406   dtckp->SetMaxITSChiNdof(2.5);
407   dtckp->SetMaxTPCChiNdof(3.0);
408   //  dtckp->SetMaxSigmaToVertex(3.0);
409   dtckp->SetMaxImpactXY(3.0);
410   dtckp->SetMaxImpactZ(3.0);
411
412   AliFemtoCutMonitorParticleYPt *cutPassYPtkp = new AliFemtoCutMonitorParticleYPt("cutPasskp", 0.493677);
413   AliFemtoCutMonitorParticleYPt *cutFailYPtkp = new AliFemtoCutMonitorParticleYPt("cutFailkp", 0.493677);
414   dtckp->AddCutMonitor(cutPassYPtkp, cutFailYPtkp);
415
416   AliFemtoCutMonitorParticlePtPDG *cutPassPidkp = new AliFemtoCutMonitorParticlePtPDG("cutPasskp", 0.493677);
417   AliFemtoCutMonitorParticlePtPDG *cutFailPidkp = new AliFemtoCutMonitorParticlePtPDG("cutFailkp", 0.493677);
418   dtckp->AddCutMonitor(cutPassPidkp, cutFailPidkp);
419
420   AliFemtoCutMonitorParticleMomRes *cutPassMRkp = new AliFemtoCutMonitorParticleMomRes("cutPasskp");
421   AliFemtoCutMonitorParticleMomRes *cutFailMRkp = new AliFemtoCutMonitorParticleMomRes("cutFailkp");
422   dtckp->AddCutMonitor(cutPassMRkp, cutFailMRkp);
423
424   AliFemtoCutMonitorParticleVertPos *cutPassVPkp = new AliFemtoCutMonitorParticleVertPos("cutPasskp");
425   AliFemtoCutMonitorParticleVertPos *cutFailVPkp = new AliFemtoCutMonitorParticleVertPos("cutFailkp");
426   dtckp->AddCutMonitor(cutPassVPkp, cutFailVPkp);
427
428   AliFemtoCutMonitorEventMult *cutPassEvMkp = new AliFemtoCutMonitorEventMult("cutPasskp");
429   AliFemtoCutMonitorEventMult *cutFailEvMkp = new AliFemtoCutMonitorEventMult("cutFailkp");
430   meckp->AddCutMonitor(cutPassEvMkp, cutFailEvMkp);
431
432   AliFemtoCutMonitorEventVertex *cutPassEvVkp = new AliFemtoCutMonitorEventVertex("cutPasskp");
433   AliFemtoCutMonitorEventVertex *cutFailEvVkp = new AliFemtoCutMonitorEventVertex("cutFailkp");
434   meckp->AddCutMonitor(cutPassEvVkp, cutFailEvVkp);
435
436   AliFemtoShareQualityTPCEntranceSepPairCut *sqpckp = new AliFemtoShareQualityTPCEntranceSepPairCut();
437   sqpckp->SetShareQualityMax(0.0);
438   sqpckp->SetShareFractionMax(0.02);
439   sqpckp->SetRemoveSameLabel(kFALSE);
440   sqpckp->SetTPCEntranceSepMinimum(3.0);
441
442   ankp->SetEventCut(meckp);
443   ankp->SetFirstParticleCut(dtckp);
444   ankp->SetSecondParticleCut(dtckp);
445   ankp->SetPairCut(sqpckp);
446
447   AliFemtoQinvCorrFctn *cqinvkp= new AliFemtoQinvCorrFctn("qinvcf",100,0.0,1.0);
448
449   AliFemtoModelBPLCMSCorrFctn *c3dsmallkp;
450   AliFemtoModelCorrFctn *c1dpikp;
451
452   // Setting up the model calculation
453   // First create the freeze-out generator
454   AliFemtoModelGausRinvFreezeOutGenerator *tFreezekp = new AliFemtoModelGausRinvFreezeOutGenerator();
455   tFreezekp->SetSizeInv(1.8*TMath::Sqrt(2.0));
456   tFreezekp->SetSelectPrimaryFromHidden(false);
457
458   // And the weight generator                                                                    
459   AliFemtoModelWeightGeneratorBasic *tWeightkp = new AliFemtoModelWeightGeneratorBasic();
460   tWeightkp->SetPairType(AliFemtoModelWeightGenerator::KaonPlusKaonPlus());
461
462   // Create a manager that will connect it  
463   AliFemtoModelManager *tModelManagerkp = new AliFemtoModelManager();
464   tModelManagerkp->AcceptFreezeOutGenerator(tFreezekp);
465   tModelManagerkp->AcceptWeightGenerator(tWeightkp);
466   tModelManagerkp->CreateCopyHiddenInfo(kFALSE);
467
468   c3dsmallkp = new AliFemtoModelBPLCMSCorrFctn("c3dsmallkp",30, 0.0, 0.6);
469   c3dsmallkp->ConnectToManager(tModelManagerkp);
470
471   c1dpikp = new AliFemtoModelCorrFctn("c1dpikp",100,0.0,1.0);
472   c1dpikp->ConnectToManager(tModelManagerkp);
473
474   //###
475   ankp->AddCorrFctn(cqinvkp);
476  
477   ankp->AddCorrFctn(c3dsmallkp);
478   ankp->AddCorrFctn(c1dpikp);
479
480   Manager->AddAnalysis(ankp);     
481
482   // *** End Kaon-Kaon (positive) analysis
483
484   return Manager;
485 }                         
486