]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliAnaPhoton: Added histograms to correlate reconstructed and generated energy.
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Jul 2009 13:02:22 +0000 (13:02 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Jul 2009 13:02:22 +0000 (13:02 +0000)
AliAnaParticleHadronCorrelation: Added histograms for UE studies with neutral triggers.

PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.h
PWG4/PartCorrDep/AliAnaPhoton.cxx
PWG4/PartCorrDep/AliAnaPhoton.h

index 9d691ef1c7b8505ac76ba59ac8a4945c9392c846..72dbb92295f719db2aff23c853c0cce7c8c0eebb 100755 (executable)
@@ -50,11 +50,14 @@ ClassImp(AliAnaParticleHadronCorrelation)
     fhPhiCharged(0), fhPhiNeutral(0), fhEtaCharged(0), fhEtaNeutral(0), 
     fhDeltaPhiCharged(0), fhDeltaPhiNeutral(0), 
     fhDeltaEtaCharged(0), fhDeltaEtaNeutral(0),
-    fhDeltaPhiChargedPt(0), fhDeltaPhiNeutralPt(0), fhDeltaPhiUeChargedPt(0), 
+    fhDeltaPhiChargedPt(0), fhDeltaPhiNeutralPt(0), 
+    fhDeltaPhiUeChargedPt(0), fhDeltaPhiUeNeutralPt(0), 
     fhPtImbalanceNeutral(0), fhPtImbalanceCharged(0), 
-    fhPtImbalanceUeCharged(0),
-    fhDeltaPhiUeLeft(0),fhDeltaPhiUeRight(0),
-    fhPtImbalanceUeLeftCharged(0),fhPtImbalanceUeRightCharged(0)
+    fhPtImbalanceUeCharged(0),fhPtImbalanceUeNeutral(0),
+    fhDeltaPhiUeLeftCharged(0),fhDeltaPhiUeRightCharged(0),
+    fhDeltaPhiUeLeftNeutral(0),fhDeltaPhiUeRightNeutral(0),
+    fhPtImbalanceUeLeftCharged(0),fhPtImbalanceUeRightCharged(0),
+    fhPtImbalanceUeLeftNeutral(0),fhPtImbalanceUeRightNeutral(0)
 {
   //Default Ctor
   
@@ -78,12 +81,19 @@ AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation(const AliAnaPar
   fhDeltaPhiChargedPt(g.fhDeltaPhiChargedPt),
   fhDeltaPhiNeutralPt(g.fhDeltaPhiNeutralPt), 
   fhDeltaPhiUeChargedPt(g.fhDeltaPhiUeChargedPt), 
+  fhDeltaPhiUeNeutralPt(g.fhDeltaPhiUeNeutralPt), 
   fhPtImbalanceNeutral(g.fhPtImbalanceNeutral), 
   fhPtImbalanceCharged(g.fhPtImbalanceCharged),
   fhPtImbalanceUeCharged(g.fhPtImbalanceUeCharged),
-  fhDeltaPhiUeLeft(g.fhDeltaPhiUeLeft),fhDeltaPhiUeRight(g.fhDeltaPhiUeRight),
+  fhPtImbalanceUeNeutral(g.fhPtImbalanceUeNeutral), 
+  fhDeltaPhiUeLeftCharged(g.fhDeltaPhiUeLeftCharged),
+  fhDeltaPhiUeRightCharged(g.fhDeltaPhiUeRightCharged),
+  fhDeltaPhiUeLeftNeutral(g.fhDeltaPhiUeLeftNeutral),
+  fhDeltaPhiUeRightNeutral(g.fhDeltaPhiUeRightNeutral),
   fhPtImbalanceUeLeftCharged(g.fhPtImbalanceUeLeftCharged),
-  fhPtImbalanceUeRightCharged(g.fhPtImbalanceUeRightCharged)
+  fhPtImbalanceUeRightCharged(g.fhPtImbalanceUeRightCharged),
+  fhPtImbalanceUeLeftNeutral(g.fhPtImbalanceUeLeftNeutral),
+  fhPtImbalanceUeRightNeutral(g.fhPtImbalanceUeRightNeutral)
 {
   // cpy ctor
   
@@ -112,13 +122,19 @@ AliAnaParticleHadronCorrelation & AliAnaParticleHadronCorrelation::operator = (c
   fhDeltaPhiChargedPt = source.fhDeltaPhiChargedPt ;
   fhDeltaPhiNeutralPt = source.fhDeltaPhiNeutralPt ; 
   fhDeltaPhiUeChargedPt = source.fhDeltaPhiUeChargedPt ; 
+  fhDeltaPhiUeNeutralPt = source.fhDeltaPhiUeNeutralPt ; 
   fhPtImbalanceNeutral = source.fhPtImbalanceNeutral ; 
   fhPtImbalanceCharged = source.fhPtImbalanceCharged ; 
   fhPtImbalanceUeCharged = source.fhPtImbalanceUeCharged ; 
-  fhDeltaPhiUeLeft = source.fhDeltaPhiUeLeft ;
-  fhDeltaPhiUeRight = source.fhDeltaPhiUeRight ;
+  fhPtImbalanceUeNeutral = source.fhPtImbalanceUeNeutral ; 
+  fhDeltaPhiUeLeftCharged = source.fhDeltaPhiUeLeftCharged ;
+  fhDeltaPhiUeRightCharged = source.fhDeltaPhiUeRightCharged ;
+  fhDeltaPhiUeLeftNeutral = source.fhDeltaPhiUeLeftNeutral ;
+  fhDeltaPhiUeRightNeutral = source.fhDeltaPhiUeRightNeutral ;
   fhPtImbalanceUeLeftCharged = source.fhPtImbalanceUeLeftCharged ;
   fhPtImbalanceUeRightCharged = source.fhPtImbalanceUeRightCharged ;
+  fhPtImbalanceUeLeftNeutral = source.fhPtImbalanceUeLeftNeutral ;
+  fhPtImbalanceUeRightNeutral = source.fhPtImbalanceUeRightNeutral ;
   return *this;
 
 }
@@ -202,19 +218,19 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
     outputContainer->Add(fhPtImbalanceUeCharged) ;
 
     if(fMakeSeveralUE){ 
-      fhDeltaPhiUeLeft  = new TH2F
+      fhDeltaPhiUeLeftCharged  = new TH2F
        ("DeltaPhiUeLeftChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE left side range of trigger particles",
         nptbins,ptmin,ptmax,700,-2.,5.);
-      fhDeltaPhiUeLeft->SetYTitle("#Delta #phi");
-      fhDeltaPhiUeLeft->SetXTitle("p_{T h^{#pm}} (GeV/c)");
-      outputContainer->Add(fhDeltaPhiUeLeft) ;
+      fhDeltaPhiUeLeftCharged->SetYTitle("#Delta #phi");
+      fhDeltaPhiUeLeftCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
+      outputContainer->Add(fhDeltaPhiUeLeftCharged) ;
 
-      fhDeltaPhiUeRight  = new TH2F
+      fhDeltaPhiUeRightCharged  = new TH2F
        ("DeltaPhiUeRightChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE right side range of trigger particles",
         nptbins,ptmin,ptmax,700,-2.,5.);
-      fhDeltaPhiUeRight->SetYTitle("#Delta #phi");
-      fhDeltaPhiUeRight->SetXTitle("p_{T h^{#pm}} (GeV/c)");
-      outputContainer->Add(fhDeltaPhiUeRight) ;
+      fhDeltaPhiUeRightCharged->SetYTitle("#Delta #phi");
+      fhDeltaPhiUeRightCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
+      outputContainer->Add(fhDeltaPhiUeRightCharged) ;
       
       fhPtImbalanceUeLeftCharged  = 
        new TH2F("CorrelationUeChargedLeft","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger} with UE left side of trigger",
@@ -257,7 +273,13 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
       ("DeltaPhiNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
        nptbins,ptmin,ptmax,700,-2.,5.); 
     fhDeltaPhiNeutralPt->SetYTitle("#Delta #phi");
-    fhDeltaPhiNeutralPt->SetXTitle("p_{T trigger} (GeV/c)");
+    fhDeltaPhiNeutralPt->SetXTitle("p_{T h^{0} (GeV/c)");
+
+    fhDeltaPhiUeNeutralPt  = new TH2F
+      ("DeltaPhiUeNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
+       nptbins,ptmin,ptmax,700,-2.,5.); 
+    fhDeltaPhiUeNeutralPt->SetYTitle("#Delta #phi");
+    fhDeltaPhiUeNeutralPt->SetXTitle("p_{T h^{0} (GeV/c)");
     
     fhDeltaEtaNeutral  = new TH2F
       ("DeltaEtaNeutral","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}",
@@ -270,14 +292,52 @@ TList *  AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
               nptbins,ptmin,ptmax,1000,0.,2.); 
     fhPtImbalanceNeutral->SetYTitle("z_{trigger #pi^{0}}");
     fhPtImbalanceNeutral->SetXTitle("p_{T trigger}");
-    
+    fhPtImbalanceUeNeutral  = 
+      new TH2F("CorrelationUeNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger}",
+              nptbins,ptmin,ptmax,1000,0.,2.); 
+    fhPtImbalanceUeNeutral->SetYTitle("z_{trigger #pi^{0}}");
+    fhPtImbalanceUeNeutral->SetXTitle("p_{T trigger}");
+   
     outputContainer->Add(fhPhiNeutral) ;  
     outputContainer->Add(fhEtaNeutral) ;   
     outputContainer->Add(fhDeltaPhiNeutral) ; 
+    outputContainer->Add(fhDeltaPhiNeutralPt) ; 
+    outputContainer->Add(fhDeltaPhiUeNeutralPt) ; 
     outputContainer->Add(fhDeltaEtaNeutral) ; 
     outputContainer->Add(fhPtImbalanceNeutral) ;
-    
-    
+    outputContainer->Add(fhPtImbalanceUeNeutral) ;    
+    if(fMakeSeveralUE){ 
+      fhDeltaPhiUeLeftNeutral  = new TH2F
+       ("DeltaPhiUeLeftNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T h^{0}} with UE left side range of trigger particles",
+        nptbins,ptmin,ptmax,700,-2.,5.);
+      fhDeltaPhiUeLeftNeutral->SetYTitle("#Delta #phi");
+      fhDeltaPhiUeLeftNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
+      outputContainer->Add(fhDeltaPhiUeLeftNeutral) ;
+
+      fhDeltaPhiUeRightNeutral  = new TH2F
+       ("DeltaPhiUeRightNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T Ueh^{0}} with UE right side range of trigger particles",
+        nptbins,ptmin,ptmax,700,-2.,5.);
+      fhDeltaPhiUeRightNeutral->SetYTitle("#Delta #phi");
+      fhDeltaPhiUeRightNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
+      outputContainer->Add(fhDeltaPhiUeRightNeutral) ;
+      
+      fhPtImbalanceUeLeftNeutral  = 
+       new TH2F("CorrelationUeNeutralLeft","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with UE left side of trigger",
+                nptbins,ptmin,ptmax,1000,0.,2.); 
+      fhPtImbalanceUeLeftNeutral->SetYTitle("z_{trigger Ueh^{0}}");
+      fhPtImbalanceUeLeftNeutral->SetXTitle("p_{T trigger}");
+      outputContainer->Add(fhPtImbalanceUeLeftNeutral) ;
+      
+      fhPtImbalanceUeRightNeutral  = 
+       new TH2F("CorrelationUeNeutralRight","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with UE right side of trigger",
+                nptbins,ptmin,ptmax,1000,0.,2.); 
+      fhPtImbalanceUeRightNeutral->SetYTitle("z_{trigger Ueh^{0}}");
+      fhPtImbalanceUeRightNeutral->SetXTitle("p_{T trigger}");
+      outputContainer->Add(fhPtImbalanceUeRightNeutral) ;
+    }  
+   
     //Keep neutral meson selection histograms if requiered
     //Setting done in AliNeutralMesonSelection
     if(GetNeutralMesonSelection()){
@@ -484,28 +544,28 @@ void  AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4Particle
        fhDeltaPhiCharged->Fill(ptTrig, deltaphi);
 
        if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
-
+       
+       //delta phi cut for correlation
+       if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
+        fhDeltaPhiChargedPt->Fill(pt,deltaphi);
+        fhPtImbalanceCharged->Fill(ptTrig,rat); 
+       }
+      else {
+       fhDeltaPhiUeChargedPt->Fill(pt,deltaphi);
+       fhPtImbalanceUeCharged->Fill(ptTrig,rat);
+      }
        //several UE calculation 
       if(fMakeSeveralUE){
         if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){  
-          fhDeltaPhiUeLeft->Fill(pt,deltaphi);
+          fhDeltaPhiUeLeftCharged->Fill(pt,deltaphi);
           fhPtImbalanceUeLeftCharged->Fill(ptTrig,rat);
        }
         if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi <fUeDeltaPhiMaxCut)){  
-          fhDeltaPhiUeRight->Fill(pt,deltaphi);
+          fhDeltaPhiUeRightCharged->Fill(pt,deltaphi);
           fhPtImbalanceUeRightCharged->Fill(ptTrig,rat);
         }
       } //several UE calculation
 
-       if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) {
-      fhDeltaPhiUeChargedPt->Fill(pt,deltaphi);
-      fhPtImbalanceUeCharged->Fill(ptTrig,rat);
-
-       }
-       else {
-       fhDeltaPhiChargedPt->Fill(pt,deltaphi);
-       fhPtImbalanceCharged->Fill(ptTrig,rat);
-       }
      }
      else{
        //Fill AODs
@@ -710,11 +770,28 @@ void  AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillHistograms(AliA
     fhPhiNeutral->Fill(ptTrig,phi);
     fhDeltaEtaNeutral->Fill(ptTrig,etaTrig-eta);
     fhDeltaPhiNeutral->Fill(ptTrig,deltaphi);
-         
-       if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
-               fhDeltaPhiNeutralPt->Fill(pt,deltaphi);
-               fhPtImbalanceNeutral->Fill(ptTrig,rat);
+
+       //delta phi cut for correlation
+       if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
+        fhDeltaPhiNeutralPt->Fill(pt,deltaphi);
+        fhPtImbalanceNeutral->Fill(ptTrig,rat); 
+       }
+      else {
+       fhDeltaPhiUeNeutralPt->Fill(pt,deltaphi);
+       fhPtImbalanceUeNeutral->Fill(ptTrig,rat);
+      }
+       //several UE calculation 
+      if(fMakeSeveralUE){
+        if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){  
+          fhDeltaPhiUeLeftNeutral->Fill(pt,deltaphi);
+          fhPtImbalanceUeLeftNeutral->Fill(ptTrig,rat);
        }
+        if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi <fUeDeltaPhiMaxCut)){  
+          fhDeltaPhiUeRightNeutral->Fill(pt,deltaphi);
+          fhPtImbalanceUeRightNeutral->Fill(ptTrig,rat);
+        }
+      } //several UE calculation
+         
          
     if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Selected neutral for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
     
