first histograms filled
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 Mar 2011 22:36:11 +0000 (22:36 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 Mar 2011 22:36:11 +0000 (22:36 +0000)
PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.cxx
PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.h

index f8f5b4a..dee85fc 100644 (file)
@@ -1,6 +1,7 @@
 // $Id$
 
 #include "AliAnalysisTaskEMCALPi0PbPb.h"
+#include <TAxis.h>
 #include <TChain.h>
 #include <TClonesArray.h>
 #include <TH1F.h>
@@ -37,9 +38,18 @@ AliAnalysisTaskEMCALPi0PbPb::AliAnalysisTaskEMCALPi0PbPb()
     fEsdCells(0),
     fAodClusters(0),
     fAodCells(0),
-    fHcuts(0),
-    fHvertexZ(0),
-    fHcent(0)
+    fPtRanges(0),
+    fHCuts(0x0),
+    fHVertexZ(0x0),
+    fHCent(0x0),
+    fHCentQual(0x0),
+    fHClustEtaPhi(0x0),
+    fHClustEnergyPt(0x0),
+    fHClustEnergySigma(0x0),
+    fHClustNTowEnergyRatio(0x0),
+    fHPionEtaPhi(0x0),
+    fHPionMggPt(0x0),
+    fHPionMggAsym(0x0)
 {
   // ROOT constructor.
 }
@@ -62,15 +72,24 @@ AliAnalysisTaskEMCALPi0PbPb::AliAnalysisTaskEMCALPi0PbPb(const char *name)
     fEsdCells(0),
     fAodClusters(0),
     fAodCells(0),
-    fHcuts(0),
-    fHvertexZ(0),
-    fHcent(0)
+    fPtRanges(0),
+    fHCuts(0x0),
+    fHVertexZ(0x0),
+    fHCent(0x0),
+    fHCentQual(0x0),
+    fHClustEtaPhi(0x0),
+    fHClustEnergyPt(0x0),
+    fHClustEnergySigma(0x0),
+    fHClustNTowEnergyRatio(0x0),
+    fHPionEtaPhi(0x0),
+    fHPionMggPt(0x0),
+    fHPionMggAsym(0x0)
 {
   // Constructor.
 
   DefineInput(0, TChain::Class());
   DefineOutput(1, TList::Class());
-  fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex,EMCALCells. "
+  fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,SPDVertex.,TPCVertex.,EMCALCells. "
                "AOD:header,vertices,emcalCells";
 }
 
@@ -80,6 +99,7 @@ AliAnalysisTaskEMCALPi0PbPb::~AliAnalysisTaskEMCALPi0PbPb()
   // Destructor.
 
   delete fOutput; fOutput = 0;
+  delete fPtRanges; fPtRanges = 0;
 }
 
 //________________________________________________________________________
@@ -90,16 +110,65 @@ void AliAnalysisTaskEMCALPi0PbPb::UserCreateOutputObjects()
   fOutput = new TList();
   fOutput->SetOwner();
 
