Untriggered DEtaDPhi: corrected PtsumDist + update for the train
authormajanik <majanik@cern.ch>
Fri, 25 Jul 2014 07:44:18 +0000 (09:44 +0200)
committermajanik <majanik@cern.ch>
Fri, 25 Jul 2014 07:45:09 +0000 (09:45 +0200)
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhiCorrections.cxx
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoCorrFctnDEtaDPhiCorrections.h
PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoMJTrackCut.cxx
PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/CorrectionsParameters/ConfigFemtoAnalysis.C [new file with mode: 0644]
PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/NoCorrectionsParameters/ConfigFemtoAnalysis.C [new file with mode: 0644]

index bfe268b..3621224 100644 (file)
@@ -386,14 +386,13 @@ void AliFemtoCorrFctnDEtaDPhiCorrections::AddRealPair( AliFemtoPair* pair){
 
   double pt1 = TMath::Hypot(px1, py1);
   double pt2 = TMath::Hypot(px2, py2);
-  fPtSumDist->Fill(pt1+pt2);
 
   double vert1[3];
   pair->Track1()->Track()->GetPrimaryVertex(vert1);
   double vert2[3];
   pair->Track2()->Track()->GetPrimaryVertex(vert2);
 
-  double corrweight=0;
+  double corrweight=0; double corrweightpT1=1;  double corrweightpT2=1; 
   //if (fIfCorrection) corrweight = CalculateCorrectionWeight(pt1, pt2);
   if (fIfCorrection) 
     {
@@ -402,16 +401,23 @@ void AliFemtoCorrFctnDEtaDPhiCorrections::AddRealPair( AliFemtoPair* pair){
   else if(fCorr1D)
     {
       corrweight = CalculateCorrectionWeight(pt1, pt2);
+      corrweightpT1 = CalculateCorrectionWeight(pt1);
+      corrweightpT2 = CalculateCorrectionWeight(pt2);
     }
+
+  fPtSumDist->Fill(pt1*corrweightpT1+pt2*corrweightpT2);
   /*   double ptmin = pt1>pt2 ? pt2 : pt1;
 
        double cosphi = (px1*px2 + py1*py2 + pz1*pz2)/
        sqrt((px1*px1 + py1*py1 + pz1*pz1)*(px2*px2 + py2*py2 + pz2*pz2));
   */
   if (fIfCorrection || fCorr1D)
-    fDPhiDEtaNumerator->Fill(dphi, deta, corrweight);
-  else
+    {
+      fDPhiDEtaNumerator->Fill(dphi, deta, corrweight);
+    }
+  else{
     fDPhiDEtaNumerator->Fill(dphi, deta);
+  }
 
 
   if (fDoFullAnalysis) {
@@ -660,20 +666,26 @@ void AliFemtoCorrFctnDEtaDPhiCorrections::LoadCorrectionTabFromROOTFile(const ch
   fpartType1 = partType1;
   fpartType2 = partType2;
 
-  char* type1 = new char[10];
-  char* type2 = new char[10];
+  char* type1 = new char[12];
+  char* type2 = new char[12];
 
 
   if(fpartType1==kPion) strcpy(type1,"Pion");
   else if(fpartType1==kKaon) strcpy(type1,"Kaon");
   else if (fpartType1==kProton)strcpy(type1,"Proton");
   else if (fpartType1==kAll) strcpy(type1,"All");
+  else if(fpartType1==kPionMinus) strcpy(type1,"PionMinus");
+  else if(fpartType1==kKaonMinus) strcpy(type1,"KaonMinus");
+  else if (fpartType1==kProtonMinus)strcpy(type1,"ProtonMinus");
   else strcpy(type1,"");
 
   if(fpartType2==kPion) strcpy(type2,"Pion");
   else if(fpartType2==kKaon) strcpy(type2,"Kaon");
   else if (fpartType2==kProton) strcpy(type2,"Proton");
   else if (fpartType2==kAll) strcpy(type2,"All");
+  else if(fpartType2==kPionMinus) strcpy(type1,"PionMinus");
+  else if(fpartType2==kKaonMinus) strcpy(type1,"KaonMinus");
+  else if (fpartType2==kProtonMinus)strcpy(type1,"ProtonMinus");
   else strcpy(type1,"");
 
 
@@ -835,20 +847,26 @@ void AliFemtoCorrFctnDEtaDPhiCorrections::LoadCorrectionTabFromROOTFile1D(const
   fpartType2 = partType2;
 
 
-  char type1[10];
-  char type2[10];
+  char type1[12]; 
+  char type2[12];
 
 
   if(fpartType1==kPion) strcpy(type1,"Pion");
   else if(fpartType1==kKaon) strcpy(type1,"Kaon");
   else if (fpartType1==kProton)strcpy(type1,"Proton");
   else if (fpartType1==kAll) strcpy(type1,"All");
+  else if(fpartType1==kPionMinus) strcpy(type1,"PionMinus");
+  else if (fpartType1==kKaonMinus) strcpy(type1,"KaonMinus");
+  else if (fpartType1==kProtonMinus)strcpy(type1,"ProtonMinus");
   else strcpy(type1,"");
 
   if(fpartType2==kPion) strcpy(type2,"Pion");
   else if(fpartType2==kKaon) strcpy(type2,"Kaon");
   else if (fpartType2==kProton) strcpy(type2,"Proton");
   else if (fpartType2==kAll) strcpy(type2,"All");
+  else if(fpartType2==kPionMinus) strcpy(type1,"PionMinus");
+  else if(fpartType2==kKaonMinus) strcpy(type1,"KaonMinus");
+  else if (fpartType2==kProtonMinus)strcpy(type1,"ProtonMinus");
   else strcpy(type1,"");
 
   fhCont1 = (TH1D*)(ifileCorrTab->Get(Form("CorrectionFactorPtEffandCont%s",type1)));//->Clone();
@@ -875,19 +893,19 @@ void AliFemtoCorrFctnDEtaDPhiCorrections::SetCorrectionTab(ParticleType partType
   for(int i=0;i<190;i++)
     fpTab[i]=pttab[i];
 
-  if(partType==kPion)
+  if(partType==kPion || partType==kPionMinus)
     {
       fCorrFactorTab = new double[190];
       for(int i=0;i<190;i++)
        fCorrFactorTab[i] = pioncorrtab[i];
     }
-  else if(partType==kKaon)
+  else if(partType==kKaon || partType==kKaonMinus)
     {
       fCorrFactorTab = new double[190];
       for(int i=0;i<190;i++)
        fCorrFactorTab[i] = kaoncorrtab[i];
     }
-  else if(partType==kProton)
+  else if(partType==kProton||partType==kProtonMinus)
     {
       fCorrFactorTab = new double[190];
       for(int i=0;i<190;i++)
@@ -916,6 +934,18 @@ double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1
 }
 
 
+double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1)
+{
+   double w1=0.;
+   if(pT1 > fhCont1->GetXaxis()->GetXmin() && pT1 < fhCont1->GetXaxis()->GetXmax())
+     {
+       w1 = fhCont1->GetBinContent(fhCont1->FindFixBin(pT1));
+       return w1;
+     } 
+   else
+     return 0;
+}
+
 double AliFemtoCorrFctnDEtaDPhiCorrections::CalculateCorrectionWeight(double pT1, double pT2, double eta1, double eta2, double phi1, double phi2, double zvert1, double zvert2)
 {
   
index f5ed828..221a020 100644 (file)
@@ -24,7 +24,7 @@
 class AliFemtoCorrFctnDEtaDPhiCorrections : public AliFemtoCorrFctn {
 public:
   enum CorrectionType {kNone=0, kPt=1, kEta=2};
-  enum ParticleType {kNoCorrection=0, kPion=1, kKaon=2, kProton=3, kAll=4};
+  enum ParticleType {kNoCorrection=0, kPion=1, kKaon=2, kProton=3, kAll=4, kPionMinus=5, kKaonMinus=6, kProtonMinus=7};
   typedef enum CorrectionType ReadCorrectionType;
 
   AliFemtoCorrFctnDEtaDPhiCorrections(char* title, const int& aPhiBins, const int& aEtaBins);
@@ -40,6 +40,7 @@ public:
   virtual void Finish();
   void SetDoFullAnalysis(Bool_t do2d);
   double CalculateCorrectionWeight(double pT1, double pT2);
+  double CalculateCorrectionWeight(double pT1);
   double CalculateCorrectionWeight(double pT1, double pT2, double eta1, double eta2, double phi1, double phi2, double zvert1, double zvert2);
   void LoadCorrectionTabFromROOTFile1D(const char *file, ParticleType partType1, ParticleType partType2);
   void LoadCorrectionTabFromROOTFile(const char *file, ParticleType partType1, ParticleType partType2, bool doPtCorr, bool doEtaCorr, bool doPhiCorr, bool doZVertCorr);
index 2f21081..1eb1e16 100644 (file)
@@ -441,15 +441,15 @@ bool AliFemtoMJTrackCut::Pass(const AliFemtoTrack* track)
            if ( IsProtonNSigma(track->Pt(), track->NSigmaTPCP(), track->NSigmaTOFP()))
              imost = 12;
          }
-         else if (fMostProbable == 13) { //cut on Nsigma in pT not p, EXCLUSIVE PID
+         else if (fMostProbable == 13) { //cut on Nsigma in pT not p, EXCLUSIVE PID, pion
            if ((IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && !IsKaonNSigma(track->Pt(),track->NSigmaTPCK(), track->NSigmaTOFK()) && !IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP())))
              imost = 13;
          }
-         else if (fMostProbable == 14) { //cut on Nsigma in pT not p, EXCLUSIVE PID
+         else if (fMostProbable == 14) { //cut on Nsigma in pT not p, EXCLUSIVE PID, kaon
            if (!IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && IsKaonNSigma(track->Pt(),track->NSigmaTPCK(), track->NSigmaTOFK()) && !IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP()))
              imost = 14;
          }
-         else if (fMostProbable == 15) { //cut on Nsigma in pT not p, EXCLUSIVE PID
+         else if (fMostProbable == 15) { //cut on Nsigma in pT not p, EXCLUSIVE PID, proton
            if (!IsPionNSigma(track->Pt(),track->NSigmaTPCPi(), track->NSigmaTOFPi()) && !IsKaonNSigma(track->Pt(), !track->NSigmaTPCK(), track->NSigmaTOFK()) && IsProtonNSigma(track->Pt(),track->NSigmaTPCP(), track->NSigmaTOFP()))
              imost = 15;
          }
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/CorrectionsParameters/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/CorrectionsParameters/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..a1c70e1
--- /dev/null
@@ -0,0 +1,569 @@
+/********************************************************************* *                                                                                                                                                                                        *
+ * Configfemtoanalysis.C - configuration macro for the femtoscopic      *
+ * analysis, meant as a QA process for two-particle effects                             *
+ *                                                                                                                                                                                      *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                                                                    *
+ *                                                                                                                                                                                      *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoMJTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoCorrFctnNonIdDR.h"
+#include "AliFemtoCorrFctnDEtaDPhiCorrections.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoPairCutPt.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis(const char* params) {
+
+       double PionMass = 0.13956995;
+       double KaonMass = 0.493677;
+       double ProtonMass = 0.938272013;
+       
+       const int numOfMultBins = 5;    
+       const int numOfChTypes = 13;
+       const int numOfkTbins = 5;
+
+       char *parameter[20];
+       if(strlen(params)!=0)
+         {
+           parameter[0] = strtok(params, ","); // Splits spaces between words in params
+           cout<<"Parameter [0] (filterbit):"<<parameter[0]<<endl; // Writes first parameter
+           parameter[1] = strtok(NULL, ",");
+           cout<<"Parameter [1] (ktdep):"<<parameter[1]<<" "<<endl;
+           parameter[2] = strtok(NULL, ",");
+           cout<<"Parameter [2] (multdep):"<<parameter[2]<<" "<<endl;    
+           parameter[3] = strtok(NULL, ",");
+           cout<<"Parameter [3]: (MinPlpContribSPD)"<<parameter[3]<<" "<<endl;
+           parameter[4] = strtok(NULL, ",");
+           cout<<"Parameter [4]: (multbino)"<<parameter[4]<<" "<<endl;
+           parameter[5] = strtok(NULL, ",");
+           cout<<"Parameter [5]: (zvertbino)"<<parameter[5]<<" "<<endl;
+           parameter[6] = strtok(NULL, ",");
+           cout<<"Parameter [6]: (ifGlobalTracks=true/false)"<<parameter[6]<<" "<<endl;
+           parameter[7] = strtok(NULL, ",");
+           cout<<"Parameter [7]: (shareQuality)"<<parameter[7]<<" "<<endl;
+           parameter[8] = strtok(NULL, ",");
+           cout<<"Parameter [8]: (shareFraction)"<<parameter[8]<<" "<<endl;
+           parameter[9] = strtok(NULL, ",");
+           cout<<"Parameter [9]: (ifElectronRejection)"<<parameter[9]<<" "<<endl;
+           parameter[10] = strtok(NULL, ",");
+           cout<<"Parameter [10]: (nSigma)"<<parameter[10]<<" "<<endl;
+           parameter[11] = strtok(NULL, ",");
+           cout<<"Parameter [12]: (etaMin)"<<parameter[11]<<" "<<endl;
+           parameter[12] = strtok(NULL, ",");
+           cout<<"Parameter [12]: (etaMax)"<<parameter[12]<<" "<<endl;
+           parameter[13] = strtok(NULL, ",");
+           cout<<"Parameter [13]: (ispileup)"<<parameter[13]<<" "<<endl;
+           parameter[14] = strtok(NULL, ",");
+           cout<<"Parameter [14]: (max pT kaons)"<<parameter[14]<<" "<<endl;
+           parameter[15] = strtok(NULL, ",");
+           cout<<"Parameter [15]: (SetMostProbable 1)"<<parameter[15]<<" "<<endl;
+           parameter[16] = strtok(NULL, ",");
+           cout<<"Parameter [16]: (SetMostProbable 2)"<<parameter[16]<<" "<<endl;
+           parameter[17] = strtok(NULL, ",");
+           cout<<"Parameter [17]: (SetMostProbable 3)"<<parameter[17]<<" "<<endl;
+           parameter[18] = strtok(NULL, ",");
+           cout<<"Parameter [18]: (FILE no)"<<parameter[18]<<" "<<endl;
+         }
+       int filterbit = atoi(parameter[0]); //96 / 768 / 128 
+       int runktdep = atoi(parameter[1]); //0
+       int runmultdep = atoi(parameter[2]); //0
+       int minPlpContribSPD = atoi(parameter[3]); //3
+       int multbino = atoi(parameter[4]); //30
+       int zvertbino = atoi(parameter[5]); //10
+       Bool_t ifGlobalTracks=kFALSE; if(atoi(parameter[6]))ifGlobalTracks=kTRUE;//kTRUE 
+       double shareQuality = atof(parameter[7]); //0.00
+       double shareFraction = atof(parameter[8]); //0.05
+       bool ifElectronRejection = atoi(parameter[9]); //true
+       double nSigmaVal = atof(parameter[10]); //3.0
+       double nEtaMin = atof(parameter[11]); //-0.8
+       double nEtaMax = atof(parameter[12]);  //0.8
+       bool ifIsPileUp = atoi(parameter[13]); //true
+       double maxPtKaons = atof(parameter[14]);  //4.0
+
+       int setMostProb1 = atoi(parameter[15]);
+       int setMostProb2 = atoi(parameter[16]);
+       int setMostProb3 = atoi(parameter[17]);
+
+       int fileNo = atoi(parameter[18]);
+       char* fileName[300];
+       if(fileNo==0)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCOnly_DoubleCounting.root");
+       else if(fileNo==1)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCDCA_DoubleCounting.root");
+       else if(fileNo==2)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCOnly_NoDoubleCounting.root");
+       else if(fileNo==3)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCDCA_NoDoubleCounting.root");
+       else if(fileNo==4)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCOnly_Exclusive.root");
+       else if(fileNo==5)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCDCA_Exclusive.root");
+       else if(fileNo==6)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCOnly_DoubleCountingNsigma2.root");
+       else if(fileNo==7)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB96_MCDCA_DoubleCountingNsigma2.root");
+       else if(fileNo==8)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB768_MCOnly_NoDoubleCounting.root");
+       else if(fileNo==9)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB768_MCDCA_NoDoubleCounting.root");
+       else if(fileNo==10)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB768_MCOnly_DoubleCounting.root");
+       else if(fileNo==11)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/1Dmap_FB768_MCDCA_DoubleCounting.root");
+       else if(fileNo==12)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/4Dmap_FB96_MCOnly_NoDoubleCounting.root");
+       else if(fileNo==13)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/4Dmap_FB96_MCDCA_NoDoubleCounting.root");
+       else if(fileNo==14)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/4Dmap_FB768_MCOnly_DoubleCounting.root");
+       else if(fileNo==15)
+         strcpy(fileName,"alien:///alice/cern.ch/user/m/majanik/2014/DEtaDPhi/Trains/Corrections/Train7Light/4Dmap_FB768_MCDCA_DoubleCounting.root");
+
+       cout<<"Filename: "<<Form("%s",fileName)<<endl;
+
+       printf("*** Connect to AliEn ***\n");
+       TGrid::Connect("alien://");
+
+       int runmults[numOfMultBins] = {0, 0, 0, 0, 1};
+       if(runmultdep)    {runmults[0]=1; runmults[1]=1; runmults[2]=1;   }
+       int multbins[numOfMultBins+1] = {2, 20, 50,150,2,150};
+       
+       int runch[numOfChTypes] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1};
+       const char *chrgs[numOfChTypes] = { "PP", "aPaP", "PaP", "KpKp", "KmKm", "KpKm", "PIpPIp", "PImPIm", "PIpPIm", "all", "plus", "minus", "mixed" };
+       
+       double ktrng[numOfkTbins+1] = {0.0, 0, 0, 0, 0, 0};
+       double ktrngAll[numOfkTbins+1] = {0.0, 1.0, 2.0, 3.0, 4.0, 100.0};
+       double ktrngPion[numOfkTbins+1] = {0.0, 0.8, 1.2, 1.4, 2.5, 100.0};
+       double ktrngKaon[numOfkTbins+1] = {0.0, 2.5, 3.5, 100.0, 0, 0};
+       double ktrngProton[numOfkTbins+1] = {0.0, 2.75, 100, 0, 0, 0};
+
+       int runqinv = 1;
+       int runshlcms = 1;// 0:PRF(PAP), 1:LCMS(PP,APAP)
+
+       int runtype = 0; // Types 0 - global, 1 - ITS only, 2 - TPC Inner       //global tracks ->mfit ITS+TPC
+       int owncuts = 0; 
+       int owndca = 0;
+
+       int gammacut = 0;       // cut na ee z gamma 
+       
+       double shqmax = 0.5; 
+       int nbinssh = 100;
+
+       //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+       //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kGlobalCount);
+
+
+       AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+       Reader->SetFilterMask(filterbit);
+       Reader->SetDCAglobalTrack(ifGlobalTracks); //false for FB7, true for the rest //we do not use DCA at all
+       Reader->SetUseMultiplicity(AliFemtoEventReaderAOD::kReference);
+       Reader->SetMinPlpContribSPD(minPlpContribSPD);
+       Reader->SetIsPileUpEvent(ifIsPileUp);
+
+       AliFemtoManager* Manager = new AliFemtoManager();
+       Manager->SetEventReader(Reader);
+
+       AliFemtoVertexMultAnalysis              *anetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoBasicEventCut                            *mecetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventMult      *cutPassEvMetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventMult      *cutFailEvMetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc1etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc2etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc3etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass3YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail3YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass3PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail3PIDetaphitpc[numOfMultBins*numOfChTypes];
+       //       AliFemtoShareQualityTPCEntranceSepPairCut                      *sqpcetaphitpcsame[numOfMultBins*numOfChTypes];
+       //AliFemtoPairCutAntiGamma                      *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       //AliFemtoPairCutRadialDistance                 *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoShareQualityPairCut                     *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       //      AliFemtoChi2CorrFctn                                    *cchiqinvetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoPairCutPt                                       *ktpcuts[numOfMultBins*numOfChTypes*numOfkTbins];
+       AliFemtoQinvCorrFctn                                    *cqinvkttpc[numOfMultBins*numOfChTypes*numOfkTbins];
+       AliFemtoQinvCorrFctn                                    *cqinvtpc[numOfMultBins*numOfChTypes];
+       AliFemtoCorrFctnDEtaDPhiCorrections                     *cdedpetaphi[numOfMultBins*numOfChTypes];
+       AliFemtoCorrFctnDEtaDPhiCorrections                     *cdedpetaphiPt[numOfMultBins*numOfChTypes*numOfkTbins];
+
+
+       
+       // *** Third QA task - HBT analysis with all pair cuts off, TPC only ***
+       // *** Begin pion-pion (positive) analysis ***
+       int aniter = 0; 
+
+       for (int imult = 0; imult < numOfMultBins; imult++)
+       {
+               if (runmults[imult])
+               {
+                       for (int ichg = 0; ichg < numOfChTypes; ichg++)
+                       {
+                               if (runch[ichg])
+                               {
+
+                                       aniter = ichg * numOfMultBins + imult;
+                                       anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(zvertbino, -10.0, 10.0, multbino, multbins[imult], multbins[imult+1]);
+                                       anetaphitpc[aniter]->SetNumEventsToMix(10);
+                                       anetaphitpc[aniter]->SetMinSizePartCollection(1);
+                                       anetaphitpc[aniter]->SetVerboseMode(kFALSE);//~~~~~~~~~~~~~~~~
+
+                                       //*** Event cut ***
+                                       mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+                                       mecetaphitpc[aniter]->SetEventMult(0.001,100000);
+                                       mecetaphitpc[aniter]->SetVertZPos(-10,10);//cm
+
+                                       //****** event monitors **********      
+                                       cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+               
+                                       //cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       //cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       //mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+
+                                       // ***** single particle track cuts *********
+                                       dtc1etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                       dtc2etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                       dtc1etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                       dtc2etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                       dtc1etaphitpc[aniter]->SetNsigma(nSigmaVal);
+                                       dtc2etaphitpc[aniter]->SetNsigma(nSigmaVal);
+                                       //dtc3etaphitpc[aniter]->SetNsigma(3.0);
+
+                                       dtc1etaphitpc[aniter]->SetCharge(1.0);
+                                       dtc2etaphitpc[aniter]->SetCharge(-1.0);
+
+                                       dtc1etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+                                       dtc2etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+
+
+                                       dtc1etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);       
+                                       dtc2etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);
+
+
+
+                                        if (ichg == 0 ||ichg == 1 ||ichg == 2)//protons 0-2
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.5,4);
+                                            dtc2etaphitpc[aniter]->SetPt(0.5,4);
+                                           
+                                           dtc1etaphitpc[aniter]->SetMass(ProtonMass);         
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb1);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(ProtonMass);         
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb1);//cut on Nsigma in pT not p
+                                          }
+
+                                       if (ichg == 3 ||ichg == 4 ||ichg == 5)//kaons 3-5
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.3,maxPtKaons);
+                                            dtc2etaphitpc[aniter]->SetPt(0.3,maxPtKaons);
+                                           dtc1etaphitpc[aniter]->SetMass(KaonMass);
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb2);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(KaonMass);
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb2);//cut on Nsigma in pT not p
+
+                                          }
+                                        if (ichg == 6 ||ichg == 7 ||ichg == 8)//pions 6-8
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.2,4);
+                                           dtc2etaphitpc[aniter]->SetPt(0.2,4);
+
+                                           dtc1etaphitpc[aniter]->SetMass(PionMass);           
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb3);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(PionMass);           
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb3);//cut on Nsigma in pT not p
+                                          }
+                                        if (ichg == 9)//all
+                                          {
+
+                                           dtc3etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                           dtc3etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                           dtc3etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+                                           dtc3etaphitpc[aniter]->SetElectronRejection(ifElectronRejection); 
+                                            dtc3etaphitpc[aniter]->SetPt(0.2,4);
+                                          }
+                                        if (ichg == 10 ||ichg == 11 ||ichg == 12)//plus,minus,mixed
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.2,4);
+                                            dtc2etaphitpc[aniter]->SetPt(0.2,4);
+                                          }
+
+                                       //****** DCA ******
+
+                                       if(owndca){
+                                         dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
+                                         //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                         dtc1etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
+                                         dtc2etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
+                                         dtc2etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
+                                         if (ichg == 9){dtc3etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);       //      DCA xy
+                                         dtc3etaphitpc[aniter]->SetMaxImpactZ(2);}     //DCA Z
+                                       }
+                                       //****** Track quality cuts ******
+
+                                       if(owncuts){
+
+                                         dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                         dtc1etaphitpc[aniter]->SetminTPCncls(70);
+                                         dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                         dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+                                         //    dtc1etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                         dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0); // pisac
+                                         //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+                                         dtc2etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                         dtc2etaphitpc[aniter]->SetminTPCncls(70);
+                                         dtc2etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                         dtc2etaphitpc[aniter]->SetLabel(kFALSE);
+                                         //    dtc2etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                         dtc2etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                         //    dtc2etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+                                         if (ichg == 9){
+                                           dtc3etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                           dtc3etaphitpc[aniter]->SetminTPCncls(70);
+                                           dtc3etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                           dtc3etaphitpc[aniter]->SetLabel(kFALSE);
+                                           //  dtc3etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                           dtc3etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                           //  dtc3etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+                                         }
+       
+                                       }
+                                       //**************** track Monitors ***************
+
+                                       
+                                       if(1)//ichg>8)
+                                         {
+                                           //FULL
+                                           if(ichg<2 || ichg==3||ichg==4 || ichg==6|| ichg==7||ichg==9||ichg==10||ichg==11){ 
+                                           //if(ichg==0 || ichg==3 || ichg==6 || ichg==10){ 
+                                             cutPass3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass%stpcM%i", chrgs[ichg], imult),PionMass);
+                                             cutFail3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail%stpcM%i", chrgs[ichg], imult),PionMass);
+                                           }
+                                           if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+                                           if(ichg==0||ichg==3||ichg==6||ichg==10)  dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+                                           if(ichg==1||ichg==4||ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+
+                                           /*
+                                           if(ichg<2){ //PP, PaP
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),2);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),2);
+                                             if(ichg==0) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==1) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           else if(ichg>=3 && ichg<=4){//KpKp, KmKm
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),1);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),1);
+                                             if(ichg==3) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==4) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           else if(ichg==6||ichg==10||ichg==7||ichg==11||ichg==9){ //pions, all
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),0);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),0);
+                                             if(ichg==6||ichg==10) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           */
+
+                                         }
+                                        
+                                       //******** Two - track cuts ************
+                                       //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+                                       sqpcetaphitpc[aniter] = new AliFemtoShareQualityPairCut();
+                               
+                                       sqpcetaphitpc[aniter]->SetShareQualityMax(shareQuality);                // two track cuts on splitting and merging  //1- wylaczany 0 -wlaczany   
+                                       sqpcetaphitpc[aniter]->SetShareFractionMax(shareFraction);      //  ile moga miec wspolnych klastrow //1 - wylaczany, 0.05 - wlaczany
+                                       sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+                                       // sqpcetaphitpc[aniter]->SetMaximumRadius(0.82);
+                                       // sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
+                                       // sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+                                       // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+                                       /*
+                                       if (gammacut == 0)
+                                         {
+                                           sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+                                           sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+                                         }
+                                       else if (gammacut == 1)
+                                         {
+                                           sqpcetaphitpc[aniter]->SetMaxEEMinv(0.002);
+                                           sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.008);
+                                         }
+                                       */
+                                       // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+                                       // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+                                       // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+                                         
+                                       
+               
+
+                                       //***** Setting cuts ***********
+
+               
+                                       // setting event cut
+                                       anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+                                       //setting single track cuts
+                                       if(ichg==0 || ichg==3  || ichg==6 || ichg==10) //positive like-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+                                       }
+                                       if(ichg==1 || ichg==4 || ichg==7 || ichg==11)//negative like-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc2etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
+                                       }
+                                       if(ichg==2 || ichg==5 || ichg==8 || ichg==12)//unlike-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
+                                       }
+                                       if(ichg==9) //all
+                                        {
+                                         anetaphitpc[aniter]->SetFirstParticleCut(dtc3etaphitpc[aniter]);
+                                         anetaphitpc[aniter]->SetSecondParticleCut(dtc3etaphitpc[aniter]);
+                                        }
+
+                                       //setting two-track cuts
+                                       anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+
+                                       //**** Correlation functions *******
+
+                                       cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhiCorrections(Form("cdedp%stpcM%i", chrgs[ichg], imult),35, 35);
+                                       cdedpetaphi[aniter]->SetDoFullAnalysis(kFALSE);
+                                       if(ichg==0 || ichg==1 || ichg==2)
+                                         cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kProton/*,1,1,1,0*/);
+                                       //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kProton,1,1,1,1);
+                                       else if(ichg==3 || ichg==4 || ichg==5)
+                                         cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon/*,1,1,1,0*/);
+                                         //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon,1,1,1,1);    
+                                        
+                                       else if(ichg==6 || ichg==7 || ichg==8)
+                                         cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kPion/*,1,1,1,0*/);
+                                         //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kPion,1,1,1,1);    
+                                       
+                                       else
+                                         cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll/*,1,1,1,0*/);
+                                         //cdedpetaphi[aniter]->LoadCorrectionTabFromROOTFile(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll,1,1,1,1);
+                                       
+                            
+
+            
+                                       anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+               
+                                       if (runktdep)
+                                       {
+
+                                         if(ichg<=2){
+                                         for(int kit=0;kit<=numOfkTbins;kit++)
+                                           ktrng[kit]=ktrngProton[kit];
+                                         }
+                                         else if(ichg>2&&ichg<6){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngKaon[kit];
+                                          }
+                                         else if(ichg>=6&&ichg<=8){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngPion[kit];
+                                          }
+                                         else if(ichg>=9){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngAll[kit];
+                                          }
+
+
+                                               int ktm;
+                                               for (int ikt=0; ikt<numOfkTbins; ikt++)
+                                               {
+                                                       if(ktrng[ikt+1]==0) continue;
+                                                       ktm = aniter * numOfkTbins + ikt;
+                                                       ktpcuts[ktm] = new AliFemtoPairCutPt(ktrng[ikt], ktrng[ikt+1]);
+                               
+                                                       //cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,(imult>6)?shqmax*2.5:shqmax);
+                                                       //cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+                                                       //anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+                                                       cdedpetaphiPt[ktm] = new AliFemtoCorrFctnDEtaDPhiCorrections(Form("cdedp%stpcM%ipT%i", chrgs[ichg], imult,ikt),35, 35);
+                                                       cdedpetaphiPt[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+
+                                                       if(ichg==0 || ichg==1 || ichg==2)
+                                                         cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kProton, AliFemtoCorrFctnDEtaDPhiCorrections::kProton/*,1,1,1,1*/);
+                                                       else if(ichg==3 || ichg==4 || ichg==5)
+                                                         cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kKaon, AliFemtoCorrFctnDEtaDPhiCorrections::kKaon);
+                                                       else if(ichg==6 || ichg==7 || ichg==8)
+                                                         cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kPion, AliFemtoCorrFctnDEtaDPhiCorrections::kPion);
+                                                       else
+                                                         cdedpetaphiPt[ktm]->LoadCorrectionTabFromROOTFile1D(Form("%s",fileName), AliFemtoCorrFctnDEtaDPhiCorrections::kAll, AliFemtoCorrFctnDEtaDPhiCorrections::kAll);
+                               
+
+                                                       /*if(ichg==0 || ichg==1 || ichg==2)
+                                                         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");
+                                                       else if(ichg==3 || ichg==4 || ichg==5)
+                                                         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");      
+                                                       else if(ichg==6 || ichg==7 || ichg==8)
+                                                         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");
+                                                       else
+                                                       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");         */              
+                                                       anetaphitpc[aniter]->AddCorrFctn(cdedpetaphiPt[ktm]);
+
+                                               }
+                                       }               
+                                       Manager->AddAnalysis(anetaphitpc[aniter]);      
+                               }
+                       }
+               }
+       }
+       return Manager;
+}                                                                                               
diff --git a/PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/NoCorrectionsParameters/ConfigFemtoAnalysis.C b/PWGCF/FEMTOSCOPY/macros/Train/DEtaDPhi/2014/Train8FinalApproval/NoCorrectionsParameters/ConfigFemtoAnalysis.C
new file mode 100644 (file)
index 0000000..08d8442
--- /dev/null
@@ -0,0 +1,490 @@
+/********************************************************************* *                                                                                                                                                                                        *
+ * Configfemtoanalysis.C - configuration macro for the femtoscopic      *
+ * analysis, meant as a QA process for two-particle effects                             *
+ *                                                                                                                                                                                      *
+ * Author: Adam Kisiel (Adam.Kisiel@cern.ch)                                                                    *
+ *                                                                                                                                                                                      *
+ *********************************************************************/
+
+#if !defined(__CINT__) || defined(__MAKECINT_)
+#include "AliFemtoManager.h"
+#include "AliFemtoEventReaderESDChain.h"
+#include "AliFemtoEventReaderESDChainKine.h"
+#include "AliFemtoEventReaderAODChain.h"
+#include "AliFemtoSimpleAnalysis.h"
+#include "AliFemtoBasicEventCut.h"
+#include "AliFemtoMJTrackCut.h"
+#include "AliFemtoCorrFctn.h"
+#include "AliFemtoCutMonitorParticleYPt.h"
+#include "AliFemtoCutMonitorParticleVertPos.h"
+#include "AliFemtoCutMonitorParticleMomRes.h"
+#include "AliFemtoCutMonitorParticlePID.h"
+#include "AliFemtoCutMonitorEventMult.h"
+#include "AliFemtoCutMonitorEventVertex.h"
+#include "AliFemtoShareQualityTPCEntranceSepPairCut.h"
+#include "AliFemtoPairCutAntiGamma.h"
+#include "AliFemtoPairCutRadialDistance.h"
+#include "AliFemtoQinvCorrFctn.h"
+#include "AliFemtoCorrFctnNonIdDR.h"
+#include "AliFemtoShareQualityCorrFctn.h"
+#include "AliFemtoTPCInnerCorrFctn.h"
+#include "AliFemtoVertexMultAnalysis.h"
+#include "AliFemtoCorrFctn3DSpherical.h"
+#include "AliFemtoChi2CorrFctn.h"
+#include "AliFemtoCorrFctnTPCNcls.h"
+#include "AliFemtoBPLCMS3DCorrFctn.h"
+#include "AliFemtoCorrFctn3DLCMSSym.h"
+#include "AliFemtoModelBPLCMSCorrFctn.h"
+#include "AliFemtoModelCorrFctn3DSpherical.h"
+#include "AliFemtoModelGausLCMSFreezeOutGenerator.h"
+#include "AliFemtoModelGausRinvFreezeOutGenerator.h"
+#include "AliFemtoModelManager.h"
+#include "AliFemtoModelWeightGeneratorBasic.h"
+#include "AliFemtoModelWeightGeneratorLednicky.h"
+#include "AliFemtoCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnDirectYlm.h"
+#include "AliFemtoModelCorrFctnSource.h"
+#include "AliFemtoCutMonitorParticlePtPDG.h"
+#include "AliFemtoKTPairCut.h"
+#include "AliFemtoPairCutPt.h"
+#endif
+
+//________________________________________________________________________
+AliFemtoManager* ConfigFemtoAnalysis(const char* params) {
+
+       double PionMass = 0.13956995;
+       double KaonMass = 0.493677;
+       double ProtonMass = 0.938272013;
+       
+       const int numOfMultBins = 5;    
+       const int numOfChTypes = 13;
+       const int numOfkTbins = 5;
+
+       char *parameter[20];
+       if(strlen(params)!=0)
+         {
+           parameter[0] = strtok(params, ","); // Splits spaces between words in params
+           cout<<"Parameter [0] (filterbit):"<<parameter[0]<<endl; // Writes first parameter
+           parameter[1] = strtok(NULL, ",");
+           cout<<"Parameter [1] (ktdep):"<<parameter[1]<<" "<<endl;
+           parameter[2] = strtok(NULL, ",");
+           cout<<"Parameter [2] (multdep):"<<parameter[2]<<" "<<endl;    
+           parameter[3] = strtok(NULL, ",");
+           cout<<"Parameter [3]: (MinPlpContribSPD)"<<parameter[3]<<" "<<endl;
+           parameter[4] = strtok(NULL, ",");
+           cout<<"Parameter [4]: (multbino)"<<parameter[4]<<" "<<endl;
+           parameter[5] = strtok(NULL, ",");
+           cout<<"Parameter [5]: (zvertbino)"<<parameter[5]<<" "<<endl;
+           parameter[6] = strtok(NULL, ",");
+           cout<<"Parameter [6]: (ifGlobalTracks=true/false)"<<parameter[6]<<" "<<endl;
+           parameter[7] = strtok(NULL, ",");
+           cout<<"Parameter [7]: (shareQuality)"<<parameter[7]<<" "<<endl;
+           parameter[8] = strtok(NULL, ",");
+           cout<<"Parameter [8]: (shareFraction)"<<parameter[8]<<" "<<endl;
+           parameter[9] = strtok(NULL, ",");
+           cout<<"Parameter [9]: (ifElectronRejection)"<<parameter[9]<<" "<<endl;
+           parameter[10] = strtok(NULL, ",");
+           cout<<"Parameter [10]: (nSigma)"<<parameter[10]<<" "<<endl;
+           parameter[11] = strtok(NULL, ",");
+           cout<<"Parameter [12]: (etaMin)"<<parameter[11]<<" "<<endl;
+           parameter[12] = strtok(NULL, ",");
+           cout<<"Parameter [12]: (etaMax)"<<parameter[12]<<" "<<endl;
+           parameter[13] = strtok(NULL, ",");
+           cout<<"Parameter [13]: (ispileup)"<<parameter[13]<<" "<<endl;
+           parameter[14] = strtok(NULL, ",");
+           cout<<"Parameter [14]: (max pT kaons)"<<parameter[14]<<" "<<endl;
+           parameter[15] = strtok(NULL, ",");
+           cout<<"Parameter [15]: (SetMostProbable 1)"<<parameter[15]<<" "<<endl;
+           parameter[16] = strtok(NULL, ",");
+           cout<<"Parameter [16]: (SetMostProbable 2)"<<parameter[16]<<" "<<endl;
+           parameter[17] = strtok(NULL, ",");
+           cout<<"Parameter [17]: (SetMostProbable 3)"<<parameter[17]<<" "<<endl;
+         }
+       int filterbit = atoi(parameter[0]); //96 / 768 / 128 
+       int runktdep = atoi(parameter[1]); //0
+       int runmultdep = atoi(parameter[2]); //0
+       int minPlpContribSPD = atoi(parameter[3]); //3
+       int multbino = atoi(parameter[4]); //30
+       int zvertbino = atoi(parameter[5]); //10
+       Bool_t ifGlobalTracks=kFALSE; if(atoi(parameter[6]))ifGlobalTracks=kTRUE;//kTRUE 
+       double shareQuality = atof(parameter[7]); //0.00
+       double shareFraction = atof(parameter[8]); //0.05
+       bool ifElectronRejection = atoi(parameter[9]); //true
+       double nSigmaVal = atof(parameter[10]); //3.0
+       double nEtaMin = atof(parameter[11]); //-0.8
+       double nEtaMax = atof(parameter[12]);  //0.8
+       bool ifIsPileUp = atoi(parameter[13]); //true
+       double maxPtKaons = atof(parameter[14]);  //4.0
+
+       int setMostProb1 = atoi(parameter[15]);
+       int setMostProb2 = atoi(parameter[16]);
+       int setMostProb3 = atoi(parameter[17]);
+
+
+       printf("*** Connect to AliEn ***\n");
+       TGrid::Connect("alien://");
+
+       int runmults[numOfMultBins] = {0, 0, 0, 0, 1};
+       if(runmultdep)    {runmults[0]=1; runmults[1]=1; runmults[2]=1;   }
+       int multbins[numOfMultBins+1] = {2, 20, 50,150,2,150};
+       
+       int runch[numOfChTypes] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1};
+       const char *chrgs[numOfChTypes] = { "PP", "aPaP", "PaP", "KpKp", "KmKm", "KpKm", "PIpPIp", "PImPIm", "PIpPIm", "all", "plus", "minus", "mixed" };
+       
+       double ktrng[numOfkTbins+1] = {0.0, 0, 0, 0, 0, 0};
+       double ktrngAll[numOfkTbins+1] = {0.0, 1.0, 2.0, 3.0, 4.0, 100.0};
+       double ktrngPion[numOfkTbins+1] = {0.0, 0.8, 1.2, 1.4, 2.5, 100.0};
+       double ktrngKaon[numOfkTbins+1] = {0.0, 2.5, 3.5, 100.0, 0, 0};
+       double ktrngProton[numOfkTbins+1] = {0.0, 2.75, 100, 0, 0, 0};
+
+       int runqinv = 1;
+       int runshlcms = 1;// 0:PRF(PAP), 1:LCMS(PP,APAP)
+
+       int runtype = 0; // Types 0 - global, 1 - ITS only, 2 - TPC Inner       //global tracks ->mfit ITS+TPC
+       int owncuts = 0; 
+       int owndca = 0;
+
+       int gammacut = 0;       // cut na ee z gamma 
+       
+       double shqmax = 0.5; 
+       int nbinssh = 100;
+
+       //AliFemtoEventReaderESDChain *Reader = new AliFemtoEventReaderESDChain();
+       //Reader->SetUseMultiplicity(AliFemtoEventReaderESDChain::kGlobalCount);
+
+
+       AliFemtoEventReaderAODChain *Reader = new AliFemtoEventReaderAODChain();
+       Reader->SetFilterMask(filterbit);
+       Reader->SetDCAglobalTrack(ifGlobalTracks); //false for FB7, true for the rest //we do not use DCA at all
+       Reader->SetUseMultiplicity(AliFemtoEventReaderAOD::kReference);
+       Reader->SetMinPlpContribSPD(minPlpContribSPD);
+       Reader->SetIsPileUpEvent(ifIsPileUp);
+
+       AliFemtoManager* Manager = new AliFemtoManager();
+       Manager->SetEventReader(Reader);
+
+       AliFemtoVertexMultAnalysis              *anetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoBasicEventCut                            *mecetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventMult      *cutPassEvMetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventMult      *cutFailEvMetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventVertex *cutPassEvVetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorEventVertex *cutFailEvVetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc1etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc2etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoMJTrackCut                       *dtc3etaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass1YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail1YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass1PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail1PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass2YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail2YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass2PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail2PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutPass3YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticleYPt *cutFail3YPtetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutPass3PIDetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoCutMonitorParticlePID *cutFail3PIDetaphitpc[numOfMultBins*numOfChTypes];
+       //       AliFemtoShareQualityTPCEntranceSepPairCut                      *sqpcetaphitpcsame[numOfMultBins*numOfChTypes];
+       //AliFemtoPairCutAntiGamma                      *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       //AliFemtoPairCutRadialDistance                 *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoShareQualityPairCut                     *sqpcetaphitpc[numOfMultBins*numOfChTypes];
+       //      AliFemtoChi2CorrFctn                                    *cchiqinvetaphitpc[numOfMultBins*numOfChTypes];
+       AliFemtoPairCutPt                                       *ktpcuts[numOfMultBins*numOfChTypes*numOfkTbins];
+       AliFemtoQinvCorrFctn                                    *cqinvkttpc[numOfMultBins*numOfChTypes*numOfkTbins];
+       AliFemtoQinvCorrFctn                                    *cqinvtpc[numOfMultBins*numOfChTypes];
+       AliFemtoCorrFctnDEtaDPhi                        *cdedpetaphi[numOfMultBins*numOfChTypes];
+       AliFemtoCorrFctnDEtaDPhi                        *cdedpetaphiPt[numOfMultBins*numOfChTypes*numOfkTbins];
+
+
+       
+       // *** Third QA task - HBT analysis with all pair cuts off, TPC only ***
+       // *** Begin pion-pion (positive) analysis ***
+       int aniter = 0; 
+
+       for (int imult = 0; imult < numOfMultBins; imult++)
+       {
+               if (runmults[imult])
+               {
+                       for (int ichg = 0; ichg < numOfChTypes; ichg++)
+                       {
+                               if (runch[ichg])
+                               {
+
+                                       aniter = ichg * numOfMultBins + imult;
+                                       anetaphitpc[aniter] = new AliFemtoVertexMultAnalysis(zvertbino, -10.0, 10.0, multbino, multbins[imult], multbins[imult+1]);
+                                       anetaphitpc[aniter]->SetNumEventsToMix(10);
+                                       anetaphitpc[aniter]->SetMinSizePartCollection(1);
+                                       anetaphitpc[aniter]->SetVerboseMode(kFALSE);//~~~~~~~~~~~~~~~~
+
+                                       //*** Event cut ***
+                                       mecetaphitpc[aniter] = new AliFemtoBasicEventCut();
+                                       mecetaphitpc[aniter]->SetEventMult(0.001,100000);
+                                       mecetaphitpc[aniter]->SetVertZPos(-10,10);//cm
+
+                                       //****** event monitors **********      
+                                       cutPassEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       cutFailEvMetaphitpc[aniter] = new AliFemtoCutMonitorEventMult(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       mecetaphitpc[aniter]->AddCutMonitor(cutPassEvMetaphitpc[aniter], cutFailEvMetaphitpc[aniter]);
+               
+                                       //cutPassEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutPass%stpcM%i", chrgs[ichg], imult));
+                                       //cutFailEvVetaphitpc[aniter] = new AliFemtoCutMonitorEventVertex(Form("cutFail%stpcM%i", chrgs[ichg], imult));
+                                       //mecetaphitpc[aniter]->AddCutMonitor(cutPassEvVetaphitpc[aniter], cutFailEvVetaphitpc[aniter]);
+
+
+                                       // ***** single particle track cuts *********
+                                       dtc1etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                       dtc2etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                       dtc1etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                       dtc2etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                       dtc1etaphitpc[aniter]->SetNsigma(nSigmaVal);
+                                       dtc2etaphitpc[aniter]->SetNsigma(nSigmaVal);
+                                       //dtc3etaphitpc[aniter]->SetNsigma(3.0);
+
+                                       dtc1etaphitpc[aniter]->SetCharge(1.0);
+                                       dtc2etaphitpc[aniter]->SetCharge(-1.0);
+
+                                       dtc1etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+                                       dtc2etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+
+
+                                       dtc1etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);       
+                                       dtc2etaphitpc[aniter]->SetElectronRejection(ifElectronRejection);
+
+
+
+                                        if (ichg == 0 ||ichg == 1 ||ichg == 2)//protons 0-2
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.5,4);
+                                            dtc2etaphitpc[aniter]->SetPt(0.5,4);
+                                           
+                                           dtc1etaphitpc[aniter]->SetMass(ProtonMass);         
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb1);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(ProtonMass);         
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb1);//cut on Nsigma in pT not p
+                                          }
+
+                                       if (ichg == 3 ||ichg == 4 ||ichg == 5)//kaons 3-5
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.3,maxPtKaons);
+                                            dtc2etaphitpc[aniter]->SetPt(0.3,maxPtKaons);
+                                           dtc1etaphitpc[aniter]->SetMass(KaonMass);
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb2);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(KaonMass);
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb2);//cut on Nsigma in pT not p
+
+                                          }
+                                        if (ichg == 6 ||ichg == 7 ||ichg == 8)//pions 6-8
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.2,4);
+                                           dtc2etaphitpc[aniter]->SetPt(0.2,4);
+
+                                           dtc1etaphitpc[aniter]->SetMass(PionMass);           
+                                           dtc1etaphitpc[aniter]->SetMostProbable(setMostProb3);//cut on Nsigma in pT not p
+                                           dtc2etaphitpc[aniter]->SetMass(PionMass);           
+                                           dtc2etaphitpc[aniter]->SetMostProbable(setMostProb3);//cut on Nsigma in pT not p
+                                          }
+                                        if (ichg == 9)//all
+                                          {
+
+                                           dtc3etaphitpc[aniter] = new AliFemtoMJTrackCut();
+                                           dtc3etaphitpc[aniter]->SetNsigmaTPCTOF(kTRUE);
+                                           dtc3etaphitpc[aniter]->SetEta(nEtaMin,nEtaMax);
+                                           dtc3etaphitpc[aniter]->SetElectronRejection(ifElectronRejection); 
+                                            dtc3etaphitpc[aniter]->SetPt(0.2,4);
+                                          }
+                                        if (ichg == 10 ||ichg == 11 ||ichg == 12)//plus,minus,mixed
+                                          {
+                                            dtc1etaphitpc[aniter]->SetPt(0.2,4);
+                                            dtc2etaphitpc[aniter]->SetPt(0.2,4);
+                                          }
+
+                                       //****** DCA ******
+
+                                       if(owndca){
+                                         dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
+                                         //dtc1etaphitpc[aniter]->SetMaxImpactXYPtDep(0.0182, 0.0350, -1.01);
+                                         dtc1etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
+                                         dtc2etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);      //      DCA xy
+                                         dtc2etaphitpc[aniter]->SetMaxImpactZ(2);      //DCA Z
+                                         if (ichg == 9){dtc3etaphitpc[aniter]->SetMaxImpactXYPtDep(0.018, 0.035, -1.01);       //      DCA xy
+                                         dtc3etaphitpc[aniter]->SetMaxImpactZ(2);}     //DCA Z
+                                       }
+                                       //****** Track quality cuts ******
+
+                                       if(owncuts){
+
+                                         dtc1etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                         dtc1etaphitpc[aniter]->SetminTPCncls(70);
+                                         dtc1etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                         dtc1etaphitpc[aniter]->SetLabel(kFALSE);
+                                         //    dtc1etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                         dtc1etaphitpc[aniter]->SetMaxTPCChiNdof(4.0); // pisac
+                                         //dtc1etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+
+                                         dtc2etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                         dtc2etaphitpc[aniter]->SetminTPCncls(70);
+                                         dtc2etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                         dtc2etaphitpc[aniter]->SetLabel(kFALSE);
+                                         //    dtc2etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                         dtc2etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                         //    dtc2etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+                                         if (ichg == 9){
+                                           dtc3etaphitpc[aniter]->SetStatus(AliESDtrack::kTPCrefit|AliESDtrack::kITSrefit);
+                                           dtc3etaphitpc[aniter]->SetminTPCncls(70);
+                                           dtc3etaphitpc[aniter]->SetRemoveKinks(kTRUE);
+                                           dtc3etaphitpc[aniter]->SetLabel(kFALSE);
+                                           //  dtc3etaphitpc[aniter]->SetMaxITSChiNdof(6.0);
+                                           dtc3etaphitpc[aniter]->SetMaxTPCChiNdof(4.0);
+                                           //  dtc3etaphitpc[aniter]->SetMaxSigmaToVertex(6.0);
+                                         }
+       
+                                       }
+                                       //**************** track Monitors ***************
+
+                                       
+                                       if(1)//ichg>8)
+                                         {
+                                           if(ichg<2 || ichg==3||ichg==4 || ichg==6|| ichg==7||ichg==9||ichg==10||ichg==11){ 
+                                             cutPass3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutPass%stpcM%i", chrgs[ichg], imult),PionMass);
+                                             cutFail3YPtetaphitpc[aniter] = new AliFemtoCutMonitorParticleYPt(Form("cutFail%stpcM%i", chrgs[ichg], imult),PionMass);
+                                           }
+                                           if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+                                           if(ichg==0||ichg==3||ichg==6||ichg==10) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+                                           if(ichg==1||ichg==4||ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3YPtetaphitpc[aniter], cutFail3YPtetaphitpc[aniter]);
+
+                                           /*
+                                           if(ichg<2){ //PP, PaP
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),2);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),2);
+                                             if(ichg==0) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==1) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           else if(ichg>=3 && ichg<=4){//KpKp, KmKm
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),1);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),1);
+                                             if(ichg==3) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==4) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           else if(ichg==6||ichg==10||ichg==7||ichg==11||ichg==9){ //pions, all
+                                             cutPass3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutPass%stpcM%i", chrgs[ichg], imult),0);//0-pion,1-kaon,2-proton
+                                             cutFail3PIDetaphitpc[aniter] = new AliFemtoCutMonitorParticlePID(Form("cutFail%stpcM%i", chrgs[ichg], imult),0);
+                                             if(ichg==6||ichg==10) dtc1etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==7||ichg==11) dtc2etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                             if(ichg==9) dtc3etaphitpc[aniter]->AddCutMonitor(cutPass3PIDetaphitpc[aniter], cutFail3PIDetaphitpc[aniter]);
+                                           }
+                                           */
+
+                                         }
+                                        
+                                       //******** Two - track cuts ************
+                                       //sqpcetaphitpc[aniter] = new AliFemtoPairCutAntiGamma();
+                                       sqpcetaphitpc[aniter] = new AliFemtoShareQualityPairCut();
+                               
+                                       sqpcetaphitpc[aniter]->SetShareQualityMax(shareQuality);                // two track cuts on splitting and merging  //1- wylaczany 0 -wlaczany   
+                                       sqpcetaphitpc[aniter]->SetShareFractionMax(shareFraction);      //  ile moga miec wspolnych klastrow //1 - wylaczany, 0.05 - wlaczany
+                                       sqpcetaphitpc[aniter]->SetRemoveSameLabel(kFALSE);
+                                       // sqpcetaphitpc[aniter]->SetMaximumRadius(0.82);
+                                       // sqpcetaphitpc[aniter]->SetMinimumRadius(0.8);
+                                       // sqpcetaphitpc[aniter]->SetPhiStarDifferenceMinimum(0.02);
+                                       // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+                                       /*
+                                       if (gammacut == 0)
+                                         {
+                                           sqpcetaphitpc[aniter]->SetMaxEEMinv(0.0);
+                                           sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.0);
+                                         }
+                                       else if (gammacut == 1)
+                                         {
+                                           sqpcetaphitpc[aniter]->SetMaxEEMinv(0.002);
+                                           sqpcetaphitpc[aniter]->SetMaxThetaDiff(0.008);
+                                         }
+                                       */
+                                       // sqpcetaphitpc[aniter]->SetTPCEntranceSepMinimum(1.5);
+                                       // sqpcetaphitpc[aniter]->SetRadialDistanceMinimum(0.12, 0.03);
+                                       // sqpcetaphitpc[aniter]->SetEtaDifferenceMinimum(0.02);
+                                         
+                                       
+               
+
+                                       //***** Setting cuts ***********
+
+               
+                                       // setting event cut
+                                       anetaphitpc[aniter]->SetEventCut(mecetaphitpc[aniter]);
+                                       //setting single track cuts
+                                       if(ichg==0 || ichg==3  || ichg==6 || ichg==10) //positive like-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc1etaphitpc[aniter]);
+                                       }
+                                       if(ichg==1 || ichg==4 || ichg==7 || ichg==11)//negative like-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc2etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
+                                       }
+                                       if(ichg==2 || ichg==5 || ichg==8 || ichg==12)//unlike-sign
+                                       {
+                                               anetaphitpc[aniter]->SetFirstParticleCut(dtc1etaphitpc[aniter]);
+                                               anetaphitpc[aniter]->SetSecondParticleCut(dtc2etaphitpc[aniter]);
+                                       }
+                                       if(ichg==9) //all
+                                        {
+                                         anetaphitpc[aniter]->SetFirstParticleCut(dtc3etaphitpc[aniter]);
+                                         anetaphitpc[aniter]->SetSecondParticleCut(dtc3etaphitpc[aniter]);
+                                        }
+
+                                       //setting two-track cuts
+                                       anetaphitpc[aniter]->SetPairCut(sqpcetaphitpc[aniter]);
+
+
+                                       //**** Correlation functions *******
+
+                                       cdedpetaphi[aniter] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%i", chrgs[ichg], imult),35, 35);
+                                       anetaphitpc[aniter]->AddCorrFctn(cdedpetaphi[aniter]);
+
+               
+                                       if (runktdep)
+                                       {
+
+                                         if(ichg<=2){
+                                         for(int kit=0;kit<=numOfkTbins;kit++)
+                                           ktrng[kit]=ktrngProton[kit];
+                                         }
+                                         else if(ichg>2&&ichg<6){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngKaon[kit];
+                                          }
+                                         else if(ichg>=6&&ichg<=8){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngPion[kit];
+                                          }
+                                         else if(ichg>=9){
+                                           for(int kit=0;kit<=numOfkTbins;kit++)
+                                             ktrng[kit]=ktrngAll[kit];
+                                          }
+
+
+                                               int ktm;
+                                               for (int ikt=0; ikt<numOfkTbins; ikt++)
+                                               {
+                                                       if(ktrng[ikt+1]==0) continue;
+                                                       ktm = aniter * numOfkTbins + ikt;
+                                                       ktpcuts[ktm] = new AliFemtoPairCutPt(ktrng[ikt], ktrng[ikt+1]);
+                               
+                                                       //cqinvkttpc[ktm] = new AliFemtoQinvCorrFctn(Form("cqinv%stpcM%ikT%i", chrgs[ichg], imult, ikt),nbinssh,0.0,(imult>6)?shqmax*2.5:shqmax);
+                                                       //cqinvkttpc[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+                                                       //anetaphitpc[aniter]->AddCorrFctn(cqinvkttpc[ktm]);
+
+                                                       cdedpetaphiPt[ktm] = new AliFemtoCorrFctnDEtaDPhi(Form("cdedp%stpcM%ipT%i", chrgs[ichg], imult,ikt),35, 35);
+                                                       cdedpetaphiPt[ktm]->SetPairSelectionCut(ktpcuts[ktm]);
+                                                       anetaphitpc[aniter]->AddCorrFctn(cdedpetaphiPt[ktm]);
+
+                                               }
+                                       }               
+                                       Manager->AddAnalysis(anetaphitpc[aniter]);      
+                               }
+                       }
+               }
+       }
+       return Manager;
+}