Cumulative update
authorprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Aug 2012 16:42:15 +0000 (16:42 +0000)
committerprsnko <prsnko@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Aug 2012 16:42:15 +0000 (16:42 +0000)
13 files changed:
PWGGA/PHOSTasks/PHOS_embedding/AliAnalysisTaskPi0DiffEfficiency.cxx
PWGGA/PHOSTasks/PHOS_embedding/AliAnalysisTaskPi0DiffEfficiency.h
PWGGA/PHOSTasks/PHOS_embedding/AliAnalysisTaskPi0Efficiency.cxx
PWGGA/PHOSTasks/PHOS_embedding/AliAnalysisTaskPi0Efficiency.h
PWGGA/PHOSTasks/PHOS_embedding/AliPHOSEmbedding.cxx
PWGGA/PHOSTasks/PHOS_embedding/AliPHOSEmbedding.h
PWGGA/PHOSTasks/PHOS_embedding/AnalyzeDiff.C
PWGGA/PHOSTasks/PHOS_embedding/Config.C
PWGGA/PHOSTasks/PHOS_embedding/CreateAOD.C
PWGGA/PHOSTasks/PHOS_embedding/Readme
PWGGA/PHOSTasks/PHOS_embedding/UpdateRecoParam.C [new file with mode: 0644]
PWGGA/PHOSTasks/PHOS_embedding/rec.C
PWGGA/PHOSTasks/PHOS_embedding/sim.C

index 5ea3e37..d6b9337 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliAnalysisTaskPi0DiffEfficiency.h"
 #include "AliCaloPhoton.h"
 #include "AliPHOSGeometry.h"
-#include "AliPHOSEsdCluster.h"
+#include "AliPHOSAodCluster.h"
 #include "AliPHOSCalibData.h"
 #include "AliAODEvent.h"
 #include "AliAODCaloCluster.h"
 #include "AliCDBManager.h"
 #include "AliCentrality.h" 
 
-// Analysis task to fill histograms with PHOS ESD clusters and cells
-// Authors: Yuri Kharlov
-// Date   : 28.05.2009
+// Analysis task to calculate pi0 registration efficiency
+// as a difference between spectra before and after embedding
+// Authors: Dmitri Peressounko
+// Date   : Aug.2011
 
 ClassImp(AliAnalysisTaskPi0DiffEfficiency)
 
 //________________________________________________________________________
 AliAnalysisTaskPi0DiffEfficiency::AliAnalysisTaskPi0DiffEfficiency(const char *name) 
-: AliAnalysisTaskSE(name),
-  fStack(0),
-  fOutputContainer(0),
+: AliAnalysisTaskPi0Efficiency(name),
   fPHOSEvent1(0),
-  fPHOSEvent2(0),
-  fPHOSCalibData(0),
-  fNonLinCorr(0),
-  fRPfull(0),
-  fRPA(0),
-  fRPC(0),
-  fRPFar(0),
-  fRPAFar(0),
-  fRPCFar(0),
-  fCentrality(0),
-  fCenBin(0),
-  fPHOSGeo(0),
-  fEventCounter(0)
+  fPHOSEvent2(0)
 {
-  // Constructor
-  for(Int_t i=0;i<1;i++){
-    for(Int_t j=0;j<10;j++)
-      for(Int_t k=0;k<11;k++)
-       fPHOSEvents[i][j][k]=0 ;
-  }
   
-  // Output slots #0 write into a TH1 container
-  DefineOutput(1,TList::Class());
-
-  // Set bad channel map
-  char key[55] ;
-  for(Int_t i=0; i<6; i++){
-    snprintf(key,55,"PHOS_BadMap_mod%d",i) ;
-    fPHOSBadMap[i]=new TH2I(key,"Bad Modules map",64,0.,64.,56,0.,56.) ;
-  }
-  // Initialize the PHOS geometry
-  fPHOSGeo = AliPHOSGeometry::GetInstance("IHEP") ;
 
 
 }
