]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGHF/vertexingHF/macros/AddTaskCFVertexingHFLctoV0bachelor.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / macros / AddTaskCFVertexingHFLctoV0bachelor.C
index 755b790270a2891a3faeda5367b4b9c95da14652..a87b57a19a33f0ca2e0c12e066867c9d79ea8433 100644 (file)
@@ -1,57 +1,50 @@
 //DEFINITION OF A FEW CONSTANTS
-const Double_t ptmin = 0.0;
-const Double_t ptmax = 12.0;
+const Double_t ptmin =    0.0;
+const Double_t ptmax = 9999.0;
+const Double_t etamin = -0.9;
+const Double_t etamax =  0.9;
 const Double_t ymin  = -1.2 ;
 const Double_t ymax  =  1.2 ;
-const Double_t cosPAV0min = 0.99;
-const Double_t cosPAV0max = 1.02;
-const Int_t onFlymin = 0;
-const Int_t onFlymax = 2;
-const Float_t centmin =   0.;
-//const Float_t centmin_0_10   =   0.;
-//const Float_t centmax_0_10   =  10.;
-//const Float_t centmin_10_60  =  10.;
-//const Float_t centmax_10_60  =  60.;
-//const Float_t centmin_60_100 =  60.;
-//const Float_t centmax_60_100 = 100.;
+
+const Double_t zmin   = -15.;
+const Double_t zmax   =  15.;
+const Float_t centmin = 0.;
 const Float_t centmax = 100.;
-const Int_t fakemin = 0;
-const Int_t fakemax = 3;
-const Float_t multmin =   0;
-//const Float_t multmin_0_20 =     0;
-//const Float_t multmax_0_20 =    20;
-//const Float_t multmin_20_50 =   20;
-//const Float_t multmax_20_50 =   50;
-//const Float_t multmin_50_102 =  50;
-//const Float_t multmax_50_102 = 102;
-const Float_t multmax = 102;
-
-const Double_t ptBachmin  = 0.0;
-const Double_t ptBachmax  = 30.0;
-const Double_t ptV0posmin = 0.0;
-const Double_t ptV0posmax = 30.0;
-const Double_t ptV0negmin = 0.0;
-const Double_t ptV0negmax = 30.0;
+const Float_t fakemin = -0.5;
+const Float_t fakemax =  2.5;
+const Float_t multmin =   0.;
+const Float_t multmax = 102.;
+
+const Double_t cosPAV0min = 0.985;
+const Double_t cosPAV0max = 1.005;
+const Float_t onFlymin = -0.5;
+const Float_t onFlymax =  1.5;
+const Double_t pBachmin   =  0.0;
+const Double_t pBachmax   = 30.0;
+const Double_t ptV0min    =  0.0;
+const Double_t ptV0max    = 30.0;
+const Double_t yV0min     =-1.2;
+const Double_t yV0max     = 1.2;
 const Double_t dcaV0min   = 0.0; // nSigma
 const Double_t dcaV0max   = 1.5; // nSigma
 const Double_t cTV0min    = 0.0; // micron
 const Double_t cTV0max    = 300; // micron
 const Double_t cTmin      = 0.0; // micron
 const Double_t cTmax      = 300; // micron
-const Float_t cosPAmin    =-1.02;
-const Float_t cosPAmax    = 1.02;
-
-const Double_t etamin = -0.9;
-const Double_t etamax =  0.9;
-//const Double_t zmin = -15.;
-//const Double_t zmax =  15.;
+const Float_t cosPAmin    =-1.05;
+const Float_t cosPAmax    = 1.05;
 
 
 //----------------------------------------------------
 
 AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "./LctoV0bachelorCuts.root",
