]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Configs file
authorrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Mar 2012 10:54:02 +0000 (10:54 +0000)
committerrbailhac <rbailhac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Mar 2012 10:54:02 +0000 (10:54 +0000)
PWGHF/hfe/macros/configs/PbPb/ConfigHFECalstandard_PbPb.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/ConfigHFETRDpbpb.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpbSYSbeauty.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYS.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYSbeauty.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/pp/ConfigHFEpidEMCAL.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/pp/ConfigHFEtrd2SYS.C [new file with mode: 0644]
PWGHF/hfe/macros/configs/pp/ConfigWeightFactors.C [new file with mode: 0644]

diff --git a/PWGHF/hfe/macros/configs/PbPb/ConfigHFECalstandard_PbPb.C b/PWGHF/hfe/macros/configs/PbPb/ConfigHFECalstandard_PbPb.C
new file mode 100644 (file)
index 0000000..955d8f6
--- /dev/null
@@ -0,0 +1,158 @@
+AliAnalysisTaskHFE* ConfigHFECalstandard_PbPb(Bool_t useMC){
+  //
+  // HFE standard task configuration
+  //
+
+  AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts for EMCal");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(120);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+
+  //hfecuts->SetMinNClustersITS(4);
+  hfecuts->SetMinNClustersITS(3);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+
+  //hfecuts->UnsetVertexRequirement();
+  hfecuts->SetMaxImpactParam(3.,3.);
+  hfecuts->SetMaxImpactParam(3.,3.);
+  hfecuts->SetPtRange(0.5,60.0);
+
+  hfecuts->SetVertexRange(10.);
+  //hfecuts->SetMaxChi2perClusterITS(36);
+  //hfecuts->SetSigmaToVertex(10);
+  //hfecuts->SetTOFPIDStep(kTRUE);
+  //hfecuts->SetTOFMISMATCHStep(kTRUE);
+  //hfecuts->SetTPCPIDCleanUpStep(kTRUE);
+  hfecuts->SetQAOn();
+  //hfecuts->SetMinNTrackletsTRD(5);
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE("HFEanalysisStandardEMCal");
+  task->SetHFECuts(hfecuts);
+  task->SetPbPbAnalysis(kTRUE);
+  //task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  // Define Variables
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  //vm->AddVariable("eta");
+  
+  const Double_t ptbinning[50] = {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., 
+                                  9., 10., 11., 12., 13., 
+                                  14., 15., 16., 17., 18.,
+                                  20., 22., 24., 26., 28.,
+                                  30., 32., 34., 36., 38.,
+                                 40., 45., 50., 55., 60.,
+                                 65., 70., 80., 90., 100}; 
+
+  const 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}; 
+
+  vm->AddVariable("pt", 49, ptbinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  vm->AddVariable("centrality");
+  /*
+  if(!useMC){
+
+      for(Int_t a=0;a<12;a++)
+      {
+         TF1 *hBackground = new TF1("hadronicBackgroundFunction","TMath::Exp([0]/x + [1])", 0., 20.);
+         hBackground->SetParameter(0, -43.87);
+         hBackground->SetParameter(1, 2.85);
+         task->SetBackGroundFactorsFunction(hBackground,a);
+      }
+
+
+  }
+  */
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("EMCAL", 1);
+  pid->AddDetector("TPC", 0);
+//  pid->ConfigureTPCrejection();
+
+  if(!useMC){
+
+      Double_t params_centr_0_5[1];
+      Double_t params_centr_5_10[1];
+      Double_t params_centr_10_20[1];
+      Double_t params_centr_20_30[1];
+      Double_t params_centr_per[1];
+      //params_centr_0_5[0]=0.16;  // cut tuned for 0-10%
+      //params_centr_5_10[0]=0.16; // cut tuned for 0-10%
+      //params_centr_10_20[0]=0.29;
+      //params_centr_20_30[0]=0.38;
+      //params_centr_per[0]=0.44;
+      params_centr_0_5[0]=-1.5;  // cut tuned for 0-10%
+      params_centr_5_10[0]=-1.5; // cut tuned for 0-10%
+      params_centr_10_20[0]=-1.5;
+      params_centr_20_30[0]=-1.5;
+      params_centr_per[0]=-1.5;
+      char *cutmodel;
+      cutmodel="pol0";
+
+
+      for(Int_t a=0;a<11;a++)
+      {
+         if(a>3)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,3.0);
+         if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,3.0);    //  0-5%
+         if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,3.0);    //  5-10%
+         if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,3.0);    //  10-20%
+         if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,3.0);    //  20-30%
+      }
+
+
+  }
+
+
+  // V0 tagged tracks
+  AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+  v0trackCuts->CreateStandardCuts();
+  v0trackCuts->SetMinNClustersTPC(120);
+  v0trackCuts->SetMinRatioTPCclusters(0.6);
+  v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  v0trackCuts->SetMinNClustersITS(1);
+  v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+  v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+  v0trackCuts->UnsetVertexRequirement();
+  //v0trackCuts->SetMaxChi2perClusterITS(36);
+  //hfecuts->SetSigmaToVertex(10);
+  v0trackCuts->SetTOFPIDStep(kTRUE);
+//  v0trackCuts->SetTOFMISMATCHStep(kTRUE);
+  //v0trackCuts->SetTPCPIDCleanUpStep(kTRUE);
+  v0trackCuts->SetQAOn();
+  
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+  task->SetTaggedTrackCuts(v0trackCuts);
+  task->SetCleanTaggedTrack(kFALSE);
+  
+  // change E/p cuts
+  AliHFEpidEMCAL *emcpid = pid->AliHFEpid::GetDetPID(AliHFEpid::kEMCALpid);
+  emcpid->SetEoPMax(1.2);
+  emcpid->SetEoPMim(0.85);
+
+  // QA
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+//  task->SetFillSignalOnly(kFALSE);    // for DE pluging for MC
+  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->Print();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/PbPb/ConfigHFETRDpbpb.C b/PWGHF/hfe/macros/configs/PbPb/ConfigHFETRDpbpb.C
new file mode 100644 (file)
index 0000000..a887d25
--- /dev/null
@@ -0,0 +1,184 @@
+AliAnalysisTaskHFE* ConfigHFETRDpbpb(Bool_t useMC=kFALSE, Bool_t beauty=kFALSE, UChar_t Sample=10,
+                                    UChar_t TPCcl=70, UChar_t TPCclPID = 80,
+                                    Double_t TPCclRatio = 0.6, Double_t TPCclshared = 1.1,
+                                    UChar_t ITScl=3,  Double_t ITSchi2perclusters=99999999.,
+                                    Double_t dcaxy=1000.0, Double_t dcaz=2000.0,
+                                    Double_t TPCs=0., Double_t TPCu=3.09,
+                                    Double_t TOFs=3.,Double_t IpSig=3., TString appendix,
+                                    UChar_t TRDtl = 5,UChar_t TRDeff = 2,Bool_t TRDonFlyCut = kFALSE, Bool_t TRDexactTracklets = kFALSE){
+  //
+  // HFE standard task configuration
+  //
+    Bool_t kAnalyseTaggedTracks = kTRUE;
+
+    Float_t eeff[6] = {0.7, 0.75, 0.8, 0.85, 0.9, 0.95};
+    Int_t eeffint[6] = {70, 75, 80, 85, 90, 95};
+    if(TRDeff >= 6 || TRDtl < 4 || TRDtl > 6) return NULL;
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts pbpb TOF TPC TRD");
+  hfecuts->CreateStandardCuts();
+
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinRatioTPCclusters(TPCclRatio);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetFractionOfSharedTPCClusters(TPCclshared);
+
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+
+  hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE);
+  if(useMC && beauty) hfecuts->SetProductionVertex(0,100,0,100);
+
+  hfecuts->SetMaxImpactParam(dcaxy,dcaz);
+
+  hfecuts->SetMinNTrackletsTRD(TRDtl, TRDexactTracklets);   // number of trd tracklets
+
+
+  // event cuts
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  // others
+  hfecuts->SetTOFPIDStep(kTRUE);
+  //hfecuts->SetMaxChi2perClusterITS(36);
+  //hfecuts->SetTOFMISMATCHStep(kTRUE);
+  //hfecuts->SetTPCPIDCleanUpStep(kTRUE);
+  hfecuts->SetQAOn();
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(appendix);
+  task->SetHFECuts(hfecuts);
+  task->SetPbPbAnalysis(kTRUE);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+  
+  // 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};
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  //vm->AddVariable("eta");
+  vm->AddVariable("pt", 35, ptbinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  vm->AddVariable("centrality");
+
+  // no background function for TRD PbPb analysis at the moment
+  /*
+  if(!useMC){
+    
+    for(Int_t a=0;a<12;a++)
+      {
+       TF1 *hBackground = new TF1("hadronicBackgroundFunction","TMath::Exp([0]/x + [1])", 0., 20.);
+       hBackground->SetParameter(0, -43.87);
+       hBackground->SetParameter(1, 2.85);
+       task->SetBackGroundFactorsFunction(hBackground,a);
+      }
+  }
+  */
+
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+ // pid->AddDetector("TRD", 2); // adjust order
+ // pid->AddDetector("TPC", 1);
+  pid->AddDetector("TRD", 1); // adjust order
+  pid->AddDetector("TPC", 2);
+
+  //pid->ConfigureTPCrejection();
+  
+  if(!useMC){
+    
+    Double_t params_centr_0_5[1];
+    Double_t params_centr_5_10[1];
+    Double_t params_centr_10_20[1];
+    Double_t params_centr_20_30[1];
+    Double_t params_centr_per[1];
+    params_centr_0_5[0]=TPCs;   // 0.16; // cut tuned for 0-10%
+    params_centr_5_10[0]=TPCs;  // 0.16; // cut tuned for 0-10%
+    params_centr_10_20[0]=TPCs; // 0.29;
+    params_centr_20_30[0]=TPCs; // 0.38;
+    params_centr_per[0]=TPCs;   // 0.44;
+    char *cutmodel;
+    cutmodel="pol0";
+    
+    
+    for(Int_t a=0;a<11;a++)
+      {
+       if(a>3)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,TPCu);
+       if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,TPCu);    //  0-5%
+       if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,TPCu);    //  5-10%
+       if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,TPCu);    //  10-20%
+       if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,TPCu);    //  20-30%
+      }
+  }
+  pid->ConfigureTOF(TOFs);
+
+
+  // adjust
+  AliHFEpidTRD *trdpid = pid->GetDetPID(AliHFEpid::kTRDpid);
+  trdpid->SetRenormalizeElPi();
+  trdpid->SetElectronEfficiency(eeff[TRDeff]);   // efficiency
+  trdpid->SetNTracklets(TRDtl);      // ntracklets threshold
+  //trdpid->SetCutNTracklets(TRDtl, TRDexactTracklets);
+  AliOADBContainer *cont = new AliOADBContainer("TRDthresholds");
+  cont->InitFromFile(Form("%s/util/hfe/TRD.OADBThresholds.root", gSystem->Getenv("TRAIN_ROOT")),"TRDthresholds");
+  trdpid->SetOADBThresholds(cont);
+  if(TRDonFlyCut) trdpid->SelectCutOnTheFly(kTRUE);
+
+
+  if(kAnalyseTaggedTracks)
+  {
+      // V0 tagged tracks
+      AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+      v0trackCuts->CreateStandardCuts();
+
+      v0trackCuts->SetMinNClustersTPC(TPCcl);
+      v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
+      v0trackCuts->SetFractionOfSharedTPCClusters(TPCclshared);
+      v0trackCuts->SetMinRatioTPCclusters(TPCclRatio);
+      v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+      v0trackCuts->SetMinNClustersITS(1);
+      v0trackCuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+      v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+      v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+      v0trackCuts->UnsetVertexRequirement();
+      //v0trackCuts->SetMaxChi2perClusterITS(36);
+      //hfecuts->SetSigmaToVertex(10);
+      v0trackCuts->SetTOFPIDStep(kTRUE);
+      //v0trackCuts->SetTOFMISMATCHStep(kTRUE);
+      //v0trackCuts->SetTPCPIDCleanUpStep(kTRUE);
+      v0trackCuts->SetQAOn();
+      v0trackCuts->SetMinNTrackletsTRD(TRDtl); // condition for TRD tracklets
+
+      task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+      task->SetTaggedTrackCuts(v0trackCuts);
+      task->SetCleanTaggedTrack(kFALSE);
+  }
+  
+  // QA
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+  //task->SetFillSignalOnly(kFALSE);    // for DE pluging for MC
+  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring task PbPb \n"); 
+  //if(isLHC10) printf("Configuring TPC1 Task 2010 :\n");
+  //if(isLHC11) printf("Configuring TPC1 Task 2011 :\n");
+  task->Print();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C b/PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C
new file mode 100644 (file)
index 0000000..6bde87d
--- /dev/null
@@ -0,0 +1,106 @@
+AliAnalysisTaskHFEFlow* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, Int_t tpcCls, Double_t tpcClsr,Int_t tpcClspid,Int_t itsCls, Double_t dcaxy, 
+                             Double_t dcaz,  Double_t tofsig, Double_t tpcdedx0, Double_t tpcdedx1, Double_t tpcdedx2, Double_t tpcdedx3, Double_t tpcdedx4, Int_t vzero)
+{
+  //
+  // HFE flow task 
+  //
+  printf("Summary settings flow task\n");
+  printf("TPC number of tracking clusters %d\n",tpcCls);
+  printf("TPC ratio clusters %f\n",tpcClsr*0.1);
+  printf("TPC number of pid clusters %d\n",tpcClspid);
+  printf("ITS number of clusters %d\n",itsCls);
+  printf("dcaxy %f\n",dcaxy);
+  printf("dcaz %f\n",dcaz);
+  printf("TOF sigma %f\n",tofsig*0.1);
+  printf("VZERO event plane %d\n",vzero);
+
+  // Cut HFE
+  AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(tpcCls);
+  hfecuts->SetMinNClustersTPCPID(tpcClspid);
+  hfecuts->SetMinRatioTPCclusters(tpcClsr*0.1);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+      
+  hfecuts->SetMinNClustersITS(itsCls);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  
+  hfecuts->SetMaxImpactParam(dcaxy,dcaz);
+      
+  //hfecuts->UnsetVertexRequirement();
+  hfecuts->SetVertexRange(10.);
+  
+  hfecuts->SetTOFPIDStep(kTRUE);
+
+  // Name
+  TString appendix(TString::Format("TPC%dTPCr%dITS%dDCAr%dz%dVZERO%d",tpcCls,(Int_t)tpcClsr, itsCls,(Int_t)dcaxy,(Int_t)dcaz,vzero));
+  printf("appendix %s\n", appendix.Data());
+  
+  // The task
+  AliAnalysisTaskHFEFlow *task = new AliAnalysisTaskHFEFlow(Form("HFEFlowtask_%s", appendix.Data()));
+  task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral); 
+  task->SetDebugLevel(1);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+  task->SetHFECuts(hfecuts);
+  if(useMC) {
+    task->SetMCPID(kTRUE);
+    //task->SetUseMCReactionPlane(kTRUE);
+    task->SetAfterBurnerOn(kTRUE);
+    task->SetV1V2V3V4V5(0.0,0.2,0.0,0.0,0.0);
+  }
+  if(vzero>=1) task->SetVZEROEventPlane(kTRUE);
+  if(vzero==2) task->SetVZEROEventPlaneA(kTRUE);
+  if(vzero==3) task->SetVZEROEventPlaneC(kTRUE);
+
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TPC", 1);
+  
+  //pid->AddDetector("BAYES", 0);
+  //pid->ConfigureBayesDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF+AliPIDResponse::kDetTRD);
+  //pid->ConfigureBayesPIDThreshold(0.9);
+
+  
+  TString datatype=gSystem->Getenv("CONFIG_FILE");
+  
+  if(!useMC) {
+    
+    Double_t params_centr_0_5[1];
+    Double_t params_centr_5_10[1];
+    Double_t params_centr_10_20[1];
+    Double_t params_centr_20_30[1];
+    Double_t params_centr_per[1];
+    params_centr_0_5[0]=tpcdedx0;  // cut tuned for 0-10%
+    params_centr_5_10[0]=tpcdedx1; // cut tuned for 0-10%
+    params_centr_10_20[0]=tpcdedx2;
+    params_centr_20_30[0]=tpcdedx3;
+    params_centr_per[0]=tpcdedx4;
+    
+    char *cutmodel;
+    cutmodel="pol0";
+    
+    for(Int_t a=0;a<11;a++)
+      {
+       if(a>3)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,3.0);
+       if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,3.0);    //  0-5%
+       if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,3.0);    //  5-10%
+       if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,3.0);    //  10-20%
+       if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,3.0);    //  20-30%
+      }
+    
+  }
+
+  pid->ConfigureTOF(tofsig*0.1);
+  
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->Print();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+
+}
diff --git a/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C b/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpb.C
new file mode 100644 (file)
index 0000000..727a0f4
--- /dev/null
@@ -0,0 +1,159 @@
+AliAnalysisTaskHFE* ConfigHFEpbpb(Bool_t useMC=kFALSE, Bool_t beauty=kFALSE, UChar_t Sample=10,
+                                 UChar_t TPCcl=70, UChar_t TPCclPID = 80, 
+                                 Double_t TPCclRatio = 0.6, Double_t TPCclshared = 1.1,
+                                 UChar_t ITScl=3,  Double_t ITSchi2perclusters=99999999.,
+                                  Double_t dcaxy=1000.0, Double_t dcaz=2000.0,
+                                 Double_t TPCs=0., Double_t TPCu=3.09, 
+                                 Double_t TOFs=3.,Double_t IpSig=3., TString appendix){
+  //
+  // HFE standard task configuration
+  //
+    Bool_t kAnalyseTaggedTracks = kTRUE;
+
+  printf("\n String settings: %s \n",appendix);
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts pbpb TOF TPC");
+  hfecuts->CreateStandardCuts();
+
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinRatioTPCclusters(TPCclRatio);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetFractionOfSharedTPCClusters(TPCclshared);
+
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+
+  hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE);
+  if(useMC && beauty) hfecuts->SetProductionVertex(0,100,0,100);
+
+  hfecuts->SetMaxImpactParam(dcaxy,dcaz);
+
+  // event cuts
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  // others
+  hfecuts->SetTOFPIDStep(kTRUE);
+  //hfecuts->SetMaxChi2perClusterITS(36);
+  //hfecuts->SetTOFMISMATCHStep(kTRUE);
+  //hfecuts->SetTPCPIDCleanUpStep(kTRUE);
+  hfecuts->SetQAOn();
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(appendix);
+  task->SetHFECuts(hfecuts);
+  task->SetPbPbAnalysis(kTRUE);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+  
+  // Define Variables
+  Double_t ptbinning[19] = {0., 0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 2., 2.5, 3., 4., 5., 6., 8., 12., 16., 20.};
+  //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};
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  //vm->AddVariable("eta");
+  // vm->AddVariable("pt", 35, ptbinning);
+  vm->AddVariable("pt", 18, ptbinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  vm->AddVariable("centrality");
+  
+  if(!useMC){
+    
+    for(Int_t a=0;a<12;a++)
+      {
+       TF1 *hBackground = new TF1("hadronicBackgroundFunction","TMath::Exp([0]/x + [1])", 0., 20.);
+       hBackground->SetParameter(0, -43.87);
+       hBackground->SetParameter(1, 2.85);
+       task->SetBackGroundFactorsFunction(hBackground,a);
+      }
+  }
+  
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TPC", 1);
+  //pid->ConfigureTPCrejection();
+  
+  if(!useMC){
+    
+    Double_t params_centr_0_5[1];
+    Double_t params_centr_5_10[1];
+    Double_t params_centr_10_20[1];
+    Double_t params_centr_20_30[1];
+    Double_t params_centr_per[1];
+    params_centr_0_5[0]=  0.16; // cut tuned for 0-10% // TPCs
+    params_centr_5_10[0]= 0.16; // cut tuned for 0-10%
+    params_centr_10_20[0]= 0.29;
+    params_centr_20_30[0]= 0.38;
+    params_centr_per[0]=   0.44;
+    char *cutmodel;
+    cutmodel="pol0";
+    
+    
+    for(Int_t a=0;a<11;a++)
+      {
+       if(a>3)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,TPCu);
+       if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,TPCu);    //  0-5%
+       if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,TPCu);    //  5-10%
+       if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,TPCu);    //  10-20%
+       if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,TPCu);    //  20-30%
+      }
+  }
+  pid->ConfigureTOF(TOFs);
+
+  if(kAnalyseTaggedTracks)
+  {
+      // V0 tagged tracks
+      AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+      v0trackCuts->CreateStandardCuts();
+
+      v0trackCuts->SetMinNClustersTPC(TPCcl);
+      v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
+      v0trackCuts->SetFractionOfSharedTPCClusters(TPCclshared);
+      v0trackCuts->SetMinRatioTPCclusters(TPCclRatio);
+      v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+      v0trackCuts->SetMinNClustersITS(1);
+      v0trackCuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+      v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+      v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+      v0trackCuts->UnsetVertexRequirement();
+      //v0trackCuts->SetMaxChi2perClusterITS(36);
+      //hfecuts->SetSigmaToVertex(10);
+      v0trackCuts->SetTOFPIDStep(kTRUE);
+      //v0trackCuts->SetTOFMISMATCHStep(kTRUE);
+      //v0trackCuts->SetTPCPIDCleanUpStep(kTRUE);
+      v0trackCuts->SetQAOn();
+
+      task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+      task->SetTaggedTrackCuts(v0trackCuts);
+      task->SetCleanTaggedTrack(kFALSE);
+  }
+  
+  // QA
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+  //task->SetFillSignalOnly(kFALSE);    // for DE pluging for MC
+  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+  if(useMC) task->SetDebugStreaming();
+
+  printf("*************************************\n");
+  printf("Configuring task PbPb \n"); 
+  //if(isLHC10) printf("Configuring TPC1 Task 2010 :\n");
+  //if(isLHC11) printf("Configuring TPC1 Task 2011 :\n");
+  task->Print();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpbSYSbeauty.C b/PWGHF/hfe/macros/configs/PbPb/ConfigHFEpbpbSYSbeauty.C
new file mode 100644 (file)
index 0000000..c393a49
--- /dev/null
@@ -0,0 +1,158 @@
+AliAnalysisTaskHFE* ConfigHFEpbpbSYSbeauty(Bool_t useMC=kFALSE, Bool_t beauty=kFALSE, UChar_t Sample=10,
+                                 UChar_t TPCcl=70, UChar_t TPCclPID = 80, 
+                                 Double_t TPCclRatio = 0.6, Double_t TPCclshared = 1.1,
+                                 UChar_t ITScl=3,  Double_t ITSchi2perclusters=99999999.,
+                                  Double_t dcaxy=1000.0, Double_t dcaz=2000.0,
+                                 Double_t TPCs=0., Double_t TPCu=3.09, 
+                                 Double_t TOFs=3.,Double_t IpSig=3., TString appendix){
+  //
+  // HFE standard task configuration
+  //
+    Bool_t kAnalyseTaggedTracks = kTRUE;
+
+  printf("\n String settings: %s \n",appendix);
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts pbpb TOF TPC");
+  hfecuts->CreateStandardCuts();
+
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinRatioTPCclusters(TPCclRatio);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetFractionOfSharedTPCClusters(TPCclshared);
+
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+
+  hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE);
+  if(useMC && beauty) hfecuts->SetProductionVertex(0,100,0,100);
+
+  hfecuts->SetMaxImpactParam(dcaxy,dcaz);
+
+  // event cuts
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  // others
+  hfecuts->SetTOFPIDStep(kTRUE);
+  //hfecuts->SetMaxChi2perClusterITS(36);
+  //hfecuts->SetTOFMISMATCHStep(kTRUE);
+  //hfecuts->SetTPCPIDCleanUpStep(kTRUE);
+  hfecuts->SetQAOn();
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(appendix);
+  task->SetHFECuts(hfecuts);
+  task->SetPbPbAnalysis(kTRUE);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+  
+  // Define Variables
+  Double_t ptbinning[19] = {0., 0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 2., 2.5, 3., 4., 5., 6., 8., 12., 16., 20.};
+  //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};
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  //vm->AddVariable("eta");
+  // vm->AddVariable("pt", 35, ptbinning);
+  vm->AddVariable("pt", 18, ptbinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  vm->AddVariable("centrality");
+  
+  if(!useMC){
+    
+    for(Int_t a=0;a<12;a++)
+      {
+       TF1 *hBackground = new TF1("hadronicBackgroundFunction","TMath::Exp([0]/x + [1])", 0., 20.);
+       hBackground->SetParameter(0, -43.87);
+       hBackground->SetParameter(1, 2.85);
+       task->SetBackGroundFactorsFunction(hBackground,a);
+      }
+  }
+  
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TPC", 1);
+  //pid->ConfigureTPCrejection();
+  
+  if(!useMC){
+    
+    Double_t params_centr_0_5[1];
+    Double_t params_centr_5_10[1];
+    Double_t params_centr_10_20[1];
+    Double_t params_centr_20_30[1];
+    Double_t params_centr_per[1];
+    params_centr_0_5[0]=  0.06; // cut tuned for 0-10% // TPCs
+    params_centr_5_10[0]= 0.06; // cut tuned for 0-10%
+    params_centr_10_20[0]= 0.17;
+    params_centr_20_30[0]= 0.26;
+    params_centr_per[0]=   0.30;
+    char *cutmodel;
+    cutmodel="pol0";
+    
+    
+    for(Int_t a=0;a<11;a++)
+      {
+       if(a>3)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,TPCu);
+       if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,TPCu);    //  0-5%
+       if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,TPCu);    //  5-10%
+       if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,TPCu);    //  10-20%
+       if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,TPCu);    //  20-30%
+      }
+  }
+  pid->ConfigureTOF(TOFs);
+
+  if(kAnalyseTaggedTracks)
+  {
+      // V0 tagged tracks
+      AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+      v0trackCuts->CreateStandardCuts();
+
+      v0trackCuts->SetMinNClustersTPC(TPCcl);
+      v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
+      v0trackCuts->SetFractionOfSharedTPCClusters(TPCclshared);
+      v0trackCuts->SetMinRatioTPCclusters(TPCclRatio);
+      v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+      v0trackCuts->SetMinNClustersITS(1);
+      v0trackCuts->SetMaxChi2perClusterITS(ITSchi2perclusters);
+      v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+      v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+      v0trackCuts->UnsetVertexRequirement();
+      //v0trackCuts->SetMaxChi2perClusterITS(36);
+      //hfecuts->SetSigmaToVertex(10);
+      v0trackCuts->SetTOFPIDStep(kTRUE);
+      //v0trackCuts->SetTOFMISMATCHStep(kTRUE);
+      //v0trackCuts->SetTPCPIDCleanUpStep(kTRUE);
+      v0trackCuts->SetQAOn();
+
+      task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+      task->SetTaggedTrackCuts(v0trackCuts);
+      task->SetCleanTaggedTrack(kFALSE);
+  }
+  
+  // QA
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+  //task->SetFillSignalOnly(kFALSE);    // for DE pluging for MC
+  task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring task PbPb \n"); 
+  //if(isLHC10) printf("Configuring TPC1 Task 2010 :\n");
+  //if(isLHC11) printf("Configuring TPC1 Task 2011 :\n");
+  task->Print();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYS.C b/PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYS.C
new file mode 100644 (file)
index 0000000..655208e
--- /dev/null
@@ -0,0 +1,134 @@
+AliAnalysisTaskHFE* ConfigHFEpid2SYS(Bool_t useMC, UChar_t TPCcl=70, UChar_t TPCclPID = 80, UChar_t ITScl=3, 
+                                    Double_t DCAxy=1000., Double_t DCAz=1000.,
+                                    Double_t TPCs=0., Double_t TPCu=3.09, Double_t TOFs=3.,
+                                    Double_t IpSig=3.){
+  //
+  // HFE task configuration PID2 (TOF-TPC only!)
+  //
+
+  Bool_t kAnalyseTaggedTracks = kTRUE;
+  
+  Int_t iDCAxy = (Int_t)(DCAxy*10.);
+  Int_t iDCAz = (Int_t)(DCAz*10.);
+  Int_t iTPCs = (Int_t)(TPCs*1000.);
+  Int_t iIPsig = (Int_t)(IpSig*10.);
+  Int_t iTOFs = (Int_t)(TOFs*10.);
+  printf("\n hfeCutsPID2t%di%dr%dz%ds%db%dt%d \n",TPCcl,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,iTOFs);
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(Form("hfeCutsPID2tc%dtp%di%dr%dz%ds%db%dt%d",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,iTOFs),"HFE cuts TOF TPC");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  if(IpSig<100) hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE);
+  else hfecuts->SetIPcutParam(0.0064,0.078,-0.56,0,kFALSE); // used Carlo's old parameter (new: 0.011+0.077*exp(-0.65*pt))
+
+  //hfecuts->SetSigmaToVertex(DCAsi);
+  hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+
+  hfecuts->SetTOFPIDStep(kFALSE);
+  //hfecuts->SetQAOn();
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEanalysisPID2tc%dtp%di%dr%dz%ds%db%dt%d",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,TOFs));
+  printf("task %p\n", task);
+  task->SetHFECuts(hfecuts);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  // Define Variables
+  Double_t ptbinning1[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[33] = {-0.8, -0.75, -0.7, -0.65, -0.6, -0.55, -0.5, -0.45, -0.4, -0.35, -0.3, -0.25, -0.2, -0.15, -0.1, 0.05, 0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8};
+  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};
+
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  vm->AddVariable("pt", 35, ptbinning1);
+  //vm->AddVariable("eta", 32, etabinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  //vm->AddVariable("centrality");
+
+  if(!useMC){
+    // New background model (LHC10d pass2)
+    TF1 *hBackground = new TF1("hadronicBackgroundFunction", "TMath::Exp(([0]/(x**1.5))+[1])", 0., 20.);
+    // These settings assume that the default is a cut on .ge.120 TPC clusters (Sep 27, 2011)
+    hBackground->SetParameter(0, -55.18);
+    hBackground->SetParameter(1, -0.0026);
+    if (TPCcl == 100){
+      hBackground->SetParameter(0, -39.5);
+      hBackground->SetParameter(1, -0.438);
+    } elseif (TPCcl == 140){
+      hBackground->SetParameter(0, -82.11);
+      hBackground->SetParameter(1, 1.138);
+    } 
+
+    task->SetBackGroundFactorsFunction(hBackground);
+  }
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TPC", 1);
+  // HERE PUT THE STRAIGHT CUT
+  Double_t params[4];
+  char *cutmodel;
+  if(useMC){
+    // Monte-Carlo needs modelling of the falling mean with momentum at low momentum
+    // for high momentum it is consistent with a flat -0.94
+    cutmodel = "expo(0)+pol1(2)";//[0]*TMath::Exp([1]*x) + [2] + [3]*x";
+    Double_t paramsMC[4] = {-1.00625e-01, -2.09446e+00, -4.71247e-01, 1.80301e-02};
+    for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];
+  } else {
+    // Data is consistent with a flat constant: (Sep 27, 2011)
+    // 100 clusters: mean = -0.076, width = 1.035
+    // 120 clusters: mean = -0.113, width = 1.03
+    // 140 clusters: mean = -0.093, width = 1.004
+    cutmodel = "pol0(0)";
+    params[0] = TPCs;
+  }
+  pid->ConfigureTOF(TOFs);
+  pid->ConfigureTPCdefaultCut(cutmodel, params, TPCu);
+
+  if(kAnalyseTaggedTracks){
+    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+    v0trackCuts->CreateStandardCuts();
+    v0trackCuts->SetMinNClustersTPC(TPCcl);  
+    v0trackCuts->SetMinRatioTPCclusters(0.6);
+    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+    v0trackCuts->SetMinNClustersITS(1);
+    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+    v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+    v0trackCuts->UnsetVertexRequirement();
+    //hfecuts->SetSigmaToVertex(10);
+    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::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->PrintStatus();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYSbeauty.C b/PWGHF/hfe/macros/configs/pp/ConfigHFEpid2SYSbeauty.C
new file mode 100644 (file)
index 0000000..192d582
--- /dev/null
@@ -0,0 +1,138 @@
+AliAnalysisTaskHFE* ConfigHFEpid2SYSbeauty(Bool_t useMC, UChar_t TPCcl=70, UChar_t TPCclPID = 80, UChar_t ITScl=3, 
+                                    Double_t DCAxy=1000., Double_t DCAz=1000.,
+                                    Double_t TPCs=0., Double_t TPCu=3.09, Double_t TOFs=3.,
+                                    Double_t IpSig=3.){
+  //
+  // HFE task configuration PID2 (TOF-TPC only!)
+  //
+
+  Bool_t kAnalyseTaggedTracks = kTRUE;
+  
+  Int_t iDCAxy = (Int_t)(DCAxy*10.);
+  Int_t iDCAz = (Int_t)(DCAz*10.);
+  Int_t iTPCs = (Int_t)(TPCs*1000.);
+  Int_t iIPsig = (Int_t)(IpSig*10.);
+  Int_t iTOFs = (Int_t)(TOFs*10.);
+  printf("\n hfeCutsPID2t%di%dr%dz%ds%db%dt%d \n",TPCcl,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,iTOFs);
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(Form("hfeCutsPID2tc%dtp%di%dr%dz%ds%db%dt%d",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,iTOFs),"HFE cuts TOF TPC");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  if(IpSig<100) hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE);
+  else hfecuts->SetIPcutParam(0.0064,0.078,-0.56,0,kFALSE); // used Carlo's old parameter (new: 0.011+0.077*exp(-0.65*pt))
+
+  hfecuts->SetProductionVertex(0,4.5,0,4.5);
+  //hfecuts->SetProductionVertex(0,100,0,100);
+
+  //hfecuts->SetSigmaToVertex(DCAsi);
+  hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+
+  hfecuts->SetTOFPIDStep(kFALSE);
+  //hfecuts->SetQAOn();
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEanalysisPID2tc%dtp%di%dr%dz%ds%db%dt%d",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs,iIPsig,TOFs));
+  printf("task %p\n", task);
+  task->SetHFECuts(hfecuts);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  // Define Variables
+  Double_t ptbinning1[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[33] = {-0.8, -0.75, -0.7, -0.65, -0.6, -0.55, -0.5, -0.45, -0.4, -0.35, -0.3, -0.25, -0.2, -0.15, -0.1, 0.05, 0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8};
+  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};
+
+  AliHFEvarManager *vm = task->GetVarManager();
+  //vm->AddVariable("pt");
+  vm->AddVariable("pt", 35, ptbinning1);
+  //vm->AddVariable("eta", 32, etabinning);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  //vm->AddVariable("centrality");
+
+  if(!useMC){
+    // New background model (LHC10d pass2)
+    TF1 *hBackground = new TF1("hadronicBackgroundFunction", "TMath::Exp(([0]/(x**1.5))+[1])", 0., 20.);
+    // These settings assume that the default is a cut on .ge.120 TPC clusters (Sep 27, 2011)
+    hBackground->SetParameter(0, -55.18);
+    hBackground->SetParameter(1, -0.0026);
+    if (TPCcl == 100){
+      hBackground->SetParameter(0, -39.5);
+      hBackground->SetParameter(1, -0.438);
+    } elseif (TPCcl == 140){
+      hBackground->SetParameter(0, -82.11);
+      hBackground->SetParameter(1, 1.138);
+    } 
+
+    task->SetBackGroundFactorsFunction(hBackground);
+  }
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TPC", 1);
+  // HERE PUT THE STRAIGHT CUT
+  Double_t params[4];
+  char *cutmodel;
+  if(useMC){
+    // Monte-Carlo needs modelling of the falling mean with momentum at low momentum
+    // for high momentum it is consistent with a flat -0.94
+    cutmodel = "expo(0)+pol1(2)";//[0]*TMath::Exp([1]*x) + [2] + [3]*x";
+    Double_t paramsMC[4] = {-1.00625e-01, -2.09446e+00, -4.71247e-01, 1.80301e-02};
+    for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];
+  } else {
+    // Data is consistent with a flat constant: (Sep 27, 2011)
+    // 100 clusters: mean = -0.076, width = 1.035
+    // 120 clusters: mean = -0.113, width = 1.03
+    // 140 clusters: mean = -0.093, width = 1.004
+    cutmodel = "pol0(0)";
+    params[0] = TPCs;
+  }
+  pid->ConfigureTOF(TOFs);
+  pid->ConfigureTPCdefaultCut(cutmodel, params, TPCu);
+
+  if(kAnalyseTaggedTracks){
+    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+    v0trackCuts->CreateStandardCuts();
+    v0trackCuts->SetMinNClustersTPC(TPCcl);  
+    v0trackCuts->SetMinRatioTPCclusters(0.6);
+    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+    v0trackCuts->SetMinNClustersITS(1);
+    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+    v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+    v0trackCuts->UnsetVertexRequirement();
+    //hfecuts->SetSigmaToVertex(10);
+    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::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+  task->SetDebugStreaming();
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->PrintStatus();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/pp/ConfigHFEpidEMCAL.C b/PWGHF/hfe/macros/configs/pp/ConfigHFEpidEMCAL.C
new file mode 100644 (file)
index 0000000..feb2bb0
--- /dev/null
@@ -0,0 +1,158 @@
+AliAnalysisTaskHFE* ConfigHFEpidEMCAL(Bool_t useMC, UChar_t TPCcl=120, UChar_t ITScl=4, 
+                                    Double_t DCAxy=1.0, Double_t DCAz=2.0,
+                                    Double_t TPCs=-1.5, Double_t TPCu=3.0,
+                                    Double_t Eop_mim = 0.8, Double_t Eop_max = 1.3){
+  //
+  // HFE task configuration  (TPC+EMCAL only!)
+  //
+
+  Bool_t kAnalyseTaggedTracks = kTRUE;
+  
+  Int_t iDCAxy = (Int_t)(DCAxy*1.);
+  Int_t iDCAz = (Int_t)(DCAz*1.);
+  Int_t iTPCs = (Int_t)(TPCs*10.);
+  Int_t iTPCu = (Int_t)(TPCu*10.);
+  Int_t ieop0 = (Int_t)(Eop_mim*10.);
+  Int_t ieop1 = (Int_t)(Eop_max*10.);
+
+  char cutname[256], taskname[256];
+  sprintf(cutname, "hfeCutsPIDemcal%di%dr%dz%ds%dls%duep0%dmep1%d",TPCcl,ITScl,iDCAxy,iDCAz,iTPCs,iTPCu,ieop0,ieop1);
+  sprintf(taskname, "HFEanalysisPIDemcalt%di%dr%dz%ds%dls%duep0%dmep1%d",TPCcl,ITScl,iDCAxy,iDCAz,iTPCs,iTPCu,ieop0,ieop1);
+  printf("\n %s \n", cutname);
+  AliHFEcuts *hfecuts = new AliHFEcuts(cutname,"HFE cuts EMCAL TPC");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  //hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  //hfecuts->SetIPcutParam(0,0,0,IpSig,kTRUE); ?
+
+  //hfecuts->SetSigmaToVertex(DCAsi);
+  hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+
+  //hfecuts->SetQAOn();
+  hfecuts->SetUseMixedVertex(kTRUE); 
+  hfecuts->SetVertexRange(10.);
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(taskname);
+  printf("task %p\n", task);
+  task->SetHFECuts(hfecuts);
+  task->SetRemovePileUp(kTRUE);
+  task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  // Define Variables
+  //const Int_t kPtBins = 41;
+  const Double_t ptbinning[42] = {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., 
+                                           9., 10., 11., 12., 13., 
+                                           14., 15., 16., 17., 18.,
+                                           19., 20.};
+
+  const 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}; 
+
+  AliHFEvarManager *vm = task->GetVarManager();
+  vm->AddVariable("pt", 41, ptbinning);
+  //vm->AddVariable("pt");
+  //vm->AddVariable("eta");
+  
+  vm->AddVariable("eta", 16, etabinning);
+  
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  //vm->AddVariable("centrality");
+
+  if(!useMC){
+    // New background model (LHC10d pass2)
+    TF1 *hBackground = new TF1("hadronicBackgroundFunction", "TMath::Exp(([0]/(x**1.5))+[1])", 0., 20.);
+    // These settings assume that the default is a cut on .ge.120 TPC clusters (Sep 27, 2011)
+    hBackground->SetParameter(0, -55.18);
+    hBackground->SetParameter(1, -0.0026);
+    if (TPCcl == 100){
+      hBackground->SetParameter(0, -39.5);
+      hBackground->SetParameter(1, -0.438);
+    } elseif (TPCcl == 140){
+      hBackground->SetParameter(0, -82.11);
+      hBackground->SetParameter(1, 1.138);
+    } 
+
+    //task->SetBackGroundFactorsFunction(hBackground);
+  }
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  if(useMC) pid->SetHasMCData(kTRUE);
+  pid->AddDetector("EMCAL", 1);
+  pid->AddDetector("TPC", 0);
+  // HERE PUT THE STRAIGHT CUT
+  Double_t params[4];
+  char *cutmodel;
+  if(useMC){
+    // Monte-Carlo needs modelling of the falling mean with momentum at low momentum
+    // for high momentum it is consistent with a flat -0.94
+    //cutmodel = "expo(0)+pol1(2)";//[0]*TMath::Exp([1]*x) + [2] + [3]*x";
+    //Double_t paramsMC[4] = {-1.00625e-01, -2.09446e+00, -4.71247e-01, 1.80301e-02};
+    //for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];
+      cutmodel = "pol0";
+      params[0] = TPCs-1.0;
+      //TPCu = 5.0;
+  } else {
+    // Data is consistent with a flat constant: (Sep 27, 2011)
+    // 100 clusters: mean = -0.076, width = 1.035
+    // 120 clusters: mean = -0.113, width = 1.03
+    // 140 clusters: mean = -0.093, width = 1.004
+    cutmodel = "pol0(0)";
+    params[0] = TPCs;
+  }
+  pid->ConfigureTPCdefaultCut(cutmodel, params, TPCu);
+
+  if(kAnalyseTaggedTracks){
+    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
+    v0trackCuts->CreateStandardCuts();
+    v0trackCuts->SetMinNClustersTPC(TPCcl);  
+    v0trackCuts->SetMinRatioTPCclusters(0.6);
+    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+    v0trackCuts->SetMinNClustersITS(1);
+    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+    v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+    v0trackCuts->UnsetVertexRequirement();
+    //hfecuts->SetSigmaToVertex(10);
+    //v0trackCuts->SetTOFPIDStep(kTRUE);
+    v0trackCuts->SetQAOn();
+
+    task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
+    task->SetTaggedTrackCuts(v0trackCuts);
+    task->SetCleanTaggedTrack(kTRUE);
+  }
+
+  // change E/p cuts
+  if(useMC && Eop_max>900)Eop_max = -999.9;
+  AliHFEpidEMCAL *emcpid = pid->AliHFEpid::GetDetPID(AliHFEpid::kEMCALpid);
+  //emcpid->SetEoPMax(Eop_mim);
+  //emcpid->SetEoPMim(Eop_max);
+  emcpid->SetEoPMax(Eop_max);
+  emcpid->SetEoPMim(Eop_mim);
+
+  // QA
+  printf("task %p\n", task);
+  task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
+  //task->SetQAOn(AliAnalysisTaskHFE::kMCqa);    
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->PrintStatus();
+  pid->PrintStatus();
+  printf("*************************************\n"); 
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/pp/ConfigHFEtrd2SYS.C b/PWGHF/hfe/macros/configs/pp/ConfigHFEtrd2SYS.C
new file mode 100644 (file)
index 0000000..d56afd9
--- /dev/null
@@ -0,0 +1,175 @@
+AliAnalysisTaskHFE *ConfigHFEtrd2SYS(Bool_t useMC, UChar_t TPCcl=70, UChar_t TPCclPID = 80, UChar_t ITScl=3, 
+                                    Double_t DCAxy=1000., Double_t DCAz=1000.,
+                                    Double_t TPCs=0., Double_t TPCu=3., Double_t TOFs=3., UChar_t TRDtl = 5, UChar_t TRDeff = 2, 
+                                    Bool_t TRDonFlyCut = kFALSE, Bool_t TRDexactTracklets = kFALSE){
+  //Bool_t IsBinning1 = kTRUE;
+  //
+  // HFE standard task configuration
+  // 4 Tracklets, 70% electron efficiency
+  //
+  Bool_t kAnalyseTaggedTracks = kTRUE;
+
+  //AliLog::SetClassDebugLevel("AliHFEOADBThresholdsTRD", 1);
+  //AliLog::SetClassDebugLevel("AliHFEpidTRD", 1);
+  //AliLog::SetClassDebugLevel("AliAnalysisTaskHFE", 2);
+  Float_t eeff[6] = {0.7, 0.75, 0.8, 0.85, 0.9, 0.95};
+  Int_t eeffint[6] = {70, 75, 80, 85, 90, 95};
+  if(TRDeff >= 6 || TRDtl < 4 || TRDtl > 6) return NULL;
+  Int_t iDCAxy = (Int_t)(DCAxy*10.);
+  Int_t iDCAz = (Int_t)(DCAz*10.);
+  Int_t iTPCs = (Int_t)(TPCs*100.);
+  Int_t iTOFs = (Int_t)(TOFs*100.);
+  printf("\n hfeCutsTRD2t%di%dr%dz%ds%d \n",TPCcl,ITScl,iDCAxy,iDCAz,iTPCs);
+
+  AliHFEcuts *hfecuts = new AliHFEcuts(Form("hfeCutsTRD2t%dtp%di%dr%dz%ds%dst%dtt%d%ste%d%s",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs,iTOFs,TRDtl, TRDexactTracklets ? "EQ" : "GE",eeffint[TRDeff], TRDonFlyCut ? "OTF" : "Normal"),"HFE cuts including TRD PID");
+  hfecuts->CreateStandardCuts();
+  hfecuts->SetMinNClustersTPC(TPCcl);
+  hfecuts->SetMinNClustersTPCPID(TPCclPID);
+  hfecuts->SetMinNClustersITS(ITScl);
+  hfecuts->SetMinRatioTPCclusters(0.6);
+  hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+  hfecuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
+  hfecuts->SetCheckITSLayerStatus(kFALSE);
+  hfecuts->SetIPcutParam(0,0,0,2,kTRUE);
+
+  hfecuts->SetMaxImpactParam(DCAxy,DCAz);
+
+  hfecuts->SetTOFPIDStep(kFALSE);
+  hfecuts->SetQAOn();
+  hfecuts->SetMinNTrackletsTRD(TRDtl, TRDexactTracklets);   // number of trd tracklets
+  hfecuts->SetUseMixedVertex(kTRUE);
+  hfecuts->SetVertexRange(10.);
+
+  AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEanalysisTRD2t%dtp%di%dr%dz%ds%dst%dtt%dte%d%s",TPCcl,TPCclPID,ITScl,iDCAxy,iDCAz,iTPCs, iTOFs, TRDtl, eeffint[TRDeff], TRDonFlyCut ? "OTF" : "Normal"));
+  task->SetFillSignalOnly(kTRUE); //kFALSE
+  task->SetHFECuts(hfecuts);
+  task->SetRemovePileUp(kTRUE);
+  if(!useMC) task->SelectSpecialTrigger("CINT1WU-B-NOPF-ALL", 127712, 130850);   // TRD pretriggered for period LHC10e
+
+  // Define Variables
+  Double_t ptbinning1[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[33] = {-0.8, -0.75, -0.7, -0.65, -0.6, -0.55, -0.5, -0.45, -0.4, -0.35, -0.3, -0.25, -0.2, -0.15, -0.1, 0.05, 0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8};
+  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};
+  /*const Int_t kPtBins2 = 45;
+  const Double_t ptbinning2[kPtBins2 + 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.7, 1.9, 2.1, 2.3,
+                                             2.5, 2.75, 3., 3.25, 3.5,
+                                             3.75, 4., 4.25, 4.5, 5.,
+                                             5.5, 6., 7., 8., 9.,
+                                             10., 11., 12., 13., 14.,
+                                             15., 16., 17., 18. 19.,
+                                             20.};
+  Int_t nPtBins = IsBinning1 ? kPtBins1 : kPtBins2;
+  const Double_t *ptbinning = IsBinning1 ? ptbinning1 : ptbinning2;*/
+  AliHFEvarManager *vm = task->GetVarManager();
+  vm->AddVariable("pt", 35, ptbinning1);
+  vm->AddVariable("eta", 16, etabinning);
+  vm->AddVariable("phi");
+  vm->AddVariable("charge");
+  vm->AddVariable("source");
+  //vm->AddVariable("centrality");
+
+  if(!useMC){
+    // background model LHC10d pass2
+    TF1 *hBackground = new TF1("hadronicBackgroundFunction_period_d", "exp([0]/x+[1])", 0., 20.);
+    hBackground->SetParameter(0, -16.4);
+    hBackground->SetParameter(1, -2.3);
+    if (TPCcl>85 && TPCcl<125){
+      hBackground->SetParameter(0, -39.0);
+      hBackground->SetParameter(1, -0.35);
+    } else if (TPCcl>125){
+      hBackground->SetParameter(0, -1.41);
+      hBackground->SetParameter(1, -2.44);
+    }
+    TObjArray *listPeriodD = new TObjArray(12);
+    listPeriodD->AddAt(hBackground, 0);
+    // background model LHC10e pass2
+    hBackground = new TF1("hadronicBackgroundFunction_period_e", "exp([0]*x+[1])", 0., 20.);
+    hBackground->SetParameter(0, 1.67);
+    hBackground->SetParameter(1, -16.);
+    if (TPCcl>85 && TPCcl<115){
+      hBackground->SetParameter(0, 1.85);
+      hBackground->SetParameter(1, -17.7);
+    } else if (TPCcl>115){
+      hBackground->SetParameter(0, 6.);
+      hBackground->SetParameter(1, -21.);
+    }
+    TObjArray *listPeriodE = new TObjArray(12);
+    listPeriodE->AddAt(hBackground, 0);
+    AliOADBContainer *cbackground = new AliOADBContainer("cbackground");
+    cbackground->AppendObject(listPeriodD, 122195, 126437);
+    cbackground->AppendObject(listPeriodE, 127712, 130850);
+    task->SetBackgroundFactorsFromOADB(cbackground);
+  }
+
+  // Define PID
+  AliHFEpid *pid = task->GetPID();
+  pid->AddDetector("TOF", 0);
+  pid->AddDetector("TRD", 1);
+  pid->AddDetector("TPC", 2);
+
+  Double_t params[4];
+  char *cutmodel;
+  if(useMC){
+      // Monte-Carlo needs modelling of the falling mean with momentum at low momentum
+      // for high momentum it is consistent with a flat -0.94
+      cutmodel = "[0]*TMath::Exp([1]*x) + [2] + [3]*x";
+      Double_t paramsMC[4] = {0.7174, -1.588, -0.9395, 0.0246};
+      for(int ipar = 0; ipar < 4; ipar++) params[ipar] = paramsMC[ipar];
+  } else {
+      // Data is consistent with a flat 0.12
+      cutmodel = "pol0";
+      params[0] = TPCs;
+  }
+  pid->ConfigureTOF(TOFs);
+  pid->ConfigureTPCdefaultCut(cutmodel, params, TPCu);
+
+  //task->GetPIDQAManager()->SetHighResolutionHistos();
+
+  AliHFEpidTRD *trdpid = pid->GetDetPID(AliHFEpid::kTRDpid);
+  trdpid->SetRenormalizeElPi();
+  trdpid->SetElectronEfficiency(eeff[TRDeff]);   // efficiency
+  trdpid->SetNTracklets(TRDtl);      // ntracklets threshold
+  //trdpid->SetCutNTracklets(TRDtl, TRDexactTracklets);
+  AliOADBContainer *cont = new AliOADBContainer("TRDthresholds");
+  cont->InitFromFile(Form("%s/util/hfe/TRD.OADBThresholds.root", gSystem->Getenv("TRAIN_ROOT")),"TRDthresholds");
+  trdpid->SetOADBThresholds(cont);
+  if(TRDonFlyCut) trdpid->SelectCutOnTheFly(kTRUE);
+
+  if(kAnalyseTaggedTracks){
+    AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCutsTRD2", "Track Cuts for tagged track Analysis");
+    v0trackCuts->CreateStandardCuts();
+    v0trackCuts->SetMinNClustersTPC(TPCcl);  
+    v0trackCuts->SetMinRatioTPCclusters(0.6);
+    v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
+    v0trackCuts->SetMinNClustersITS(1);
+    v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kAny);
+    v0trackCuts->SetCheckITSLayerStatus(kFALSE);
+    v0trackCuts->UnsetVertexRequirement();
+    //hfecuts->SetSigmaToVertex(10);
+    v0trackCuts->SetTOFPIDStep(kFALSE);
+    v0trackCuts->SetQAOn();
+    v0trackCuts->SetMinNTrackletsTRD(TRDtl);
+
+    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::kIsElecBackGround);
+  //task->SwitchOnPlugin(AliAnalysisTaskHFE::kSecVtx);
+  task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
+
+  printf("*************************************\n");
+  printf("Configuring standard Task:\n");
+  task->PrintStatus();
+  pid->PrintStatus();
+  printf("*************************************\n");
+  return task;
+}
diff --git a/PWGHF/hfe/macros/configs/pp/ConfigWeightFactors.C b/PWGHF/hfe/macros/configs/pp/ConfigWeightFactors.C
new file mode 100644 (file)
index 0000000..40fac06
--- /dev/null
@@ -0,0 +1,74 @@
+void ConfigWeightFactors(AliAnalysisTaskHFE *task, Bool_t syst = kFALSE, Bool_t ispp = 1){
+  //
+  // Set weighting factors for nonHFE backgrounds
+  //
+  
+  //Get the correction factors for Non-HF electron yields from a root-file
+  Double_t elecBackGroundWeight[11][6][44][3];//centrality, species, momentum, background level
+  for(Int_t iCent = 0; iCent < 11; iCent++){
+    for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){
+      for(Int_t iBin = 0; iBin < 44; iBin++){
+        for(Int_t iError = 0; iError < 3; iError++){
+          elecBackGroundWeight[iCent][iSpecies][iBin][iError] = 0;
+        }
+      }
+    }
+  }
+  const Char_t *backNameMC[6] = {"pion","eta","omega","phi","etap","rho"};
+  TFile *weightFile = TFile::Open(Form("%s/util/hfe/rootfiles/nonHFEcorrect.root", gSystem->Getenv("TRAIN_ROOT")));
+  if(weightFile){
+    if(syst){
+      TH1F *hRelErr[2];//errors for pion yields, which form the correlated component of the relative error for all other decaying mesons
+      hRelErr[0] = (TH1F*)weightFile->Get("hErrorspionLower");
+      hRelErr[1] = (TH1F*)weightFile->Get("hErrorspionUpper");
+    }
+    for(Int_t iCent = 0; iCent < 11; iCent++){//centrality bins
+      for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){//species of decaying mesons
+        TH1F *hRatio = 0x0;
+        if(ispp){
+          hRatio = (TH1F*)weightFile->Get(Form("hRatio%s",backNameMC[iSpecies]));
+        }
+        else{
+          if((iCent == 1)||(iCent == 4)){ 
+            hRatio = (TH1F*)weightFile->Get(Form("hRatio%s%d",backNameMC[iSpecies],iCent-1));
+          }
+          else if(iCent > 7){
+            hRatio = weightFile->Get(Form("hRatio%s7",backNameMC[iSpecies]));
+          }
+          else{
+            hRatio = (TH1F*)weightFile->Get(Form("hRatio%s%d",backNameMC[iSpecies],iCent));
+          }
+        }
+       for(Int_t iBin = 1; iBin < 45; iBin++){//momentum bin of mother meson
+         if(iCent == 0){
+           elecBackGroundWeight[iCent][iSpecies][iBin-1][0] = hRatio->GetBinContent(iBin);
+            if(syst && ispp){
+              for(Int_t iError = 0; iError < 2; iError++){//0: best estimate, 1,2: lower, upper uncertainty level
+                elecBackGroundWeight[iCent][iSpecies][iBin-1][iError+1]=elecBackGroundWeight[iCent][iSpecies][iBin-1][0]*(1+hRelErr[iError]->GetBinContent(iBin));//Addition of relative errors from histograms with "+", because lower errors are defined as negative numbers in the reference histograms!
+             }
+           }
+         }
+          else{
+            if(!ispp){
+              elecBackGroundWeight[iCent][iSpecies][iBin-1][0] = hRatio->GetBinContent(iBin);             
+            }           
+          }
+       }
+      }
+    }
+    weightFile->Close();
+  }
+  else{
+    printf("No reference file for weighting found!\n");   
+  }
+  
+  const Double_t binLimit[45] =  {0.1,0.112797,0.127231,0.143512,0.161877,0.182592,0.205957,0.232313,0.262041,0.295573,0.333397,0.37606,0.424183,0.478465,0.539692,0.608754,0.686654,0.774523,0.873636,0.985432,1.11153,1.25377,1.41421,1.59519,1.79932,2.02957,2.28928,2.58223,2.91267,3.2854,3.70582,4.18004,4.71494,5.3183,5.99886,6.76651,7.6324,8.60909,9.71076,10.9534,12.3551,13.9361,15.7195,17.731,20};//bin limits from the measured pi0 spectrum - possibly we won't need the last bin
+  
+  for(Int_t iBin = 1; iBin < 45; iBin++){//for all pt bins and all meson decays, set weighting factors for daughter electrons
+    task->SetBinLimits(iBin,binLimit[iBin-1]);
+    for(Int_t iSpecies = 0; iSpecies < 6; iSpecies++){
+      for(Int_t iError = 0; iError < 3; iError++)
+       task->SetElecBackGroundFactors(iBin, iSpecies, 0, iError, elecBackGroundWeight[0][iSpecies][iBin-1][iError]);
+    }
+  }
+}