Further TPC pid 2011
authorrbailhac <Raphaelle.Bailhache@cern.ch>
Mon, 20 Oct 2014 22:05:45 +0000 (00:05 +0200)
committerrbailhac <Raphaelle.Bailhache@cern.ch>
Mon, 20 Oct 2014 22:05:45 +0000 (00:05 +0200)
PWGHF/hfe/AliAnalysisTaskFlowTPCTOFEPSP.cxx
PWGHF/hfe/AliHFEpidTPC.cxx
PWGHF/hfe/AliHFEpidTPC.h
PWGHF/hfe/macros/AddTaskHFEFlowTPCTOFEPSP.C
PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C
PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root [new file with mode: 0644]
PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root [new file with mode: 0644]

index 81dffff..eabf6d7 100644 (file)
@@ -2145,14 +2145,14 @@ void AliAnalysisTaskFlowTPCTOFEPSP::UserExec(Option_t */*option*/)
        AliHFEpidObject hfetrack;
        if(!fAODAnalysis){
          hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
-         if(fVariableMultiplicity==0)
-           if(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
+         if(fVariableMultiplicity==0) hfetrack.SetMulitplicity(cntr);
+         //if(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
          if(fVariableMultiplicity==1)
            hfetrack.SetMulitplicity(((AliESDEvent*)fInputEvent)->GetNumberOfESDTracks()/8.);
        }else{
          hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis);
-         if(fVariableMultiplicity==0)
-           if(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
+         if(fVariableMultiplicity==0) hfetrack.SetMulitplicity(cntr);
+           //if(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()) hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetPrimaryVertexSPD()->GetNContributors());
          if(fVariableMultiplicity==1)
            hfetrack.SetMulitplicity(((AliAODEvent*)fInputEvent)->GetNumberOfESDTracks()/8.);
        }
index 4f807b3..a7e07dd 100644 (file)
@@ -27,6 +27,7 @@
 //  
 #include <TF1.h>
 #include <TMath.h>
+#include <TH2D.h>
 
 #include "AliTPCdEdxInfo.h"
 #include "AliAODPid.h"
@@ -86,6 +87,8 @@ AliHFEpidTPC::AliHFEpidTPC(const char* name) :
   , fkEtaWidthCorrection(NULL)
   , fkCentralityMeanCorrection(NULL)
   , fkCentralityWidthCorrection(NULL)
+  , fkCentralityEtaCorrectionMeanJpsi(NULL)
+  , fkCentralityEtaCorrectionWidthJpsi(NULL)
   , fHasCutModel(kFALSE)
   , fUseOnlyOROC(kFALSE)
   , fNsigmaTPC(3)
@@ -115,6 +118,8 @@ AliHFEpidTPC::AliHFEpidTPC(const AliHFEpidTPC &ref) :
   , fkEtaWidthCorrection(NULL)
   , fkCentralityMeanCorrection(NULL)
   , fkCentralityWidthCorrection(NULL)
+  , fkCentralityEtaCorrectionMeanJpsi(NULL)
+  , fkCentralityEtaCorrectionWidthJpsi(NULL)
   , fHasCutModel(ref.fHasCutModel)
   , fUseOnlyOROC(ref.fUseOnlyOROC)
   , fNsigmaTPC(2)
@@ -201,20 +206,6 @@ Int_t AliHFEpidTPC::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager
   const AliVTrack *rectrack;
   AliESDtrack esdtrack;
   AliAODTrack aodtrack;
-  /*if(fUseOnlyOROC && !(fkEtaCorrection || fkCentralityCorrection)) {
-    if(track->IsESDanalysis()){
-      esdtrack.~AliESDtrack();
-      new(&esdtrack) AliESDtrack(*(static_cast<const AliESDtrack *>(track->GetRecTrack())));
-      UseOROC(&esdtrack, anatype);
-      rectrack = &esdtrack;
-    } else {
-      aodtrack.~AliAODTrack();
-      new(&aodtrack) AliAODTrack(*(static_cast<const AliAODTrack *>(track->GetRecTrack())));
-      UseOROC(&aodtrack, anatype);
-      rectrack = &aodtrack;
-    }
-  }
-  else if(fkEtaCorrection || fkCentralityCorrection){*/
   Double_t correctedTPCnSigma=0.;
   Bool_t TPCnSigmaCorrected=kFALSE;
   if((fkEtaMeanCorrection&&fkEtaWidthCorrection)||
@@ -222,6 +213,12 @@ Int_t AliHFEpidTPC::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager
     TPCnSigmaCorrected=kTRUE;
     correctedTPCnSigma=GetCorrectedTPCnSigma(track->GetRecTrack()->Eta(), track->GetMultiplicity(), fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron));
   }