-  fHcuts = new TH1F("hEventCuts","",4,0.5,4.5);
-  fHcuts->GetXaxis()->SetBinLabel(1,"All (PS)");
-  fHcuts->GetXaxis()->SetBinLabel(2,Form("%s: %.0f-%.0f",fCentVar.Data(),fCentFrom,fCentTo));
-  fHcuts->GetXaxis()->SetBinLabel(3,"QFlag");
-  fHcuts->GetXaxis()->SetBinLabel(4,Form("zvtx: %.0f-%.0f",fVtxZMin,fVtxZMax));
-  fOutput->Add(fHcuts);
-  fHvertexZ = new TH1F("hVertexZBeforeCuts",";z [cm];",100,-25,25);
-  fOutput->Add(fHvertexZ);
-  fHcent = new TH1F("hCentBeforeCuts",Form(";%s;",fCentVar.Data()),101,-1,100);
-  fOutput->Add(fHcent);
+  fHCuts = new TH1F("hEventCuts","",4,0.5,4.5);
+  fHCuts->GetXaxis()->SetBinLabel(1,"All (PS)");
+  fHCuts->GetXaxis()->SetBinLabel(2,Form("%s: %.0f-%.0f",fCentVar.Data(),fCentFrom,fCentTo));
+  fHCuts->GetXaxis()->SetBinLabel(3,"QFlag");
+  fHCuts->GetXaxis()->SetBinLabel(4,Form("zvtx: %.0f-%.0f",fVtxZMin,fVtxZMax));
+  fOutput->Add(fHCuts);
+  fHVertexZ = new TH1F("hVertexZBeforeCut","",100,-25,25);
+  fHVertexZ->SetXTitle("z [cm]");
+  fOutput->Add(fHVertexZ);
+  fHCent = new TH1F("hCentBeforeCut","",101,-1,100);
+  fHCent->SetXTitle(fCentVar.Data());
+  fHCentQual = new TH1F("hCentAfterCut","",101,-1,100);
+  fHCentQual->SetXTitle(fCentVar.Data());
+  fOutput->Add(fHCentQual);
+
+  fHClustEtaPhi = new TH2F("hClustEtaPhi","",100,-0.8,0.8,100,1.2,2.2);
+  fHClustEtaPhi->SetXTitle("#eta");
+  fHClustEtaPhi->SetYTitle("#varphi");
+  fOutput->Add(fHClustEtaPhi);
+  fHClustEnergyPt = new TH2F("hClustEnergyPt","",250,0,50,250,0,50);
+  fHClustEnergyPt->SetXTitle("E [GeV]");
+  fHClustEnergyPt->SetYTitle("p_{T}^{} [GeV/c]");
+  fOutput->Add(fHClustEnergyPt);
+  fHClustEnergySigma = new TH2F("hClustEnergySigma","",100,0,100,100,0,100);
+  fHClustEnergySigma->SetXTitle("E*#sigma_{max}^{} [GeV*cm]");
+  fHClustEnergySigma->SetYTitle("#sigma_{max}^{} [cm]");
+  //fOutput->Add(fHClustEnergySigma);
+  fHClustNTowEnergyRatio = new TH2F("hClustNTowEnergyRatio","",15,-0.5,14.5,101,-0.05,1.05);
+  fHClustNTowEnergyRatio->SetXTitle("N towers");
+  fHClustNTowEnergyRatio->SetYTitle("Energy ratio");
+  //fOutput->Add(fHClustNTowEnergyRatio);
+
+  fHPionEtaPhi = new TH2F("hPionEtaPhi","",100,-0.8,0.8,100,1.2,2.2);
+  fHPionEtaPhi->SetXTitle("#eta^{#gamma#gamma}");
+  fHPionEtaPhi->SetYTitle("#varphi^{#gamma#gamma}");
+  fOutput->Add(fHPionEtaPhi);
+  fHPionMggPt = new TH2F("hPionMggPt","",100,0,2,100,0,20.0);
+  fHPionMggPt->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]");
+  fHPionMggPt->SetYTitle("p_{T}^{#gamma#gamma} [GeV/c]");
+  fOutput->Add(fHPionMggPt);
+  fHPionMggAsym = new TH2F("hPionMggAsym","",100,0,2,100,0,1);
+  fHPionMggAsym->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]");
+  fHPionMggAsym->SetYTitle("Z_{#gamma#gamma} [GeV]");
+  fOutput->Add(fHPionMggAsym);
+  const Int_t nbins = 19; 
+  Double_t xbins[nbins] = {0.5,1,1.5,2,2.5,3,3.5,4,4.5,6,7,8,9,10,12.5,15,20,25,50};
+  fPtRanges = new TAxis(nbins-1,xbins);
+  for (Int_t i = 0; i<=nbins; ++i) {
+    fHPionInvMasses[i] = new TH1F(Form("HPionInvMass%d",i),"",100,0,2);
+    fHPionInvMasses[i]->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]");
+    if (i==0)
+      fHPionInvMasses[i]->SetTitle(Form("0 < p_{T}^{#gamma#gamma} <%.1f",xbins[0]));
+    else if (i==nbins)
+      fHPionInvMasses[i]->SetTitle(Form("p_{T}^{#gamma#gamma} > 50"));
+    else 
+      fHPionInvMasses[i]->SetTitle(Form("%.1f < p_{T}^{#gamma#gamma} <%.1f",xbins[i-1],xbins[i]));
+    //cout << i << ": " << fHPionInvMasses[i]->GetTitle() << endl;
+    fOutput->Add(fHPionInvMasses[i]);
+  }
 
   PostData(1, fOutput); 
 }
@@ -123,25 +192,28 @@ void AliAnalysisTaskEMCALPi0PbPb::UserExec(Option_t *)
   }
 
   Int_t cut = 1;