index ca4abf7245515965e832b07d05d27f3f0f5e35cc..903242a2aba1df8010c6d434d0513339c2fdf6da 100755 (executable)
@@ -78,18 +78,23 @@ class AliAnaParticleHadronCorrelation : public AliAnaPartCorrBaseClass {
   TH2F * fhDeltaPhiChargedPt  ;  //! Difference of charged particle phi and trigger particle  phi as function of charged particle pT
   TH2F * fhDeltaPhiNeutralPt  ;  //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT
   TH2F * fhDeltaPhiUeChargedPt  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
+  TH2F * fhDeltaPhiUeNeutralPt  ;  //! Difference of neutral particle phi and trigger particle  phi as function of neutral particle particle pT
 
   TH2F * fhPtImbalanceNeutral  ; //! Trigger particle - neutral hadron momentum imbalance histogram 
   TH2F * fhPtImbalanceCharged  ; //! Trigger particle -charged hadron momentim imbalance histogram
   TH2F * fhPtImbalanceUeCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram  
+  TH2F * fhPtImbalanceUeNeutral  ; //! Trigger particle - neutral hadron momentum imbalance histogram 
 
 //if several UE calculation is on, most useful for jet-jet events contribution
-  TH2F * fhDeltaPhiUeLeft  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
-  TH2F * fhDeltaPhiUeRight  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
+  TH2F * fhDeltaPhiUeLeftCharged  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi as function of charged particle pT
+  TH2F * fhDeltaPhiUeRightCharged  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi 
+  TH2F * fhDeltaPhiUeLeftNeutral  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi as function of neutral particle pT
+  TH2F * fhDeltaPhiUeRightNeutral  ;  //! Difference of charged particle from underlying events phi and trigger particle  phi 
   TH2F * fhPtImbalanceUeLeftCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram 
   TH2F * fhPtImbalanceUeRightCharged  ; //! Trigger particle -underlying charged hadron momentim imbalance histogram  
-
-  ClassDef(AliAnaParticleHadronCorrelation,1)
+  TH2F * fhPtImbalanceUeLeftNeutral  ; //! Trigger particle -underlying neutral hadron momentim imbalance histogram 
+  TH2F * fhPtImbalanceUeRightNeutral  ; //! Trigger particle -underlying neutral hadron momentim imbalance histogram  
+  ClassDef(AliAnaParticleHadronCorrelation,2)
 } ;
  
 