+  // jpsi
+  if((fkCentralityEtaCorrectionMeanJpsi)&&
+     (fkCentralityEtaCorrectionWidthJpsi)){
+    TPCnSigmaCorrected=kTRUE;
+    correctedTPCnSigma=GetCorrectedTPCnSigmaJpsi(track->GetRecTrack()->Eta(), track->GetMultiplicity(), fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron));
+  }
   if(fkEtaCorrection || fkCentralityCorrection){
     // Correction available
     // apply it on copy
@@ -384,7 +381,6 @@ Double_t AliHFEpidTPC::GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEs
   // N.B. This correction has to be applied on a copy track
   //
   Double_t corrtpcNsigma = tpcNsigma;
-  AliDebug(1, Form("Applying correction function %s\n", fkEtaCorrection->GetName()));
   if(fkEtaMeanCorrection&&fkEtaWidthCorrection){
     if(TMath::Abs(fkEtaWidthCorrection->Eval(eta))>0.0000001) corrtpcNsigma=(corrtpcNsigma-fkEtaMeanCorrection->Eval(eta))/fkEtaWidthCorrection->Eval(eta);
   }
@@ -395,6 +391,32 @@ Double_t AliHFEpidTPC::GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEs
 }
 
 //___________________________________________________________________
+Double_t AliHFEpidTPC::GetCorrectedTPCnSigmaJpsi(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const{
+  //
+  // Apply correction for the eta dependence
+  // N.B. This correction has to be applied on a copy track
+  //
+  Double_t corrtpcNsigma = tpcNsigma;
+  if(fkCentralityEtaCorrectionMeanJpsi&&fkCentralityEtaCorrectionWidthJpsi){
+    TAxis *caxis = fkCentralityEtaCorrectionMeanJpsi->GetXaxis();
+    TAxis *eaxis = fkCentralityEtaCorrectionMeanJpsi->GetYaxis();
+    Int_t cbin = caxis->FindBin(centralityEstimator);
+    Int_t ebin = eaxis->FindBin(eta);
+    Double_t cbinlowedge = caxis->GetBinLowEdge(cbin);
+    Double_t cbinupedge = caxis->GetBinUpEdge(cbin);
+    Double_t ebinlowedge = eaxis->GetBinLowEdge(ebin);
+    Double_t ebinupedge = eaxis->GetBinUpEdge(ebin);
+    Double_t center = fkCentralityEtaCorrectionMeanJpsi->GetBinContent(cbin,ebin);
+    Double_t width = fkCentralityEtaCorrectionWidthJpsi->GetBinContent(cbin,ebin);
+    //printf("cbin %d, cbinlowe %f, cbinupe %f, centrality %f\n",cbin,cbinlowedge,cbinupedge,centralityEstimator);
+    //printf("ebin %d, ebinlowe %f, ebinupe %f, eta %f\n",ebin,ebinlowedge,ebinupedge,eta);
+    //printf("mean %f, width %f\n",center,width);
+    if(TMath::Abs(width)>0.0000001) corrtpcNsigma=(corrtpcNsigma-center)/width;
+  }
+  return corrtpcNsigma;
+}
+
+//___________________________________________________________________
 void AliHFEpidTPC::UseOROC(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const{
   //
   // Use TPC signal from the OROC
index e9bdc23..7108eaf 100644 (file)
@@ -30,6 +30,7 @@
 
 class TList;
 class TF1;
+class TH2D;
 class AliAODTrack;
 class AliAODMCParticle;
 class AliESDtrack;
@@ -63,8 +64,9 @@ class AliHFEpidTPC : public AliHFEpidBase{
     void SetLowerSigmaCutCentrality(const TF1 * const model, Int_t centralityBin) { if(centralityBin < 11) fkLowerSigmaCut[centralityBin+1] = model; fHasCutModel = kTRUE; }
     void SetEtaCorrection(const TF1 *const param) { fkEtaCorrection = param; }
     void SetCentralityCorrection(const TF1 *const param){ fkCentralityCorrection = param; }
-  void SetEtaCorrections(const TF1 *const mean, const TF1 *const wdth) { fkEtaMeanCorrection = mean; fkEtaWidthCorrection = wdth; }
-  void SetCentralityCorrections(const TF1 *const mean, const TF1 *const wdth) { fkCentralityMeanCorrection = mean; fkCentralityWidthCorrection = wdth; }
+    void SetEtaCorrections(const TF1 *const mean, const TF1 *const wdth) { fkEtaMeanCorrection = mean; fkEtaWidthCorrection = wdth; }
+    void SetCentralityCorrections(const TF1 *const mean, const TF1 *const wdth) { fkCentralityMeanCorrection = mean; fkCentralityWidthCorrection = wdth; }
+    void SetJpsiCorrections(const TH2D *const mean, const TH2D *const wdth) { fkCentralityEtaCorrectionMeanJpsi = mean; fkCentralityEtaCorrectionWidthJpsi = wdth; }
     void UsedEdx() { fUsedEdx = kTRUE; }
     void UseNSigma() { fUsedEdx = kFALSE; }
     Bool_t HasEtaCorrection() const { return fkEtaCorrection != NULL; }
@@ -75,6 +77,7 @@ class AliHFEpidTPC : public AliHFEpidBase{
     void ApplyEtaCorrection(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;
     void ApplyCentralityCorrection(AliVTrack *track, Double_t centralityEstimator, AliHFEpidObject::AnalysisType_t anatype) const;
     Double_t GetCorrectedTPCnSigma(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
+    Double_t GetCorrectedTPCnSigmaJpsi(Double_t eta, Double_t centralityEstimator, Double_t tpcNsigma) const;
     void UseOROC(AliVTrack *track, AliHFEpidObject::AnalysisType_t anatype) const;
 
   protected:
@@ -98,6 +101,8 @@ class AliHFEpidTPC : public AliHFEpidBase{
     const TF1 *fkEtaWidthCorrection;                        // Correct eta dependence of the width of the TPC n sigma
     const TF1 *fkCentralityMeanCorrection;                  // Correct centrality dependence of the mean of the TPC n sigma
     const TF1 *fkCentralityWidthCorrection;                 // Correct centrality dependence of the width of the TPC n sigma
+    const TH2D *fkCentralityEtaCorrectionMeanJpsi;          // Correction from J/psi group for the mean
+    const TH2D *fkCentralityEtaCorrectionWidthJpsi;         // Correction from J/psi group for the width
     Bool_t fHasCutModel;                                    // Has cut model functions
     Bool_t fUseOnlyOROC;                                    // Use only OROC
     Float_t fPAsigCut[2];                                   // Momentum region where to perform asymmetric sigma cut
@@ -107,7 +112,7 @@ class AliHFEpidTPC : public AliHFEpidBase{
     UChar_t fRejectionEnabled;                              // Bitmap for enabled particle rejection
     Bool_t  fUsedEdx;                                       // Apply cut on dE/dx instead of number of sigmas
 
-  ClassDef(AliHFEpidTPC, 2)   // TPC Electron ID class
+  ClassDef(AliHFEpidTPC, 3)   // TPC Electron ID class
 };
 
 inline void AliHFEpidTPC::SetAsymmetricTPCsigmaCut(Float_t pmin, Float_t pmax, Float_t sigmaMin, Float_t sigmaMax) { 
index 96eb441..1d1a42d 100644 (file)
@@ -12,6 +12,8 @@ AliAnalysisTask *AddTaskHFEFlowTPCTOFEPSP(Int_t trigger=0,Int_t aodfilter=16,Boo
   // 0.19 40-50%, sigma=1.2
   // 0.2 50-60%
   // 0.2 60-80% list_t65536f16TPC110r60p80s11km0ITS4C36Pi2DCAr100z200TOF30TPCe50V1D0er8i0t-20t50
+
+  /*
   tpcdedx[0]=-0.2;
   tpcdedx[1]=-0.15;
   tpcdedx[2]=-0.1;
@@ -60,6 +62,7 @@ AliAnalysisTask *AddTaskHFEFlowTPCTOFEPSP(Int_t trigger=0,Int_t aodfilter=16,Boo
     tpcdedx[6]=0.473;
     tpcdedx[7]=0.473;
   }
+  */
 
   // Name
   TString appendixx(TString::Format("t%df%ds%dp%dM%dTPC%dr%dp%dITS%dPi%dDCAr%dz%dTOF%dTPCe%dV%dD%der%dbin%di%dt%dt%d",(Int_t)trigger,aodfilter,(Int_t)scalarProduct,(Int_t)cutPileup,(Int_t)variableM,tpcCls,(Int_t)tpcClsr,tpcClspid,itsCls,(Int_t) pixellayer,(Int_t) dcaxy,(Int_t)dcaz,(Int_t) tofsig,(Int_t)tpceff,vzero,debuglevel,(Int_t)(etarange*0.1),(Int_t)withetacorrection,(Int_t)withmultcorrection,(Int_t)ITSclustersback,(Int_t)(minTPCback*10.0),(Int_t)(maxTPCback*10.0)));
index 3ee2f70..9f0b83b 100644 (file)
@@ -1,3 +1,27 @@
+TH2D *GetCorrectionsJpsiMean(TString map){
+  if (gSystem->AccessPathName(gSystem->ExpandPathName(map.Data()))){
+    Warning("ConfigHFE","Centrality map not found: %s",map.Data());
+    printf("ConfigHFE: Centrality map not found: %s\n",map.Data());
+    return kFALSE;
+  }
+  printf("File %s\n",map.Data());
+  TFile *f = TFile::Open(map.Data());
+  if(!f->IsOpen()) return kFALSE;
+  f->ls();
+  return (TH2D*)f->Get("centroidCentEta");
+}
+TH2D *GetCorrectionsJpsiWidth(TString map){
+  if (gSystem->AccessPathName(gSystem->ExpandPathName(map.Data()))){
+    Warning("ConfigHFE","Centrality map not found: %s",map.Data());
+    printf("ConfigHFE: Centrality map not found: %s\n",map.Data());
+    return kFALSE;
+  }
+  printf("File %s\n",map.Data());
+  TFile *f = TFile::Open(map.Data());
+  if(!f->IsOpen()) return kFALSE;
+  f->ls();
+  return (TH2D*)f->Get("widthCentEta");
+}
 TF1* GetCentralityCorrection(TString listname="LHC11h"){
   
   TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/CentCorrMapsTPC.root";
@@ -113,7 +137,7 @@ Double_t Contamination_40_50(const Double_t *x, const Double_t *par)
 
   
 }
-AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appendix,Int_t trigger,Int_t aodfilter=-1,Bool_t scalarProduct=kFALSE,Bool_t cutPileup=kTRUE,Int_t variableM = 1,Int_t tpcCls=110, Double_t tpcClsr=60.,Int_t tpcClspid=80, Int_t itsCls=4, Int_t pixellayer=2, Double_t dcaxy=100., Double_t dcaz=200.,  Double_t tofsig=30., Double_t *tpcdedx=NULL, Int_t vzero=1, Int_t debuglevel=0, Double_t etarange=80, Bool_t withetacorrection=kFALSE, Bool_t withmultcorrection=kFALSE, Double_t ITSclustersback=0,Double_t minTPCback=-2.0,Double_t maxTPCback=5.0)
+AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appendix,Int_t trigger,Int_t aodfilter=-1,Bool_t scalarProduct=kFALSE,Bool_t cutPileup=kTRUE,Int_t variableMr = 1,Int_t tpcCls=110, Double_t tpcClsr=60.,Int_t tpcClspid=80, Int_t itsCls=4, Int_t pixellayer=2, Double_t dcaxy=100., Double_t dcaz=200.,  Double_t tofsig=30., Double_t *tpcdedx=NULL, Int_t vzero=1, Int_t debuglevel=0, Double_t etarange=80, Bool_t withetacorrection=kFALSE, Bool_t withmultcorrection=kFALSE, Double_t ITSclustersback=0,Double_t minTPCback=-2.0,Double_t maxTPCback=5.0)
 {
   //
   // HFE flow task 
@@ -121,6 +145,10 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   Double_t tpcsharedfraction=11;
   Double_t chi2peritscl=36.;
 
+  // multEst = 0 or 10 (VZERO centrality, good, bad runs for Jpsi), = 1 (GetNumberOfESDtracks, Theo)
+  Int_t variableM = variableMr;
+  if(variableMr==10) variableM = 0;
+
   printf("Summary settings flow task\n");
   printf("filter %d\n",aodfilter);
   printf("TPC number of tracking clusters %d\n",tpcCls);
@@ -151,6 +179,7 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   printf("Max TPC back %f\n",maxTPCback);
   printf("PileUp cut %d\n",cutPileup);
   printf("Scalar Product %d\n",scalarProduct);
+  printf("Multiplicity Esimator %d\n",variableM);
 
   // Cut HFE
   AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
@@ -237,17 +266,35 @@ AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appen
   
   if(withetacorrection || withmultcorrection) {
     AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
-    TF1 *etaCorrMean = GetEtaCorrection("LHC11h_etaCorrMean");
-    TF1 *etaCorrWdth = GetEtaCorrection("LHC11h_etaCorrWidth");
-    if(etaCorrMean && etaCorrWdth && withetacorrection){
-      tpcpid->SetEtaCorrections(etaCorrMean, etaCorrWdth);
-      printf("TPC dE/dx Eta correction %p %p\n",etaCorrMean,etaCorrWdth);
+    // Jpsi
+    if(variableMr==0) {
+      TH2D *meanc = GetCorrectionsJpsiMean("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root");
+      TH2D *widthc = GetCorrectionsJpsiWidth("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root");
+      //printf("Set\n");
+      if(meanc && widthc) {
+       tpcpid->SetJpsiCorrections(meanc,widthc);
+       //printf("Set the histos\n");
+      }
+    }
+    if(variableMr==10) {
+      TH2D *meanc = GetCorrectionsJpsiMean("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root");
+      TH2D *widthc = GetCorrectionsJpsiMean("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root");
+      if(meanc && widthc) tpcpid->SetJpsiCorrections(meanc,widthc);
     }
-    TF1 *centCorrMean = GetCentralityCorrection("LHC11h_multCorrMean");
-    TF1 *centCorrWdth = GetCentralityCorrection("LHC11h_multCorrWidth");
-    if(centCorrMean && centCorrWdth && withmultcorrection){
-      tpcpid->SetCentralityCorrections(centCorrMean, centCorrWdth);
-      printf("TPC dE/dx multiplicity correction %p %p\n",centCorrMean,centCorrWdth);
+    // Theo
+    if(variableMr==1) {
+      TF1 *etaCorrMean = GetEtaCorrection("LHC11h_etaCorrMean");
+      TF1 *etaCorrWdth = GetEtaCorrection("LHC11h_etaCorrWidth");
+      if(etaCorrMean && etaCorrWdth && withetacorrection){
+       tpcpid->SetEtaCorrections(etaCorrMean, etaCorrWdth);
+       printf("TPC dE/dx Eta correction %p %p\n",etaCorrMean,etaCorrWdth);
+      }
+      TF1 *centCorrMean = GetCentralityCorrection("LHC11h_multCorrMean");
+      TF1 *centCorrWdth = GetCentralityCorrection("LHC11h_multCorrWidth");
+      if(centCorrMean && centCorrWdth && withmultcorrection){
+       tpcpid->SetCentralityCorrections(centCorrMean, centCorrWdth);
+       printf("TPC dE/dx multiplicity correction %p %p\n",centCorrMean,centCorrWdth);
+      }
     }
   }
  
diff --git a/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root
new file mode 100644 (file)
index 0000000..758df72
Binary files /dev/null and b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr2_2011.root differ
diff --git a/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root
new file mode 100644 (file)
index 0000000..8b3219b
Binary files /dev/null and b/PWGHF/hfe/macros/configs/PbPb/jpsietacentcorr3_2011.root differ