-                                                        Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB = kTRUE,
-                                                        Bool_t isKeepDfromBOnly = kFALSE, Int_t pdgCode = 4122, Char_t isSign = 0, TString usercomment = "username")
+                                                        Bool_t rejectIfNotFromQuark=kTRUE,
+                                                        //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kFALSE, // all in
+                                                        Bool_t isKeepDfromB = kFALSE, Bool_t isKeepDfromBOnly = kFALSE, // prompt
+                                                        //Bool_t isKeepDfromB = kTRUE, Bool_t isKeepDfromBOnly = kTRUE, // no-prompt
+                                                        Int_t configuration = AliCFTaskVertexingHF::kCheetah,
+                                                        Int_t pdgCode = 4122, Char_t isSign = 2, Char_t lcToV0bachelorDecayMode = 0,
+                                                        TString usercomment = "username")
 {
 
 
@@ -69,26 +62,21 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
               
   gSystem->Sleep(2000);
 
-  // isSign = 0 --> K0S only
-  // isSign = 1 --> Lambda only
-  // isSign = 2 --> LambdaBar only
-  // isSign = 3 --> K0S and Lambda and LambdaBar
+  // isSign = 0 --> Lc+ only
+  // isSign = 1 --> Lc- only
+  // isSign = 2 --> Lc+ and Lc-
 
   TString expected;
   if (isSign == 0 && pdgCode < 0){
-    AliError(Form("Error setting PDG code (%d) and sign (0 --> K0S only): they are not compatible, returning"));
+    AliError(Form("Error setting PDG code (%d) and sign (0 --> Lc+ only): they are not compatible, returning",pdgCode));
     return 0x0;
   }
-  else if (isSign == 1 && pdgCode < 0){
-    AliError(Form("Error setting PDG code (%d) and sign (1 --> Lambda only): they are not compatible, returning"));
+  else if (isSign == 1 && pdgCode > 0){
+    AliError(Form("Error setting PDG code (%d) and sign (1 --> Lc- only): they are not compatible, returning",pdgCode));
     return 0x0;
   }
-  else if (isSign == 2 && pdgCode > 0){
-    AliError(Form("Error setting PDG code (%d) and sign (2 --> LambdaBar only): they are not compatible, returning"));
-    return 0x0;
-  }
-  else if (isSign > 3 || isSign < 0){
-    AliError(Form("Sign not valid (%d, possible values are 0, 1, 2, 3), returning"));
+  else if (isSign > 2 || isSign < 0){
+    AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning",isSign));
     return 0x0;
   }
 
@@ -101,45 +89,40 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
 
   Double_t massV0min = 0.47;
   Double_t massV0max = 1.14;
-  if (isSign==0) {
+  if (lcToV0bachelorDecayMode==0) {
     massV0min = 0.47 ;
     massV0max = 0.53 ;
-  } else if (isSign==1 || isSign==2) {
+  } else if (lcToV0bachelorDecayMode==1) {
     massV0min = 1.09;
     massV0max = 1.14;
   }
 
-  const Double_t phimin = 0.0;
+  const Double_t phimin = 0.;
   const Double_t phimax = 2.*TMath::Pi();
-
-  const Int_t nbinpt          =  8; //bins in pt from 0 to 12 GeV
-  const Int_t nbiny           = 24; //bins in y
-  Int_t nbininvMassV0         = 60; //bins in invMassV0
-  if (isSign==3) nbininvMassV0=134; //bins in invMassV0
-  const Int_t nbinpointingV0  = 12; //bins in cosPointingAngleV0
-  const Int_t nbinonFly       =  2; //bins in onFlyStatus x V0
-
-  const Int_t nbincent        = 18; //bins in centrality (total number)
-  //const Int_t nbincent_0_10   =  4; //bins in centrality between 0 and 10
-  //const Int_t nbincent_10_60  = 10; //bins in centrality between 10 and 60
-  //const Int_t nbincent_60_100 =  4; //bins in centrality between 60 and 100
-
-  const Int_t nbinfake        =  3; //bins in fake
-
-  const Int_t nbinmult        = 48; //bins in multiplicity (total number)
-  //const Int_t nbinmult_0_20   = 20; //bins in multiplicity between 0 and 20
-  //const Int_t nbinmult_20_50  = 15; //bins in multiplicity between 20 and 50
-  //const Int_t nbinmult_50_102 = 13; //bins in multiplicity between 50 and 102
-
-
-  const Int_t nbinptBach      = 300; //bins in pt from 0 to 30 GeV
-  const Int_t nbinptV0pos     = 300; //bins in pt from 0 to 30 GeV
-  const Int_t nbinptV0neg     = 300; //bins in pt from 0 to 30 GeV
-  const Int_t nbinphi         = 18; //bins in Phi
-  const Int_t nbindcaV0       = 15; //bins in dcaV0
-  const Int_t nbincTV0        = 15; //bins in cTV0
-  const Int_t nbincT          = 15; //bins in cT
-  const Int_t nbinpointing    = 51; //bins in cosPointingAngle
+  const Double_t phiV0min = 0.;
+  const Double_t phiV0max = 2.*TMath::Pi();
+
+  const Int_t nbinZvtx       =  30; //bins in centrality (total number)
+  const Int_t nbincent       =18+1; //bins in centrality (total number)
+  const Int_t nbinfake       =   3; //bins in fake
+  const Int_t nbinmult       =  48; //bins in multiplicity (total number)
+
+  const Int_t nbinpt         =  11; //bins in pt from 0,1,2,3,4,5,6,8,12,17,25,35 GeV
+  const Int_t nbiny          =  24; //bins in y Lc
+  const Int_t nbinphi        =  18; //bins in phi Lc
+  const Int_t nbinonFly      =   2; //bins in onFlyStatus x V0
+
+  const Int_t nbinpBach      = 300; //bins in pt from 0 to 30 GeV
+  const Int_t nbinptV0       = 300; //bins in pt from 0 to 30 GeV
+  const Int_t nbinyV0        =  24; //bins in y V0
+  const Int_t nbinphiV0      =  18; //bins in phi V0
+  const Int_t nbindcaV0      = 150; //bins in dcaV0
+  const Int_t nbininvMassV0  =  60; //bins in invMassV0
+  const Int_t nbinpointingV0 =  42; //bins in cosPointingAngleV0
+  const Int_t nbinpointing   =  42; //bins in cosPointingAngle
+
+  //const Int_t nbincTV0      =  15; //bins in cTV0
+  //const Int_t nbincT        =  15; //bins in cT
 
   //the sensitive variables, their indices
 
@@ -147,29 +130,31 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   const UInt_t ipT        = 0;
   const UInt_t iy         = 1;
   const UInt_t iphi       = 2;
-  const UInt_t icosPAxV0  = 3;
-  const UInt_t ionFly     = 4;
-  const UInt_t imult      = 5;
+  const UInt_t ionFly     = 3;
+  const UInt_t iZvtx      = 4;
+  const UInt_t icent      = 5;
   const UInt_t ifake      = 6;
-  const UInt_t icent      = 7;
-
-  const UInt_t ipTbach   =  8;
-  const UInt_t ipTposV0  =  9;
-  const UInt_t ipTnegV0  = 10;
-  const UInt_t iinvMassV0= 11;
-  const UInt_t idcaV0    = 12;
-  const UInt_t icTv0     = 13;
-  const UInt_t icT       = 14;
+  const UInt_t imult      = 7;
+
+  const UInt_t ipbach    =  8;
+  const UInt_t ipTV0     =  9;
+  const UInt_t iyV0      = 10;
+  const UInt_t iphiV0    = 11;
+  const UInt_t iinvMassV0= 12;
+  const UInt_t idcaV0    = 13;
+  const UInt_t icosPAxV0 = 14;
   const UInt_t icosPA    = 15;
+  //const UInt_t icTv0     = 16;
+  //const UInt_t icT       = 17;
 
   //Setting the bins: pt, ptPi, and ptK are considered seprately because for them you can either define the binning by hand, or using the cuts file
 
   //arrays for the number of bins in each dimension
 
   //if ( configuration ==AliCFTaskVertexingHF::kSnail)
-  const Int_t nvarTot   = 16 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, z, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
+  const Int_t nvarTot   = 16 ; //number of variables on the grid
   //if ( configuration ==AliCFTaskVertexingHF::kCheetah)
-  //const Int_t nvarTot   =  8 ; //number of variables on the grid:pt, y, cosThetaStar, pTpi, pTk, cT, dca, d0pi, d0K, d0xd0, cosPointingAngle, phi, z, centrality, fake, cosPointingAngleXY, normDecayLengthXY, multiplicity
+  //const Int_t nvarTot =  8 ; //number of variables on the grid
 
   Int_t iBin[nvarTot];
 
@@ -177,231 +162,113 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   iBin[ipT]=nbinpt;
   iBin[iy]=nbiny;
   iBin[iphi]=nbinphi;
-  iBin[icosPAxV0]=nbinpointingV0;
   iBin[ionFly]=nbinonFly;
-  iBin[imult]=nbinmult;
-  iBin[ifake]=nbinfake;
+  iBin[iZvtx]=nbinZvtx;
   iBin[icent]=nbincent;
+  iBin[ifake]=nbinfake;
+  iBin[imult]=nbinmult;
 
-  iBin[ipTbach]=nbinptBach;
-  iBin[ipTposV0]=nbinptV0pos;
-  iBin[ipTnegV0]=nbinptV0neg;
+  iBin[ipbach]=nbinpBach;
+  iBin[ipTV0]=nbinptV0;
+  iBin[iyV0]=nbinyV0;
+  iBin[iphiV0]=nbinphiV0;
   iBin[iinvMassV0]=nbininvMassV0;
   iBin[idcaV0]=nbindcaV0;
-  iBin[icTv0]=nbincTV0;
-  iBin[icT]=nbincT;
+  iBin[icosPAxV0]=nbinpointingV0;
   iBin[icosPA]=nbinpointing;
+  //iBin[icTv0]=nbincTV0;
+  //iBin[icT]=nbincT;
 
   // values for bin lower bounds
 
   // pt
-  Double_t *binLimpT=new Double_t[iBin[0]+1];
-  //for(Int_t ii=0; ii<=iBin[0]; ii++) binLimpT[ii]=(Double_t)ptmin + (ptmax-ptmin)/iBin[0]*(Double_t)ii ; 
-  for(Int_t ii=0; ii<=iBin[0]-2; ii++) binLimpT[ii]=(Double_t)ptmin + (Double_t)ii;
-  binLimpT[iBin[0]-1]=8.;
-  binLimpT[iBin[0]]=12.;
+  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
+  binLimpT[ 0]= 0.;
+  binLimpT[ 1]= 1.;
+  binLimpT[ 2]= 2.;
+  binLimpT[ 3]= 3.;
+  binLimpT[ 4]= 4.;
+  binLimpT[ 5]= 5.;
+  binLimpT[ 6]= 6.;
+  binLimpT[ 7]= 8.;
+  binLimpT[ 8]=12.;
+  binLimpT[ 9]=17.;
+  binLimpT[10]=25.;
+  binLimpT[11]=35.;
 
   // y
-  Double_t *binLimy=new Double_t[iBin[1]+1];
-  for(Int_t i=0; i<=iBin[1]; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin)/iBin[1]*(Double_t)i ;
+  Double_t *binLimy=new Double_t[iBin[iy]+1];
+  for(Int_t i=0; i<=iBin[iy]; i++) binLimy[i]=(Double_t)ymin + (ymax-ymin)/iBin[iy]*(Double_t)i ;
 
   // phi
-  Double_t *binLimphi=new Double_t[iBin[2]+1];
-  for(Int_t i=0; i<=iBin[2]; i++) binLimphi[i]=(Double_t)phimin  + (phimax-phimin)/iBin[2]*(Double_t)i ;
-
-  // cosPointingAngleV0
-  Double_t *binLimcosPAV0=new Double_t[iBin[3]+1];
-  for(Int_t i=0; i<=iBin[3]; i++) binLimcosPAV0[i]=(Double_t)cosPAV0min + (cosPAV0max-cosPAV0min)/iBin[3]*(Double_t)i ;
+  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
+  for(Int_t i=0; i<=iBin[iphi]; i++) binLimphi[i]=(Double_t)phimin + (phimax-phimin)/iBin[iphi]*(Double_t)i ;
 
   // onTheFlyV0
-  Double_t *binLimonFlyV0=new Double_t[iBin[4]+1];
-  for(Int_t i=0; i<=iBin[4]; i++) binLimonFlyV0[i]=(Double_t)onFlymin + (onFlymax-onFlymin)/iBin[4]*(Double_t)i ;
+  Double_t *binLimonFlyV0=new Double_t[iBin[ionFly]+1];
+  for(Int_t i=0; i<=iBin[ionFly]; i++) binLimonFlyV0[i]=(Double_t)onFlymin + (onFlymax-onFlymin)/iBin[ionFly]*(Double_t)i ;
 
-  // centrality
-  Double_t *binLimcent=new Double_t[iBin[5]+1];
-  for(Int_t i=0; i<=iBin[5]; i++) binLimcent[i]=(Double_t)centmin + (centmax-centmin)/iBin[5]*(Double_t)i ; 
-  /*
-  Double_t *binLimcent_0_10=new Double_t[iBin[icent]+1];
-  for(Int_t i=0; i<=nbincent_0_10; i++) binLimcent[i]=(Double_t)centmin_0_10 + (centmax_0_10-centmin_0_10)/nbincent_0_10*(Double_t)i ; 
-  if (binLimcent[nbincent_0_10] != centmin_10_60)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
-  }
+  // z Primary Vertex
+  Double_t *binLimzvtx=new Double_t[iBin[iZvtx]+1];
+  for(Int_t i=0; i<=nbinZvtx; i++) binLimzvtx[i]=(Double_t)zmin  + (zmax-zmin)/iBin[iZvtx]*(Double_t)i ;
 
-  Double_t *binLimcent_10_60=new Double_t[iBin[icent]+1];
-  for(Int_t i=0; i<=nbincent_10_60; i++) binLimcent[i+nbincent_0_10]=(Double_t)centmin_10_60 + (centmax_10_60-centmin_10_60)/nbincent_10_60*(Double_t)i ;
-  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
-  }
+  // centrality
+  Double_t *binLimcent=new Double_t[iBin[icent]+1];
+  binLimcent[0]=centmin;
+  for(Int_t i=1; i<=iBin[icent]; i++) binLimcent[i]=centmin + (centmax-centmin)/iBin[icent]*(Double_t)i;
 
-  Double_t *binLimcent_60_100=new Double_t[iBin[icent]+1];
-  for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
-  */
-        
   // fake
-  Double_t *binLimfake=new Double_t[iBin[6]+1];
-  for(Int_t i=0; i<=iBin[6]; i++) binLimfake[i]=(Double_t)fakemin  + (fakemax-fakemin)/iBin[6] * (Double_t)i;
+  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
+  for(Int_t i=0; i<=iBin[ifake]; i++) binLimfake[i]=(Double_t)fakemin  + (fakemax-fakemin)/iBin[ifake] * (Double_t)i;
 
   // multiplicity
-  Double_t *binLimmult=new Double_t[iBin[7]+1];
-  for(Int_t i=0; i<=iBin[7]; i++) binLimmult[i]=(Double_t)multmin + (multmax-multmin)/iBin[7]*(Double_t)i ; 
-  /*
-  for(Int_t i=0; i<=nbinmult_0_20; i++) binLimmult[i]=(Double_t)multmin_0_20 + (multmax_0_20-multmin_0_20)/nbinmult_0_20*(Double_t)i ; 
-  if (binLimmult[nbinmult_0_20] != multmin_20_50)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbinmult_20_50; i++) binLimmult[i+nbinmult_0_20]=(Double_t)multmin_20_50 + (multmax_20_50-multmin_20_50)/nbinmult_20_50*(Double_t)i ; 
-  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbinmult_50_102; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50]=(Double_t)multmin_50_102 + (multmax_50_102-multmin_50_102)/nbinmult_50_102*(Double_t)i ; 
-  */
+  Double_t *binLimmult=new Double_t[iBin[imult]+1];
+  for(Int_t i=0; i<=iBin[imult]; i++) binLimmult[i]=(Double_t)multmin + (multmax-multmin)/iBin[imult]*(Double_t)i ; 
+
 
+  // pBach
+  Double_t *binLimpbach=new Double_t[iBin[ipbach]+1];
+  for(Int_t i=0; i<=iBin[ipbach]; i++) binLimpbach[i]=(Double_t)pBachmin + (pBachmax-pBachmin)/iBin[ipbach]*(Double_t)i ; 
 
-  // ptBach
-  Double_t *binLimpTbach=new Double_t[iBin[8]+1];
-  for(Int_t i=0; i<=iBin[8]; i++) binLimpTbach[i]=(Double_t)ptBachmin + (ptBachmax-ptBachmin)/iBin[8]*(Double_t)i ; 
+  // ptV0
+  Double_t *binLimpTV0=new Double_t[iBin[ipTV0]+1];
+  for(Int_t i=0; i<=iBin[ipTV0]; i++) binLimpTV0[i]=(Double_t)ptV0min + (ptV0max-ptV0min)/iBin[ipTV0]*(Double_t)i ; 
 
-  // ptV0pos
-  Double_t *binLimpTV0pos=new Double_t[iBin[9]+1];
-  for(Int_t i=0; i<=iBin[9]; i++) binLimpTV0pos[i]=(Double_t)ptV0posmin + (ptV0posmax-ptV0posmin)/iBin[9]*(Double_t)i ; 
+  // yV0
+  Double_t *binLimyV0=new Double_t[iBin[iyV0]+1];
+  for(Int_t i=0; i<=iBin[iyV0]; i++) binLimyV0[i]=(Double_t)yV0min + (yV0max-yV0min)/iBin[iyV0]*(Double_t)i ; 
 
-  // ptV0neg
-  Double_t *binLimpTV0neg=new Double_t[iBin[10]+1];
-  for(Int_t i=0; i<=iBin[10]; i++) binLimpTV0neg[i]=(Double_t)ptV0negmin + (ptV0negmax-ptV0negmin)/iBin[10]*(Double_t)i ; 
+  // phiV0
+  Double_t *binLimphiV0=new Double_t[iBin[iphiV0]+1];
+  for(Int_t i=0; i<=iBin[iphiV0]; i++) binLimphiV0[i]=(Double_t)phiV0min + (phiV0max-phiV0min)/iBin[iphiV0]*(Double_t)i ; 
 
   // invMassV0
-  Double_t *binLimInvMassV0=new Double_t[iBin[11]+1];
-  for(Int_t i=0; i<=iBin[11]; i++) binLimInvMassV0[i]=(Double_t)massV0min + (massV0max-massV0min)/iBin[11]*(Double_t)i ;
+  Double_t *binLimInvMassV0=new Double_t[iBin[iinvMassV0]+1];
+  for(Int_t i=0; i<=iBin[iinvMassV0]; i++) binLimInvMassV0[i]=(Double_t)massV0min + (massV0max-massV0min)/iBin[iinvMassV0]*(Double_t)i ;
 
   // dcaV0
-  Double_t *binLimdcaV0=new Double_t[iBin[12]+1];
-  for(Int_t i=0; i<=iBin[12]; i++) binLimdcaV0[i]=(Double_t)dcaV0min + (dcaV0max-dcaV0min)/iBin[12]*(Double_t)i ; 
-
-  // cTV0
-  Double_t *binLimcTV0=new Double_t[iBin[13]+1];
-  for(Int_t i=0; i<=iBin[13]; i++) binLimcTV0[i]=(Double_t)cTV0min + (cTV0max-cTV0min)/iBin[13]*(Double_t)i ; 
+  Double_t *binLimdcaV0=new Double_t[iBin[idcaV0]+1];
+  for(Int_t i=0; i<=iBin[idcaV0]; i++) binLimdcaV0[i]=(Double_t)dcaV0min + (dcaV0max-dcaV0min)/iBin[idcaV0]*(Double_t)i ; 
 
-  // cT
-  Double_t *binLimcT=new Double_t[iBin[14]+1];
-  for(Int_t i=0; i<=iBin[14]; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin)/iBin[14]*(Double_t)i ;
+  // cosPointingAngleV0
+  Double_t *binLimcosPAV0=new Double_t[iBin[icosPAxV0]+1];
+  for(Int_t i=0; i<=iBin[icosPAxV0]; i++) binLimcosPAV0[i]=(Double_t)cosPAV0min + (cosPAV0max-cosPAV0min)/iBin[icosPAxV0]*(Double_t)i ;
 
   // cosPointingAngle
-  Double_t *binLimcosPA=new Double_t[iBin[15]+1];
-  for(Int_t i=0; i<=iBin[15]; i++) binLimcosPA[i]=(Double_t)cosPAmin + (cosPAmax-cosPAmin)/iBin[15]*(Double_t)i ;
+  Double_t *binLimcosPA=new Double_t[iBin[icosPA]+1];
+  for(Int_t i=0; i<=iBin[icosPA]; i++) binLimcosPA[i]=(Double_t)cosPAmin + (cosPAmax-cosPAmin)/iBin[icosPA]*(Double_t)i ;
 
-
-
-  // z Primary Vertex
-  //for(Int_t i=0; i<=nbinzvtx; i++) binLimzvtx[i]=(Double_t)zmin  + (zmax-zmin)  /nbinzvtx*(Double_t)i ;
-
-
-  //OPTION 2: ...or from the cuts file
   /*
-  const Int_t nbinpt = cutsLctoV0->GetNPtBins(); // bins in pT
-  iBin[ipT]=nbinpt;
-  iBin[ipTpi]=nbinpt;
-  iBin[ipTk]=nbinpt;
-  Double_t *binLimpT=new Double_t[iBin[ipT]+1];
-  Double_t *binLimpTpi=new Double_t[iBin[ipTpi]+1];
-  Double_t *binLimpTk=new Double_t[iBin[ipTk]+1];
-  // values for bin lower bounds
-  Float_t* floatbinLimpT = cutsLctoV0->GetPtBinLimits();
-  for (Int_t ibin0 = 0 ; ibin0<iBin[ipT]+1; ibin0++){
-    binLimpT[ibin0] = (Double_t)floatbinLimpT[ibin0];
-    binLimpTpi[ibin0] = (Double_t)floatbinLimpT[ibin0];
-    binLimpTk[ibin0] = (Double_t)floatbinLimpT[ibin0];
-  }
-  for(Int_t i=0; i<=nbinpt; i++) printf("binLimpT[%d]=%f\n",i,binLimpT[i]);  
-
-  printf("pT: nbin (from cuts file) = %d\n",nbinpt);
-
-  // defining now the binning for the other variables:
-
-  iBin[iy]=nbiny;
-  iBin[icosThetaStar]=nbincosThetaStar;
-  iBin[icT]=nbincT;
-  iBin[idca]=nbindca;
-  iBin[id0xd0]=nbind0xd0;
-  iBin[ipointing]=nbinpointing;
-  iBin[iphi]=nbinphi;
-  iBin[izvtx]=nbinzvtx;
-  iBin[icent]=nbincent;
-  iBin[ifake]=nbinfake;
-  iBin[ipointingXY]=nbinpointingXY;
-  iBin[inormDecayLXY]=nbinnormDecayLXY;
-  iBin[imult]=nbinmult;
-
-  //arrays for lower bounds :
-  Double_t *binLimy=new Double_t[iBin[iy]+1];
-  Double_t *binLimcosThetaStar=new Double_t[iBin[icosThetaStar]+1];
-  Double_t *binLimcT=new Double_t[iBin[icT]+1];
-  Double_t *binLimdca=new Double_t[iBin[idca]+1];
-  Double_t *binLimd0xd0=new Double_t[iBin[id0xd0]+1];
-  Double_t *binLimpointing=new Double_t[iBin[ipointing]+1];
-  Double_t *binLimphi=new Double_t[iBin[iphi]+1];
-  Double_t *binLimzvtx=new Double_t[iBin[izvtx]+1];
-  Double_t *binLimcent=new Double_t[iBin[icent]+1];
-  Double_t *binLimfake=new Double_t[iBin[ifake]+1];
-  Double_t *binLimpointingXY=new Double_t[iBin[ipointingXY]+1];
-  Double_t *binLimnormDecayLXY=new Double_t[iBin[inormDecayLXY]+1];
-  Double_t *binLimmult=new Double_t[iBin[imult]+1];
-
-  // y
-  for(Int_t i=0; i<=nbiny; i++) binLimy[i]=(Double_t)ymin  + (ymax-ymin)  /nbiny*(Double_t)i ;
+  // cTV0
+  Double_t *binLimcTV0=new Double_t[iBin[icTv0]+1];
+  for(Int_t i=0; i<=iBin[icTv0]; i++) binLimcTV0[i]=(Double_t)cTV0min + (cTV0max-cTV0min)/iBin[icTv0]*(Double_t)i ; 
 
-  // cosThetaStar
-  for(Int_t i=0; i<=nbincosThetaStar; i++) binLimcosThetaStar[i]=(Double_t)cosminTS  + (cosmaxTS-cosminTS)  /nbincosThetaStar*(Double_t)i ;
-       
   // cT
-  for(Int_t i=0; i<=nbincT; i++) binLimcT[i]=(Double_t)cTmin  + (cTmax-cTmin)  /nbincT*(Double_t)i ;
-
-  // dca
-  for(Int_t i=0; i<=nbindca; i++) binLimdca[i]=(Double_t)dcamin  + (dcamax-dcamin)  /nbindca*(Double_t)i ;
-
-  // d0xd0
-  for(Int_t i=0; i<=nbind0xd0; i++) binLimd0xd0[i]=(Double_t)d0xd0min  + (d0xd0max-d0xd0min)  /nbind0xd0*(Double_t)i ;
-
-  // cosPointingAngle
-  for(Int_t i=0; i<=nbinpointing; i++) binLimpointing[i]=(Double_t)cosmin  + (cosmax-cosmin)  /nbinpointing*(Double_t)i ;
-
-  // Phi
-  for(Int_t i=0; i<=nbinphi; i++) binLimphi[i]=(Double_t)phimin  + (phimax-phimin)  /nbinphi*(Double_t)i ;
-
-  // z Primary Vertex
-  for(Int_t i=0; i<=nbinzvtx; i++) {
-    binLimzvtx[i]=(Double_t)zmin  + (zmax-zmin)  /nbinzvtx*(Double_t)i ;
-  }
-
-  // centrality
-  for(Int_t i=0; i<=nbincent_0_10; i++) binLimcent[i]=(Double_t)centmin_0_10 + (centmax_0_10-centmin_0_10)/nbincent_0_10*(Double_t)i ; 
-  if (binLimcent[nbincent_0_10] != centmin_10_60)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 1st range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbincent_10_60; i++) binLimcent[i+nbincent_0_10]=(Double_t)centmin_10_60 + (centmax_10_60-centmin_10_60)/nbincent_10_60*(Double_t)i ;
-  if (binLimcent[nbincent_0_10+nbincent_10_60] != centmin_60_100)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for cent - 2st range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbincent_60_100; i++) binLimcent[i+nbincent_10_60]=(Double_t)centmin_60_100 + (centmax_60_100-centmin_60_100)/nbincent_60_100*(Double_t)i ;
-        
-  // fake
-  for(Int_t i=0; i<=nbinfake; i++) {
-    binLimfake[i]=(Double_t)fakemin  + (fakemax-fakemin)/nbinfake * (Double_t)i;
-  }
-
-  // multiplicity
-  for(Int_t i=0; i<=nbinmult_0_20; i++) binLimmult[i]=(Double_t)multmin_0_20 + (multmax_0_20-multmin_0_20)/nbinmult_0_20*(Double_t)i ; 
-  if (binLimmult[nbinmult_0_20] != multmin_20_50)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 1st range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbinmult_20_50; i++) binLimmult[i+nbinmult_0_20]=(Double_t)multmin_20_50 + (multmax_20_50-multmin_20_50)/nbinmult_20_50*(Double_t)i ; 
-  if (binLimmult[nbinmult_0_20+nbinmult_20_50] != multmin_50_102)  {
-    Error("AliCFHeavyFlavourTaskMultiVarMultiStep","Calculated bin lim for mult - 2nd range - differs from expected!\n");
-  }
-  for(Int_t i=0; i<=nbinmult_50_102; i++) binLimmult[i+nbinmult_0_20+nbinmult_20_50]=(Double_t)multmin_50_102 + (multmax_50_102-multmin_50_102)/nbinmult_50_102*(Double_t)i ; 
+  Double_t *binLimcT=new Double_t[iBin[icT]+1];
+  for(Int_t i=0; i<=iBin[icT]; i++) binLimcT[i]=(Double_t)cTmin + (cTmax-cTmin)/iBin[icT]*(Double_t)i ;
   */
 
 
-
   //one "container" for MC
   TString nameContainer="";
   if (!isKeepDfromB) {
@@ -429,42 +296,46 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   }
 
   //setting the bin limits
-  container -> SetBinLimits(0,binLimpT);
-  container -> SetBinLimits(1,binLimy);
-  container -> SetBinLimits(2,binLimphi);
-  container -> SetBinLimits(3,binLimcosPAV0);
-  container -> SetBinLimits(4,binLimonFlyV0);
-  container -> SetBinLimits(5,binLimcent);
-  container -> SetBinLimits(6,binLimfake);
-  container -> SetBinLimits(7,binLimmult);
-
-  container -> SetVarTitle(0,"pt");
-  container -> SetVarTitle(1,"y");
-  container -> SetVarTitle(2,"phi");
-  container -> SetVarTitle(3,"cosPA -V0-");
-  container -> SetVarTitle(4,"onFlyV0");
-  container -> SetVarTitle(5,"centrality");
-  container -> SetVarTitle(6,"fake");
-  container -> SetVarTitle(7,"multiplicity");
+  container -> SetBinLimits(ipT,binLimpT);
+  container -> SetBinLimits(iy,binLimy);
+  container -> SetBinLimits(iphi,binLimphi);
+  container -> SetBinLimits(ionFly,binLimonFlyV0);
+  container -> SetBinLimits(iZvtx,binLimzvtx);
+  container -> SetBinLimits(icent,binLimcent);
+  container -> SetBinLimits(ifake,binLimfake);
+  container -> SetBinLimits(imult,binLimmult);
+
+  container -> SetVarTitle(ipT,"p_{T}(#Lambda_{c}) [GeV/c]");
+  container -> SetVarTitle(iy,"y(#Lambda_{c})");
+  container -> SetVarTitle(iphi,"#phi(#Lambda_{c}) [rad]");
+  container -> SetVarTitle(ionFly,"onTheFlyStatusV0");
+  container -> SetVarTitle(iZvtx,"z_{vtx} [cm]");
+  container -> SetVarTitle(icent,"centrality");
+  container -> SetVarTitle(ifake,"fake");
+  container -> SetVarTitle(imult,"multiplicity");
 
   if (configuration == AliCFTaskVertexingHF::kSnail) {
-    container -> SetBinLimits(8,binLimpTbach);
-    container -> SetBinLimits(9,binLimpTV0pos);
-    container -> SetBinLimits(10,binLimpTV0neg);
-    container -> SetBinLimits(11,binLimInvMassV0);
-    container -> SetBinLimits(12,binLimdcaV0);
-    container -> SetBinLimits(13,binLimcTV0);
-    container -> SetBinLimits(14,binLimcT);
-    container -> SetBinLimits(15,binLimcosPA);
-
-    container -> SetVarTitle(8,"ptBachelor");
-    container -> SetVarTitle(9,"ptV0pos");
-    container -> SetVarTitle(10,"ptV0neg");
-    container -> SetVarTitle(11,"mV0");
-    container -> SetVarTitle(12,"DCA -V0-");
-    container -> SetVarTitle(13,"c#tau -V0-");
-    container -> SetVarTitle(14,"c#tau");
-    container -> SetVarTitle(15,"cosPA");
+    container -> SetBinLimits(ipbach,binLimpbach);
+    container -> SetBinLimits(ipTV0,binLimpTV0);
+    container -> SetBinLimits(iyV0,binLimyV0);
+    container -> SetBinLimits(iphiV0,binLimphiV0);
+    container -> SetBinLimits(iinvMassV0,binLimInvMassV0);
+    container -> SetBinLimits(idcaV0,binLimdcaV0);
+    container -> SetBinLimits(icosPAxV0,binLimcosPAV0);
+    container -> SetBinLimits(icosPA,binLimcosPA);
+    //container -> SetBinLimits(,binLimcTV0);
+    //container -> SetBinLimits(,binLimcT);
+
+    container -> SetVarTitle(ipbach,"p(bachelor) [GeV/c]");
+    container -> SetVarTitle(ipTV0,"p_{T}(V0) [GeV/c]");
+    container -> SetVarTitle(iyV0,"y(V0)");
+    container -> SetVarTitle(iphiV0,"#varphi(V0) [rad]");
+    container -> SetVarTitle(iinvMassV0,"m_{inv}(#pi^{+},#pi^{-}) [GeV/c^{2}]");
+    container -> SetVarTitle(idcaV0,"DCA(V0) [n#sigma]");
+    container -> SetVarTitle(icosPAxV0,"cosine pointing angle(V0)");
+    container -> SetVarTitle(icosPA,"cosine pointing angle (#Lambda_{c})");
+    //container -> SetVarTitle(,"c#tau -V0-");
+    //container -> SetVarTitle(,"c#tau");
   }
 
   container -> SetStepTitle(0, "MCLimAcc");
@@ -488,7 +359,7 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   //Particle-Level cuts:  
   AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
   Bool_t useAbsolute = kTRUE;
-  if (isSign != 3 && isSign!=0) {
+  if (isSign != 2) {
     useAbsolute = kFALSE;
   }
   mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute);  // kTRUE set in order to include Lc-
@@ -555,11 +426,19 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   task->SetFillFromGenerated(kFALSE);
   task->SetCFManager(man); //here is set the CF manager
   task->SetDecayChannel(22);//kLctoV0bachelor
+  switch (lcToV0bachelorDecayMode) {
+  case 0:
+    task->SetCountLctoK0Sp();
+    break;
+  case 1:
+    task->SetCountLctoLambdapi();
+    break;
+  }
   task->SetUseWeight(kFALSE);
   task->SetSign(isSign);
   task->SetCentralitySelection(kFALSE);
   task->SetFakeSelection(0);
-  task->SetRejectCandidateIfNotFromQuark(kTRUE); // put to false if you want to keep HIJING D0!!
+  task->SetRejectCandidateIfNotFromQuark(rejectIfNotFromQuark); // put to false if you want to keep HIJING D0!!
   task->SetUseMCVertex(kFALSE); // put to true if you want to do studies on pp
 
   if (isKeepDfromB && !isKeepDfromBOnly) task->SetDselection(2);
@@ -608,10 +487,10 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   //first half  : reconstructed 
   //second half : MC
 
-  thnDim[0] = iBin[0];
-  thnDim[2] = iBin[0];
-  thnDim[1] = iBin[1];
-  thnDim[3] = iBin[1];
+  thnDim[0] = iBin[ipT];
+  thnDim[2] = iBin[ipT];
+  thnDim[1] = iBin[iy];
+  thnDim[3] = iBin[iy];
 
   TString nameCorr="";
   if (!isKeepDfromB) {