index 5badc93fcf55a8778b09c648d663855b3808b630..e04cabd2b979e28cd625abec7c200d0735224731 100755 (executable)
 #include <TClonesArray.h>
 #include <TObjString.h>
 //#include <Riostream.h>
+#include "TParticle.h"
 
 // --- Analysis system --- 
 #include "AliAnaPhoton.h" 
 #include "AliCaloTrackReader.h"
+#include "AliStack.h"
 #include "AliCaloPID.h"
 #include "AliMCAnalysisUtils.h"
 #include "AliFidutialCut.h"
@@ -46,6 +48,7 @@ ClassImp(AliAnaPhoton)
     fMinDist(0.),fMinDist2(0.),fMinDist3(0.),fRejectTrackMatch(0),
        fhPtPhoton(0),fhPhiPhoton(0),fhEtaPhoton(0),
     //MC
+    fhDeltaE(0), fhDeltaPt(0),fhRatioE(0), fhRatioPt(0),fh2E(0),fh2Pt(0),
     fhPtPrompt(0),fhPhiPrompt(0),fhEtaPrompt(0), 
     fhPtFragmentation(0),fhPhiFragmentation(0),fhEtaFragmentation(0), 
     fhPtISR(0),fhPhiISR(0),fhEtaISR(0), 
