e79853fa296d68b2771d6c7f81a82a87578500e9
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / macros / Train / DEtaDPhi / 2014 / Train4 / ConfigFemtoAnalysis.C
1 /*********************************************************************
2  *                                                                                                                                                                                       *
3  * Configfemtoanalysis.C - configuration macro for the femtoscopic       *
4  * analysis, meant as a QA process for two-particle effects                              *
5  *                                                                                                                                                                                       *
6  * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                                                                     *
7  *                                                                                                                                                                                       *
8  *********************************************************************/
9
10 #if !defined(__CINT__) || defined(__MAKECINT_)
11 #include "AliFemtoManager.h"
12 #include "AliFemtoEventReaderESDChain.h"
13 #include "AliFemtoEventReaderESDChainKine.h"
14 #include "AliFemtoEventReaderAODChain.h"
15 #include "AliFemtoSimpleAnalysis.h"
16 #include "AliFemtoBasicEventCut.h"
17 #include "AliFemtoESDTrackCut.h"
18 #include "AliFemtoCorrFctn.h"
19 #include "AliFemtoCutMonitorParticleYPt.h"
20 #include "AliFemtoCutMonitorParticleVertPos.h"
21 #include "AliFemtoCutMonitorParticleMomRes.h"
22 #include "AliFemtoCutMonitorParticlePID.h"
23 #include "AliFemtoCutMonitorEventMult.h"
24 #include "AliFemtoCutMonitorEventVertex.h"
25 #include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
26 #include "AliFemtoPairCutAntiGamma.h"
27 #include "AliFemtoPairCutRadialDistance.h"
28 #include "AliFemtoQinvCorrFctn.h"
29 #include "AliFemtoCorrFctnNonIdDR.h"
30 #include "AliFemtoCorrFctnDEtaDPhiCorrections.h"
31 #include "AliFemtoShareQualityCorrFctn.h"
32 #include "AliFemtoTPCInnerCorrFctn.h"
33 #include "AliFemtoVertexMultAnalysis.h"
34 #include "AliFemtoCorrFctn3DSpherical.h"
35 #include "AliFemtoChi2CorrFctn.h"
36 #include "AliFemtoCorrFctnTPCNcls.h"
37 #include "AliFemtoBPLCMS3DCorrFctn.h"
38 #include "AliFemtoCorrFctn3DLCMSSym.h"
39 #include "AliFemtoModelBPLCMSCorrFctn.h"
40 #include "AliFemtoModelCorrFctn3DSpherical.h"
41 #include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
42 #include "AliFemtoModelGausRinvFreezeOutGenerator.h"
43 #include "AliFemtoModelManager.h"
44 #include "AliFemtoModelWeightGeneratorBasic.h"
45 #include "AliFemtoModelWeightGeneratorLednicky.h"
46 #include "AliFemtoCorrFctnDirectYlm.h"
47 #include "AliFemtoModelCorrFctnDirectYlm.h"
48 #include "AliFemtoModelCorrFctnSource.h"
49 #include "AliFemtoCutMonitorParticlePtPDG.h"
50 #include "AliFemtoKTPairCut.h"
51 #include "AliFemtoPairCutPt.h"
52 #endif
53
54 //________________________________________________________________________
55 AliFemtoManager* ConfigFemtoAnalysis(const char* params="") {
56
57         double PionMass = 0.13956995;
58         double KaonMass = 0.493677;
59         double ProtonMass = 0.938272013;
60         
61         const int numOfMultBins = 5;    
62         const int numOfChTypes = 13;
63         const int numOfkTbins = 6;
64
65         char *parameter[15];
66         if(strlen(params)!=0)
67           {
68             parameter[0] = strtok(params, ","); // Splits spaces between words in params
69             cout<<"Parameter [0] (filterbit):"<<parameter[0]<<endl; // Writes first parameter
70             parameter[1] = strtok(NULL, ",");
71             cout<<"Parameter [1] (ktdep):"<<parameter[1]<<" "<<endl;
72             parameter[2] = strtok(NULL, ",");
73             cout<<"Parameter [2] (multdep):"<<parameter[2]<<" "<<endl;    
74             parameter[3] = strtok(NULL, ",");
75             cout<<"Parameter [3]: (MinPlpContribSPD)"<<parameter[3]<<" "<<endl;
76             parameter[4] = strtok(NULL, ",");
77             cout<<"Parameter [4]: (multbino)"<<parameter[4]<<" "<<endl;
78             parameter[5] = strtok(NULL, ",");
79             cout<<"Parameter [5]: (zvertbino)"<<parameter[5]<<" "<<endl;
80             parameter[6] = strtok(NULL, ",");
81             cout<<"Parameter [6]: (ifGlobalTracks=true/false)"<<parameter[6]<<" "<<endl;
82             parameter[7] = strtok(NULL, ",");
83             cout<<"Parameter [7]: (shareQuality)"<<parameter[7]<<" "<<endl;
84             parameter[8] = strtok(NULL, ",");
85             cout<<"Parameter [8]: (shareFraction)"<<parameter[8]<<" "<<endl;
86             parameter[9] = strtok(NULL, ",");
87             cout<<"Parameter [9]: (ifElectronRejection)"<<parameter[9]<<" "<<endl;
88             parameter[10] = strtok(NULL, ",");
89             cout<<"Parameter [10]: (nSigma)"<<parameter[10]<<" "<<endl;
90             parameter[11] = strtok(NULL, ",");
91             cout<<"Parameter [12]: (etaMin)"<<parameter[11]<<" "<<endl;
92             parameter[12] = strtok(NULL, ",");
93             cout<<"Parameter [12]: (etaMax)"<<parameter[12]<<" "<<endl;
94             parameter[13] = strtok(NULL, ",");
95             cout<<"Parameter [13]: (ispileup)"<<parameter[13]<<" "<<endl;
96           }
97         int filterbit = atoi(parameter[0]); //96 / 768 / 128 
98         int runktdep = atoi(parameter[1]); //0
99         int runmultdep = atoi(parameter[2]); //0
100         int minPlpContribSPD = atoi(parameter[3]); //3
101         int multbino = atoi(parameter[4]); //30
102         int zvertbino = atoi(parameter[5]); //10
103         Bool_t ifGlobalTracks=kFALSE; if(atoi(parameter[6]))ifGlobalTracks=kTRUE;//kTRUE 
104         double shareQuality = atof(parameter[7]); //0.00
105         double shareFraction = atof(parameter[8]); //0.05
106         bool ifElectronRejection = atoi(parameter[9]); //true
107         double nSigmaVal = atof(parameter[10]); //3.0
108         double nEtaMin = atof(parameter[11]); //-0.8
109         double nEtaMax = atof(parameter[12]);  //0.8
110         bool ifIsPileUp = atoi(parameter[13]); //true
111
112         int runmults[numOfMultBins] = {0, 0, 0, 0, 1};
113         if(runmultdep)    {runmults[0]=1; runmults[1]=1; runmults[2]=1;   }
114         int multbins[numOfMultBins+1] = {2, 20, 50,150,2,150};
115         
116         int runch[numOfChTypes] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
117         const char *chrgs[numOfChTypes] = { "PP", "aPaP", "PaP", "KpKp", "KmKm", "KpKm", "PIpPIp", "PImPIm", "PIpPIm", "all", "plus", "minus", "mixed" };
118         
119         int runktdep = 1;
120         double ktrng[numOfkTbins+1] = {0.0, 0, 0, 0, 0, 0};
121         double ktrngAll[numOfkTbins+1] = {0.0, 7.0, 1.2, 2.0, 3.0, 4.0, 100.0};
122         double ktrngPion[numOfkTbins+1] = {0.0, 0.7, 0.9, 1.1, 1.4, 2.5, 100.0};
123         double ktrngKaon[numOfkTbins+1] = {0.0, 1.5, 2.5, 3.5, 100.0, 0, 0};
124         double ktrngProton[numOfkTbins+1] = {0.0, 2.75, 100, 0, 0};
125
126         int runqinv = 1;
127         int runshlcms = 1;// 0:PRF(PAP), 1:LCMS(PP,APAP)
128
129         int runtype = 0; // Types 0 - global, 1 - ITS only, 2 - TPC Inner       //global tracks ->mfit ITS+TPC
130         int owncuts = 0; 
131         int owndca = 0;
132
133         int gammacut = 0;       // cut na ee z gamma 
134         
135         double shqmax = 0.5; 
136         int nbinssh = 100;
137
138         //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
139         //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kGlobalCount);
140
141
142         AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
143         Reader->SetFilterMask(filterbit);
144         Reader->SetDCAglobalTrack(ifGlobalTracks); //false for FB7, true for the rest //we do not use DCA at all
145         Reader->SetUseMultiplicity(AliFemtoEventReaderAOD::kReference);
146         Reader->SetMinPlpContribSPD(minPlpContribSPD);
147         Reader->SetIsPileUpEvent(ifIsPileUp);
148
149         AliFemtoManager* Manager = new AliFemtoManager();
150         Manager->SetEventReader(Reader);
151
152         AliFemtoVertexMultAnalysis              *anetaphitpc[numOfMultBins*numOfChTypes];
153         AliFemtoBasicEventCut                            *mecetaphitpc[numOfMultBins*numOfChTypes];
154         AliFemtoCutMonitorEventMult      *cutPassEvMetaphitpc[numOfMultBins*numOfChTypes];
155         AliFemtoCutMonitorEventMult      *cutFailEvMetaphitpc[numOfMultBins*numOfChTypes];
156         AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[numOfMultBins*numOfChTypes];
157         AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[numOfMultBins*numOfChTypes];
158         AliFemtoESDTrackCut                      *dtc1etaphitpc[numOfMultBins*numOfChTypes];
159         AliFemtoESDTrackCut                      *dtc2etaphitpc[numOfMultBins*numOfChTypes];
160         AliFemtoESDTrackCut                      *dtc3etaphitpc[numOfMultBins*numOfChTypes];
161         AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[numOfMultBins*numOfChTypes];
162         AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[numOfMultBins*numOfChTypes];
163         AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[numOfMultBins*numOfChTypes];
164         AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[numOfMultBins*numOfChTypes];
165         AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[numOfMultBins*numOfChTypes];
166         AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[numOfMultBins*numOfChTypes];
167         AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[numOfMultBins*numOfChTypes];
168         AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[numOfMultBins*numOfChTypes];
169         AliFemtoCutMonitorParticleYPt *cutPass3YPtetaphitpc[numOfMultBins*numOfChTypes];
170         AliFemtoCutMonitorParticleYPt *cutFail3YPtetaphitpc[numOfMultBins*numOfChTypes];
171         AliFemtoCutMonitorParticlePID *cutPass3PIDetaphitpc[numOfMultBins*numOfChTypes];
172         AliFemtoCutMonitorParticlePID *cutFail3PIDetaphitpc[numOfMultBins*numOfChTypes];
173         //       AliFemtoShareQualityTPCEntranceSepPairCut                      *sqpcetaphitpcsame[numOfMultBins*numOfChTypes];
174         //AliFemtoPairCutAntiGamma                      *sqpcetaphitpc[numOfMultBins*numOfChTypes];
175         //AliFemtoPairCutRadialDistance                 *sqpcetaphitpc[numOfMultBins*numOfChTypes];
176         AliFemtoShareQualityPairCut                     *sqpcetaphitpc[numOfMultBins*numOfChTypes];
177         //      AliFemtoChi2CorrFctn                                    *cchiqinvetaphitpc[numOfMultBins*numOfChTypes];
178         AliFemtoPairCutPt                                       *ktpcuts[numOfMultBins*numOfChTypes*numOfkTbins];
179         AliFemtoQinvCorrFctn                                    *cqinvkttpc[numOfMultBins*numOfChTypes*numOfkTbins];
180         AliFemtoQinvCorrFctn                                    *cqinvtpc[numOfMultBins*numOfChTypes];
181         AliFemtoCorrFctnDEtaDPhiCorrections                     *cdedpetaphi[numOfMultBins*numOfChTypes];
182         AliFemtoCorrFctnDEtaDPhiCorrections                     *cdedpetaphiPt[numOfMultBins*numOfChTypes*numOfkTbins];
183
184
185         
186         // *** Third QA task - HBT analysis with all pair cuts off, TPC only ***
187         // *** Begin pion-pion (positive) analysis ***
188         int aniter = 0; 
189
190         for (int imult = 0; imult < numOfMultBins; imult++)
191         {
192                 if (runmults[imult])
193                 {
194                         for (int ichg = 0; ichg < numOfChTypes; ichg++)
195                         {
196                                 if (runch[ichg])
197                                 {
198
199                                         aniter = ichg * numOfMultBins + imult;
200                                         anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(zvertbino, -10.0, 10.0, multbino, multbins[imult], multbins[imult+1]);
201                                         anetaphitpc[aniter]->SetNumEventsToMix(10);
202                                         anetaphitpc[aniter]->SetMinSizePartCollection(1);
203                                         anetaphitpc[aniter]->SetVerboseMode(kFALSE);//~~~~~~~~~~~~~~~~
204
205                                         //*** Event cut ***
206                                         mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
207                                         mecetaphitpc[aniter]->SetEventMult(0.001,100000);
208                                         mecetaphitpc[aniter]->SetVertZPos(-10,10);//cm
209
210                                         //****** event monitors **********      
211                                         cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
212                                         cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
213                                         mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
214                 
215                                         cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
216                                         cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
217                                         mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
218
219
220                                         // ***** single particle track cuts *********
221                                         dtc1etaphitpc[aniter] = new AliFemtoESDTrackCut();
222                                         dtc2etaphitpc[aniter] = new AliFemtoESDTrackCut();
223                                         dtc1etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
224                                         dtc2etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
225                                         dtc1etaphitpc[aniter]->SetNsigma(nSigmaVal);
226                                         dtc2etaphitpc[aniter]->SetNsigma(nSigmaVal);
227                                         //dtc3etaphitpc[aniter]->SetNsigma(3.0);
228
229                                         dtc1etaphitpc[aniter]->SetCharge(1.0);
230                                         dtc2etaphitpc[aniter]->SetCharge(-1.0);
231
232                                         dtc1etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
233                                         dtc2etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
234
235
236                                         dtc1etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);       
237                                         dtc2etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);
238
239
240
241                                         if (ichg == 0 ||ichg == 1 ||ichg == 2)//protons 0-2
242                                           {
243                                             dtc1etaphitpc[aniter]->SetPt(0.5,4);
244                                             dtc2etaphitpc[aniter]->SetPt(0.5,4);
245                                            
246                                             dtc1etaphitpc[aniter]->SetMass(ProtonMass);         
247                                             dtc1etaphitpc[aniter]->SetMostProbableProton();
248                                             dtc2etaphitpc[aniter]->SetMass(ProtonMass);         
249                                             dtc2etaphitpc[aniter]->SetMostProbableProton();
250                                           }
251
252                                         if (ichg == 3 ||ichg == 4 ||ichg == 5)//kaons 3-5
253                                           {
254                                             dtc1etaphitpc[aniter]->SetPt(0.3,4);
255                                             dtc2etaphitpc[aniter]->SetPt(0.3,4);
256                                         
257                                             dtc1etaphitpc[aniter]->SetMass(KaonMass);
258                                             dtc1etaphitpc[aniter]->SetMostProbableKaon();
259                                             dtc2etaphitpc[aniter]->SetMass(KaonMass);
260                                             dtc2etaphitpc[aniter]->SetMostProbableKaon();
261
262                                           }
263                                         if (ichg == 6 ||ichg == 7 ||ichg == 8)//pions 6-8
264                                           {
265                                             dtc1etaphitpc[aniter]->SetPt(0.2,4);
266                                             dtc2etaphitpc[aniter]->SetPt(0.2,4);
267
268                                             dtc1etaphitpc[aniter]->SetMass(PionMass);           
269                                             dtc1etaphitpc[aniter]->SetMostProbablePion();
270                                             dtc2etaphitpc[aniter]->SetMass(PionMass);           
271                                             dtc2etaphitpc[aniter]->SetMostProbablePion();
272                                           }
273                                         if (ichg == 9)//all
274                                           {
275
276                                             dtc3etaphitpc[aniter] = new AliFemtoESDTrackCut();
277                                             dtc3etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
278                                             dtc3etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
279                                             dtc3etaphitpc[aniter]->SetElectronRejection(ifElectronRejection); 
280                                             dtc3etaphitpc[aniter]->SetPt(0.2,4);
281                                           }
282                                         if (ichg == 10 ||ichg == 11 ||ichg == 12)//plus,minus,mixed
283                                           {
284                                             dtc1etaphitpc[aniter]->SetPt(0.2,4);
285                                             dtc2etaphitpc[aniter]->SetPt(0.2,4);
286                                           }
287
288                                         //****** DCA ******
289
290                                         if(owndca){
291                                           dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
292                                           //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
293                                           dtc1etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
294                                           dtc2etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
295                                           dtc2etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
296                                           if (ichg == 9){dtc3etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);       //      DCA xy
297                                           dtc3etaphitpc[aniter]->SetMaxImpactZ(2);}     //DCA Z
298                                         }
299                                         //****** Track quality cuts ******
300
301                                         if(owncuts){
302
303                                           dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
304                                           dtc1etaphitpc[aniter]->SetminTPCncls(70);
305                                           dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
306                                           dtc1etaphitpc[aniter]->SetLabel(kFALSE);
307                                           //    dtc1etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
308                                           dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0); // pisac
309                                           //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
310
311                                           dtc2etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
312                                           dtc2etaphitpc[aniter]->SetminTPCncls(70);
313                                           dtc2etaphitpc[aniter]->SetRemoveKinks(kTRUE);
314                                           dtc2etaphitpc[aniter]->SetLabel(kFALSE);
315                                           //    dtc2etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
316                                           dtc2etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
317                                           //    dtc2etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
318                                           if (ichg == 9){
319                                             dtc3etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
320                                             dtc3etaphitpc[aniter]->SetminTPCncls(70);
321                                             dtc3etaphitpc[aniter]->SetRemoveKinks(kTRUE);
322                                             dtc3etaphitpc[aniter]->SetLabel(kFALSE);
323                                             //  dtc3etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
324                                             dtc3etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
325                                             //  dtc3etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
326                                           }
327         
328                                         }
329                                         //**************** track Monitors ***************
330
331                                         
332                                         if(1)//ichg>8)
333                                           {
334                                             if(ichg<2 || ichg==3||ichg==4 || ichg==6|| ichg==7||ichg==9||ichg==10||ichg==11){ 
335                                               cutPass3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass%stpcM%i", chrgs[ichg], imult),PionMass);
336                                               cutFail3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail%stpcM%i", chrgs[ichg], imult),PionMass);
337                                             }
338                                             if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
339                                             if(ichg==0||ichg==3||ichg==6||ichg==10) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
340                                             if(ichg==1||ichg==4||ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
341
342                                             if(ichg<2){ //PP, PaP
343                                               cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),2);//0-pion,1-kaon,2-proton
344                                               cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),2);
345                                               if(ichg==0) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
346                                               if(ichg==1) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
347                                             }
348                                             else if(ichg>=3 && ichg<=4){//KpKp, KmKm
349                                               cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),1);//0-pion,1-kaon,2-proton
350                                               cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),1);
351                                               if(ichg==3) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
352                                               if(ichg==4) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
353                                             }
354                                             else if(ichg==6||ichg==10||ichg==7||ichg==11||ichg==9){ //pions, all
355                                               cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),0);//0-pion,1-kaon,2-proton
356                                               cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),0);
357                                               if(ichg==6||ichg==10) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
358                                               if(ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
359                                               if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
360                                             }
361                                           }
362                                          
363                                         //******** Two - track cuts ************
364                                         //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
365                                         sqpcetaphitpc[aniter] = new AliFemtoShareQualityPairCut();
366                                 
367                                         sqpcetaphitpc[aniter]->SetShareQualityMax(shareQuality);                // two track cuts on splitting and merging  //1- wylaczany 0 -wlaczany   
368                                         sqpcetaphitpc[aniter]->SetShareFractionMax(shareFraction);      //  ile moga miec wspolnych klastrow //1 - wylaczany, 0.05 - wlaczany
369                                         sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
370                                         // sqpcetaphitpc[aniter]->SetMaximumRadius(0.82);
371                                         // sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
372                                         // sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
373                                         // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
374                                         /*
375                                         if (gammacut == 0)
376                                           {
377                                             sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
378                                             sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
379                                           }
380                                         else if (gammacut == 1)
381                                           {
382                                             sqpcetaphitpc[aniter]->SetMaxEEMinv(0.002);
383                                             sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.008);
384                                           }
385                                         */
386                                         // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
387                                         // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
388                                         // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
389                                           
390                                         
391                 
392
393                                         //***** Setting cuts ***********
394
395                 
396                                         // setting event cut
397                                         anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
398                                         //setting single track cuts
399                                         if(ichg==0 || ichg==3  || ichg==6 || ichg==10) //positive like-sign
400                                         {
401                                                 anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
402                                                 anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
403                                         }
404                                         if(ichg==1 || ichg==4 || ichg==7 || ichg==11)//negative like-sign
405                                         {
406                                                 anetaphitpc[aniter]->SetFirstParticleCut(dtc2etaphitpc[aniter]);
407                                                 anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
408                                         }
409                                         if(ichg==2 || ichg==5 || ichg==8 || ichg==12)//unlike-sign
410                                         {
411                                                 anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
412                                                 anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
413                                         }
414                                         if(ichg==9) //all
415                                         {
416                                           anetaphitpc[aniter]->SetFirstParticleCut(dtc3etaphitpc[aniter]);
417                                           anetaphitpc[aniter]->SetSecondParticleCut(dtc3etaphitpc[aniter]);
418                                         }
419
420                                         //setting two-track cuts
421                                         anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
422
423
424                                         //**** Correlation functions *******
425
426                                         cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhiCorrections(Form("cdedp%stpcM%i", chrgs[ichg], imult),35, 35);
427                                         if(ichg==0 || ichg==1 || ichg==2)
428                                           cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kProton/*,1,1,1,0*/);
429                                         //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kProton,1,1,1,1);
430                                         else if(ichg==3 || ichg==4 || ichg==5)
431                                           cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon/*,1,1,1,0*/);
432                                           //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon,1,1,1,1);        
433                                          
434                                         else if(ichg==6 || ichg==7 || ichg==8)
435                                           cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kPion/*,1,1,1,0*/);
436                                         
437                                           //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kPion,1,1,1,1);        
438                                         
439                                         else
440                                           cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll/*,1,1,1,0*/);
441                                           //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll,1,1,1,1);
442                                         
443                              
444
445              
446                                         anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
447
448                 
449                                         if (runktdep)
450                                         {
451
452                                           if(ichg<=2){
453                                           for(int kit=0;kit<=numOfkTbins;kit++)
454                                             ktrng[kit]=ktrngProton[kit];
455                                           }
456                                           else if(ichg>2&&ichg<6){
457                                             for(int kit=0;kit<=numOfkTbins;kit++)
458                                               ktrng[kit]=ktrngKaon[kit];
459                                           }
460                                           else if(ichg>=6&&ichg<=8){
461                                             for(int kit=0;kit<=numOfkTbins;kit++)
462                                               ktrng[kit]=ktrngPion[kit];
463                                           }
464                                           else if(ichg>=9){
465                                             for(int kit=0;kit<=numOfkTbins;kit++)
466                                               ktrng[kit]=ktrngAll[kit];
467                                           }
468
469
470                                                 int ktm;
471                                                 for (int ikt=0; ikt<numOfkTbins; ikt++)
472                                                 {
473                                                         if(ktrng[ikt+1]==0) continue;
474                                                         ktm = aniter * numOfkTbins + ikt;
475                                                         ktpcuts[ktm] = new AliFemtoPairCutPt(ktrng[ikt], ktrng[ikt+1]);
476                                 
477                                                         //cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,(imult>6)?shqmax*2.5:shqmax);
478                                                         //cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
479                                                         //anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
480
481                                                         cdedpetaphiPt[ktm] = new AliFemtoCorrFctnDEtaDPhiCorrections(Form("cdedp%stpcM%ipT%i", chrgs[ichg], imult,ikt),35, 35);
482                                                         cdedpetaphiPt[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
483
484                                                         if(ichg==0 || ichg==1 || ichg==2)
485                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kProton/*,1,1,1,1*/);
486                                                         else if(ichg==3 || ichg==4 || ichg==5)
487                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon);
488                                                         else if(ichg==6 || ichg==7 || ichg==8)
489                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kPion);
490                                                         else
491                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D("alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Data/AOD/SystematicStudies/PIDSqrtNsigma/Corrections/4D/4Dmap_MCOnly.root", AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll);
492                                 
493
494                                                         /*if(ichg==0 || ichg==1 || ichg==2)
495                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromFile("alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/pTab.txt","alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/protonCorrTab.txt");
496                                                         else if(ichg==3 || ichg==4 || ichg==5)
497                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromFile("alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/pTab.txt","alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/kaonCorrTab.txt");      
498                                                         else if(ichg==6 || ichg==7 || ichg==8)
499                                                           cdedpetaphiPt[ktm]->LoadCorrectionTabFromFile("alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/pTab.txt","alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/pionCorrTab.txt");
500                                                         else
501                                                         cdedpetaphiPt[ktm]->LoadCorrectionTabFromFile("alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/pTab.txt","alien:///alice/cern.ch/user/l/lgraczyk/2014/DEtaDPhi/CorrectionTables/allCorrTab.txt");         */              
502                                                         anetaphitpc[aniter]->AddCorrFctn(cdedpetaphiPt[ktm]);
503
504                                                 }
505                                         }               
506                                         Manager->AddAnalysis(anetaphitpc[aniter]);      
507                                 }
508                         }
509                 }
510         }
511         return Manager;
512 }