]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Nov 2013 21:10:24 +0000 (21:10 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 27 Nov 2013 21:10:24 +0000 (21:10 +0000)
PWGHF/hfe/AliHFENonPhotonicElectron.cxx
PWGHF/hfe/AliHFENonPhotonicElectron.h
PWGHF/hfe/macros/AddTaskHFEnpepPb.C
PWGHF/hfe/macros/configs/PbPb/ConfigHFEnpePbPb.C
PWGHF/hfe/macros/configs/pPb/ConfigHFEnpepPb.C
PWGHF/hfe/macros/test/runGridAODPbPb.C

index d5d3e1ccdfb82d2c2ad7b07551f4ff5d46f8e948..8a08cc4bc00df7238115e2237520edef83add2a7 100644 (file)
@@ -68,6 +68,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const char *name, const Cha
   ,fPIDBackground      (0x0)
   ,fPIDBackgroundQA    (0)
   ,fkPIDRespons                (NULL)
+  ,fPtBinning()
+  ,fEtaBinning()
   ,fAlgorithmMA                (kTRUE)
   ,fChi2OverNDFCut     (3.0)
   ,fMaxDCA             (3.0)
@@ -110,6 +112,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron()
   ,fPIDBackground      (0x0)
   ,fPIDBackgroundQA    (0)
   ,fkPIDRespons                (NULL)
+  ,fPtBinning()
+  ,fEtaBinning()
   ,fAlgorithmMA                (kTRUE)
   ,fChi2OverNDFCut     (3.0)
   ,fMaxDCA             (3.0)
@@ -152,6 +156,8 @@ AliHFENonPhotonicElectron::AliHFENonPhotonicElectron(const AliHFENonPhotonicElec
   ,fPIDBackground      (ref.fPIDBackground)
   ,fPIDBackgroundQA    (ref.fPIDBackgroundQA)
   ,fkPIDRespons                (ref.fkPIDRespons)
+  ,fPtBinning(ref.fPtBinning)
+  ,fEtaBinning(ref.fEtaBinning)
   ,fAlgorithmMA                (ref.fAlgorithmMA)
   ,fChi2OverNDFCut     (ref.fChi2OverNDFCut)
   ,fMaxDCA             (ref.fMaxDCA)
@@ -237,14 +243,16 @@ void AliHFENonPhotonicElectron::Init()
   fListOutput->Add(fPIDBackgroundQA->MakeList("HFENP_PID_Background"));
   fPIDBackground->SortDetectors();
 
-  Int_t nBinsPt = 35;
-  //Double_t binLimPt[25] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 3., 3.5, 4., 5., 6.};
-  Double_t binLimPt[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
-  const Int_t kBinsEtaInclusive = 8;
-  Double_t binLimEtaInclusive[kBinsEtaInclusive+1] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
+  const Int_t kBinsPtDefault = 35;
+  Double_t binLimPtDefault[kBinsPtDefault+1] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
+  const Int_t kBinsEtaInclusiveDefault = 8;
+  Double_t binLimEtaInclusiveDefault[kBinsEtaInclusiveDefault+1] = {-0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8};
   const Int_t kBinsEtaAssociated = 30;
   Double_t binLimEtaAssociat[kBinsEtaAssociated+1] = {-1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5};
 
+  if(!fPtBinning.GetSize()) fPtBinning.Set(kBinsPtDefault+1, binLimPtDefault);
+  if(!fEtaBinning.GetSize()) fEtaBinning.Set(kBinsEtaInclusiveDefault+1, binLimEtaInclusiveDefault);
+
   //Int_t nBinsP = 400;
   //Double_t minP = 0.0;
   //Double_t maxP = 20.0;
@@ -292,25 +300,25 @@ void AliHFENonPhotonicElectron::Init()
   // Constrain histograms
   const Int_t nDimSingle=4;
   const Int_t nDimPair=9;
-  Int_t nBinPair[nDimPair] = {nBinsPhi,nBinsC,nBinsPt,nBinsInvMass,nBinsSource,nBinsAngle,nBinsPt,kBinsEtaInclusive,kBinsEtaAssociated};
+  Int_t nBinPair[nDimPair] = {nBinsPhi,nBinsC,fPtBinning.GetSize()-1,nBinsInvMass,nBinsSource,nBinsAngle,fPtBinning.GetSize()-1,fEtaBinning.GetSize()-1,kBinsEtaAssociated};
   
   // Associated Electron
-  Int_t nBinAssElectron[nDimSingle] = {nBinsC,nBinsPt,nBinsSource,kBinsEtaAssociated};
+  Int_t nBinAssElectron[nDimSingle] = {nBinsC,fPtBinning.GetSize()-1,nBinsSource,kBinsEtaAssociated};
   fAssElectron = new THnSparseF("fAssElectron","fAssElectron",nDimSingle,nBinAssElectron);
   fAssElectron->SetBinEdges(0,binLimC);
-  fAssElectron->SetBinEdges(1,binLimPt);
+  fAssElectron->SetBinEdges(1,fPtBinning.GetArray());
   fAssElectron->SetBinEdges(2,binLimSource);
   fAssElectron->SetBinEdges(3,binLimEtaAssociat);
   fAssElectron->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fAssElectron");
 
   // Inclusive Electron
-  Int_t nBinIncElectron[nDimSingle] = {nBinsC,nBinsPt,nBinsSource,kBinsEtaInclusive};
+  Int_t nBinIncElectron[nDimSingle] = {nBinsC,fPtBinning.GetSize()-1,nBinsSource,fEtaBinning.GetSize()-1};
   fIncElectron = new THnSparseF("fIncElectron","fIncElectron",nDimSingle,nBinIncElectron);
   fIncElectron->SetBinEdges(0,binLimC);
-  fIncElectron->SetBinEdges(1,binLimPt);
+  fIncElectron->SetBinEdges(1,fPtBinning.GetArray());
   fIncElectron->SetBinEdges(2,binLimSource);
-  fIncElectron->SetBinEdges(3,binLimEtaInclusive);
+  fIncElectron->SetBinEdges(3,fEtaBinning.GetArray());
   fIncElectron->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fIncElectron");
 
@@ -318,12 +326,12 @@ void AliHFENonPhotonicElectron::Init()
   fUSign = new THnSparseF("fUSign","fUSign",nDimPair,nBinPair);
   fUSign->SetBinEdges(0,binLimPhi);
   fUSign->SetBinEdges(1,binLimC);
-  fUSign->SetBinEdges(2,binLimPt);
+  fUSign->SetBinEdges(2,fPtBinning.GetArray());
   fUSign->SetBinEdges(3,binLimInvMass);
   fUSign->SetBinEdges(4,binLimSource);
   fUSign->SetBinEdges(5,binLimAngle);
-  fUSign->SetBinEdges(6,binLimPt);
-  fUSign->SetBinEdges(7,binLimEtaInclusive);
+  fUSign->SetBinEdges(6,fPtBinning.GetArray());
+  fUSign->SetBinEdges(7,fEtaBinning.GetArray());
   fUSign->SetBinEdges(8,binLimEtaAssociat);
   fUSign->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fUSign");
@@ -332,12 +340,12 @@ void AliHFENonPhotonicElectron::Init()
   fLSign = new THnSparseF("fLSign","fLSign",nDimPair,nBinPair);
   fLSign->SetBinEdges(0,binLimPhi);
   fLSign->SetBinEdges(1,binLimC);
-  fLSign->SetBinEdges(2,binLimPt);
+  fLSign->SetBinEdges(2,fPtBinning.GetArray());
   fLSign->SetBinEdges(3,binLimInvMass);
   fLSign->SetBinEdges(4,binLimSource);
   fLSign->SetBinEdges(5,binLimAngle);
-  fLSign->SetBinEdges(6,binLimPt);
-  fLSign->SetBinEdges(7,binLimEtaInclusive);
+  fLSign->SetBinEdges(6,fPtBinning.GetArray());
+  fLSign->SetBinEdges(7,fEtaBinning.GetArray());
   fLSign->SetBinEdges(8,binLimEtaAssociat);
   fLSign->Sumw2();
   AliDebug(2,"AliHFENonPhotonicElectron: fLSign");
@@ -347,15 +355,15 @@ void AliHFENonPhotonicElectron::Init()
   Double_t binLimMatches[nBinsMatches+1];
   for(int ib = 0; ib <= nBinsMatches; ib++) binLimMatches[ib] = ib;
   const Int_t nDimMatches = 3;  // centrality, pt_inc, number of matches 
-  const Int_t nBinsMatchHist[nDimMatches] = {nBinsC, nBinsPt, nBinsMatches};
+  const Int_t nBinsMatchHist[nDimMatches] = {nBinsC, fPtBinning.GetSize()-1, nBinsMatches};
   fUSmatches = new THnSparseF("fUSmatches", "fUSmatches", nDimMatches, nBinsMatchHist);
   fUSmatches->SetBinEdges(0,binLimC);
-  fUSmatches->SetBinEdges(1,binLimPt);
+  fUSmatches->SetBinEdges(1,fPtBinning.GetArray());
   fUSmatches->SetBinEdges(2,binLimMatches);
 
   fLSmatches = new THnSparseF("fLSmatches", "fLSmatches", nDimMatches, nBinsMatchHist);
   fLSmatches->SetBinEdges(0,binLimC);
-  fLSmatches->SetBinEdges(1,binLimPt);
+  fLSmatches->SetBinEdges(1,fPtBinning.GetArray());
   fLSmatches->SetBinEdges(2,binLimMatches);
 
 /*
index 51efe7227a3f75693044ef9c5565f32bacce3bd1..cdab7d4d7e403b74782200c0ff58f64e9b857550 100644 (file)
 #include <TNamed.h>
 #endif
 
+#ifndef ROOT_TArrayD
+#include <TArrayD.h>
+#endif
+
 class AliESDtrackCuts;
 class AliHFEpid;
 class AliHFEpidQAmanager;
@@ -91,6 +95,11 @@ class AliHFENonPhotonicElectron : public TNamed {
 
   Int_t    FindMother          (Int_t tr, Int_t &indexmother) const;
 
+  void SetPtBinning(const TArrayD &binning) { fPtBinning = binning; }
+  void SetPtBinning(Int_t nbins, const Double_t *const binning) { fPtBinning.Set(nbins+1, binning); }
+  void SetEtaBinning(const TArrayD &binning) { fEtaBinning = binning; }
+  void SetEtaBinning(Int_t nbins, const Double_t *const binning) { fEtaBinning.Set(nbins+1, binning); }
+
 
  private:
   Int_t    GetMotherPDG(Int_t tr, Int_t &motherIndex) const;
@@ -105,37 +114,39 @@ class AliHFENonPhotonicElectron : public TNamed {
   Bool_t FilterCategory1Track(const AliVTrack * const track, Bool_t isAOD, Int_t binct);
   Bool_t FilterCategory2Track(const AliVTrack * const track, Bool_t isAOD);
 
-  Bool_t                fIsAOD;                        // Is AOD
-  AliMCEvent           *fMCEvent;                      //! MC event ESD
-  TClonesArray         *fAODArrayMCInfo;               //! MC info particle AOD
-  AliHFEcuts           *fHFEBackgroundCuts;            // HFE background cuts
-  AliHFEpid            *fPIDBackground;                // PID background cuts
-  AliHFEpidQAmanager   *fPIDBackgroundQA;              // QA Manager Background
-  const AliPIDResponse *fkPIDRespons;                  // PID response
-  Bool_t                fAlgorithmMA;                  // algorithm MA
-  Double_t              fChi2OverNDFCut;               // Limit chi2
-  Double_t              fMaxDCA;                       // Limit dca
-//  Double_t            fMaxOpeningTheta;              // Limit opening angle in theta
-//  Double_t            fMaxOpeningPhi;                // Limit opening angle in phi
-  Double_t              fMaxOpening3D;                 // Limit opening 3D
-  Double_t              fMaxInvMass;                   // Limit invariant mass
-  Bool_t                fSetMassConstraint;            // Set mass constraint
-  Bool_t     fSelectCategory1tracks;    // Category 1 tracks: Standard track cuts
-  Bool_t     fSelectCategory2tracks;    // Category 2 tracks: tracks below 300 MeV/c
-  Double_t   fITSmeanShift;             // Shift of the mean in the ITS
-  TArrayI              *fArraytrack;                   //! list of associated tracks
-  Int_t                         fCounterPoolBackground;        // number of associated electrons
-  Int_t                         fnumberfound;                  // number of inclusive  electrons
-  TList                        *fListOutput;                   // List of histos
-  THnSparseF           *fAssElectron;                  //! centrality, pt, Source MC, P, TPCsignal
-  THnSparseF           *fIncElectron;                  //! centrality, pt, Source MC, P, TPCsignal
-  THnSparseF           *fUSign;                        //! delta phi, c, pt, inv, source
-  THnSparseF           *fLSign;                        //! delta phi, c, pt, inv, source
-  THnSparseF    *fUSmatches;  //! number of matched tracks with oposite sign per inclusive track after inv mass cut
-  THnSparseF    *fLSmatches;  //! number of matched tracks with same sign per inclusive track after inv mass cut
-  TH2F* fHnsigmaITS;  //! Control histogram for ITS pid of category 2 tracks
-//  THnSparseF         *fUSignAngle;                   //! angle, c, source
-//  THnSparseF         *fLSignAngle;                   //! angle, c, source
+  Bool_t                    fIsAOD;                         // Is AOD
+  AliMCEvent                *fMCEvent;                      //! MC event ESD
+  TClonesArray              *fAODArrayMCInfo;               //! MC info particle AOD
+  AliHFEcuts                *fHFEBackgroundCuts;            // HFE background cuts
+  AliHFEpid                    *fPIDBackground;                // PID background cuts
+  AliHFEpidQAmanager        *fPIDBackgroundQA;              // QA Manager Background
+  const AliPIDResponse      *fkPIDRespons;                  // PID response
+  TArrayD                   fPtBinning;                     // pt binning
+  TArrayD                   fEtaBinning;                    // eta binning
+  Bool_t                    fAlgorithmMA;                   // algorithm MA
+  Double_t                  fChi2OverNDFCut;                // Limit chi2
+  Double_t                  fMaxDCA;                        // Limit dca
+//  Double_t                fMaxOpeningTheta;               // Limit opening angle in theta
+//  Double_t                fMaxOpeningPhi;                 // Limit opening angle in phi
+  Double_t                  fMaxOpening3D;                  // Limit opening 3D
+  Double_t                  fMaxInvMass;                    // Limit invariant mass
+  Bool_t                    fSetMassConstraint;             // Set mass constraint
+  Bool_t                    fSelectCategory1tracks;         // Category 1 tracks: Standard track cuts
+  Bool_t                    fSelectCategory2tracks;         // Category 2 tracks: tracks below 300 MeV/c
+  Double_t                  fITSmeanShift;                  // Shift of the mean in the ITS
+  TArrayI                   *fArraytrack;                   //! list of associated tracks
+  Int_t                     fCounterPoolBackground;         // number of associated electrons
+  Int_t                     fnumberfound;                   // number of inclusive  electrons
+  TList                     *fListOutput;                   // List of histos
+  THnSparseF                *fAssElectron;                  //! centrality, pt, Source MC, P, TPCsignal
+  THnSparseF                *fIncElectron;                  //! centrality, pt, Source MC, P, TPCsignal
+  THnSparseF                *fUSign;                        //! delta phi, c, pt, inv, source
+  THnSparseF                *fLSign;                        //! delta phi, c, pt, inv, source
+  THnSparseF                *fUSmatches;                    //! number of matched tracks with oposite sign per inclusive track after inv mass cut
+  THnSparseF                *fLSmatches;                    //! number of matched tracks with same sign per inclusive track after inv mass cut
+  TH2F*                     fHnsigmaITS;                    //! Control histogram for ITS pid of category 2 tracks
+//  THnSparseF              *fUSignAngle;                   //! angle, c, source
+//  THnSparseF              *fLSignAngle;                   //! angle, c, source
 
 
   AliHFENonPhotonicElectron(const AliHFENonPhotonicElectron &ref); 
index 58d84a202aa4e52fed4fc0632da836307dbbab53..5899aaca154747decfbde3dd2424fe133c1e38ef 100644 (file)
@@ -13,8 +13,8 @@ AliAnalysisTask *AddTaskHFEnpepPb(Bool_t MCthere,
   const double kDefDCAr        =   1.;
   const double kDefDCAz        =   2.;
   const double kDefTOFs        =   3.;
-  const double  kDefEtaIncMin = -0.6;
-  const double  kDefEtaIncMax = 0.6;
+  const double  kDefEtaIncMin = -0.8;
+  const double  kDefEtaIncMax = 0.8;
 
   // TPC PID Cuts Inclusive leg:
   // NEW SPLINES + CORRECTIONS: mean 0, width 1
index 7f636c64515328772fb9d80610b9e56c39bc1b1a..20a309a730bd732796fd3917b4a04d14ada6df71 100755 (executable)
-TF1* GetEtaCorrection(){\r
-  TString list=gSystem->Getenv("LIST");\r
-\r
-  TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/EtaCorrMapsTPC.root";\r
-  if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){\r
-    Error("ConfigPbPb2010_Cent","Eta map not found: %s",etaMap.Data());\r
-    return 0;\r
-  }\r
-\r
-  TFile f(etaMap.Data());\r
-  if (!f.IsOpen()) return 0;\r
-  gROOT->cd();\r
-  TList *keys=f.GetListOfKeys();\r
-\r
-  for (Int_t i=0; i<keys->GetEntries(); ++i){\r
-    TString kName=keys->At(i)->GetName();\r
-    TPRegexp reg(kName);\r
-    if (reg.MatchB(list)){\r
-      printf("Using Eta Correction Function: %s\n",kName.Data());\r
-      return (TF1*)f.Get(kName.Data());\r
-    }\r
-  }\r
-  return 0;\r
-}\r
-\r
-Bool_t ReadContaminationFunctions(TString filename, TF1 **functions, double sigma){\r
-  TFile *in = TFile::Open(Form("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/%s", filename.Data()));\r
-  gROOT->cd();\r
-  int isig = static_cast<int>(sigma * 100.);\r
-  printf("Getting hadron background for the sigma cut: %d\n", isig);\r
-  bool status = kTRUE;\r
-  for(int icent = 0; icent < 12; icent++){\r
-    functions[icent] = dynamic_cast<TF1 *>(in->Get(Form("hback_%d_%d", isig, icent)));\r
-    if(functions[icent]) printf("Config for centrality class %d found\n", icent);\r
-    else{\r
-      printf("Config for the centrality class %d not found\n", icent);\r
-      status = kFALSE;\r
-    }\r
-  }\r
-  delete in;\r
-  return status;\r
-}\r
-\r
-AliAnalysisTaskHFE* ConfigHFEnpePbPb(Bool_t useMC, Bool_t isAOD, TString appendix,\r
-                UChar_t TPCcl=70, UChar_t TPCclPID = 80, \r
-                UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000., \r
-                Double_t* tpcdEdxcutlow=NULL, Double_t* tpcdEdxcuthigh=NULL, \r
-                Double_t TOFs=3., Int_t TOFmis=0, \r
-                Int_t itshitpixel = 0, Double_t itsChi2PerClusters, Double_t tpcClShared,\r
-                Bool_t etacor = kFALSE, Bool_t multicor = kFALSE, \r
-                       Double_t etami=-0.8, Double_t etama=0.8,\r
-                Double_t assETAm=-0.8, Double_t assETAp=0.8,\r
-                Int_t assITS=2, \r
-                Int_t assTPCcl=100, Int_t assTPCPIDcl=80, \r
-                Double_t assDCAr=1.0, Double_t assDCAz=2.0, \r
-                Double_t *assTPCSminus=NULL, Double_t *assTPCSplus=NULL, \r
-                Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE)\r
-{\r
-  Bool_t kAnalyseTaggedTracks = kFALSE;\r
-  Bool_t kApplyPreselection = kFALSE;\r
-\r
-  //***************************************//\r
-  //        Setting up the HFE cuts        //\r
-  //***************************************//\r
-\r
-  AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts for PbPb");\r
-  //hfecuts->SetQAOn();\r
-  hfecuts->CreateStandardCuts();\r
-  hfecuts->SetMinNClustersTPC(TPCcl);\r
-  hfecuts->SetMinNClustersTPCPID(TPCclPID);\r
-  hfecuts->SetMinNClustersITS(ITScl);\r
-  hfecuts->SetMinRatioTPCclusters(0.6);\r
-  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
-  hfecuts->SetCutITSpixel(itshitpixel);\r
-  hfecuts->SetCheckITSLayerStatus(kFALSE);\r
-  hfecuts->SetMaxChi2perClusterITS(itsChi2PerClusters);\r
-  hfecuts->SetEtaRange(etami,etama);\r
-  hfecuts->SetFractionOfSharedTPCClusters(tpcClShared);\r
-  if(isAOD) hfecuts->SetAODFilterBit(4);\r
-  \r
-  //if((iPixelAny==AliHFEextraCuts::kAny) || (iPixelAny==AliHFEextraCuts::kSecond))     \r
-  //hfecuts->SetProductionVertex(0,7,0,7);\r
\r
-  hfecuts->SetMaxImpactParam(DCAxy,DCAz);\r
-  hfecuts->SetUseMixedVertex(kTRUE);\r
-  hfecuts->SetVertexRange(10.);\r
-\r
-  // TOF settings:\r
-  Int_t usetof=0;\r
-  Bool_t kTOFmis=kFALSE;\r
-  if (TOFs>0.){\r
-    usetof = 1;\r
-    printf("CONFIGURATION FILE: TOF is used \n");\r
-    hfecuts->SetTOFPIDStep(kTRUE);\r
-    printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");\r
-    if (TOFmis>0){\r
-      kTOFmis = kTRUE;\r
-      printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");\r
-    }\r
-  }\r
-\r
-  //***************************************//\r
-  //        Setting up the task            //\r
-  //***************************************//\r
-\r
-  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEtask%s",appendix.Data()));\r
-  printf("task %p\n", task);\r
-  task->SetPbPbAnalysis();\r
-  task->SetRemovePileUp(kFALSE);\r
-  task->SetHFECuts(hfecuts);\r
-  task->GetPIDQAManager()->SetHighResolutionHistos();\r
-\r
-  // Determine the centrality estimator\r
-  task->SetCentralityEstimator("V0M");\r
-\r
-  //***************************************//\r
-  //        Prepare preselection           //\r
-  // This mimics the ESD->AOD filter in    //\r
-  // case of the ESD analysis and selects  //\r
-  // only tracks which will be selected in //\r
-  // the AOD analysis with the given filter//\r
-  // bit. Not to be applied for AODS.      //\r
-  // For pPb the cuts used are (bit 4)     //\r
-  // esdTrackCutsHG0 from file $ALICE_ROOT///\r
-  // ANALYSIS/macros/AddTaskESDFilter.C    //\r
-  //***************************************//\r
-  if(kApplyPreselection){\r
-       AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);\r
-       esdTrackCutsH->SetMaxDCAToVertexXY(2.4);\r
-       esdTrackCutsH->SetMaxDCAToVertexZ(3.2);\r
-       esdTrackCutsH->SetDCAToVertex2D(kTRUE); \r
-       esdTrackCutsH->SetMaxChi2PerClusterITS(1e10);\r
-       task->SetHFECutsPreselect(esdTrackCutsH);\r
-       printf("Put a preselection cut\n");\r
-       task->SetFillNoCuts(kTRUE);\r
-  }\r
-\r
-  //***************************************//\r
-  //          Variable manager             //\r
-  //***************************************//\r
-  // Define Variables\r
-  Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};\r
-  Double_t etabinning[17] = {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};\r
-\r
-  Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;\r
-  Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;\r
-\r
-  AliHFEvarManager *vm = task->GetVarManager();\r
-  vm->AddVariable("pt", sizept, ptbinning);\r
-  vm->AddVariable("eta", sizeeta, -0.8,0.8);\r
-  vm->AddVariable("phi",21, -0, 2*TMath::Pi());\r
-  vm->AddVariable("charge");\r
-  vm->AddVariable("source");\r
-  vm->AddVariable("centrality");\r
-\r
-  // For the moment, remove the part dedicated to the background subtraction.\r
-  // It will be implemented in a different way, reading it from a root file.\r
-\r
-  //***************************************//\r
-  //          Configure the PID            //\r
-  //***************************************//\r
-\r
-  // Define PID\r
-  AliHFEpid *pid = task->GetPID();\r
-  if(useMC) pid->SetHasMCData(kTRUE);\r
-\r
-  if (usetof){\r
-    pid->AddDetector("TOF", 0);\r
-    pid->AddDetector("TPC", 1);\r
-  } else {\r
-    pid->AddDetector("TPC", 0);\r
-  }\r
-  \r
-  // Configure TPC PID\r
-  // do the identical thing in data and MC\r
-  Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};\r
-  if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));\r
-\r
-  Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};\r
-  if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));\r
-\r
-  char *cutmodel;\r
-  cutmodel="pol0";\r
-\r
-  for(Int_t a=0;a<11;a++){\r
-    // Not necessary anymore, since the PbPb case is handled similarly to the pp case\r
-    //   cout << a << " " << paramsTPCdEdxcut[a] << endl;\r
-    Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};\r
-    Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];\r
-    pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);\r
-  }\r
-\r
-  if(!useMC){\r
-    AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTOFpid);\r
-    if(etacor){ \r
-         // Apply eta correction\r
-         TF1 *etacorrection = GetEtaCorrection();\r
-         if(etacorrection) tpcpid->SetEtaCorrection(etacorrection);\r
-    }\r
-    if(multicor){\r
-         TF1 *centralityCorrection = new TF1("centralityCorrection", "pol1", 0., 10000.);\r
-         centralityCorrection->SetParameter(0, 1.0);\r
-         centralityCorrection->SetParameter(1, -0.00002);\r
-         tpcpid->SetCentralityCorrection(centralityCorrection);\r
-    }\r
-  }\r
-\r
-  // Configure TOF PID\r
-  if (usetof){\r
-    pid->ConfigureTOF(TOFs);\r
-    AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);\r
-    if (kTOFmis){\r
-      tofpid->SetRejectTOFmismatch();\r
-    }\r
-  }\r
-\r
-  // To make different upper TOF cut to see contamination effect\r
-  // The below two lines should be removed after this check\r
-  //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);\r
-  //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut\r
-\r
-  // Load hadron background\r
-  if(!useMC){\r
-    Bool_t status = kTRUE;\r
-    TF1 *hBackground[12];\r
-    status = ReadContaminationFunctions("hadronContamination_PbPbTPC.root", hBackground, tpcdEdxcutlow[0]);\r
-    for(Int_t a=0;a<12;a++) {\r
-      //printf("back %f \n",hBackground[a]);\r
-      if(status) task->SetBackGroundFactorsFunction(hBackground[a],a);\r
-      else printf("not all background functions found\n");\r
-    }\r
-  }\r
-\r
-  //***************************************//\r
-  //       Configure NPE plugin            //\r
-  //***************************************//\r
-\r
-  AliHFENonPhotonicElectron *backe = new AliHFENonPhotonicElectron(Form("HFEBackGroundSubtractionPID2%s",appendix.Data()),"Background subtraction");  //appendix\r
-    //Setting the Cuts for the Associated electron-pool\r
-  AliHFEcuts *hfeBackgroundCuts = new AliHFEcuts(Form("HFEBackSub%s",appendix.Data()),"Background sub Cuts");\r
-  //  hfeBackgroundCuts->SetEtaRange(assETA);\r
-  hfeBackgroundCuts->SetEtaRange(assETAm,assETAp);\r
-  hfeBackgroundCuts->SetPtRange(0.1,1e10);\r
-\r
-  hfeBackgroundCuts->SetMaxChi2perClusterTPC(4);\r
-  hfeBackgroundCuts->SetMinNClustersITS(assITS);\r
-  hfeBackgroundCuts->SetMinNClustersTPC(assTPCcl);\r
-  hfeBackgroundCuts->SetMinNClustersTPCPID(assTPCPIDcl);\r
-  hfeBackgroundCuts->SetMaxImpactParam(assDCAr,assDCAz);\r
-  if(isAOD) hfeBackgroundCuts->SetAODFilterBit(4);\r
-  hfeBackgroundCuts->SetQAOn();                                // QA\r
-\r
-  AliHFEpid *pidbackground = backe->GetPIDBackground();\r
-  if(useMC) pidbackground->SetHasMCData(kTRUE);\r
-  pidbackground->AddDetector("TPC", 0);\r
-  Double_t paramsTPCdEdxcutlowAssoc[12] ={-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0};\r
-  if(assTPCSminus) memcpy(paramsTPCdEdxcutlowAssoc,assTPCSminus,sizeof(paramsTPCdEdxcutlowAssoc));\r
-\r
-  Double_t paramsTPCdEdxcuthighAssoc[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};\r
-  if(assTPCSplus) memcpy(paramsTPCdEdxcuthighAssoc,assTPCSplus,sizeof(paramsTPCdEdxcuthighAssoc));\r
-    \r
-  char *cutmodelAssoc;\r
-  cutmodelAssoc="pol0";\r
-  for(Int_t a=0;a<11;a++){\r
-    //   cout << a << " " << paramsTPCdEdxcut[a] << endl;\r
-    Double_t tpcparamlow[1]={paramsTPCdEdxcutlowAssoc[a]};\r
-    Float_t tpcparamhigh=paramsTPCdEdxcuthighAssoc[a];\r
-    pidbackground->ConfigureTPCcentralityCut(a,cutmodelAssoc,tpcparamlow,tpcparamhigh);\r
-  }\r
-  backe->GetPIDBackgroundQAManager()->SetHighResolutionHistos();\r
-  backe->SetHFEBackgroundCuts(hfeBackgroundCuts);\r
-\r
-  // Selection of associated tracks for the pool\r
-  if(useCat1Tracks) backe->SelectCategory1Tracks(kTRUE);\r
-  if(useCat2Tracks){\r
-    backe->SelectCategory2Tracks(kTRUE);\r
-    backe->SetITSMeanShift(-0.5);\r
-  }\r
-\r
-  // apply opening angle cut to reduce file size\r
-  backe->SetMaxInvMass(0.3);\r
-\r
-  task->SetHFEBackgroundSubtraction(backe);\r
-\r
-  //***************************************//\r
-  //          V0 tagged tracks             //\r
-  //***************************************//\r
-\r
-  if(kAnalyseTaggedTracks){\r
-    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");\r
-    v0trackCuts->CreateStandardCuts();\r
-    v0trackCuts->SetMinNClustersTPC(TPCcl);\r
-    v0trackCuts->SetMinNClustersTPCPID(TPCclPID);\r
-    v0trackCuts->SetMinRatioTPCclusters(0.6);\r
-    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);\r
-    v0trackCuts->SetMinNClustersITS(1);\r
-    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);\r
-    v0trackCuts->SetCheckITSLayerStatus(kFALSE);\r
-    v0trackCuts->UnsetVertexRequirement();\r
-    //hfecuts->SetSigmaToVertex(10);\r
-    if(usetof) v0trackCuts->SetTOFPIDStep(kTRUE);\r
-    v0trackCuts->SetQAOn();\r
-\r
-    task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);\r
-    task->SetTaggedTrackCuts(v0trackCuts);\r
-    task->SetCleanTaggedTrack(kTRUE);\r
-  }\r
-\r
-  // QA\r
-  printf("task %p\n", task);\r
-  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);\r
-  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);\r
-  task->SwitchOnPlugin(AliAnalysisTaskHFE::kNonPhotonicElectron);\r
-  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);\r
-\r
-  printf("*************************************\n");\r
-  printf("Configuring standard Task:\n");\r
-  task->PrintStatus();\r
-  pid->PrintStatus();\r
-  printf("*************************************\n");\r
-  return task;\r
-}\r
+TF1* GetEtaCorrection(){
+  TString list=gSystem->Getenv("LIST");
+
+  TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/EtaCorrMapsTPC.root";
+  if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){
+    Error("ConfigPbPb2010_Cent","Eta map not found: %s",etaMap.Data());
+    return 0;
+  }
+
+  TFile f(etaMap.Data());
+  if (!f.IsOpen()) return 0;
+  gROOT->cd();
+  TList *keys=f.GetListOfKeys();
+
+  for (Int_t i=0; i<keys->GetEntries(); ++i){
+    TString kName=keys->At(i)->GetName();
+    TPRegexp reg(kName);
+    if (reg.MatchB(list)){
+      printf("Using Eta Correction Function: %s\n",kName.Data());
+      return (TF1*)f.Get(kName.Data());
+    }
+  }
+  return 0;
+}
+
+Bool_t ReadContaminationFunctions(TString filename, TF1 **functions, double sigma){
+  TFile *in = TFile::Open(Form("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/%s", filename.Data()));
+  gROOT->cd();
+  int isig = static_cast<int>(sigma * 100.);
+  printf("Getting hadron background for the sigma cut: %d\n", isig);
+  bool status = kTRUE;
+  for(int icent = 0; icent < 12; icent++){
+    functions[icent] = dynamic_cast<TF1 *>(in->Get(Form("hback_%d_%d", isig, icent)));
+    if(functions[icent]) printf("Config for centrality class %d found\n", icent);
+    else{
+      printf("Config for the centrality class %d not found\n", icent);
+      status = kFALSE;
+    }
+  }
+  delete in;
+  return status;
+}
+
+AliAnalysisTaskHFE* ConfigHFEnpePbPb(Bool_t useMC, Bool_t isAOD, TString appendix,
+                UChar_t TPCcl=70, UChar_t TPCclPID = 80, 
+                UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000., 
+                Double_t* tpcdEdxcutlow=NULL, Double_t* tpcdEdxcuthigh=NULL, 
+                Double_t TOFs=3., Int_t TOFmis=0, 
+                Int_t itshitpixel = 0, Double_t itsChi2PerClusters, Double_t tpcClShared,
+                Bool_t etacor = kFALSE, Bool_t multicor = kFALSE, 
+                       Double_t etami=-0.8, Double_t etama=0.8,
+                Double_t assETAm=-0.8, Double_t assETAp=0.8,
+                Int_t assITS=2, 
+                Int_t assTPCcl=100, Int_t assTPCPIDcl=80, 
+                Double_t assDCAr=1.0, Double_t assDCAz=2.0, 
+                Double_t *assTPCSminus=NULL, Double_t *assTPCSplus=NULL, 
+                Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE)
+{
+  Bool_t kAnalyseTaggedTracks = kFALSE;
+  Bool_t kApplyPreselection = kTRUE;
+
+  //***************************************//
+  //        Setting up the HFE cuts        //
+  //***************************************//
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts for PbPb");
+  //hfecuts->SetQAOn();
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFoundAll, AliHFEextraCuts::kFoundAllOverFindable);
+  hfecuts->SetCutITSpixel(itshitpixel);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  hfecuts->SetMaxChi2perClusterITS(itsChi2PerClusters);
+  hfecuts->SetEtaRange(etami,etama);
+  hfecuts->SetFractionOfSharedTPCClusters(tpcClShared);
+  hfecuts->SetAcceptKinkMothers();
+  if(isAOD) hfecuts->SetAODFilterBit(2);
+  
+  if((iPixelAny==AliHFEextraCuts::kAny) || (iPixelAny==AliHFEextraCuts::kSecond))     
+  hfecuts->SetProductionVertex(0,7,0,7);
+  hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  // TOF settings:
+  Int_t usetof=0;
+  Bool_t kTOFmis=kFALSE;
+  if (TOFs>0.){
+    usetof = 1;
+    printf("CONFIGURATION FILE: TOF is used \n");
+    hfecuts->SetTOFPIDStep(kTRUE);
+    printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");
+    if (TOFmis>0){
+      kTOFmis = kTRUE;
+      printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");
+    }
+  }
+
+  //***************************************//
+  //        Setting up the task            //
+  //***************************************//
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEtask%s",appendix.Data()));
+  printf("task %p\n", task);
+  task->SetPbPbAnalysis();
+  task->SetRemovePileUp(kFALSE);
+  task->SetHFECuts(hfecuts);
+  task->SetRejectKinkMother(kFALSE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  // Determine the centrality estimator
+  task->SetCentralityEstimator("V0M");
+
+  //***************************************//
+  //        Prepare preselection           //
+  // This mimics the ESD->AOD filter in    //
+  // case of the ESD analysis and selects  //
+  // only tracks which will be selected in //
+  // the AOD analysis with the given filter//
+  // bit. Not to be applied for AODS.      //
+  // For pPb the cuts used are (bit 4)     //
+  // esdTrackCutsHG0 from file $ALICE_ROOT///
+  // ANALYSIS/macros/AddTaskESDFilter.C    //
+  //***************************************//
+  if(kApplyPreselection){
+    AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+    esdTrackCutsH->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+    task->SetHFECutsPreselect(esdTrackCutsH);
+    printf("Put a preselection cut\n");
+    task->SetFillNoCuts(kTRUE);
+  }
+
+  //***************************************//
+  //          Variable manager             //
+  //***************************************//
+  // Define Variables
+  Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
+  Double_t etabinning[17] = {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};
+
+  Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;
+  Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;
+
+  AliHFEvarManager *vm = task->GetVarManager();
+  vm->AddVariable("pt", sizept, ptbinning);
+  vm->AddVariable("eta", sizeeta, -0.8,0.8);
+  vm->AddVariable("phi",21, -0, 2*TMath::Pi());
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  vm->AddVariable("centrality");
+
+  // For the moment, remove the part dedicated to the background subtraction.
+  // It will be implemented in a different way, reading it from a root file.
+
+  //***************************************//
+  //          Configure the PID            //
+  //***************************************//
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+
+  if (usetof){
+    pid->AddDetector("TOF", 0);
+    pid->AddDetector("TPC", 1);
+  } else {
+    pid->AddDetector("TPC", 0);
+  }
+  
+  // Configure TPC PID
+  // do the identical thing in data and MC
+  Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
+  if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));
+
+  Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
+  if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));
+
+  char *cutmodel;
+  cutmodel="pol0";
+
+  for(Int_t a=0;a<11;a++){
+    // Not necessary anymore, since the PbPb case is handled similarly to the pp case
+    //   cout << a << " " << paramsTPCdEdxcut[a] << endl;
+    Double_t tpcparamlow[1]={paramsTPCdEdxcutlow[a]};
+    Float_t tpcparamhigh=paramsTPCdEdxcuthigh[a];
+    pid->ConfigureTPCcentralityCut(a,cutmodel,tpcparamlow,tpcparamhigh);
+  }
+
+  if(!useMC){
+    AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTOFpid);
+    if(etacor){ 
+         // Apply eta correction
+         TF1 *etacorrection = GetEtaCorrection();
+         if(etacorrection) tpcpid->SetEtaCorrection(etacorrection);
+    }
+    if(multicor){
+         TF1 *centralityCorrection = new TF1("centralityCorrection", "pol1", 0., 10000.);
+         centralityCorrection->SetParameter(0, 1.0);
+         centralityCorrection->SetParameter(1, -0.00002);
+         tpcpid->SetCentralityCorrection(centralityCorrection);
+    }
+  }
+
+  // Configure TOF PID
+  if (usetof){
+    pid->ConfigureTOF(TOFs);
+    AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
+    if (kTOFmis){
+      tofpid->SetRejectTOFmismatch();
+    }
+  }
+
+  // To make different upper TOF cut to see contamination effect
+  // The below two lines should be removed after this check
+  //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
+  //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut
+
+  // Load hadron background
+  if(!useMC){
+    Bool_t status = kTRUE;
+    TF1 *hBackground[12];
+    status = ReadContaminationFunctions("hadronContamination_PbPbTPC.root", hBackground, tpcdEdxcutlow[0]);
+    for(Int_t a=0;a<12;a++) {
+      //printf("back %f \n",hBackground[a]);
+      if(status) task->SetBackGroundFactorsFunction(hBackground[a],a);
+      else printf("not all background functions found\n");
+    }
+  }
+
+  //***************************************//
+  //       Configure NPE plugin            //
+  //***************************************//
+
+  AliHFENonPhotonicElectron *backe = new AliHFENonPhotonicElectron(Form("HFEBackGroundSubtractionPID2%s",appendix.Data()),"Background subtraction");  //appendix
+    //Setting the Cuts for the Associated electron-pool
+  AliHFEcuts *hfeBackgroundCuts = new AliHFEcuts(Form("HFEBackSub%s",appendix.Data()),"Background sub Cuts");
+  //  hfeBackgroundCuts->SetEtaRange(assETA);
+  hfeBackgroundCuts->SetEtaRange(assETAm,assETAp);
+  hfeBackgroundCuts->SetPtRange(0.1,1e10);
+
+  hfeBackgroundCuts->SetMaxChi2perClusterTPC(4);
+  hfeBackgroundCuts->SetMinNClustersITS(assITS);
+  hfeBackgroundCuts->SetMinNClustersTPC(assTPCcl);
+  hfeBackgroundCuts->SetMinNClustersTPCPID(assTPCPIDcl);
+  hfeBackgroundCuts->SetMaxImpactParam(assDCAr,assDCAz);
+  if(isAOD) hfeBackgroundCuts->SetAODFilterBit(0);
+  //hfeBackgroundCuts->SetQAOn();                              // QA
+
+  AliHFEpid *pidbackground = backe->GetPIDBackground();
+  if(useMC) pidbackground->SetHasMCData(kTRUE);
+  pidbackground->AddDetector("TPC", 0);
+  Double_t paramsTPCdEdxcutlowAssoc[12] ={-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0};
+  if(assTPCSminus) memcpy(paramsTPCdEdxcutlowAssoc,assTPCSminus,sizeof(paramsTPCdEdxcutlowAssoc));
+
+  Double_t paramsTPCdEdxcuthighAssoc[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
+  if(assTPCSplus) memcpy(paramsTPCdEdxcuthighAssoc,assTPCSplus,sizeof(paramsTPCdEdxcuthighAssoc));
+    
+  char *cutmodelAssoc;
+  cutmodelAssoc="pol0";
+  for(Int_t a=0;a<11;a++){
+    //   cout << a << " " << paramsTPCdEdxcut[a] << endl;
+    Double_t tpcparamlow[1]={paramsTPCdEdxcutlowAssoc[a]};
+    Float_t tpcparamhigh=paramsTPCdEdxcuthighAssoc[a];
+    pidbackground->ConfigureTPCcentralityCut(a,cutmodelAssoc,tpcparamlow,tpcparamhigh);
+  }
+  //backe->GetPIDBackgroundQAManager()->SetHighResolutionHistos();
+  backe->SetHFEBackgroundCuts(hfeBackgroundCuts);
+
+  // Selection of associated tracks for the pool
+  if(useCat1Tracks) backe->SelectCategory1Tracks(kTRUE);
+  if(useCat2Tracks){
+    backe->SelectCategory2Tracks(kTRUE);
+    backe->SetITSMeanShift(-0.5);
+  }
+
+  // apply opening angle cut to reduce file size
+  backe->SetMaxInvMass(0.3);
+  backe->SetPtBinning(sizept, ptbinning);
+  backe->SetEtaBinning(sizeeta, etabinning);
+
+  task->SetHFEBackgroundSubtraction(backe);
+
+  //***************************************//
+  //          V0 tagged tracks             //
+  //***************************************//
+
+  if(kAnalyseTaggedTracks){
+    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+    v0trackCuts->CreateStandardCuts();
+    v0trackCuts->SetMinNClustersTPC(TPCcl);
+    v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
+    v0trackCuts->SetMinRatioTPCclusters(0.6);
+    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+    v0trackCuts->SetMinNClustersITS(1);
+    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+    v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+    v0trackCuts->UnsetVertexRequirement();
+    //hfecuts->SetSigmaToVertex(10);
+    if(usetof) v0trackCuts->SetTOFPIDStep(kTRUE);
+    v0trackCuts->SetQAOn();
+
+    task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+    task->SetTaggedTrackCuts(v0trackCuts);
+    task->SetCleanTaggedTrack(kTRUE);
+  }
+
+  // QA
+  printf("task %p\n", task);
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kNonPhotonicElectron);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->PrintStatus();
+  pid->PrintStatus();
+  printf("*************************************\n");
+  return task;
+}
index 089673da0f63e2adf9ade5432d719cf72be62499..df7b3ac9ac0f36db549fa265ccfc567a1d9b0023 100644 (file)
@@ -47,6 +47,8 @@ AliAnalysisTaskHFE* ConfigHFEnpepPb(Bool_t useMC, Bool_t isAOD, TString appendix
   hfecuts->SetCutITSpixel(itshitpixel);
   hfecuts->SetCheckITSLayerStatus(kFALSE);
   hfecuts->SetEtaRange(etami,etama);
+  hfecuts->SetRejectKinkDaughters();
+  hfecuts->SetAcceptKinkMothers();
   if(isAOD) hfecuts->SetAODFilterBit(4);
   
   //if((iPixelAny==AliHFEextraCuts::kAny) || (iPixelAny==AliHFEextraCuts::kSecond))     
@@ -85,6 +87,7 @@ AliAnalysisTaskHFE* ConfigHFEnpepPb(Bool_t useMC, Bool_t isAOD, TString appendix
   task->SetRemovePileUp(kFALSE);
   task->SetHFECuts(hfecuts);
   task->GetPIDQAManager()->SetHighResolutionHistos();
+  task->SetRejectKinkMother(kFALSE);
 
   // Determine the centrality estimator
   task->SetCentralityEstimator("V0A");
@@ -92,6 +95,29 @@ AliAnalysisTaskHFE* ConfigHFEnpepPb(Bool_t useMC, Bool_t isAOD, TString appendix
   else if (icent == 3) task->SetCentralityEstimator("CL1");
   else if (icent == 4) task->SetCentralityEstimator("ZNA");
 
+  //***************************************//
+  //        Prepare preselection           //
+  // This mimics the ESD->AOD filter in    //
+  // case of the ESD analysis and selects  //
+  // only tracks which will be selected in //
+  // the AOD analysis with the given filter//
+  // bit. Not to be applied for AODS.      //
+  // For pPb the cuts used are (bit 4)     //
+  // esdTrackCutsHG0 from file $ALICE_ROOT///
+  // ANALYSIS/macros/AddTaskESDFilter.C    //
+  //***************************************//
+
+  if(kApplyPreselection){    
+    AliESDtrackCuts* esdfilter = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
+    esdfilter->SetMaxDCAToVertexXY(2.4);
+    esdfilter->SetMaxDCAToVertexZ(3.2);
+    esdfilter->SetDCAToVertex2D(kTRUE);
+
+    task->SetHFECutsPreselect(esdfilter);
+    printf("Put a preselection cut\n");
+    task->SetFillNoCuts(kTRUE);
+  }
+
   //***************************************//
   //          Variable manager             //
   //***************************************//
@@ -217,10 +243,15 @@ AliAnalysisTaskHFE* ConfigHFEnpepPb(Bool_t useMC, Bool_t isAOD, TString appendix
 
   // Selection of associated tracks for the pool
   if(useCat1Tracks) backe->SelectCategory1Tracks(kTRUE);
-  if(useCat2Tracks) backe->SelectCategory2Tracks(kTRUE);
+  if(useCat2Tracks){
+    backe->SelectCategory2Tracks(kTRUE);
+    backe-> SetITSMeanShift(-0.5);
+  }
 
   // apply opening angle cut to reduce file size
   backe->SetMaxInvMass(0.3);
+  backe->SetPtBinning(sizept, ptbinning);
+  backe->SetEtaBinning(sizeeta, etabinning);
 
   task->SetHFEBackgroundSubtraction(backe);
 
index cc75d28b30dc9dc17be179e084278c8ff1309c56..e67eb03e15384ea84c844c825c3f7ba79328899b 100644 (file)
@@ -100,6 +100,9 @@ void runGridAODPbPb()
    gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/AddTaskHFEreducedEvent.C");
    AddTaskHFEreducedEvent();
 
+   //===== ADD TASK::
+   gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/AddTaskHFEnpePbPb.C");
+   AddTaskHFEnpePbPb();
 
 
    // Enable debug printouts