-  fHcuts->Fill(cut++);
+  fHCuts->Fill(cut++);
 
   const AliCentrality *centP = InputEvent()->GetCentrality();
   Double_t cent = centP->GetCentralityPercentileUnchecked(fCentVar);
-  fHcent->Fill(cent);
+  fHCent->Fill(cent);
   if (cent<fCentFrom||cent>fCentTo)
     return;
 
-  fHcuts->Fill(cut++);
+  fHCuts->Fill(cut++);
   
   if (fUseQualFlag) {
     if (centP->GetQuality()>0)
       return;
   }
 
-  fHcuts->Fill(cut++);
+  fHCentQual->Fill(cent);
+  fHCuts->Fill(cut++);
 
   if (fEsdEv) {
-    am->LoadBranch("PrimaryVertex");
+    am->LoadBranch("PrimaryVertex.");
+    am->LoadBranch("SPDVertex.");
+    am->LoadBranch("TPCVertex.");
   } else {
     fAodEv = dynamic_cast<AliAODEvent*>(InputEvent());
     am->LoadBranch("vertices");
@@ -151,12 +223,12 @@ void AliAnalysisTaskEMCALPi0PbPb::UserExec(Option_t *)
   if (!vertex)
     return;
 
-  fHvertexZ->Fill(vertex->GetZ());
+  fHVertexZ->Fill(vertex->GetZ());
 
   if(vertex->GetZ()<fVtxZMin||vertex->GetZ()>fVtxZMax)
     return;
 
-  fHcuts->Fill(cut++);
+  fHCuts->Fill(cut++);
 
   fRecPoints   = 0; // will be set if fClusName is given and AliAnalysisTaskEMCALClusterizeFast is used
   fEsdClusters = 0; // will be set if ESD input used and if fRecPoints are not set of if clusters are attached
@@ -254,12 +326,107 @@ void AliAnalysisTaskEMCALPi0PbPb::FillCellHists()
 //________________________________________________________________________
 void AliAnalysisTaskEMCALPi0PbPb::FillClusHists()
 {
+  // Fill histograms related to clusters.
+
+  Double_t vertex[3] = {0,0,0};
+  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
+
   // Fill histograms related to cluster properties.
+  TLorentzVector clusterVec;
+  if (fEsdClusters) {
+    Int_t nclus = fEsdClusters->GetEntries();
+    for(Int_t i = 0; i<nclus; ++i) {
+      AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fEsdClusters->At(i));
+      if (!clus)
+        continue;
+      if (!clus->IsEMCAL()) 
+        continue;
+      clus->GetMomentum(clusterVec,vertex);
+      
+      fHClustEtaPhi->Fill(clusterVec.Eta(),clusterVec.Phi());
+      fHClustEnergyPt->Fill(clusterVec.E(),clusterVec.Pt());
+      //fHClustEnergySigma->Fill();
+      //fHClustNTowEnergyRatio->Fill();
+    }
+  } else if (fAodClusters) {
+    Int_t nclus = fAodClusters->GetEntries();
+    for (Int_t i = 0; i<nclus; ++i) {
+      AliAODCaloCluster *clus = static_cast<AliAODCaloCluster*>(fAodClusters->At(i));
+      if (!clus)
+        continue;
+      if (!clus->IsEMCAL()) 
+        continue;
+      clus->GetMomentum(clusterVec,vertex);
+      
+      fHClustEtaPhi->Fill(clusterVec.Eta(),clusterVec.Phi());
+      fHClustEnergyPt->Fill(clusterVec.E(),clusterVec.Pt());
+      //fHClustEnergySigma->Fill();
+      //fHClustNTowEnergyRatio->Fill();
+    }
+  }
 }
 
 //________________________________________________________________________
 void AliAnalysisTaskEMCALPi0PbPb::FillPionHists()
 {
   // Fill histograms related to pions.
-}
 