@@ -68,6 +71,9 @@ AliAnaPhoton::AliAnaPhoton(const AliAnaPhoton & g) :
    fRejectTrackMatch(g.fRejectTrackMatch),
    fhPtPhoton(g.fhPtPhoton),fhPhiPhoton(g.fhPhiPhoton),fhEtaPhoton(g.fhEtaPhoton), 
   //MC
+  fhDeltaE(g.fhDeltaE), fhDeltaPt(g.fhDeltaPt), 
+  fhRatioE(g.fhRatioE), fhRatioPt(g.fhRatioPt),
+  fh2E(g.fh2E), fh2Pt(g.fh2Pt), 
   fhPtPrompt(g.fhPtPrompt),fhPhiPrompt(g.fhPhiPrompt),fhEtaPrompt(g.fhEtaPrompt), 
   fhPtFragmentation(g.fhPtFragmentation),fhPhiFragmentation(g.fhPhiFragmentation),fhEtaFragmentation(g.fhEtaFragmentation), 
   fhPtISR(g.fhPtISR),fhPhiISR(g.fhPhiISR),fhEtaISR(g.fhEtaISR), 
@@ -97,6 +103,13 @@ AliAnaPhoton & AliAnaPhoton::operator = (const AliAnaPhoton & g)
   fhPtPhoton  = g.fhPtPhoton ; 
   fhPhiPhoton = g.fhPhiPhoton ;
   fhEtaPhoton = g.fhEtaPhoton ;