@@ -120,92 +90,392 @@ void AliAnalysisTaskPi0DiffEfficiency::UserCreateOutputObjects()
     snprintf(key,55,"hPhotAll_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hPhotAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hPhotAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hPhotCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hPhotDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hPhotDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hPhotDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hPhotBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hPhotBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
 
+    snprintf(key,55,"hNegPhotAll_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotCPV_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hNegPhotCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hNegPhotCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotDisp_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotBoth_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegPhotBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    
     snprintf(key,55,"hOldMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hOldMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hOldMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hOldMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hOldMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hOldMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hOldMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hOldMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hOldMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hOldMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hOldMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     
     snprintf(key,55,"hNewMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hNewMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hNewMassPtCPV2_cen%d",cent) ;
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hNewMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hNewMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNewMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+
+    snprintf(key,55,"hNegMassPtAll_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtCPV_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtDisp_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtBoth_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hNegMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    
     
     snprintf(key,55,"hMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    ((TH2F*)fOutputContainer->Last())->Sumw2() ;
+    
+    snprintf(key,55,"hMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    
+    snprintf(key,55,"hMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));    
+    
     
     //Mixed
     snprintf(key,55,"hMiMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
+    snprintf(key,55,"hMiMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMiMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    
+     snprintf(key,55,"hMiMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));    
+    
     snprintf(key,55,"hMCMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMCMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMCMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMCMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
     //Single photon
     snprintf(key,55,"hMCPhotAll_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMCPhotAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMCPhotAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hMCPhotCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMCPhotCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMCPhotCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
     snprintf(key,55,"hMCPhotDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
-    snprintf(key,55,"hMCPhotBoth_cen%d",cent) ;
+    snprintf(key,55,"hMCPhotDisp2_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     ((TH1F*)fOutputContainer->Last())->Sumw2() ;
-
-    
+    snprintf(key,55,"hMCPhotDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;
+    snprintf(key,55,"hMCPhotBoth_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;    
+    snprintf(key,55,"hMCPhotBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    ((TH1F*)fOutputContainer->Last())->Sumw2() ;    
     
   }
 
+  fOutputContainer->Add(new TH2F("hMCPi0M11","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M22","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M33","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M12","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M13","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M23","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
   //MC
   for(Int_t cent=0; cent<6; cent++){
@@ -263,11 +533,6 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
 
  // don't rely on ESD vertex, assume (0,0,0)
   Double_t vtx0[3] ={0.,0.,0.};
-  Double_t vtx5[3] ={0.,0.,0.};
-  
-  vtx5[0] = esdVertex5->GetX();
-  vtx5[1] = esdVertex5->GetY();
-  vtx5[2] = esdVertex5->GetZ();
   
   
   FillHistogram("hZvertex",esdVertex5->GetZ());
@@ -310,7 +575,7 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
   FillHistogram("hCentrality",fCentrality) ;
   //Reaction plain is defined in the range (-pi/2;pi/2)
   //We have 10 bins
-  Int_t irp=Int_t(10.*(fRPfull+TMath::PiOver2())/TMath::Pi());
+  Int_t irp=Int_t(10.*fRPfull/TMath::Pi());
   if(irp>9)irp=9 ;
 
   if(!fPHOSEvents[zvtx][fCenBin][irp]) 
@@ -339,7 +604,9 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
   }
 
   TClonesArray * clustersEmb = (TClonesArray*)event->FindListObject("EmbeddedCaloClusters") ;
+  AliAODCaloCells * cellsEmb = (AliAODCaloCells *)event->FindListObject("EmbeddedPHOScells") ;
   TClonesArray * clustersOld = event->GetCaloClusters() ;
+  AliAODCaloCells * cellsOld = event->GetPHOSCells() ;
   TVector3 vertex(vtx0);
   char key[55] ;
   //Before Embedding
@@ -382,12 +649,19 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
     }
     AliCaloPhoton * ph = new((*fPHOSEvent1)[inPHOSold]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
     ph->SetModule(mod) ;
+    AliPHOSAodCluster cluPHOS1(*clu);
+    cluPHOS1.Recalibrate(fPHOSCalibData,cellsOld); // modify the cell energies
+    Double_t ecore=CoreEnergy(&cluPHOS1) ;
+    pv1*= ecore/pv1.E() ;    
     ph->SetMomV2(&pv1) ;
     ph->SetNCells(clu->GetNCells());
-    ph->SetDispBit(TestLambda(clu->GetM20(),clu->GetM02())) ;
-    ph->SetCPVBit(clu->GetEmcCpvDistance()>1.) ;
+    ph->SetDispBit(TestLambda(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetDisp2Bit(TestLambda2(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetCPVBit(clu->GetEmcCpvDistance()>2.) ;
+    ph->SetCPV2Bit(clu->GetEmcCpvDistance()>4.) ;
     if(!survive) //this cluster found in list after embedding, skipping it
-     ph->SetTagged(1) ;
+      ph->SetTagged(1) ;
+    ph->SetPhoton(clu->GetNExMax()<2); // Remember, if it is unfolded
 
     inPHOSold++ ;
   }
@@ -426,12 +700,19 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
     }
     AliCaloPhoton * ph = new((*fPHOSEvent2)[inPHOSemb]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
     ph->SetModule(mod) ;
+    AliPHOSAodCluster cluPHOS1(*clu);
+    cluPHOS1.Recalibrate(fPHOSCalibData,cellsEmb); // modify the cell energies
+    Double_t ecore=CoreEnergy(&cluPHOS1) ;
+    pv1*= ecore/pv1.E() ;    
     ph->SetMomV2(&pv1) ;
     ph->SetNCells(clu->GetNCells());
-    ph->SetDispBit(TestLambda(clu->GetM20(),clu->GetM02())) ;
-    ph->SetCPVBit(clu->GetEmcCpvDistance()>1.) ;
+    ph->SetDispBit(TestLambda(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetDisp2Bit(TestLambda2(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetCPVBit(clu->GetEmcCpvDistance()>2.) ;
+    ph->SetCPV2Bit(clu->GetEmcCpvDistance()>4.) ;
     if(!survive) //this cluster found in list after embedding, skipping it
-     ph->SetTagged(1) ;
+      ph->SetTagged(1) ;
+    ph->SetPhoton(clu->GetNExMax()<2); // Remember, if it is unfolded
 
     inPHOSemb++ ;
   }
@@ -443,16 +724,60 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
       continue ;
     snprintf(key,55,"hPhotAll_cen%d",fCenBin) ;
     FillHistogram(key,ph1->Pt(),-1.) ;
+    snprintf(key,55,"hNegPhotAll_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->Pt(),-1.) ;
+    snprintf(key,55,"hPhotAllcore_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
+    snprintf(key,55,"hNegPhotAllcore_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
+    if(ph1->IsPhoton()){
+      snprintf(key,55,"hPhotAllwou_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotAllwou_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+    }    
     if(ph1->IsCPVOK() ){
       snprintf(key,55,"hPhotCPV_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotCPV_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hPhotCPVcore_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotCPVcore_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
+    }
+    if(ph1->IsCPV2OK() ){
+      snprintf(key,55,"hPhotCPV2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotCPV2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+    }
+    if(ph1->IsDisp2OK()){
+      snprintf(key,55,"hPhotDisp2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotDisp2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
     }
     if(ph1->IsDispOK()){
       snprintf(key,55,"hPhotDisp_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt(),-1.) ;
+      snprintf(key,55,"hNegPhotDisp_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),-1.) ;
+      if(ph1->IsPhoton()){
+        snprintf(key,55,"hPhotDispwou_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt(),-1.) ;
+        snprintf(key,55,"hNegPhotDispwou_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt(),-1.) ;
+      }
       if(ph1->IsCPVOK()){
        snprintf(key,55,"hPhotBoth_cen%d",fCenBin) ;
         FillHistogram(key,ph1->Pt(),-1.) ;
+       snprintf(key,55,"hNegPhotBoth_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt(),-1.) ;
+       snprintf(key,55,"hPhotBothcore_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
+       snprintf(key,55,"hNegPhotBothcore_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->GetMomV2()->Pt(),-1.) ;
       }
     } // end of loop i2
   } // end of loop i1 
@@ -463,16 +788,38 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
       continue ;
     snprintf(key,55,"hPhotAll_cen%d",fCenBin) ;
     FillHistogram(key,ph1->Pt(),1.) ;
+    snprintf(key,55,"hPhotAllcore_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->GetMomV2()->Pt(),1.) ;
+    if(ph1->IsPhoton()){
+      snprintf(key,55,"hPhotAllwou_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),1.) ;
+    }
     if(ph1->IsCPVOK() ){
       snprintf(key,55,"hPhotCPV_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt(),1.) ;
+      snprintf(key,55,"hPhotCPVcore_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->GetMomV2()->Pt(),1.) ;
+    }
+    if(ph1->IsCPV2OK() ){
+      snprintf(key,55,"hPhotCPV2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),1.) ;
+    }
+    if(ph1->IsDisp2OK()){
+      snprintf(key,55,"hPhotDisp2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt(),1.) ;
     }
     if(ph1->IsDispOK()){
       snprintf(key,55,"hPhotDisp_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt(),1.) ;
+      if(ph1->IsPhoton()){
+        snprintf(key,55,"hPhotDispwou_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt(),1.) ;
+      }
       if(ph1->IsCPVOK()){
        snprintf(key,55,"hPhotBoth_cen%d",fCenBin) ;
         FillHistogram(key,ph1->Pt(),1.) ;
+       snprintf(key,55,"hPhotBothcore_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->GetMomV2()->Pt(),1.) ;
       }
     } // end of loop i2
   } // end of loop i1 
@@ -489,39 +836,169 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
 
       TLorentzVector p12  = *ph1  + *ph2;
       TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
+      Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
+
       //Fill Controll histogram: Real before embedding
       snprintf(key,55,"hOldMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      snprintf(key,55,"hOldMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M() ,pv12.Pt(),-1.) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hOldMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      }
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hOldMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       snprintf(key,55,"hOldMassPtCPV_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M(), pv12.Pt(),-1) ;
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hOldMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+      }
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hOldMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hOldMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
-
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hOldMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       }
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hOldMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+         snprintf(key,55,"hOldMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),-1) ;
         }
       }
       
-      //Now fill mail histograms with negative contributions
+      //Now fill main histograms with negative contributions
       if(!(ph1->IsTagged() || ph2->IsTagged()) )
         continue ;
       snprintf(key,55,"hMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      snprintf(key,55,"hMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M() ,pv12.Pt(),-1.) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      }
+      if(a<0.9){
+        snprintf(key,55,"hMassPtAll_a09_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+        if(a<0.8){
+          snprintf(key,55,"hMassPtAll_a08_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+          if(a<0.7){
+            snprintf(key,55,"hMassPtAll_a07_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+          }
+        }
+      }
+      snprintf(key,55,"hNegMassPtAll_cen%d",fCenBin) ;
+      FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      snprintf(key,55,"hNegMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M() ,pv12.Pt(),-1.) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hNegMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+      }
+      
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       snprintf(key,55,"hMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M() ,pv12.Pt(),-1) ;
+        if(a<0.9){
+          snprintf(key,55,"hMassPtCPV_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            }
+          }
+        }
+       snprintf(key,55,"hNegMassPtCPV_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       snprintf(key,55,"hNegMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M() ,pv12.Pt(),-1) ;
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+        if(a<0.9){
+          snprintf(key,55,"hMassPtCPV2_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV2_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV2_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            }
+          }
+       }
+        snprintf(key,55,"hNegMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+      }
+      
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
-
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       }
+        if(a<0.9){
+          snprintf(key,55,"hMassPtDisp_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtDisp_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtDisp_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            }
+          }
+        }
+       snprintf(key,55,"hNegMassPtDisp_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hNegMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+       }
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+         snprintf(key,55,"hMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),-1) ;
+          if(a<0.9){
+            snprintf(key,55,"hMassPtBoth_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+            if(a<0.8){
+              snprintf(key,55,"hMassPtBoth_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+              if(a<0.7){
+                snprintf(key,55,"hMassPtBoth_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt(),-1.) ;
+             }
+            }
+          }
+         snprintf(key,55,"hNegMassPtBoth_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),-1) ;
+         snprintf(key,55,"hNegMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),-1) ;
         }
       }
     } // end of loop i2
@@ -538,21 +1015,43 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
 
       TLorentzVector p12  = *ph1  + *ph2;
       TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
+      Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
 
       // Controll histogram: Real after embedding
       snprintf(key,55,"hNewMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+      snprintf(key,55,"hNewMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M() ,pv12.Pt(),1.) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hNewMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+      }
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hNewMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+       snprintf(key,55,"hNewMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M() ,pv12.Pt(),1) ;
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hNewMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+      }
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hNewMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),1) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hNewMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),1) ;
-
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hNewMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+       }
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hNewMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+         snprintf(key,55,"hNewMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),1) ;
         }
       }
      
@@ -562,17 +1061,99 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
         continue ;
       snprintf(key,55,"hMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+      snprintf(key,55,"hMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M() ,pv12.Pt(),1.) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+      }
+      if(a<0.9){
+        snprintf(key,55,"hMassPtAll_a09_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(a<0.8){
+          snprintf(key,55,"hMassPtAll_a08_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.7){
+            snprintf(key,55,"hMassPtAll_a07_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+          }
+        }
+      }
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+       snprintf(key,55,"hMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M() ,pv12.Pt(),1) ;
+        if(a<0.9){
+          snprintf(key,55,"hMassPtCPV_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+         if(a<0.9){
+          snprintf(key,55,"hMassPtCPV2_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV2_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV2_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt(),1) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+       }
+       if(a<0.9){
+          snprintf(key,55,"hMassPtDisp_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtDisp_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtDisp_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
 
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),1) ;
+         snprintf(key,55,"hMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),1) ;
+          if(a<0.9){
+            snprintf(key,55,"hMassPtBoth_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMassPtBoth_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMassPtBoth_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
         }
       }
     } // end of loop i2
@@ -588,20 +1169,103 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
        AliCaloPhoton * ph2=(AliCaloPhoton*)mixPHOS->At(i2) ;
        TLorentzVector p12  = *ph1  + *ph2;
        TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());
+        Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
        
        snprintf(key,55,"hMiMassPtAll_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+       snprintf(key,55,"hMiMassPtAllcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M() ,pv12.Pt(),1.) ;
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hMiMassPtAllwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+       }
+        if(a<0.9){
+          snprintf(key,55,"hMiMassPtAll_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMiMassPtAll_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMiMassPtAll_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMiMassPtCPV_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+         snprintf(key,55,"hMiMassPtCPVcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M() ,pv12.Pt(),1.) ;
+          if(a<0.9){
+            snprintf(key,55,"hMiMassPtCPV_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtCPV_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtCPV_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
+       }
+       if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+         snprintf(key,55,"hMiMassPtCPV2_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+          if(a<0.9){
+            snprintf(key,55,"hMiMassPtCPV2_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtCPV2_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtCPV2_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
+       }
+       if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+         snprintf(key,55,"hMiMassPtDisp2_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
        }
        if(ph1->IsDispOK() && ph2->IsDispOK()){
          snprintf(key,55,"hMiMassPtDisp_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+          if(ph1->IsPhoton() && ph2->IsPhoton()){
+           snprintf(key,55,"hMiMassPtDispwou_cen%d",fCenBin) ;
+           FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+         }
+         if(a<0.9){
+            snprintf(key,55,"hMiMassPtDisp_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtDisp_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtDisp_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+         }
          
          if(ph1->IsCPVOK() && ph2->IsCPVOK()){
            snprintf(key,55,"hMiMassPtBoth_cen%d",fCenBin) ;
            FillHistogram(key,p12.M() ,p12.Pt(),1.) ;
+           snprintf(key,55,"hMiMassPtBothcore_cen%d",fCenBin) ;
+           FillHistogram(key,pv12.M() ,pv12.Pt(),1.) ;
+            if(a<0.9){
+              snprintf(key,55,"hMiMassPtBoth_a09_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.8){
+                snprintf(key,55,"hMiMassPtBoth_a08_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+                if(a<0.7){
+                  snprintf(key,55,"hMiMassPtBoth_a07_cen%d",fCenBin) ;
+                  FillHistogram(key,p12.M() ,p12.Pt()) ;
+               }
+              }
+            }
          }
        }
       } // end of loop i2
@@ -626,267 +1290,6 @@ void AliAnalysisTaskPi0DiffEfficiency::UserExec(Option_t *)
   PostData(1, fOutputContainer);
   fEventCounter++;
 }
-
-//________________________________________________________________________
-void AliAnalysisTaskPi0DiffEfficiency::Terminate(Option_t *)
-{
-  // Draw result to the screen
-  // Called once at the end of the query
-  
-}
-
-//________________________________________________________________________
-Bool_t AliAnalysisTaskPi0DiffEfficiency::IsGoodChannel(const char * det, Int_t mod, Int_t ix, Int_t iz)
-{
-  //Check if this channel belogs to the good ones
-
-  if(strcmp(det,"PHOS")==0){
-    if(mod>5 || mod<1){
-      AliError(Form("No bad map for PHOS module %d ",mod)) ;
-      return kTRUE ;
-    }
-    if(!fPHOSBadMap[mod]){
-      AliError(Form("No Bad map for PHOS module %d",mod)) ;
-      return kTRUE ;
-    }
-    if(fPHOSBadMap[mod]->GetBinContent(ix,iz)>0)
-      return kFALSE ;
-    else
-      return kTRUE ;
-  }
-  else{
-    AliError(Form("Can not find bad channels for detector %s ",det)) ;
-  }
-  return kTRUE ;
-}
-//_____________________________________________________________________________
-void AliAnalysisTaskPi0DiffEfficiency::FillHistogram(const char * key,Double_t x)const{
-  //FillHistogram
-  TH1I * tmpI = dynamic_cast<TH1I*>(fOutputContainer->FindObject(key)) ;
-  if(tmpI){
-    tmpI->Fill(x) ;
-    return ;
-  }
-  TH1F * tmpF = dynamic_cast<TH1F*>(fOutputContainer->FindObject(key)) ;
-  if(tmpF){
-    tmpF->Fill(x) ;
-    return ;
-  }
-  TH1D * tmpD = dynamic_cast<TH1D*>(fOutputContainer->FindObject(key)) ;
-  if(tmpD){
-    tmpD->Fill(x) ;
-    return ;
-  }
-  AliInfo(Form("can not find histogram <%s> ",key)) ;
-}
-//_____________________________________________________________________________
-void AliAnalysisTaskPi0DiffEfficiency::FillHistogram(const char * key,Double_t x,Double_t y)const{
-  //FillHistogram
-  TObject * tmp = fOutputContainer->FindObject(key) ;
-  if(!tmp){
-    AliInfo(Form("can not find histogram <%s> ",key)) ;
-    return ;
-  }
-  if(tmp->IsA() == TClass::GetClass("TH1F")){
-    ((TH1F*)tmp)->Fill(x,y) ;
-    return ;
-  }
-  if(tmp->IsA() == TClass::GetClass("TH2F")){
-    ((TH2F*)tmp)->Fill(x,y) ;
-    return ;
-  }
-  AliError(Form("Calling FillHistogram with 2 parameters for histo <%s> of type %s",key,tmp->IsA()->GetName())) ;
-}
-
-//_____________________________________________________________________________
-void AliAnalysisTaskPi0DiffEfficiency::FillHistogram(const char * key,Double_t x,Double_t y, Double_t z) const{
-  //Fills 1D histograms with key
-  TObject * tmp = fOutputContainer->FindObject(key) ;
-  if(!tmp){
-    AliInfo(Form("can not find histogram <%s> ",key)) ;
-    return ;
-  }
-  if(tmp->IsA() == TClass::GetClass("TH2F")){
-    ((TH2F*)tmp)->Fill(x,y,z) ;
-    return ;
-  }
-  if(tmp->IsA() == TClass::GetClass("TH3F")){
-    ((TH3F*)tmp)->Fill(x,y,z) ;
-    return ;
-  }
-}
-//_____________________________________________________________________________
-Bool_t AliAnalysisTaskPi0DiffEfficiency::TestLambda(Double_t l1,Double_t l2){
-  Double_t l1Mean=1.22 ;
-  Double_t l2Mean=2.0 ;
-  Double_t l1Sigma=0.42 ;
-  Double_t l2Sigma=0.71 ;
-  Double_t c=-0.59 ;
-  Double_t R2=(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma+(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma-c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
-  return (R2<9.) ;
-  
-}
-//___________________________________________________________________________
-void AliAnalysisTaskPi0DiffEfficiency::ProcessMC(){
-  //fill histograms for efficiensy etc. calculation
-  const Double_t rcut = 1. ; //cut for primary particles
-  //---------First pi0/eta-----------------------------
-  char partName[10] ;
-  char hkey[55] ;
-
-  AliAODEvent *event = dynamic_cast<AliAODEvent*>(InputEvent());
-  if(!event) return ;
-  TClonesArray *mcArray = (TClonesArray*)event->FindListObject(AliAODMCParticle::StdBranchName());
-  for(Int_t i=0;i<mcArray->GetEntriesFast();i++){
-     AliAODMCParticle* particle =  (AliAODMCParticle*) mcArray->At(i);
-    if(particle->GetPdgCode() == 111)
-      snprintf(partName,10,"pi0") ;
-    else
-      if(particle->GetPdgCode() == 221)
-        snprintf(partName,10,"eta") ;
-      else
-        if(particle->GetPdgCode() == 22)
-           snprintf(partName,10,"gamma") ;
-       else
-           continue ;
-
-    //Primary particle
-    Double_t r=TMath::Sqrt(particle->Xv()*particle->Xv()+particle->Yv()*particle->Yv());
-    if(r >rcut)
-      continue ;
-
-    Double_t pt = particle->Pt() ;
-    //Total number of pi0 with creation radius <1 cm
-    snprintf(hkey,55,"hMC_all_%s_cen%d",partName,fCenBin) ;
-    FillHistogram(hkey,pt) ;
-    if(TMath::Abs(particle->Y())<0.12){
-      snprintf(hkey,55,"hMC_unitEta_%s_cen%d",partName,fCenBin) ;
-      FillHistogram(hkey,pt) ;
-    }
-
-    snprintf(hkey,55,"hMC_rap_%s_cen%d",partName,fCenBin) ;
-    FillHistogram(hkey,particle->Y()) ;
-    
-    Double_t phi=particle->Phi() ;
-    while(phi<0.)phi+=TMath::TwoPi() ;
-    while(phi>TMath::TwoPi())phi-=TMath::TwoPi() ;
-    snprintf(hkey,55,"hMC_phi_%s_cen%d",partName,fCenBin) ;
-    FillHistogram(hkey,phi) ;
-   
-
-    //Check if one of photons converted
-    if(particle->GetNDaughters()!=2)
-     continue ; //Do not account Dalitz decays
-
-/*
-    TParticle * gamma1 = fStack->Particle(particle->GetFirstDaughter());
-    TParticle * gamma2 = fStack->Particle(particle->GetLastDaughter());
-    //Number of pi0s decayed into acceptance
-    Int_t mod1,mod2 ;
-    Double_t x=0.,z=0. ;
-    Bool_t hitPHOS1 = fPHOSGeo->ImpactOnEmc(gamma1, mod1, z,x) ;
-    Bool_t hitPHOS2 = fPHOSGeo->ImpactOnEmc(gamma2, mod2, z,x) ;
-
-    Bool_t goodPair=kFALSE ;
-    if( hitPHOS1 && hitPHOS2){
-      sprintf(hkey,"hMC_PHOSacc_%s",partName) ;
-      FillHistogram(hkey,pt) ;
-      goodPair=kTRUE ;
-    }
-
-*/
-  }
-  //Now calculate "Real" distribution of clusters with primary
-  TClonesArray cluPrim("AliCaloPhoton",200) ; //clusters with primary
-  Int_t multClust = event->GetNumberOfCaloClusters();
-  Int_t inPHOS=0 ;
-  Double_t vtx0[3] = {0,0,0}; 
-  for (Int_t i=0; i<multClust; i++) {
-    AliVCluster *clu = event->GetCaloCluster(i);
-    if ( !clu->IsPHOS() || clu->E()<0.3) continue;
-    if(clu->GetLabel()<0) continue ;
-
-    Float_t  position[3];
-    clu->GetPosition(position);
-    TVector3 global(position) ;
-    Int_t relId[4] ;
-    fPHOSGeo->GlobalPos2RelId(global,relId) ;
-    Int_t mod  = relId[0] ;
-    Int_t cellX = relId[2];
-    Int_t cellZ = relId[3] ;
-    if ( !IsGoodChannel("PHOS",mod,cellX,cellZ) ) 
-      continue ;
-    if(clu->GetNCells()<3)
-      continue ;
-
-    TLorentzVector pv1 ;
-    clu->GetMomentum(pv1 ,vtx0);
-    
-    if(inPHOS>=cluPrim.GetSize()){
-      cluPrim.Expand(inPHOS+50) ;
-    }
-    AliCaloPhoton * ph = new(cluPrim[inPHOS]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
-    //AliCaloPhoton * ph = (AliCaloPhoton*)fPHOSEvent->At(inPHOS) ;
-    ph->SetModule(mod) ;
-    ph->SetMomV2(&pv1) ;
-    ph->SetNCells(clu->GetNCells());
-    ph->SetDispBit(TestLambda(clu->GetM20(),clu->GetM02())) ;
-    ph->SetCPVBit(clu->GetEmcCpvDistance()>1.) ;
-
-    inPHOS++ ;
-
-  }
-  
-  //Single photon
-  char key[55] ;
-  for (Int_t i1=0; i1<inPHOS; i1++) {
-    AliCaloPhoton * ph1=(AliCaloPhoton*)cluPrim.At(i1) ;
-    snprintf(key,55,"hMCPhotAll_cen%d",fCenBin) ;
-    FillHistogram(key,ph1->Pt()) ;
-    if(ph1->IsCPVOK() ){
-      snprintf(key,55,"hMCPhotCPV_cen%d",fCenBin) ;
-      FillHistogram(key,ph1->Pt()) ;
-      
-    }
-    if(ph1->IsDispOK()){
-      snprintf(key,55,"hMCPhotDisp_cen%d",fCenBin) ;
-      FillHistogram(key,ph1->Pt()) ;
-      if(ph1->IsCPVOK()){
-       snprintf(key,55,"hMCPhotBoth_cen%d",fCenBin) ;
-       FillHistogram(key,ph1->Pt()) ;
-      }
-    } // end of loop i2
-  } // end of loop i1 
-
-  // Fill Real disribution
-  for (Int_t i1=0; i1<inPHOS-1; i1++) {
-    AliCaloPhoton * ph1=(AliCaloPhoton*)cluPrim.At(i1) ;
-    for (Int_t i2=i1+1; i2<inPHOS; i2++) {
-      AliCaloPhoton * ph2=(AliCaloPhoton*)cluPrim.At(i2) ;
-      TLorentzVector p12  = *ph1  + *ph2;
-      TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
-  
-      snprintf(key,55,"hMCMassPtAll_cen%d",fCenBin) ;
-      FillHistogram(key,p12.M() ,p12.Pt()) ;
-      if(ph1->IsCPVOK() && ph2->IsCPVOK()){
-       snprintf(key,55,"hMCMassPtCPV_cen%d",fCenBin) ;
-       FillHistogram(key,p12.M() ,p12.Pt()) ;
-      }
-      if(ph1->IsDispOK() && ph2->IsDispOK()){
-       snprintf(key,55,"hMCMassPtDisp_cen%d",fCenBin) ;
-       FillHistogram(key,p12.M() ,p12.Pt()) ;
-
-       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
-         snprintf(key,55,"hMCMassPtBoth_cen%d",fCenBin) ;
-         FillHistogram(key,p12.M() ,p12.Pt()) ;
-        }
-      }
-    } // end of loop i2
-  } // end of loop i1
-
-  
-}
 //___________________________________________________________________________
 Bool_t AliAnalysisTaskPi0DiffEfficiency::IsSameCluster(AliAODCaloCluster * c1, AliAODCaloCluster * c2)const{
  //Compare clusters before and after embedding
@@ -897,7 +1300,7 @@ Bool_t AliAnalysisTaskPi0DiffEfficiency::IsSameCluster(AliAODCaloCluster * c1, A
  if(c1->GetNCells() != c2->GetNCells())
    return kFALSE ;
  
- if(TMath::Abs(c1->E()-c2->E())>0.001*c1->E())
+ if(TMath::Abs(c1->E()-c2->E())>0.01*c1->E())
    return kFALSE ;
 
  UShort_t *list1 = c1->GetCellsAbsId() ; 
index 63c0047..219cfb2 100644 (file)
@@ -1,79 +1,32 @@
 #ifndef ALIANALYSISTASKPI0DIFFEFFICIENCY_H\r
 #define ALIANALYSISTASKPI0DIFFEFFICIENCY_H\r
 \r
-// example of an analysis task creating a p_t spectrum\r
-// Authors: Panos Cristakoglou, Jan Fiete Grosse-Oetringhaus, Christian Klein-Boesing\r
+// Task calculating effciency of pi0 registration \r
+// as a difference between spectrum after and before \r
+// embedding\r
 \r
-class TObjArray;\r
-class TH1F;\r
-class TH2I;\r
-class TH2F;\r
-class TH3F;\r
-class TF1 ;\r
-class AliStack ;\r
-class AliESDtrackCuts;\r
-class AliPHOSGeometry;\r
-class AliAODEvent ;\r
-class AliPHOSCalibData;\r
-class AliAODTrack ;\r
+class TClonesArray;\r
 class AliAODCaloCluster ;\r
 \r
 \r
-#include "AliAnalysisTaskSE.h"\r
+#include "AliAnalysisTaskPi0Efficiency.h"\r
 \r
-class AliAnalysisTaskPi0DiffEfficiency : public AliAnalysisTaskSE {\r
+class AliAnalysisTaskPi0DiffEfficiency : public AliAnalysisTaskPi0Efficiency {\r
 public:\r
   AliAnalysisTaskPi0DiffEfficiency(const char *name = "AliAnalysisTaskPi0DiffEfficiency");\r
   virtual ~AliAnalysisTaskPi0DiffEfficiency() {}\r
   \r
   virtual void   UserCreateOutputObjects();\r
   virtual void   UserExec(Option_t *option);\r
-  virtual void   Terminate(Option_t *);\r
-  void SetPHOSBadMap(Int_t mod,TH2I * h)\r
-  {\r
-    if(fPHOSBadMap[mod]) delete fPHOSBadMap[mod] ;\r
-    fPHOSBadMap[mod]=new TH2I(*h) ;\r
-    printf("Set %s \n",fPHOSBadMap[mod]->GetName());\r
-  }\r
   \r
 private:\r
-  AliAnalysisTaskPi0DiffEfficiency(const AliAnalysisTaskPi0DiffEfficiency&); // not implemented\r
-  AliAnalysisTaskPi0DiffEfficiency& operator=(const AliAnalysisTaskPi0DiffEfficiency&); // not implemented\r
   Bool_t IsSameCluster(AliAODCaloCluster * c1,AliAODCaloCluster * c2)const ;\r
-  Bool_t IsGoodChannel(const char * det, Int_t mod,Int_t ix, Int_t iz); //Use addisional bad map for PHOS\r
-  void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key\r
-  void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key\r
-  void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key\r
-  Bool_t TestLambda(Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons\r
-  void ProcessMC() ;\r
  \r
 private:\r
-  AliStack * fStack ;              //stack of MC tracks\r
-  TList * fOutputContainer;        //final histogram container\r
-  TList * fPHOSEvents[1][10][11] ; //Containers for events with PHOS photons\r
-  TClonesArray * fPHOSEvent1 ;      //PHOS photons in current event\r
-  TClonesArray * fPHOSEvent2 ;      //PHOS photons in current event\r
-  AliPHOSCalibData *fPHOSCalibData; // PHOS calibration object\r
-  TF1 *fNonLinCorr;          // Non-linearity correction\r
+  TClonesArray * fPHOSEvent1 ;      //!PHOS photons in current event\r
+  TClonesArray * fPHOSEvent2 ;      //!PHOS photons in current event\r
  \r
-  //Reaction plain for v2\r
-  Float_t fRPfull ; //!Reaction plain calculated with full TPC \r
-  Float_t fRPA ;    //!Reaction plain calculated with A-side TPC: eta>0.15 \r
-  Float_t fRPC ;    //!Reaction plain calculated with C-side TPC: eta<-0.15\r
-  Float_t fRPFar ;  //!Reaction plain calculated with TPC: eta>0.6 \r
-  Float_t fRPAFar ; //!Reaction plain calculated with A-side TPC: eta>0.6 \r
-  Float_t fRPCFar ; //!Reaction plain calculated with C-side TPC: eta<-0.6\r
-\r
-  Float_t fCentrality ; //!Centrality of the currecnt event\r
-\r
-  Int_t fCenBin ;       //! Current centrality bin\r
-\r
-  TH2I *fPHOSBadMap[6] ;    //Container for PHOS bad channels map\r
-\r
-  AliPHOSGeometry  *fPHOSGeo;  //! PHOS geometry\r
-  Int_t fEventCounter;         // number of analyzed events\r
-\r
-  ClassDef(AliAnalysisTaskPi0DiffEfficiency, 1); // PHOS analysis task\r
+  ClassDef(AliAnalysisTaskPi0DiffEfficiency, 2); // PHOS analysis task\r
 };\r
 \r
 #endif\r
index f3ca6c5..30e7fde 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliAnalysisTaskPi0Efficiency.h"
 #include "AliCaloPhoton.h"
 #include "AliPHOSGeometry.h"
-#include "AliPHOSEsdCluster.h"
+#include "AliPHOSAodCluster.h"
 #include "AliPHOSCalibData.h"
 #include "AliAODEvent.h"
 #include "AliAODCaloCluster.h"
@@ -76,6 +76,15 @@ AliAnalysisTaskPi0Efficiency::AliAnalysisTaskPi0Efficiency(const char *name)
   // Initialize the PHOS geometry
   fPHOSGeo = AliPHOSGeometry::GetInstance("IHEP") ;
 
+  fPHOSCalibData = new AliPHOSCalibData();
+  for(Int_t module=1; module<=5; module++) {
+    for(Int_t column=1; column<=56; column++) {
+      for(Int_t row=1; row<=64; row++) {
+        fPHOSCalibData->SetADCchannelEmc(module,column,row,1.);
+      }
+    }
+  }
+
 
 }
 
@@ -118,54 +127,231 @@ void AliAnalysisTaskPi0Efficiency::UserCreateOutputObjects()
     //Single photon
     snprintf(key,55,"hPhotAll_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hPhotCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hPhotDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hPhotBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hPhotBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     
     snprintf(key,55,"hMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    
+    snprintf(key,55,"hMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    
     
     //Mixed
     snprintf(key,55,"hMiMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMiMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
+    snprintf(key,55,"hMiMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMiMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    
+     snprintf(key,55,"hMiMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMiMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+   
+    //MC
     snprintf(key,55,"hMCMassPtAll_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCMassPtBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));  
+    
+    
+    snprintf(key,55,"hMCMassPtAll_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a07_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMCMassPtAll_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a08_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+
+    snprintf(key,55,"hMCMassPtAll_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtCPV2_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtDisp_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCMassPtBoth_a09_cen%d",cent) ;
+    fOutputContainer->Add(new TH2F(key,"(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
     //Single photon
     snprintf(key,55,"hMCPhotAll_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotAllwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotAllcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCPhotCPV_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotCPVcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotCPV2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCPhotDisp_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotDispwou_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotDisp2_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
     snprintf(key,55,"hMCPhotBoth_cen%d",cent) ;
     fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
+    snprintf(key,55,"hMCPhotBothcore_cen%d",cent) ;
+    fOutputContainer->Add(new TH1F(key,"dN/dpt" ,nPt,ptMin,ptMax));
 
-    
-    
   }
+    
+  fOutputContainer->Add(new TH2F("hMCPi0M11","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M22","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M33","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M12","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M13","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
+  fOutputContainer->Add(new TH2F("hMCPi0M23","(M,p_{T},d#phi)_{#gamma#gamma}" ,nM,mMin,mMax,nPt,ptMin,ptMax));
 
 
   //MC
@@ -224,11 +410,6 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
 
  // don't rely on ESD vertex, assume (0,0,0)
   Double_t vtx0[3] ={0.,0.,0.};
-  Double_t vtx5[3] ={0.,0.,0.};
-  
-  vtx5[0] = esdVertex5->GetX();
-  vtx5[1] = esdVertex5->GetY();
-  vtx5[2] = esdVertex5->GetZ();
   
   
   FillHistogram("hZvertex",esdVertex5->GetZ());
@@ -271,7 +452,7 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
   FillHistogram("hCentrality",fCentrality) ;
   //Reaction plain is defined in the range (-pi/2;pi/2)
   //We have 10 bins
-  Int_t irp=Int_t(10.*(fRPfull+TMath::PiOver2())/TMath::Pi());
+  Int_t irp=Int_t(10.*fRPfull/TMath::Pi());
   if(irp>9)irp=9 ;
 
   if(!fPHOSEvents[zvtx][fCenBin][irp]) 
@@ -300,9 +481,10 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
   Int_t inPHOS=0 ;
   TVector3 vertex(vtx0);
   TClonesArray * clusters = (TClonesArray*)event->FindListObject("EmbeddedCaloClusters") ;
+  AliAODCaloCells * cells = (AliAODCaloCells*)event->FindListObject("EmbeddedPHOScells") ;
   Int_t multClust = clusters->GetEntriesFast();
   for (Int_t i=0; i<multClust; i++) {
-    AliVCluster *clu = (AliVCluster*) clusters->At(i);
+    AliAODCaloCluster *clu = (AliAODCaloCluster*) clusters->At(i);
     if ( !clu->IsPHOS() || clu->E()<0.3) continue;
 
     Float_t  position[3];
@@ -317,6 +499,8 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
       continue ;
     if(clu->GetNCells()<3)
       continue ;
+    if(clu->GetM02()<0.2)
+      continue ;
 
     snprintf(key,55,"hCluM%d",mod) ;
     FillHistogram(key,cellX,cellZ,1.);
@@ -330,10 +514,17 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
     new((*fPHOSEvent)[inPHOS]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
     AliCaloPhoton * ph = (AliCaloPhoton*)fPHOSEvent->At(inPHOS) ;
     ph->SetModule(mod) ;
+    AliPHOSAodCluster cluPHOS1(*clu);
+    cluPHOS1.Recalibrate(fPHOSCalibData,cells); // modify the cell energies
+    Double_t ecore=CoreEnergy(&cluPHOS1) ; 
+    pv1*= ecore/pv1.E() ;
     ph->SetMomV2(&pv1) ;
     ph->SetNCells(clu->GetNCells());
-    ph->SetDispBit(TestLambda(clu->GetM20(),clu->GetM02())) ;
-    ph->SetCPVBit(clu->GetEmcCpvDistance()>1.) ;
+    ph->SetDispBit(TestLambda(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetDisp2Bit(TestLambda2(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetCPVBit(clu->GetEmcCpvDistance()>2.) ;
+    ph->SetCPV2Bit(clu->GetEmcCpvDistance()>4.) ;
+    ph->SetPhoton(clu->GetNExMax()<2); // Remember, if it is unfolded
 
     inPHOS++ ;
   }
@@ -342,16 +533,38 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
     AliCaloPhoton * ph1=(AliCaloPhoton*)fPHOSEvent->At(i1) ;
     snprintf(key,55,"hPhotAll_cen%d",fCenBin) ;
     FillHistogram(key,ph1->Pt()) ;
+    snprintf(key,55,"hPhotAllcore_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->GetMomV2()->Pt()) ;
+    if(ph1->IsPhoton()){
+      snprintf(key,55,"hPhotAllwou_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
+    }
     if(ph1->IsCPVOK() ){
       snprintf(key,55,"hPhotCPV_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt()) ;
+      snprintf(key,55,"hPhotCPVcore_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->GetMomV2()->Pt()) ;
+    }
+    if(ph1->IsCPV2OK() ){
+      snprintf(key,55,"hPhotCPV2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
+    }
+    if(ph1->IsDisp2OK()){
+      snprintf(key,55,"hPhotDisp2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
     }
     if(ph1->IsDispOK()){
       snprintf(key,55,"hPhotDisp_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt()) ;
+      if(ph1->IsPhoton()){
+        snprintf(key,55,"hPhotDispwou_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt()) ;
+      }
       if(ph1->IsCPVOK()){
        snprintf(key,55,"hPhotBoth_cen%d",fCenBin) ;
        FillHistogram(key,ph1->Pt()) ;
+       snprintf(key,55,"hPhotBothcore_cen%d",fCenBin) ;
+       FillHistogram(key,ph1->GetMomV2()->Pt()) ;
       }
     } // end of loop i2
   } // end of loop i1 
@@ -363,20 +576,103 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
       AliCaloPhoton * ph2=(AliCaloPhoton*)fPHOSEvent->At(i2) ;
       TLorentzVector p12  = *ph1  + *ph2;
       TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
-
+      Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
+      
       snprintf(key,55,"hMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt()) ;
+      snprintf(key,55,"hMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M(), pv12.Pt()) ;
+      if(ph1->IsPhoton() && ph2->IsPhoton()){
+        snprintf(key,55,"hMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt()) ;
+      }
+      if(a<0.9){
+        snprintf(key,55,"hMassPtAll_a09_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(a<0.8){
+          snprintf(key,55,"hMassPtAll_a08_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.7){
+            snprintf(key,55,"hMassPtAll_a07_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+          }
+        }
+      }
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt()) ;
+       snprintf(key,55,"hMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M(), pv12.Pt()) ;
+        if(a<0.9){
+          snprintf(key,55,"hMassPtCPV_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(a<0.9){
+          snprintf(key,55,"hMassPtCPV2_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtCPV2_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtCPV2_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt()) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt()) ;
+       }
+        if(a<0.9){
+          snprintf(key,55,"hMassPtDisp_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMassPtDisp_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMassPtDisp_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
 
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt()) ;
+         snprintf(key,55,"hMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M(), pv12.Pt()) ;
+          if(a<0.9){
+            snprintf(key,55,"hMassPtBoth_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMassPtBoth_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMassPtBoth_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+             }
+            }
+          }
         }
       }
     } // end of loop i2
@@ -391,20 +687,102 @@ void AliAnalysisTaskPi0Efficiency::UserExec(Option_t *)
        AliCaloPhoton * ph2=(AliCaloPhoton*)mixPHOS->At(i2) ;
        TLorentzVector p12  = *ph1  + *ph2;
        TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());
+        Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
        
        snprintf(key,55,"hMiMassPtAll_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt()) ;
-       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
+       snprintf(key,55,"hMiMassPtAllcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M(), pv12.Pt()) ;
+        if(ph1->IsPhoton() && ph2->IsPhoton()){
+         snprintf(key,55,"hMiMassPtAllwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt()) ;
+       }
+        if(a<0.9){
+          snprintf(key,55,"hMiMassPtAll_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMiMassPtAll_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMiMassPtAll_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMiMassPtCPV_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt()) ;
+         snprintf(key,55,"hMiMassPtCPVcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M(), pv12.Pt()) ;
+          if(a<0.9){
+            snprintf(key,55,"hMiMassPtCPV_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtCPV_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtCPV_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
+       }
+       if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+         snprintf(key,55,"hMiMassPtCPV2_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.9){
+            snprintf(key,55,"hMiMassPtCPV2_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtCPV2_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtCPV2_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
+       }
+       if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+         snprintf(key,55,"hMiMassPtDisp2_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt()) ;
        }
        if(ph1->IsDispOK() && ph2->IsDispOK()){
          snprintf(key,55,"hMiMassPtDisp_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt()) ;
-         
+         if(ph1->IsPhoton() && ph2->IsPhoton()){
+           snprintf(key,55,"hMiMassPtDispwou_cen%d",fCenBin) ;
+           FillHistogram(key,p12.M() ,p12.Pt()) ;
+         }
+          if(a<0.9){
+            snprintf(key,55,"hMiMassPtDisp_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMiMassPtDisp_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMiMassPtDisp_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+         }
          if(ph1->IsCPVOK() && ph2->IsCPVOK()){
            snprintf(key,55,"hMiMassPtBoth_cen%d",fCenBin) ;
            FillHistogram(key,p12.M() ,p12.Pt()) ;
+           snprintf(key,55,"hMiMassPtBothcore_cen%d",fCenBin) ;
+           FillHistogram(key,pv12.M(), pv12.Pt()) ;
+            if(a<0.9){
+              snprintf(key,55,"hMiMassPtBoth_a09_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.8){
+                snprintf(key,55,"hMiMassPtBoth_a08_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+                if(a<0.7){
+                  snprintf(key,55,"hMiMassPtBoth_a07_cen%d",fCenBin) ;
+                  FillHistogram(key,p12.M() ,p12.Pt()) ;
+               }
+              }
+            }
          }
        }
       } // end of loop i2
@@ -517,14 +895,31 @@ void AliAnalysisTaskPi0Efficiency::FillHistogram(const char * key,Double_t x,Dou
   }
 }
 //_____________________________________________________________________________
-Bool_t AliAnalysisTaskPi0Efficiency::TestLambda(Double_t l1,Double_t l2){
-  Double_t l1Mean=1.22 ;
-  Double_t l2Mean=2.0 ;
-  Double_t l1Sigma=0.42 ;
-  Double_t l2Sigma=0.71 ;
-  Double_t c=-0.59 ;
-  Double_t R2=(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma+(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma-c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
-  return (R2<9.) ;
+Bool_t AliAnalysisTaskPi0Efficiency::TestLambda(Double_t pt,Double_t l1,Double_t l2){
+  
+  Double_t l2Mean  = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
+  Double_t l1Mean  = 1.12365+0.123770*TMath::Exp(-pt*0.246551)+5.30000e-03*pt ;
+  Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
+  Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
+  Double_t c=-0.35-0.550*TMath::Exp(-0.390730*pt) ;
+  Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma + 
+              0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
+              0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
+  return (R2<2.5*2.5) ;
+  
+}
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskPi0Efficiency::TestLambda2(Double_t pt,Double_t l1,Double_t l2){
+  
+  Double_t l2Mean  = 1.53126+9.50835e+06/(1.+1.08728e+07*pt+1.73420e+06*pt*pt) ;
+  Double_t l1Mean  = 1.12365+0.123770*TMath::Exp(-pt*0.246551)+5.30000e-03*pt ;
+  Double_t l2Sigma = 6.48260e-02+7.60261e+10/(1.+1.53012e+11*pt+5.01265e+05*pt*pt)+9.00000e-03*pt;
+  Double_t l1Sigma = 4.44719e-04+6.99839e-01/(1.+1.22497e+00*pt+6.78604e-07*pt*pt)+9.00000e-03*pt;
+  Double_t c=-0.35-0.550*TMath::Exp(-0.390730*pt) ;
+  Double_t R2=0.5*(l1-l1Mean)*(l1-l1Mean)/l1Sigma/l1Sigma + 
+              0.5*(l2-l2Mean)*(l2-l2Mean)/l2Sigma/l2Sigma +
+              0.5*c*(l1-l1Mean)*(l2-l2Mean)/l1Sigma/l2Sigma ;
+  return (R2<1.5*1.5) ;
   
 }
 //___________________________________________________________________________
@@ -600,11 +995,13 @@ void AliAnalysisTaskPi0Efficiency::ProcessMC(){
  
   //Now calculate "Real" distribution of clusters with primary
   TClonesArray cluPrim("AliCaloPhoton",200) ; //clusters with primary
-  Int_t multClust = event->GetNumberOfCaloClusters();
+  TClonesArray * clusters = (TClonesArray*)event->FindListObject("EmbeddedCaloClusters") ;
+  AliAODCaloCells * cells = (AliAODCaloCells *)event->FindListObject("EmbeddedPHOScells") ;
+  Int_t multClust = clusters->GetEntriesFast();
   Int_t inPHOS=0 ;
   Double_t vtx0[3] = {0,0,0}; 
   for (Int_t i=0; i<multClust; i++) {
-    AliVCluster *clu = event->GetCaloCluster(i);
+    AliAODCaloCluster *clu = (AliAODCaloCluster*)clusters->At(i);
     if ( !clu->IsPHOS() || clu->E()<0.3) continue;
     if(clu->GetLabel()<0) continue ;
 
@@ -630,10 +1027,18 @@ void AliAnalysisTaskPi0Efficiency::ProcessMC(){
     AliCaloPhoton * ph = new(cluPrim[inPHOS]) AliCaloPhoton(pv1.X(),pv1.Py(),pv1.Z(),pv1.E()) ;
     //AliCaloPhoton * ph = (AliCaloPhoton*)fPHOSEvent->At(inPHOS) ;
     ph->SetModule(mod) ;
+    AliPHOSAodCluster cluPHOS1(*clu);
+    cluPHOS1.Recalibrate(fPHOSCalibData,cells); // modify the cell energies
+    Double_t ecore=CoreEnergy(&cluPHOS1) ;
+    pv1*= ecore/pv1.E() ;
     ph->SetMomV2(&pv1) ;
     ph->SetNCells(clu->GetNCells());
-    ph->SetDispBit(TestLambda(clu->GetM20(),clu->GetM02())) ;
-    ph->SetCPVBit(clu->GetEmcCpvDistance()>1.) ;
+    ph->SetDispBit(TestLambda(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetDisp2Bit(TestLambda2(clu->E(),clu->GetM20(),clu->GetM02())) ;
+    ph->SetCPVBit(clu->GetEmcCpvDistance()>2.) ; //radius in sigmas
+    ph->SetCPV2Bit(clu->GetEmcCpvDistance()>4.) ;
+    ph->SetPhoton(clu->GetNExMax()<2); // Remember, if it is unfolded
+
 
     inPHOS++ ;
 
@@ -645,17 +1050,40 @@ void AliAnalysisTaskPi0Efficiency::ProcessMC(){
     AliCaloPhoton * ph1=(AliCaloPhoton*)cluPrim.At(i1) ;
     snprintf(key,55,"hMCPhotAll_cen%d",fCenBin) ;
     FillHistogram(key,ph1->Pt()) ;
+    snprintf(key,55,"hMCPhotAllcore_cen%d",fCenBin) ;
+    FillHistogram(key,ph1->GetMomV2()->Pt()) ;
+    if(ph1->IsPhoton()){
+      snprintf(key,55,"hMCPhotAllwou_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
+    }
     if(ph1->IsCPVOK() ){
       snprintf(key,55,"hMCPhotCPV_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt()) ;
+      snprintf(key,55,"hMCPhotCPVcore_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->GetMomV2()->Pt()) ;
       
     }
+    if(ph1->IsCPV2OK() ){
+      snprintf(key,55,"hMCPhotCPV2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
+      
+    }
+    if(ph1->IsDisp2OK()){
+      snprintf(key,55,"hMCPhotDisp2_cen%d",fCenBin) ;
+      FillHistogram(key,ph1->Pt()) ;
+    }
     if(ph1->IsDispOK()){
       snprintf(key,55,"hMCPhotDisp_cen%d",fCenBin) ;
       FillHistogram(key,ph1->Pt()) ;
+      if(ph1->IsPhoton()){
+        snprintf(key,55,"hMCPhotDispwou_cen%d",fCenBin) ;
+        FillHistogram(key,ph1->Pt()) ;
+      }
       if(ph1->IsCPVOK()){
        snprintf(key,55,"hMCPhotBoth_cen%d",fCenBin) ;
        FillHistogram(key,ph1->Pt()) ;
+       snprintf(key,55,"hMCPhotBothcore_cen%d",fCenBin) ;
+       FillHistogram(key,ph1->GetMomV2()->Pt()) ;
       }
     } // end of loop i2
   } // end of loop i1 
@@ -667,26 +1095,171 @@ void AliAnalysisTaskPi0Efficiency::ProcessMC(){
       AliCaloPhoton * ph2=(AliCaloPhoton*)cluPrim.At(i2) ;
       TLorentzVector p12  = *ph1  + *ph2;
       TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());      
-  
+      Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
+       
       snprintf(key,55,"hMCMassPtAll_cen%d",fCenBin) ;
       FillHistogram(key,p12.M() ,p12.Pt()) ;
+      snprintf(key,55,"hMCMassPtAllcore_cen%d",fCenBin) ;
+      FillHistogram(key,pv12.M(), pv12.Pt()) ;
+      if(ph1->IsPhoton()&& ph2->IsPhoton()){
+        snprintf(key,55,"hMCMassPtAllwou_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt()) ;
+      }
+      if(a<0.9){
+        snprintf(key,55,"hMCMassPtAll_a09_cen%d",fCenBin) ;
+        FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(a<0.8){
+          snprintf(key,55,"hMCMassPtAll_a08_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.7){
+            snprintf(key,55,"hMCMassPtAll_a07_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+          }
+        }
+      }
+
+      
+           if(ph1->Module()==1 && ph2->Module()==1)
+           FillHistogram("hMCPi0M11",p12.M(),p12.Pt() );
+          else if(ph1->Module()==2 && ph2->Module()==2)
+           FillHistogram("hMCPi0M22",p12.M(),p12.Pt() );
+          else if(ph1->Module()==3 && ph2->Module()==3)
+           FillHistogram("hMCPi0M33",p12.M(),p12.Pt() );
+          else if(ph1->Module()==1 && ph2->Module()==2)
+           FillHistogram("hMCPi0M12",p12.M(),p12.Pt() );
+          else if(ph1->Module()==1 && ph2->Module()==3)
+           FillHistogram("hMCPi0M13",p12.M(),p12.Pt() );
+          else if(ph1->Module()==2 && ph2->Module()==3)
+           FillHistogram("hMCPi0M23",p12.M(),p12.Pt() );
+        
+
+     
+      
+      
       if(ph1->IsCPVOK() && ph2->IsCPVOK()){
        snprintf(key,55,"hMCMassPtCPV_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt()) ;
+       snprintf(key,55,"hMCMassPtCPVcore_cen%d",fCenBin) ;
+       FillHistogram(key,pv12.M(), pv12.Pt()) ;
+        if(a<0.9){
+          snprintf(key,55,"hMCMassPtCPV_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMCMassPtCPV_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMCMassPtCPV_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
+       snprintf(key,55,"hMCMassPtCPV2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(a<0.9){
+          snprintf(key,55,"hMCMassPtCPV2_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMCMassPtCPV2_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMCMassPtCPV2_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
+      }
+      if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
+       snprintf(key,55,"hMCMassPtDisp2_cen%d",fCenBin) ;
+       FillHistogram(key,p12.M() ,p12.Pt()) ;
       }
       if(ph1->IsDispOK() && ph2->IsDispOK()){
        snprintf(key,55,"hMCMassPtDisp_cen%d",fCenBin) ;
        FillHistogram(key,p12.M() ,p12.Pt()) ;
+        if(ph1->IsPhoton()&& ph2->IsPhoton()){
+         snprintf(key,55,"hMCMassPtDispwou_cen%d",fCenBin) ;
+         FillHistogram(key,p12.M() ,p12.Pt()) ;
+       }
+       if(a<0.9){
+          snprintf(key,55,"hMCMassPtDisp_a09_cen%d",fCenBin) ;
+          FillHistogram(key,p12.M() ,p12.Pt()) ;
+          if(a<0.8){
+            snprintf(key,55,"hMCMassPtDisp_a08_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.7){
+              snprintf(key,55,"hMCMassPtDisp_a07_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+            }
+          }
+        }
 
        if(ph1->IsCPVOK() && ph2->IsCPVOK()){
          snprintf(key,55,"hMCMassPtBoth_cen%d",fCenBin) ;
          FillHistogram(key,p12.M() ,p12.Pt()) ;
+         snprintf(key,55,"hMCMassPtBothcore_cen%d",fCenBin) ;
+         FillHistogram(key,pv12.M(), pv12.Pt()) ;
+          if(a<0.9){
+            snprintf(key,55,"hMCMassPtBoth_a09_cen%d",fCenBin) ;
+            FillHistogram(key,p12.M() ,p12.Pt()) ;
+            if(a<0.8){
+              snprintf(key,55,"hMCMassPtBoth_a08_cen%d",fCenBin) ;
+              FillHistogram(key,p12.M() ,p12.Pt()) ;
+              if(a<0.7){
+                snprintf(key,55,"hMCMassPtBoth_a07_cen%d",fCenBin) ;
+                FillHistogram(key,p12.M() ,p12.Pt()) ;
+              }
+            }
+          }
         }
       }
     } // end of loop i2
   } // end of loop i1
-
+}
+//____________________________________________________________________________
+Double_t  AliAnalysisTaskPi0Efficiency::CoreEnergy(AliPHOSAodCluster * clu){  
+  //calculate energy of the cluster in the circle with radius distanceCut around the maximum
   
+  //Can not use already calculated coordinates?
+  //They have incidence correction...
+  const Double_t distanceCut =3.5 ;
+  const Double_t logWeight=4.5 ;
+  
+  Double32_t * elist = clu->GetCellsAmplitudeFraction() ;  
+// Calculates the center of gravity in the local PHOS-module coordinates
+  Float_t wtot = 0;
+  Double_t xc[100]={0} ;
+  Double_t zc[100]={0} ;
+  Double_t x = 0 ;
+  Double_t z = 0 ;
+  Int_t mulDigit=TMath::Min(100,clu->GetNCells()) ;
+  for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
+    Int_t relid[4] ;
+    Float_t xi ;
+    Float_t zi ;
+    fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
+    fPHOSGeo->RelPosInModule(relid, xi, zi);
+    xc[iDigit]=xi ;
+    zc[iDigit]=zi ;
+    if (clu->E()>0 && elist[iDigit]>0) {
+      Float_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
+      x    += xc[iDigit] * w ;
+      z    += zc[iDigit] * w ;
+      wtot += w ;
+    }
+  }
+  if (wtot>0) {
+    x /= wtot ;
+    z /= wtot ;
+  }
+  Double_t coreE=0. ;
+  for(Int_t iDigit=0; iDigit < mulDigit; iDigit++) {
+    Double_t distance = TMath::Sqrt((xc[iDigit]-x)*(xc[iDigit]-x)+(zc[iDigit]-z)*(zc[iDigit]-z)) ;
+    if(distance < distanceCut)
+      coreE += elist[iDigit] ;
+  }
+  //Apply non-linearity correction
+  return (0.0241+1.0504*coreE+0.000249*coreE*coreE) ;
 }
 
-
+  
index 2203dd0..679b6a3 100644 (file)
@@ -16,6 +16,7 @@ class AliPHOSGeometry;
 class AliAODEvent ;\r
 class AliPHOSCalibData;\r
 class AliAODTrack ;\r
+class AliPHOSAodCluster ;\r
 \r
 \r
 #include "AliAnalysisTaskSE.h"\r
@@ -35,17 +36,19 @@ public:
     printf("Set %s \n",fPHOSBadMap[mod]->GetName());\r
   }\r
   \r
-private:\r
-  AliAnalysisTaskPi0Efficiency(const AliAnalysisTaskPi0Efficiency&); // not implemented\r
-  AliAnalysisTaskPi0Efficiency& operator=(const AliAnalysisTaskPi0Efficiency&); // not implemented\r
+protected:\r
+  AliAnalysisTaskPi0Efficiency(const AliAnalysisTaskPi0Efficiency& a):AliAnalysisTaskSE(a){} // not implemented\r
+  AliAnalysisTaskPi0Efficiency& operator=(const AliAnalysisTaskPi0Efficiency& ){return *this;} // not implemented\r
   Bool_t IsGoodChannel(const char * det, Int_t mod,Int_t ix, Int_t iz); //Use addisional bad map for PHOS\r
   void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key\r
   void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key\r
   void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key\r
-  Bool_t TestLambda(Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons\r
+  Bool_t TestLambda(Double_t e,Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons\r
+  Bool_t TestLambda2(Double_t e,Double_t l1,Double_t l2) ;  //Evaluate Dispersion cuts for photons\r
   void ProcessMC() ;\r
+  Double_t CoreEnergy(AliPHOSAodCluster * clu); \r
  \r
-private:\r
+protected:\r
   AliStack * fStack ;\r
   TList * fOutputContainer;        //final histogram container\r
   TList * fPHOSEvents[1][10][11] ; //Containers for events with PHOS photons\r
index 674377b..722bee4 100644 (file)
@@ -117,7 +117,6 @@ void AliPHOSEmbedding::UserExec(Option_t *) {
   if( acentrality <= 0. || acentrality>80.){
     return;
   }
-
   
   //Read next AOD event
   //If necesary method checks if AOD event is good to embed
@@ -132,9 +131,7 @@ void AliPHOSEmbedding::UserExec(Option_t *) {
   Init() ;
 
   //Remember PHOS digits before any modification
-  if(fCellsPHOS)
-    delete fCellsPHOS ;
-  fCellsPHOS = new AliESDCaloCells(*(event->GetPHOSCells())) ;
+  CopyRecalibrateDigits() ;
 
   //First re-reconstruct existing digits to ensure identical reconstruction before and 
   //after embeding
@@ -159,6 +156,39 @@ void AliPHOSEmbedding::UserExec(Option_t *) {
   PostData(0, fTreeOut);
 }
 //______________________________________________________________________________
+void AliPHOSEmbedding::CopyRecalibrateDigits(){
+  //Recalibrate digits if there is better calibration ("new") 
+  //exists than one used in reconstruction ("ESD")
+  
+  AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
+  if(fCellsPHOS)
+    delete fCellsPHOS ;
+  fCellsPHOS = new AliESDCaloCells() ;
+  fCellsPHOS->CreateContainer(event->GetPHOSCells()->GetNumberOfCells());
+
+  //Apply recalibration if necessary to account for
+  //difference between calibration used in reconstruction and 
+  //final calibration
+//  if(fOldPHOSCalibration[0]){ //there is a difference in calibrations
+    for (Short_t icell = 0; icell < event->GetPHOSCells()->GetNumberOfCells(); icell++) {
+      Short_t id=0;
+      Double_t time=0., amp=0. ;
+      Short_t mclabel; 
+      Double_t efrac =0. ;
+//      if (fCellsPHOS->GetCell(icell, id, amp,time,mclabel,efrac) != kTRUE)
+      if (event->GetPHOSCells()->GetCell(icell, id, amp,time,mclabel,efrac) != kTRUE)
+        break;      
+      Int_t relId[4] ;
+      AliPHOSGeometry::GetInstance()->AbsToRelNumbering(id,relId);
+      Float_t calibESD=fOldPHOSCalibration[relId[0]-1]->GetBinContent(relId[2],relId[3]) ;
+      Float_t calibNew=fPHOSReconstructor->Calibrate(1.,id) ;
+      if(calibESD>0.)
+        amp=amp*calibNew/calibESD ;
+      fCellsPHOS->SetCell(icell, id, amp, time,mclabel,efrac);     
+    }
+//  }  
+}
+//______________________________________________________________________________
 void AliPHOSEmbedding::Init(){
   if(fInitialized)
     return ;
@@ -191,7 +221,7 @@ void AliPHOSEmbedding::Init(){
 
 //________________________________________________________________________
 AliAODEvent* AliPHOSEmbedding::GetNextSignalEvent(){
-  //Read AOD event from the chain
+  //Read signal AOD event from the chain
   
   if(fAODChain==0){
     AliError("No chain to read signal events") ;
@@ -259,6 +289,13 @@ void AliPHOSEmbedding::MakeEmbedding(AliESDEvent *event,AliAODEvent * signal){
   
   //create digits
   MakeDigits(signal);    
+
+/*  
+for(Int_t i=0;i<fDigitsArr->GetEntriesFast();i++){  
+   AliPHOSDigit * d = (AliPHOSDigit *) fDigitsArr->At(i) ;
+   printf("  Digit(%d) = %d, E=%f \n",i,d->GetId(),d->GetEnergy()) ;
+}
+*/
   
   //clusterize and make tracking
   fPHOSReconstructor->Reconstruct(fDigitsTree,fClustersTree) ;
@@ -339,8 +376,7 @@ void AliPHOSEmbedding::ConvertPHOSCells(const AliESDEvent& esd)
     aodPHcells.CreateContainer(nPHcell);
     aodPHcells.SetType(AliAODCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
-      aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),
-                         esdPHcells.GetTime(iCell),esdPHcells.GetMCLabel(iCell),0);
+      aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),esdPHcells.GetTime(iCell),-1,0.);
     }
     aodPHcells.Sort();
   }
@@ -358,8 +394,7 @@ void AliPHOSEmbedding::ConvertEMCALCells(const AliESDEvent& esd)
     aodEMcells.CreateContainer(nEMcell);
     aodEMcells.SetType(AliAODCaloCells::kEMCALCell);
     for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
-      aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell),
-                         esdEMcells.GetTime(iCell),esdEMcells.GetMCLabel(iCell),0);
+      aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell),esdEMcells.GetTime(iCell));
     }
     aodEMcells.Sort();
   }
@@ -501,8 +536,7 @@ void AliPHOSEmbedding::ConvertEmbeddedClusters(const AliESDEvent* esd)
     fEmbeddedCells->CreateContainer(nPHcell);
     fEmbeddedCells->SetType(AliAODCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
-      fEmbeddedCells->SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),
-                              esdPHcells.GetTime(iCell),esdPHcells.GetMCLabel(iCell),0);
+      fEmbeddedCells->SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell),esdPHcells.GetTime(iCell));
     }
     fEmbeddedCells->Sort();
   }
@@ -613,7 +647,9 @@ void AliPHOSEmbedding::ConvertHeader(AliESDEvent & esd){
   } 
   
   //EventPlane
-  Double_t epQ=TPCrp(&esd);
+  AliEventplane *eventplane = (dynamic_cast<AliESDEvent*>(InputEvent()))->GetEventplane();
+  Double_t epQ = eventplane->GetEventplane("Q"); 
+  
   //Standard Eventplane setter is too complicated...
   //use durty hack
   header->SetZDCN1Energy(epQ) ;
@@ -694,8 +730,9 @@ void AliPHOSEmbedding::ConvertPrimaryVertices(AliESDEvent const&esd){
 //__________________________________________________________________________________
 void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
   
-    //-------------------------------------------------------------------------------------
-  //Transform CaloCells into Digits
+  //-------------------------------------------------------------------------------------
+  //Transform CaloCells into Digits which can be used for standard reconstruction
+  //Add signal digits to the event
   //-------------------------------------------------------------------------------------
   
   fDigitsArr->Clear() ;
@@ -704,9 +741,11 @@ void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
   //First copy data digits
   Int_t ndigit=0 ;
   for (Short_t icell = 0; icell < fCellsPHOS->GetNumberOfCells(); icell++) {
-    Short_t id=0, mcLabel=-1;
-    Double_t time=0., amp=0., efrac = 0. ;
-    if (fCellsPHOS->GetCell(icell, id, amp, time,mcLabel,efrac) != kTRUE)
+    Short_t id=0;
+    Double_t time=0., amp=0. ;
+    Short_t mclabel;
+    Double_t efrac =0. ;
+    if (fCellsPHOS->GetCell(icell, id, amp, time,mclabel, efrac) != kTRUE)
       break;
         
     new((*fDigitsArr)[ndigit]) AliPHOSDigit(-1,id,float(amp),float(time),ndigit);
@@ -719,17 +758,16 @@ void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
   Int_t isdigit=0 ;
   if(signal){
     AliAODCaloCells* cellsS = signal->GetPHOSCells();
-//    Int_t cellLabels[cellsS->GetNumberOfCells()]={0} ;
-//    Int_t cellSecondLabels[cellsS->GetNumberOfCells()]={0} ;
     Int_t cellLabels[1000]={0} ;       //1000 should be enough for simulated
     Int_t cellSecondLabels[1000]={0} ; //low-statistics event.
     for(Int_t i=0;i<cellsS->GetNumberOfCells();i++){
       cellLabels[i]=-1 ;
       cellSecondLabels[i]=-1;
-   }
-//  printf("===========Signal clusters==============\n") ;
+    }
     //------------------------------------------------------------------------------------
     //Ancestry information
+    //Celect digits contributing to signal clusters and add primary information
+    //(it is not stored in CaloCells)
     //------------------------------------------------------------------------------------
     sdigits.Expand(cellsS->GetNumberOfCells());
     for(Int_t i=0; i<signal->GetNumberOfCaloClusters(); i++) {    
@@ -738,25 +776,19 @@ void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
     
       if(!clus->IsPHOS())
         continue;
-/*    
-    printf("Signal clu(%d): E=%f \n",i,clus->E()) ;
-    UShort_t * ind    = clus->GetCellsAbsId() ;
-    for(Int_t ic=0; ic < clus->GetNCells(); ic++ )
-      printf("Dig(%d)=%d, ",ic,ind[ic]) ;
-  printf("\n") ;
-*/   
     
       Int_t label = clus->GetLabel();
       Int_t label2 = -1 ;
       if (clus->GetNLabels()>=2) label2 = clus->GetLabelAt(1) ;
     
       UShort_t * index    = clus->GetCellsAbsId() ;
-    
       for(Int_t ic=0; ic < clus->GetNCells(); ic++ ){
         for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++){
-          Short_t cellNumber, mcLabel = -1;
-          Double_t cellAmplitude=0., cellTime=0., efrac = 0 ;
-          cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mcLabel,efrac) ;
+          Short_t cellNumber;
+          Double_t cellAmplitude=0., cellTime=0. ;
+           Short_t mclabel;
+           Double_t efrac =0. ;
+          cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mclabel,efrac) ;
           if(cellNumber==index[ic]){
              cellLabels[icell]=label;
               cellSecondLabels[icell]=label2;
@@ -765,35 +797,23 @@ void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
         }
       }
     }
-// printf("================End Signal==================\n") ;
 
     for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++) {
-      Short_t cellNumber, mcLabel = -1;
-      Double_t cellAmplitude=0., cellTime=0., efrac ;
-      if (cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime, mcLabel, efrac) != kTRUE)
+      Short_t cellNumber;
+      Double_t cellAmplitude=0., cellTime=0. ;
+      Short_t mclabel;
+      Double_t efrac =0. ;
+      if (cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mclabel,efrac) != kTRUE)
         break;
       //Add only digits related to the cluster, no noisy digits...
-      if(cellLabels[icell]==-1)
+      if(cellLabels[icell]==-1){
         continue ;
-    
+      }    
       new(sdigits[isdigit]) AliPHOSDigit(cellLabels[icell],cellNumber,float(cellAmplitude),float(cellTime),isdigit);    
       isdigit++;
     }
   }
-  
-  //If necessary, take into account difference between calibration used to produce ESD and
-  //final calibration
-  if(fOldPHOSCalibration[0]){ //there is a difference
-    for(Int_t i=0; i<isdigit;i++){
-      AliPHOSDigit * sdigit=static_cast<AliPHOSDigit*>(sdigits.At(i)) ;
-      Int_t relId[4] ;
-      AliPHOSGeometry::GetInstance()->AbsToRelNumbering(sdigit->GetId(),relId);
-      Float_t calibESD=fOldPHOSCalibration[relId[0]-1]->GetBinContent(relId[2],relId[3]) ;
-      Float_t calibNew=fPHOSReconstructor->Calibrate(1.,sdigit->GetId()) ;
-      if(calibNew>0.)
-        sdigit->SetEnergy(sdigit->GetEnergy()*calibESD/calibNew) ;
-    }
-  }
+
   
   //Merge digits  
   Int_t icurrent = 0 ; //index of the last used digit in underlying event
@@ -821,22 +841,14 @@ void AliPHOSEmbedding::MakeDigits(AliAODEvent * signal){
   }
  
   //Change Amp back from Energy to ADC counts
+  //Note that Reconstructor uses best ("new") calibration
   for(Int_t i=0; i<ndigit;i++){
      AliPHOSDigit * digit=static_cast<AliPHOSDigit*>(fDigitsArr->At(i)) ;
-     Float_t calib = 0 ; 
-     if(fOldPHOSCalibration[0]){ //Use old calibration
-        Int_t relId[4] ;
-       AliPHOSGeometry::GetInstance()->AbsToRelNumbering(digit->GetId(),relId);
-        calib=fOldPHOSCalibration[relId[0]-1]->GetBinContent(relId[2],relId[3]) ;
-     }
-     else{
-       calib=fPHOSReconstructor->Calibrate(1.,digit->GetId()) ;        
-     }
+     Float_t calib =fPHOSReconstructor->Calibrate(1.,digit->GetId()) ; 
      if(calib>0.)
        digit->SetEnergy(digit->GetEnergy()/calib) ;
   }  
-  
-   
+     
   fDigitsArr->Sort() ;
   for (Int_t i = 0 ; i < ndigit ; i++) { 
     AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( fDigitsArr->At(i) ) ; 
@@ -856,56 +868,6 @@ void AliPHOSEmbedding::SetOldCalibration(TH2F **calibH){
     fOldPHOSCalibration[i]->SetName(name) ;
   }
 }  
-//___________________________________________________________________________
-Double_t AliPHOSEmbedding::TPCrp(const AliESDEvent * event){
-  //calculate reaction plain in TPC
-  Double_t rp=999 ; //!Reaction plain calculated with full TPC 
-  
-  Double_t cosF=0.,sinF=0.,nF=0.;
-  for (Int_t i=0;i<event->GetNumberOfTracks();i++) {
-    AliESDtrack *track = event->GetTrack(i) ;
-    if(!SelectTrack(track))
-      continue ;
-    Double_t eta= track->Eta() ;
-    if(TMath::Abs(eta)> 0.9)
-      continue ;
-    Double_t phi=track->Phi();
-    Double_t cos2phi=TMath::Cos(2.*phi) ;
-    Double_t sin2phi=TMath::Sin(2.*phi) ;
-    cosF+=cos2phi ;
-    sinF+=sin2phi ;
-    nF+=1. ;
-  }
-  if(nF>0){
-    rp=0.5*TMath::ATan2(sinF,cosF) ;
-  }
-  return rp ;
-  
-}
-//___________________________________________________________________________
-Bool_t AliPHOSEmbedding::SelectTrack(AliESDtrack * t){
-  //estimate if this track can be used for the RP calculation
-  Float_t pt=t->Pt();
-  if(pt<0.15 || pt>5.)
-    return kFALSE ;
-//  if(!fESDtrackCuts->AcceptTrack(t))
-//    return kFALSE ;
-  if(t->GetTPCNcls()<70) 
-    return kFALSE;
-/*
-  Float_t dcaXY=t->DCA();
-  Float_t dcaZ=t->ZAtDCA() ;
-  t->GetImpactParametersTPC(&dcaXY,&dcaZ);
-  if (TMath::Abs(dcaZ)>3)
-    return kFALSE;
-  if (TMath::Abs(dcaXY)>3.) 
-    return kFALSE;
-*/  
-  return kTRUE ;
-
-
-}
 //____________________________________________________________________________
 void AliPHOSEmbedding::InitMF(){
   
@@ -1042,7 +1004,7 @@ void AliPHOSEmbedding::InitGeometry(){
         
   if(AliGeomManager::GetNalignable("GRP") != 0)
       loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules
-  AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data());
+//  AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data());
 
   AliCDBManager::Instance()->UnloadFromCache("*/Align/*");
   AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data");
@@ -1053,14 +1015,32 @@ Float_t AliPHOSEmbedding::TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t c
   //Parameterization of LHC10h period
   //_true if neutral_
   
-  Double_t z0=0.84 ; //Both charges
-  Double_t sz=TMath::Min(2.75,2.*3.*3./(pt*pt+3.*3.)+1.);
-  Double_t x0=TMath::Min(7.6, 27.4628*TMath::Exp(-(pt+13.3572)*(pt+13.3572)/2./6.29214/6.29214)+
-                                    243.020*0.0526626*0.0526626/(pt*pt+0.0526626*0.0526626)) ;
-  if(charge>0)
-    x0=-x0 ;
-  Double_t sx=TMath::Min(5.4,9.9*TMath::Exp(-pt/0.31)+0.5*0.4*0.4/((pt-1.2)*(pt-1.2)+0.4*0.4)+1.5);
-  Double_t rz=(dz-z0)/sz ;
-  Double_t rx=(dx-x0)/sx ;
-  return TMath::Sqrt(rx*rx+rz*rz)/2. ;
+  Double_t meanX=0;
+  Double_t meanZ=0.;
+  Double_t sx=TMath::Min(5.4,2.59719e+02*TMath::Exp(-pt/1.02053e-01)+
+              6.58365e-01*5.91917e-01*5.91917e-01/((pt-9.61306e-01)*(pt-9.61306e-01)+5.91917e-01*5.91917e-01)+1.59219);
+  Double_t sz=TMath::Min(2.75,4.90341e+02*1.91456e-02*1.91456e-02/(pt*pt+1.91456e-02*1.91456e-02)+1.60) ;
+  
+  AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
+  Double_t mf = event->GetMagneticField(); //Positive for ++ and negative for --
+
+  if(mf<0.){ //field --
+    meanZ = -0.468318 ;
+    if(charge>0)
+      meanX=TMath::Min(7.3, 3.89994*1.20679*1.20679/(pt*pt+1.20679*1.20679)+0.249029+2.49088e+07*TMath::Exp(-pt*3.33650e+01)) ;
+    else
+      meanX=-TMath::Min(7.7,3.86040*0.912499*0.912499/(pt*pt+0.912499*0.912499)+1.23114+4.48277e+05*TMath::Exp(-pt*2.57070e+01)) ;
+  }
+  else{ //Field ++
+    meanZ= -0.468318;
+    if(charge>0)
+      meanX=-TMath::Min(8.0,3.86040*1.31357*1.31357/(pt*pt+1.31357*1.31357)+0.880579+7.56199e+06*TMath::Exp(-pt*3.08451e+01)) ;
+    else
+      meanX= TMath::Min(6.85, 3.89994*1.16240*1.16240/(pt*pt+1.16240*1.16240)-0.120787+2.20275e+05*TMath::Exp(-pt*2.40913e+01)) ;     
+  }
+
+  Double_t rz=(dz-meanZ)/sz ;
+  Double_t rx=(dx-meanX)/sx ;
+  return TMath::Sqrt(rx*rx+rz*rz) ;
 }
+
index b67bb8f..41e4ae2 100644 (file)
@@ -22,16 +22,17 @@ public:
   AliPHOSEmbedding(const char *name = "AliPHOSEmbedding");\r
   virtual ~AliPHOSEmbedding() {}\r
   \r
+  //Standard methods\r
   virtual void   UserCreateOutputObjects();\r
   virtual void   UserExec(Option_t *option);\r
   virtual void   Terminate(Option_t *){}\r
   \r
-\r
+  //Chain with signal AOD for embedding\r
   void SetSignalChain(TChain * signal){fAODChain =signal;}\r
 \r
-  void SetOldCalibration(TH2F **calib) ; \r
   //Calibration used in reconstruction of real data (ESDs)\r
   //If not set, assume same calibration as set by default\r
+  void SetOldCalibration(TH2F **calib) ; \r
 \r
 private:\r
   AliPHOSEmbedding(const AliPHOSEmbedding&); // not implemented\r
@@ -43,9 +44,12 @@ private:
   \r
   AliAODEvent * GetNextSignalEvent(void) ;\r
 \r
+  void CopyRecalibrateDigits(void) ;\r
   void MakeEmbedding(AliESDEvent * data, AliAODEvent * signal) ;\r
   void MakeDigits(AliAODEvent* signal) ;  \r
 \r
+  //Convert ESD with embedded signal to AOD\r
+  //First standard stuff\r
   void ConvertESDtoAOD(AliESDEvent *esd) ;\r
   void ConvertHeader(AliESDEvent &esd) ;\r
   void ConvertPrimaryVertices(const AliESDEvent &esd) ;\r
@@ -53,12 +57,11 @@ private:
   void ConvertEMCALCells(const AliESDEvent &esd) ;\r
   void ConvertPHOSCells(const AliESDEvent &esd) ;\r
   \r
+  //Add new branch\r
   void ConvertEmbeddedClusters(const AliESDEvent *esd) ;\r
   void ConvertEmbeddedCells(const AliESDEvent *esd) ;\r
   void ConvertMCParticles(const AliAODEvent *aod) ;\r
 \r
-  Double_t TPCrp(const AliESDEvent * event) ;\r
-  Bool_t SelectTrack(AliESDtrack * t) ;  \r
   Float_t TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t charge) ;\r
   \r
 \r
@@ -66,7 +69,7 @@ private:
 \r
   TTree * fDigitsTree ;  //! Digits\r
   TTree * fClustersTree; //! Clusters\r
-  TTree * fTreeOut; //Output AOD\r
+  TTree * fTreeOut;      //Output AOD\r
   TClonesArray * fDigitsArr ; //!\r
 \r
   TClonesArray * fEmbeddedClusters ; //!\r
index 6d7acef..e5f2aa6 100644 (file)
@@ -13,7 +13,9 @@ void AnalyzeDiff()
   gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");
 
   // A task can be compiled dynamically with AClic
-  gROOT->LoadMacro("AliCaloPhoton.cxx+g");
+  gSystem->Load("AliCaloPhoton_cxx");
+//  gSystem->Load("AliAnalysisTaskPi0Efficiency_cxx");
+  gROOT->LoadMacro("AliAnalysisTaskPi0Efficiency.cxx+g");
   gROOT->LoadMacro("AliAnalysisTaskPi0DiffEfficiency.cxx+g");
   
   // Create the chain
index c180bb3..c80e86e 100644 (file)
@@ -30,7 +30,7 @@
 #include "STRUCT/AliFRAMEv2.h"
 #include "STRUCT/AliSHILv3.h"
 #include "STRUCT/AliPIPEv3.h"
-#include "ITS/AliITSv11.h"
+#include "ITS/AliITSv11Hybrid.h"
 #include "TPC/AliTPCv2.h"
 #include "TOF/AliTOFv6T0.h"
 #include "HMPID/AliHMPIDv3.h"
@@ -206,27 +206,37 @@ void Config()
       gener = MbPhojet();
   }
 */  
-/*
+
+printf("Creating Hagedorn generator \n") ;
    AliGenCocktail *gener  = new AliGenCocktail();
 
+    myIp * my = new myIp(111) ;
+
+
    AliGenPHOSlib * lib = new AliGenPHOSlib() ;
-   //4pi0
-   AliGenParam *genPHOS = new AliGenParam(4,AliGenPHOSlib::kPion,lib->GetPt(AliGenPHOSlib::kPi0),lib->GetY(AliGenPHOSlib::kPi0Flat),lib->GetIp(AliGenPHOSlib::kPi0)) ;
-   genPHOS->SetPhiRange(250.,330.) ;
-   genPHOS->SetYRange(-0.15.,0.15) ;
-   genPHOS->SetPtRange(0.5,30.) ;
+   //2pi0
+   AliGenParam *genPHOS = new AliGenParam(1,AliGenPHOSlib::kPion, my->GetPt(AliGenPHOSlib::kPion, ""),
+                                            lib->GetY(AliGenPHOSlib::kPi0Flat),
+                                            my->GetV2(AliGenPHOSlib::kPi0Flat,""),
+                                            my->GetIp(AliGenPHOSlib::kPi0)) ;
+   genPHOS->SetPhiRange(260.,320.) ;
+   genPHOS->SetYRange(-0.125.,0.125) ;
+   genPHOS->SetPtRange(1.,10.) ; 
+//   genPHOS->SetPtRange(2.,10.) ; 
+   genPHOS->SetForceDecay(kNoDecay);
    gener->AddGenerator(genPHOS,"PHOS",1.) ;
-*/
 
+
+/*
 printf("Creating FLAT generator \n") ;
 
-   gener = new AliGenBox(2) ;
+   gener = new AliGenBox(1) ;
    gener->SetPhiRange(250.,330.) ;
    gener->SetYRange(-0.15.,0.15) ;
-   gener->SetEtaRange(-0.15,0.15) ;
    gener->SetPtRange(0.5,30.) ;
    gener->SetPart(111) ;
 
+*/
   //
   //
   // Size of the interaction diamond
@@ -342,7 +352,7 @@ printf("Creating FLAT generator \n") ;
     {
         //=================== ITS parameters ============================
 
-       AliITS *ITS  = new AliITSv11("ITS","ITS v11");
+       AliITS *ITS  = new AliITSv11("ITS","ITS v11");
     }
 
     if (iTPC)
index 502c502..3c9aaae 100644 (file)
@@ -1,3 +1,4 @@
+//Bool_t AddTrackCutsLHC10h(AliAnalysisTaskESDfilter* esdFilter);
 void CreateAOD()
 {
   // Main
@@ -15,13 +16,7 @@ void CreateAOD()
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libANALYSISalice.so");
   gSystem->Load("libCORRFW.so");
-  gSystem->Load("libPWGHFbase.so");
-  gSystem->Load("libPWGmuon.so");
-  gSystem->Load("libTENDER.so");
-//gSystem->Load("libTENDERSupplies.so"); 
 
-  gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS");
-  gROOT->LoadMacro("AliPHOSDigitDecalibrate.cxx++") ;
 
   //Data
   TChain *chain       = new TChain("esdTree") ;
@@ -59,46 +54,191 @@ void CreateAOD()
     coutput1 = mgr->GetCommonOutputContainer();
 
 
+   // Create the task, add it to the manager and configure it.
+   //===========================================================================   
+   // Barrel tracks filter
+   AliAnalysisTaskESDfilter *esdfilter = new AliAnalysisTaskESDfilter("ESD Filter");
+//   esdfilter->SetTimeZeroType(AliESDpid::kTOF_T0);
+//   esdfilter->DisableCascades();
+//   esdfilter->DisableKinks();
+  
+   mgr->AddTask(esdfilter);
+  
+   
+   // Filtering of MC particles (decays conversions etc)
+   // this task has to go AFTER all other filter tasks
+   // since it fills the AODMC array with all
+   // selected MC Particles, only this way we have the 
+   // AODMCparticle information available for following tasks
+   AliAnalysisTaskMCParticleFilter *kinefilter = new AliAnalysisTaskMCParticleFilter("Particle Kine Filter");
+   mgr->AddTask(kinefilter);
 
-    //========= Add tender to the ANALYSIS manager and set default storage =====
+   
+  Printf("%s%d: Creating Track Cuts for LH10h",(char*)__FILE__,__LINE__);
 
-    AliTender *tender=new AliTender("AnalysisTender");
-    tender->SetDefaultCDBStorage("local://$ALICE_ROOT/OCDB"); //comment this you acess grid
-    mgr->AddTask(tender);
+  // Cuts on primary tracks
+  AliESDtrackCuts* esdTrackCutsL = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+  
+  // ITS stand-alone tracks
+  AliESDtrackCuts* esdTrackCutsITSsa = new AliESDtrackCuts("ITS stand-alone Track Cuts", "ESD Track Cuts");
+  esdTrackCutsITSsa->SetRequireITSStandAlone(kTRUE);
+  
+  // Pixel OR necessary for the electrons
+  AliESDtrackCuts *itsStrong = new AliESDtrackCuts("ITSorSPD", "pixel requirement for ITS");
+  itsStrong->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
+  
+  
+  // PID for the electrons
+  AliESDpidCuts *electronID = new AliESDpidCuts("Electrons", "Electron PID cuts");
+  electronID->SetTPCnSigmaCut(AliPID::kElectron, 3.);
+  
+  // tighter cuts on primary particles for high pT tracks
+  // take the standard cuts, which include already 
+  // ITSrefit and use only primaries...
+  
+  // ITS cuts for new jet analysis 
+  //  gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/CreateTrackCutsPWGJE.C");
+  //  AliESDtrackCuts* esdTrackCutsHG0 = CreateTrackCutsPWGJE(10001006);
 
-    //========= Attach PHOS supply ======
-    AliPHOSDigitDecalibrate *PHOSSupply=new AliPHOSDigitDecalibrate("PHOStender");
-    tender->AddSupply(PHOSSupply);
-    TFile * fDecalib = TFile::Open("Decalibraiton.root") ;
-    char key[55] ;
-    for(Int_t mod=0; mod<5; mod++){
-      sprintf(key,"DecalibrMod%d",mod) ;
-      TH2F * h = (TH2F*)fDecalib->Get(key) ;
-      PHOSSupply->SetDecalibration(mod,h) ;
-    }
-    fDecalib->Close() ;
+  AliESDtrackCuts *jetCuts1006 = new AliESDtrackCuts("AliESDtrackCuts"); 
 
-    //================================================
-    //              data containers
-    //================================================
+  TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
+  jetCuts1006->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
+  jetCuts1006->SetMinNClustersTPC(70);
+  jetCuts1006->SetMaxChi2PerClusterTPC(4);
+  jetCuts1006->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
+  jetCuts1006->SetAcceptKinkDaughters(kFALSE);
+  jetCuts1006->SetRequireTPCRefit(kTRUE);
+  jetCuts1006->SetMaxFractionSharedTPCClusters(0.4);
+  // ITS
+  jetCuts1006->SetRequireITSRefit(kTRUE);
+  //accept secondaries
+  jetCuts1006->SetMaxDCAToVertexXY(2.4);
+  jetCuts1006->SetMaxDCAToVertexZ(3.2);
+  jetCuts1006->SetDCAToVertex2D(kTRUE);
+  //reject fakes
+  jetCuts1006->SetMaxChi2PerClusterITS(36);
+  jetCuts1006->SetMaxChi2TPCConstrainedGlobal(36);
 
-    //            define output containers, please use 'username'_'somename'
-    AliAnalysisDataContainer *coutput1 =
-      mgr->CreateContainer("tender_event", AliESDEvent::Class(),
-                           AliAnalysisManager::kExchangeContainer,"default_tender");
-    //           connect containers
-    mgr->ConnectInput  (tender,  0, mgr->GetCommonInputContainer() );
-    mgr->ConnectOutput (tender,  1, coutput1);
+  jetCuts1006->SetRequireSigmaToVertex(kFALSE);
 
+  jetCuts1006->SetEtaRange(-0.9,0.9);
+  jetCuts1006->SetPtRange(0.15, 1E+15.);
 
+  AliESDtrackCuts* esdTrackCutsHG0 = jetCuts1006->Clone("JetCuts10001006");
+  esdTrackCutsHG0->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
 
 
+  // throw out tracks with too low number of clusters in
+  // the first pass (be consistent with TPC only tracks)
+  // N.B. the number off crossed rows still acts on the tracks after
+  // all iterations if we require tpc standalone, number of clusters
+  // and chi2 TPC cuts act on track after the first iteration
+  //   esdTrackCutsH0->SetRequireTPCStandAlone(kTRUE);
+  //   esdTrackCutsH0->SetMinNClustersTPC(80); // <--- first pass
+  
+  
+  // the complement to the one with SPD requirement
+  //  AliESDtrackCuts* esdTrackCutsHG1 = CreateTrackCutsPWGJE(10011006);
+  AliESDtrackCuts* esdTrackCutsHG1 = jetCuts1006->Clone("JetCuts10011006");
+  esdTrackCutsHG1->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone);
 
+  // the tracks that must not be taken pass this cut and
+  // non HGC1 and HG
+  //  AliESDtrackCuts* esdTrackCutsHG2 = CreateTrackCutsPWGJE(10021006);
+  AliESDtrackCuts* esdTrackCutsHG2 = jetCuts1006->Clone("JetCuts10021006");
+  esdTrackCutsHG2->SetMaxChi2PerClusterITS(1E10);
+
+
+  // standard cuts also used in R_AA analysis
+  //   "Global track RAA analysis QM2011 + Chi2ITS<36";
+  //  AliESDtrackCuts* esdTrackCutsH2 = CreateTrackCutsPWGJE(1000);
+  AliESDtrackCuts* esdTrackCutsH2 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
+  esdTrackCutsH2->SetMinNCrossedRowsTPC(120);
+  esdTrackCutsH2->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
+  esdTrackCutsH2->SetMaxChi2PerClusterITS(36);
+  esdTrackCutsH2->SetMaxFractionSharedTPCClusters(0.4);
+  esdTrackCutsH2->SetMaxChi2TPCConstrainedGlobal(36);
+
+  esdTrackCutsH2->SetEtaRange(-0.9,0.9);
+  esdTrackCutsH2->SetPtRange(0.15, 1e10);
+
+
+  //  AliESDtrackCuts* esdTrackCutsGCOnly = CreateTrackCutsPWGJE(10041006);
+  AliESDtrackCuts* esdTrackCutsGCOnly = jetCuts1006->Clone("JetCuts10041006");
+  esdTrackCutsGCOnly->SetRequireITSRefit(kFALSE);
+
+
+
+  // TPC only tracks
+  AliESDtrackCuts* esdTrackCutsTPCCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+  esdTrackCutsTPCCOnly->SetMinNClustersTPC(70);
+  
+  // Compose the filter
+  AliAnalysisFilter* trackFilter = new AliAnalysisFilter("trackFilter");
+  // 1, 1<<0
+  trackFilter->AddCuts(esdTrackCutsL);
+  // 2 1<<1
+  trackFilter->AddCuts(esdTrackCutsITSsa);
+  // 4 1<<2
+  trackFilter->AddCuts(itsStrong);
+  itsStrong->SetFilterMask(1);        // AND with Standard track cuts 
+  // 8 1<<3
+  trackFilter->AddCuts(electronID);
+  electronID->SetFilterMask(4);       // AND with Pixel Cuts
+  // 16 1<<4
+  trackFilter->AddCuts(esdTrackCutsHG0);
+  // 32 1<<5
+  trackFilter->AddCuts(esdTrackCutsHG1);
+  // 64 1<<6
+  trackFilter->AddCuts(esdTrackCutsHG2);
+  // 128 1<<7
+  trackFilter->AddCuts(esdTrackCutsTPCCOnly); // add QM TPC only track cuts
+  esdfilter->SetTPCOnlyFilterMask(128);
+  // 256 1<<8
+  trackFilter->AddCuts(esdTrackCutsGCOnly);
+  // 512 1<<9                         
+  AliESDtrackCuts* esdTrackCutsHG1_tmp = new AliESDtrackCuts(*esdTrackCutsHG1); // avoid double delete
+  trackFilter->AddCuts(esdTrackCutsHG1_tmp); // add once more for tpc only tracks
+  // 1024 1<<10                        
+  trackFilter->AddCuts(esdTrackCutsH2); // add r_aa cuts
+
+  
+  
+  esdfilter->SetGlobalConstrainedFilterMask(1<<8|1<<9); // these tracks are written out as global constrained tracks
+  esdfilter->SetHybridFilterMaskGlobalConstrainedGlobal((1<<4)); // these normal global tracks will be marked as hybrid
+  esdfilter->SetWriteHybridGlobalConstrainedOnly(kTRUE); // write only the complement
+  //     esdfilter->SetTPCConstrainedFilterMask(1<<11); // these tracks are written out as tpc constrained tracks
+
+  esdfilter->SetTrackFilter(trackFilter);
+      
+   
+
+   // Filter with cuts on V0s
+   AliESDv0Cuts*   esdV0Cuts = new AliESDv0Cuts("Standard V0 Cuts pp", "ESD V0 Cuts");
+   esdV0Cuts->SetMinRadius(0.2);
+   esdV0Cuts->SetMaxRadius(200);
+   esdV0Cuts->SetMinDcaPosToVertex(0.05);
+   esdV0Cuts->SetMinDcaNegToVertex(0.05);
+   esdV0Cuts->SetMaxDcaV0Daughters(1.5);
+   esdV0Cuts->SetMinCosinePointingAngle(0.99);
+   AliAnalysisFilter* v0Filter = new AliAnalysisFilter("v0Filter");
+   v0Filter->AddCuts(esdV0Cuts);
+
+   esdfilter->SetV0Filter(v0Filter);
+
+   // Create ONLY the output containers for the data produced by the task.
+   // Get and connect other common input/output containers via the manager as below
+   //==============================================================================
+   mgr->ConnectInput  (esdfilter,  0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (esdfilter,  0, mgr->GetCommonOutputContainer());
+   mgr->ConnectInput  (kinefilter,  0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (kinefilter,  0, mgr->GetCommonOutputContainer());
+   AliAnalysisDataContainer *coutputEx = mgr->CreateContainer("cFilterList", TList::Class(),
+                                                                  AliAnalysisManager::kOutputContainer,"pyxsec_hists.root");
+   mgr->ConnectOutput (kinefilter,  1,coutputEx);
 
-    
-    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
-    AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kTRUE);
     
     //-----------------------
     // Run the analysis
index 4145cd5..0944b0e 100644 (file)
@@ -3,13 +3,16 @@ These are tasks to perform PHOS embedding. Steps are following:
 2. Performs simulation of the same number of events, using enclosed Config.C 
    (single pi0 per event with flat or Hagedorn spectrum)
    then simulated signals are reconstructed clusters and converted to AOD
+   There are several special moments:
+   - no noise is added to digits in simulation (special setting in sim.C)
+   - all digits are copied to CaloCells (threshold is zero in cpecial RecoParams) 
 3. Then class AliPHOSEmbedding is called
    - read data ESDs, extract PHOS calocells, convert them to PHOSDigits
    - run default reconstruction to avoid possible problems with different 
      OCDBs used now and in official reconstruction. Apply final calibration if necessary
    - merge digits with (re-calibrated if necessary) signal digits
    - reconstruct digits with embedding signal (with final calibration if necessary)
-4. As a result of all these procedures AOD is produced with
+4. As a result of all these procedures AliAODout file is produced with
    - MC information about embedded pi0s
    - standard CaloClosters, CaloCells with final calibration
    - Embedded CaloClusters, embedded CaloCells with final calibration
diff --git a/PWGGA/PHOSTasks/PHOS_embedding/UpdateRecoParam.C b/PWGGA/PHOSTasks/PHOS_embedding/UpdateRecoParam.C
new file mode 100644 (file)
index 0000000..40b4982
--- /dev/null
@@ -0,0 +1,82 @@
+UpdateRecoParam(const Int_t runNumber)
+{
+  // Read the array of PHOS recoparam objects from OCDB and update
+  // EMC fitter version to "v4".
+  // Write the updated object to OCDB.
+  // Yuri Kharlov. 9.12.2011
+  //
+  /* $Id: UpdateRecoParam.C 53497 2011-12-09 12:22:47Z kharlov $ */
+
+  AliCDBManager::Instance()->SetDefaultStorage("local://./OCDB");
+  AliCDBManager::Instance()->SetRun(runNumber);
+
+  AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("PHOS/Calib/RecoParam");
+  AliCDBMetaData *md = cdbEntry->GetMetaData();
+  cout << "Responsible: " << md->GetResponsible() << endl;
+  cout << "MD Comment : " << md->GetComment() << endl;
+  TObjArray* arrayRecoParam = (TObjArray*)cdbEntry->GetObject();
+
+  cout << "N recoparam = " << arrayRecoParam->GetEntries() << endl;
+
+  AliPHOSRecoParam *rp = 0;
+  for (Int_t i=0; i<arrayRecoParam->GetEntries(); i++) {
+    rp = (AliPHOSRecoParam*)arrayRecoParam->At(i);
+//    printf("RP %d: event specie = %d, fitter version = %s\n",
+//        i,rp->GetEventSpecie(),rp->EMCFitterVersion());
+    rp->SetEMCMinE(0.);
+  }
+
+  // Writing new recoparam to OCDB
+
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  cdb->SetDefaultStorage("local://PHOSRP");
+
+  AliCDBMetaData *md= new AliCDBMetaData();
+  md->SetResponsible("Dmitri Peresunko");
+  md->SetComment("PHOS recoparameters: EMC minimum energy set to 0. Should be used only for embedding!!");
+  AliCDBId id("PHOS/Calib/RecoParam",80000,AliCDBRunRange::Infinity());
+  cdb->Put(arrayRecoParam,id, md);
+
+}
+//-----------------------------------------------------------------------------
+
+ReadRecoParam(const Int_t runNumber)
+{
+  // Read the array of PHOS recoparam objects from OCDB and
+  // print its content to stdout
+
+  AliCDBManager::Instance()->SetDefaultStorage("local://./OCDB");
+  AliCDBManager::Instance()->SetRun(runNumber);
+
+  AliCDBEntry* cdbEntry = AliCDBManager::Instance()->Get("PHOS/Calib/RecoParam");
+  AliCDBMetaData *md = cdbEntry->GetMetaData();
+  printf("Responsible: %s\n",md->GetResponsible());
+  printf("MD Comment : %s\n",md->GetComment());
+  TObjArray* arrayRecoParam = (TObjArray*)cdbEntry->GetObject();
+
+  AliPHOSRecoParam *rp = 0;
+  for (Int_t i=0; i<arrayRecoParam->GetEntries(); i++) {
+    rp = (AliPHOSRecoParam*)arrayRecoParam->At(i);
+    printf("Recoparam %d: event specie = %d\n",
+          i,rp->GetEventSpecie());
+
+    printf("\tEMCClusteringThreshold = %g\n",rp->GetEMCClusteringThreshold());
+    printf("\tEMCLocalMaxCut         = %g\n",rp->GetEMCLocalMaxCut());
+    printf("\tEMCRawDigitThreshold   = %g\n",rp->GetEMCRawDigitThreshold());
+    printf("\tEMCMinE                = %g\n",rp->GetEMCMinE());
+    printf("\tEMCLogWeight           = %g\n",rp->GetEMCLogWeight());
+    printf("\tEMCSampleQualityCut    = %g\n",rp->GetEMCSampleQualityCut());
+    printf("\tEMCEcoreRadius         = %g\n",rp->GetEMCEcoreRadius());
+    printf("\tEMCEcore2ESD           = %d\n",rp->EMCEcore2ESD());
+    printf("\tEMCSubtractPedestals   = %d\n",rp->EMCSubtractPedestals());
+    printf("\tEMCToUnfold            = %d\n",rp->EMCToUnfold());
+    printf("\tEMCfitter version      = %s\n",rp->EMCFitterVersion());
+    printf("\tEMCEnergyCorrectionOn  = %d\n",rp->GetEMCEnergyCorrectionOn());
+    printf("\tGlobalAltroOffset      = %f\n",rp->GetGlobalAltroOffset());
+    printf("\tGlobalAltroThreshold   = %d\n",rp->GetGlobalAltroThreshold());
+    printf("\tTimeGateAmpThresh      = %g\n",rp->GetTimeGateAmpThresh());
+    printf("\tTimeGateLow            = %g\n",rp->GetTimeGateLow());
+    printf("\tTimeGateHigh           = %g\n",rp->GetTimeGateHigh());
+    printf("\tNonlinearityCorrectionVersion = %s\n",rp->GetNonlinearityCorrectionVersion());
+  }
+}
index 86bef89..69be721 100644 (file)
@@ -20,9 +20,10 @@ void rec() {
 //
 // Residual OCDB
 
-  reco.SetDefaultStorage("alien://folder=/alice/data/2010/OCDB");
-//  reco.SetDefaultStorage("local://./OCDB");
-  reco.SetSpecificStorage("PHOS/*/*","local://./OCDB");
+//  reco.SetDefaultStorage("alien://folder=/alice/data/2010/OCDB");
+  reco.SetDefaultStorage("local://./OCDB");
+//  reco.SetSpecificStorage("PHOS/*/*","local://./OCDB");
+  reco.SetSpecificStorage("PHOS/Calib/RecoParam","local://./PHOSRP");
 
 
 //  reco.SetRunReconstruction("PHOS EMCAL") ;
index 9782229..49018fc 100644 (file)
@@ -1,10 +1,12 @@
-void sim(Int_t nev=20) {
+void sim(Int_t nev=50) {
 
   if (gSystem->Getenv("SIM_EVENTS"))
     nev = atoi(gSystem->Getenv("SIM_EVENTS"));
 
   printf("GENERATE << %d >> events \n",nev);
 
+  gROOT->LoadMacro("IpPion.C++") ;
+
 
   AliSimulation simulator;
   simulator.SetMakeSDigits("PHOS");
@@ -30,6 +32,15 @@ void sim(Int_t nev=20) {
 
   simulator.SetSpecificStorage("GRP/GRP/Data", "alien://Folder=/alice/data/2010/OCDB");
 
+  AliPHOSSimParam *simParam =  AliPHOSSimParam::GetInstance() ;
+  simParam->SetAPDNoise(0.000001) ;
+  simParam->SetCellNonLineairyA(0.001) ;
+//  simParam->SetCellNonLineairyA(0.1) ; //Default
+  simParam->SetCellNonLineairyB(0.2) ;
+//  simParam->SetCellNonLineairyC(0.989) ; //Jan4
+//  simParam->SetCellNonLineairyC(0.995) ; //Jan5 - 2GeV
+  simParam->SetCellNonLineairyC(1.031) ; //no NL
+
 // Vertex and Mag.field from OCDB
 
 //  simulator.UseVertexFromCDB();