+  Double_t vertex[3] = {0,0,0};
+  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
+
+  TLorentzVector clusterVec1;
+  TLorentzVector clusterVec2;
+  TLorentzVector pionVec;
+
+  if (fEsdClusters) {
+    Int_t nclus = fEsdClusters->GetEntries();
+    for (Int_t i = 0; i<nclus; ++i) {
+      AliESDCaloCluster *clus1 = static_cast<AliESDCaloCluster*>(fEsdClusters->At(i));
+      if (!clus1)
+        continue;
+      if (!clus1->IsEMCAL()) 
+        continue;
+      clus1->GetMomentum(clusterVec1,vertex);
+      for (Int_t j = i+1; j<nclus; ++j) {
+        AliESDCaloCluster *clus2 = static_cast<AliESDCaloCluster*>(fEsdClusters->At(j));
+        if (!clus2)
+          continue;
+        if (!clus2->IsEMCAL()) 
+          continue;
+        clus2->GetMomentum(clusterVec2,vertex);
+        pionVec = clusterVec1 + clusterVec2;
+        Double_t pionZgg = TMath::Abs(clusterVec1.E()-clusterVec2.E())/pionVec.E();
+        fHPionEtaPhi->Fill(pionVec.Eta(),pionVec.Phi()); 
+        fHPionMggPt->Fill(pionVec.M(),pionVec.Pt()); 
+        fHPionMggAsym->Fill(pionVec.M(),pionZgg); 
+        Int_t bin = fPtRanges->FindBin(pionVec.Pt());
+        fHPionInvMasses[bin]->Fill(pionVec.M());
+      }
+    }
+  } else if (fAodClusters) {
+    Int_t nclus = fAodClusters->GetEntries();
+    for (Int_t i = 0; i<nclus; ++i) {
+      AliAODCaloCluster *clus1 = static_cast<AliAODCaloCluster*>(fAodClusters->At(i));
+      if (!clus1)
+        continue;
+      if (!clus1->IsEMCAL()) 
+        continue;
+      clus1->GetMomentum(clusterVec1,vertex);
+      for (Int_t j = i+1; j<nclus; ++j) {
+        AliAODCaloCluster *clus2 = static_cast<AliAODCaloCluster*>(fAodClusters->At(j));
+        if (!clus2)
+          continue;
+        if (!clus2->IsEMCAL()) 
+          continue;
+        clus2->GetMomentum(clusterVec2,vertex);
+        pionVec = clusterVec1 + clusterVec2;
+        Double_t pionZgg = TMath::Abs(clusterVec1.E()-clusterVec2.E())/pionVec.E();
+        fHPionEtaPhi->Fill(pionVec.Eta(),pionVec.Phi()); 
+        fHPionMggPt->Fill(pionVec.M(),pionVec.Pt()); 
+        fHPionMggAsym->Fill(pionVec.M(),pionZgg); 
+        Int_t bin = fPtRanges->FindBin(pionVec.Pt());
+        fHPionInvMasses[bin]->Fill(pionVec.M());
+      }
+    }
+  }
+}
index cd45610..bfc56c5 100644 (file)
@@ -3,6 +3,7 @@
 
 // $Id$
 
+class TAxis;
 class TH1F;
 class TH2F;
 class TClonesArray;
@@ -53,10 +54,22 @@ class AliAnalysisTaskEMCALPi0PbPb : public AliAnalysisTaskSE {
   const AliESDCaloCells *fEsdCells;             //!pointer to esd cells
   const TObjArray       *fAodClusters;          //!pointer to aod clusters
   const AliAODCaloCells *fAodCells;             //!pointer to aod cells
+  TAxis                 *fPtRanges;             //!pointer to pt ranges
     // histograms
-  TH1F                  *fHcuts;                //!histo for cuts
-  TH1F                  *fHvertexZ;             //!histo for vtxz
-  TH1F                  *fHcent;                //!histo for cent
+  TH1F                  *fHCuts;                //!histo for cuts
+  TH1F                  *fHVertexZ;             //!histo for vtxz
+  TH1F                  *fHCent;                //!histo for cent
+  TH1F                  *fHCentQual;            //!histo for cent after quality flag cut
+    // histograms for clusters
+  TH2F                  *fHClustEtaPhi;         //!histo for cluster eta vs. phi
+  TH2F                  *fHClustEnergyPt;       //!histo for cluster energy vs. pT
+  TH2F                  *fHClustEnergySigma;    //!histo for cluster 
+  TH2F                  *fHClustNTowEnergyRatio;//!histo for cluster n tow vs. energy ratio
+    // histograms for pion candidates
+  TH2F                  *fHPionEtaPhi;          //!histo for pion eta vs. phi
+  TH2F                  *fHPionMggPt;           //!histo for pion mass vs. pT
+  TH2F                  *fHPionMggAsym;         //!histo for pion mass vs. asym
+  TH1F                  *fHPionInvMasses[20];   //!histos for invariant mass plots 
 
  private:
   AliAnalysisTaskEMCALPi0PbPb(const AliAnalysisTaskEMCALPi0PbPb&);            // not implemented