+
+  fhDeltaE   = g.fhDeltaE;  
+  fhDeltaPt  = g.fhDeltaPt;
+  fhRatioE   = g.fhRatioE;  
+  fhRatioPt  = g.fhRatioPt;
+  fh2E   = g.fh2E;  
+  fh2Pt  = g.fh2Pt;
  
   fhPtPrompt  = g.fhPtPrompt;
   fhPhiPrompt = g.fhPhiPrompt;
@@ -169,7 +182,32 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
   outputContainer->Add(fhEtaPhoton) ;
   
   if(IsDataMC()){
+    fhDeltaE  = new TH1F ("hDeltaE","MC - Reco E ", 200,-50,50); 
+    fhDeltaE->SetXTitle("#Delta E (GeV)");
+    outputContainer->Add(fhDeltaE);
+                
+    fhDeltaPt  = new TH1F ("hDeltaPt","MC - Reco p_{T} ", 200,-50,50); 
+    fhDeltaPt->SetXTitle("#Delta p_{T} (GeV/c)");
+    outputContainer->Add(fhDeltaPt);
+
+    fhRatioE  = new TH1F ("hRatioE","Reco/MC E ", 200,0,2); 
+    fhRatioE->SetXTitle("E_{reco}/E_{gen}");
+    outputContainer->Add(fhRatioE);
     
+    fhRatioPt  = new TH1F ("hRatioPt","Reco/MC p_{T} ", 200,0,2); 
+    fhRatioPt->SetXTitle("p_{T, reco}/p_{T, gen}");
+    outputContainer->Add(fhRatioPt);    
+
+    fh2E  = new TH2F ("h2E","E distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    fh2E->SetYTitle("E_{rec} (GeV)");
+    fh2E->SetXTitle("E_{gen} (GeV)");
+    outputContainer->Add(fh2E);          
+    
+    fh2Pt  = new TH2F ("h2Pt","p_T distribution, reconstructed vs generated", nptbins,ptmin,ptmax,nptbins,ptmin,ptmax); 
+    fh2Pt->SetYTitle("p_{T,rec} (GeV/c)");
+    fh2Pt->SetXTitle("p_{T,gen} (GeV/c)");
+    outputContainer->Add(fh2Pt);
+   
     fhPtPrompt  = new TH1F("hPtMCPrompt","Number of #gamma over calorimeter",nptbins,ptmin,ptmax); 
     fhPtPrompt->SetYTitle("N");
     fhPtPrompt->SetXTitle("p_{T #gamma}(GeV/c)");
@@ -467,18 +505,24 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
 //__________________________________________________________________
 void  AliAnaPhoton::MakeAnalysisFillHistograms() 
 {
-  //Do analysis and fill histograms
-  
-  //Get vertex for photon momentum calculation
-  //Double_t v[]={0,0,0} ; //vertex ;
-  //if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) 
-  //GetReader()->GetVertex(v);
-  
-  //Loop on stored AOD photons
-  Int_t naod = GetOutputAODBranch()->GetEntriesFast();
-  if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
-  
-  for(Int_t iaod = 0; iaod < naod ; iaod++){
+    //Do analysis and fill histograms
+           
+    // Access MC information in stack if requested, check that it exists.
+    AliStack * stack = 0x0;
+    TParticle * primary = 0x0;   
+    if(IsDataMC()){
+         stack =  GetMCStack() ;
+         if(!stack) {
+               printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
+               abort();
+         } 
+    }
+
+       //Loop on stored AOD photons
+       Int_t naod = GetOutputAODBranch()->GetEntriesFast();
+       if(GetDebug() > 0) printf("AliAnaPhoton::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
+       
+       for(Int_t iaod = 0; iaod < naod ; iaod++){
     AliAODPWG4Particle* ph =  (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
     Int_t pdg = ph->GetPdg();
     
@@ -486,28 +530,30 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
       printf("AliAnaPhoton::MakeAnalysisFillHistograms() - PDG %d, MC TAG %d, Calorimeter %s\n", ph->GetPdg(),ph->GetTag(), (ph->GetDetector()).Data()) ;
     
     //If PID used, fill histos with photons in Calorimeter fCalorimeter
-    if(IsCaloPIDOn())  
-      if(pdg != AliCaloPID::kPhoton) continue; 
+    if(IsCaloPIDOn() && pdg != AliCaloPID::kPhoton) continue; 
     if(ph->GetDetector() != fCalorimeter) continue;
     
     if(GetDebug() > 1) 
       printf("AliAnaPhoton::MakeAnalysisFillHistograms() - ID Photon: pt %f, phi %f, eta %f\n", ph->Pt(),ph->Phi(),ph->Eta()) ;
     
     //Fill photon histograms 
-    Float_t ptcluster = ph->Pt();
+    Float_t ptcluster  = ph->Pt();
     Float_t phicluster = ph->Phi();
     Float_t etacluster = ph->Eta();
-    
-    fhPtPhoton   ->Fill(ptcluster);
+    Float_t ecluster   = ph->E();
+   
+    fhPtPhoton  ->Fill(ptcluster);
     fhPhiPhoton ->Fill(ptcluster,phicluster);
     fhEtaPhoton ->Fill(ptcluster,etacluster);
-    
+
+  //Play with the MC stack if available
     if(IsDataMC()){
+               
       Int_t tag =ph->GetTag();
       if(tag == AliMCAnalysisUtils::kMCPrompt){
-       fhPtPrompt  ->Fill(ptcluster);
-       fhPhiPrompt ->Fill(ptcluster,phicluster);
-       fhEtaPrompt ->Fill(ptcluster,etacluster);
+         fhPtPrompt  ->Fill(ptcluster);
+         fhPhiPrompt ->Fill(ptcluster,phicluster);
+         fhEtaPrompt ->Fill(ptcluster,etacluster);
       }
       else if(tag==AliMCAnalysisUtils::kMCFragmentation)
        {
@@ -545,6 +591,31 @@ void  AliAnaPhoton::MakeAnalysisFillHistograms()
        fhPhiUnknown ->Fill(ptcluster,phicluster);
        fhEtaUnknown ->Fill(ptcluster,etacluster);
       }
+               
+       Int_t label =ph->GetLabel();
+       if(label < 0) {
+               printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** bad label ***:  label %d \n", label);
+               continue;
+       }
+               
+       if(label >=  stack->GetNtrack()) {
+               if(GetDebug() > 2)  printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** large label ***:  label %d, n tracks %d \n", label, stack->GetNtrack());
+               continue ;
+       }
+               
+       primary = stack->Particle(label);
+       if(!primary){
+               printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() *** no primary ***:  label %d \n", label);
+               continue;
+       }
+               
+       fh2E->Fill(primary->Energy(),ecluster);
+       fh2Pt->Fill(primary->Pt(), ptcluster);     
+       fhDeltaE->Fill(primary->Energy()-ecluster);
+       fhDeltaPt->Fill(primary->Pt()-ptcluster);     
+       if(primary->Energy()!=0) fhRatioE  ->Fill(ecluster/primary->Energy());
+       if(primary->Pt()!=0) fhRatioPt ->Fill(ptcluster/primary->Pt());                 
+               
     }//Histograms with MC
     
   }// aod loop
index a0aa3c7b1d92ec883ff5b1bdf4e6cbe90c3c816e..d84d06868df1780b6858f1a3a1c191bb5151b532 100755 (executable)
 
 // --- ROOT system ---
 class TH2F ;
+class TH1F;
 class TString ;
 
 // --- ANALYSIS system ---
 #include "AliAnaPartCorrBaseClass.h"
+//#include "AliStack.h"
+//#include "TParticle.h"
+class AliStack;
+class TParticle;
 
 class TList ;
 
@@ -70,6 +75,13 @@ public:
   TH2F * fhEtaPhoton  ; //! Pseudorapidity of identified  photon vs transerse momentum 
                
   //MC
+  TH1F * fhDeltaE  ; //! MC-Reco E distribution      
+  TH1F * fhDeltaPt ; //! MC-Reco pT distribution
+  TH1F * fhRatioE  ; //! Reco/MC E distribution      
+  TH1F * fhRatioPt ; //! Reco/MC pT distribution
+  TH2F * fh2E  ; //! E distribution, Reco vs MC
+  TH2F * fh2Pt ; //! pT distribution, Reco vs MC
+  
   TH1F * fhPtPrompt;   //! Number of identified prompt gamma 
   TH2F * fhPhiPrompt;  //! Phi of identified  prompt gamma
   TH2F * fhEtaPrompt;  //! eta of identified  prompt gamma
@@ -98,7 +110,7 @@ public:
   TH2F * fhPhiUnknown;  //! Phi of identified  Unknown gamma
   TH2F * fhEtaUnknown;  //! eta of identified  Unknown gamma
 
-  ClassDef(AliAnaPhoton,3)
+   ClassDef(AliAnaPhoton,4)
 
 } ;