new Et analysis (David, Oeystein, Christine)
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 28 Aug 2010 15:25:10 +0000 (15:25 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 28 Aug 2010 15:25:10 +0000 (15:25 +0000)
21 files changed:
PWG4/PROOF-INF.PWG4totEt/BUILD.sh [new file with mode: 0755]
PWG4/PROOF-INF.PWG4totEt/SETUP.C [new file with mode: 0755]
PWG4/PWG4totEtLinkDef.h [new file with mode: 0644]
PWG4/libPWG4totEt.pkg [new file with mode: 0644]
PWG4/totEt/AliAnalysisEt.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEt.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtCuts.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarlo.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarlo.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarloEmcal.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarloEmcal.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarloPhos.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtMonteCarloPhos.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructed.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructed.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructedEmcal.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructedEmcal.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructedPhos.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisEtReconstructedPhos.h [new file with mode: 0644]
PWG4/totEt/AliAnalysisTaskTotEt.cxx [new file with mode: 0644]
PWG4/totEt/AliAnalysisTaskTotEt.h [new file with mode: 0644]

diff --git a/PWG4/PROOF-INF.PWG4totEt/BUILD.sh b/PWG4/PROOF-INF.PWG4totEt/BUILD.sh
new file mode 100755 (executable)
index 0000000..fc9490a
--- /dev/null
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+make 
diff --git a/PWG4/PROOF-INF.PWG4totEt/SETUP.C b/PWG4/PROOF-INF.PWG4totEt/SETUP.C
new file mode 100755 (executable)
index 0000000..832583b
--- /dev/null
@@ -0,0 +1,13 @@
+void SETUP()
+{
+
+   // Load the ESD library
+   gSystem->Load("libPWG4totEt");
+
+   // Set the Include paths
+   gSystem->SetIncludePath("-I$ROOTSYS/include -IPWG4totEt");
+   gROOT->ProcessLine(".include PWG4totEt/totEt");
+
+   // Set our location, so that other packages can find us
+   gSystem->Setenv("PWG4totEt_INCLUDE", "PWG4totEt/totEt");
+}
diff --git a/PWG4/PWG4totEtLinkDef.h b/PWG4/PWG4totEtLinkDef.h
new file mode 100644 (file)
index 0000000..b02f06e
--- /dev/null
@@ -0,0 +1,16 @@
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliAnalysisEt+;
+#pragma link C++ class AliAnalysisEtMonteCarlo+;
+#pragma link C++ class AliAnalysisEtMonteCarloEmcal+;
+#pragma link C++ class AliAnalysisEtMonteCarloPhos+;
+#pragma link C++ class AliAnalysisEtReconstructed+;
+#pragma link C++ class AliAnalysisEtReconstructedEmcal+;
+#pragma link C++ class AliAnalysisEtReconstructedPhos+;
+#pragma link C++ class AliAnalysisTaskTotEt+;
+      
+#endif
diff --git a/PWG4/libPWG4totEt.pkg b/PWG4/libPWG4totEt.pkg
new file mode 100644 (file)
index 0000000..261a957
--- /dev/null
@@ -0,0 +1,24 @@
+#-*- Mode: Makefile -*-
+
+SRCS = totEt/AliAnalysisEt.cxx \
+totEt/AliAnalysisEtMonteCarlo.cxx \
+totEt/AliAnalysisEtMonteCarloEmcal.cxx \
+totEt/AliAnalysisEtMonteCarloPhos.cxx \
+totEt/AliAnalysisEtReconstructed.cxx \
+totEt/AliAnalysisEtReconstructedEmcal.cxx \
+totEt/AliAnalysisEtReconstructedPhos.cxx \
+totEt/AliAnalysisTaskTotEt.cxx \
+
+HDRS:= $(SRCS:.cxx=.h) 
+
+DHDR:= PWG4totEtLinkDef.h
+
+EXPORT:=$(SRCS:.cxx=.h)
+
+EINCLUDE = PWG4/totEt 
+
+ifeq (win32gcc,$(ALICE_TARGET))
+PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \
+                         -lESD -lAOD -lANALYSIS -lANALYSISalice -lPHOSUtils \
+                         -L$(ROOTLIBDIR) -lEG
+endif
diff --git a/PWG4/totEt/AliAnalysisEt.cxx b/PWG4/totEt/AliAnalysisEt.cxx
new file mode 100644 (file)
index 0000000..8072c72
--- /dev/null
@@ -0,0 +1,223 @@
+#include "AliAnalysisEt.h"
+#include "TMath.h"
+#include "TList.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include <iostream>
+#include "AliAnalysisEtCuts.h"
+ClassImp(AliAnalysisEt);
+
+
+AliAnalysisEt::AliAnalysisEt() :
+        fHistogramNameSuffix("")
+        ,fPdgDB(0)
+        ,fSumEt(0)
+        ,fSumEtAcc(0)
+        ,fTotEt(0)
+        ,fTotEtAcc(0)
+        ,fTotNeutralEt(0)
+        ,fTotNeutralEtAcc(0)
+        ,fTotChargedEt(0)
+        ,fTotChargedEtAcc(0)
+        ,fMultiplicity(0)
+        ,fChargedMultiplicity(0)
+        ,fNeutralMultiplicity(0)
+        ,fEtaCut(EtCommonCuts::kEtaCut)
+        ,fEtaCutAcc(0)
+        ,fPhiCutAccMin(0)
+        ,fPhiCutAccMax(360.)
+        ,fDetectorRadius(460.)
+        ,fVertexXCut(0)
+        ,fVertexYCut(0)
+        ,fVertexZCut(0)
+        ,fIPxyCut(0)
+        ,fIPzCut(0)
+        ,fClusterEnergyCut(EtCommonCuts::kClusterEnergyCut)
+        ,fTrackPtCut(EtCommonCuts::kTrackPtCut)
+        ,fSingleCellEnergyCut(0)
+        ,fHistEt(0)
+        ,fHistChargedEt(0)
+        ,fHistNeutralEt(0)
+        ,fHistEtAcc(0)
+        ,fHistChargedEtAcc(0)
+        ,fHistNeutralEtAcc(0)
+        ,fHistMult(0)
+        ,fHistChargedMult(0)
+        ,fHistNeutralMult(0)
+        ,fHistPhivsPtPos(0)
+        ,fHistPhivsPtNeg(0)
+        ,fHistBaryonEt(0)
+        ,fHistAntiBaryonEt(0)
+        ,fHistMesonEt(0)
+        ,fHistBaryonEtAcc(0)
+        ,fHistAntiBaryonEtAcc(0)
+        ,fHistMesonEtAcc(0)
+        ,fHistEtRecvsEtMC(0)
+        ,fHistTMDeltaR(0)
+{
+
+}
+
+AliAnalysisEt::~AliAnalysisEt()
+{
+
+}
+
+void AliAnalysisEt::FillOutputList(TList *list)
+{
+    list->Add(fHistEt);
+    list->Add(fHistChargedEt);
+    list->Add(fHistNeutralEt);
+
+    list->Add(fHistEtAcc);
+    list->Add(fHistChargedEtAcc);
+    list->Add(fHistNeutralEtAcc);
+
+    list->Add(fHistMult);
+    list->Add(fHistChargedMult);
+    list->Add(fHistNeutralMult);
+
+    list->Add(fHistPhivsPtPos);
+    list->Add(fHistPhivsPtNeg);
+
+    list->Add(fHistBaryonEt);
+    list->Add(fHistAntiBaryonEt);
+    list->Add(fHistMesonEt);
+
+    list->Add(fHistBaryonEtAcc);
+    list->Add(fHistAntiBaryonEtAcc);
+    list->Add(fHistMesonEtAcc);
+
+    list->Add(fHistEtRecvsEtMC);
+
+    list->Add(fHistTMDeltaR);
+}
+
+void AliAnalysisEt::Init()
+{
+    fPdgDB = new TDatabasePDG();
+}
+
+void AliAnalysisEt::CreateHistograms()
+{
+
+    TString histname = "fHistEt" + fHistogramNameSuffix;
+
+    fHistEt = new TH1F(histname.Data(), "Total E_{T} Distribution", 1000, 0.00, 99);
+    fHistEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+
+    histname = "fHistChargedEt" + fHistogramNameSuffix;
+    fHistChargedEt = new TH1F(histname.Data(), "Total Charged E_{T} Distribution", 1000, 0.00, 99);
+    fHistChargedEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistChargedEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+
+    histname = "fHistNeutralEt" + fHistogramNameSuffix;
+    fHistNeutralEt = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution", 1000, 0.00, 99);
+    fHistNeutralEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistNeutralEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+
+    histname = "fHistEtAcc" + fHistogramNameSuffix;
+    fHistEtAcc = new TH1F(histname.Data(), "Total E_{T} Distribution in Acceptance", 1000, 0.00, 99);
+    fHistEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+
+    histname = "fHistChargedEtAcc" + fHistogramNameSuffix;
+    fHistChargedEtAcc = new TH1F(histname.Data(), "Total Charged E_{T} Distribution in Acceptance", 1000, 0.00, 99);
+    fHistChargedEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistChargedEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+
+    histname = "fHistNeutralEtAcc" + fHistogramNameSuffix;
+    fHistNeutralEtAcc = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution in Acceptance", 1000, 0.00, 99);
+    fHistNeutralEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
+    fHistNeutralEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
+    std::cout << histname << std::endl;
+    histname = "fHistMult" + fHistogramNameSuffix;
+    fHistMult = new TH1F(histname.Data(), "Total Multiplicity", 200, 0, 199);
+    fHistMult->GetXaxis()->SetTitle("N");
+    fHistMult->GetYaxis()->SetTitle("Multiplicity");
+
+    histname = "fHistChargedMult" + fHistogramNameSuffix;
+    fHistChargedMult = new TH1F(histname.Data(), "Charged Multiplicity", 200, 0, 199);
+    fHistChargedMult->GetXaxis()->SetTitle("N");
+    fHistChargedMult->GetYaxis()->SetTitle("Multiplicity");
+
+    histname = "fHistNeutralMult" + fHistogramNameSuffix;
+    fHistNeutralMult = new TH1F(histname.Data(), "Charged Multiplicity", 200, 0, 199);
+    fHistNeutralMult->GetXaxis()->SetTitle("N");
+    fHistNeutralMult->GetYaxis()->SetTitle("Multiplicity");
+
+    histname = "fHistPhivsPtPos" + fHistogramNameSuffix;
+    fHistPhivsPtPos = new TH2F(histname.Data(), "Phi vs pT of positively charged tracks hitting the calorimeter",      200, 0, 2*TMath::Pi(), 2000, 0, 100);
+
+    histname = "fHistPhivsPtNeg" + fHistogramNameSuffix;
+    fHistPhivsPtNeg = new TH2F(histname.Data(), "Phi vs pT of negatively charged tracks hitting the calorimeter",      200, 0, 2*TMath::Pi(), 2000, 0, 100);
+
+    histname = "fHistBaryonEt" + fHistogramNameSuffix;
+    fHistBaryonEt = new TH1F(histname.Data(), "E_{T} for baryons",  1000, 0.0001, 100);
+
+    histname = "fHistAntiBaryonEt" + fHistogramNameSuffix;
+    fHistAntiBaryonEt = new TH1F(histname.Data(), "E_{T} for anti baryons",  1000, 0.0001, 100);
+
+    histname = "fHistMesonEt" + fHistogramNameSuffix;
+    fHistMesonEt = new TH1F(histname.Data(), "E_{T} for mesons",  1000, 0.0001, 100);
+
+    histname = "fHistBaryonEtAcc" + fHistogramNameSuffix;
+    fHistBaryonEtAcc = new TH1F(histname.Data(), "E_{T} for baryons in calorimeter acceptance",  1000, 0.0001, 100);
+
+    histname = "fHistAntiBaryonEtAcc" + fHistogramNameSuffix;
+    fHistAntiBaryonEtAcc = new TH1F(histname.Data(), "E_{T} for anti baryons in calorimeter acceptance",  1000, 0.0001, 100);
+
+    histname = "fHistMesonEtAcc" + fHistogramNameSuffix;
+    fHistMesonEtAcc = new TH1F(histname.Data(), "E_{T} for mesons in calorimeter acceptance",  1000, 0.0001, 100);
+
+    histname = "fHistEtRecvsEtMC" + fHistogramNameSuffix;
+    fHistEtRecvsEtMC = new TH2F(histname.Data(), "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100);
+
+    histname = "fHistTMDeltaR" + fHistogramNameSuffix;
+    fHistTMDeltaR = new TH1F(histname.Data(), "#Delta R for calorimeter clusters", 200, 0, 50);
+
+}
+
+void AliAnalysisEt::FillHistograms()
+{
+    fHistEt->Fill(fTotEt);
+    fHistChargedEt->Fill(fTotChargedEt);
+    fHistNeutralEt->Fill(fTotNeutralEt);
+
+    fHistEtAcc->Fill(fTotEtAcc);
+    fHistChargedEtAcc->Fill(fTotChargedEtAcc);
+    fHistNeutralEtAcc->Fill(fTotNeutralEtAcc);
+
+    fHistMult->Fill(fMultiplicity);
+    fHistChargedMult->Fill(fChargedMultiplicity);
+    fHistNeutralMult->Fill(fNeutralMultiplicity);
+
+    /* // DS commented out non-fills to prevent compilation warnings
+    fHistPhivsPtPos;
+    fHistPhivsPtNeg;
+
+    fHistBaryonEt;
+    fHistAntiBaryonEt;
+    fHistMesonEt;
+
+    fHistBaryonEtAcc;
+    fHistAntiBaryonEtAcc;
+    fHistMesonEtAcc;
+
+    fHistTMDeltaR;
+    */
+}
+
+void AliAnalysisEt::ResetEventValues()
+{
+    fTotEt = 0;
+    fTotEtAcc = 0;
+    fTotNeutralEt = 0;
+    fTotNeutralEtAcc = 0;
+    fTotChargedEt  = 0;
+    fTotChargedEtAcc = 0;
+    fMultiplicity = 0;
+    fChargedMultiplicity = 0;
+    fNeutralMultiplicity = 0;
+}
diff --git a/PWG4/totEt/AliAnalysisEt.h b/PWG4/totEt/AliAnalysisEt.h
new file mode 100644 (file)
index 0000000..3aa941c
--- /dev/null
@@ -0,0 +1,198 @@
+#ifndef ALIANALYSISET_H
+#define ALIANALYSISET_H
+
+#include "TString.h"
+#include "TDatabasePDG.h"
+#include "Rtypes.h"
+
+class TH2F;
+class TH1F;
+class AliVEvent;
+class TList;
+
+class AliAnalysisEt
+{
+public:
+   
+    AliAnalysisEt();
+    virtual ~AliAnalysisEt();
+
+private:
+  //Declare it private to avoid compilation warning
+  AliAnalysisEt & operator = (const AliAnalysisEt & g) ;//cpy assignment
+  AliAnalysisEt(const AliAnalysisEt & g) ; // cpy ctor
+  
+public:
+  
+    /** Analyse the event! */
+    virtual Int_t AnalyseEvent(AliVEvent *event) = 0;
+
+    /** Fill the objects you want to output, classes which add new histograms should overload this. */
+    virtual void FillOutputList(TList* list);
+
+    /** Initialise the analysis, must be overloaded. */
+    virtual void Init() = 0;
+
+    /** 
+    * Creates the histograms, must be overloaded if you want to add your own. 
+    * Uses the fHistogramNameSuffix to create proper histogram names
+    */
+    virtual void CreateHistograms();
+    
+    /** Fills the histograms, must be overloaded if you want to add your own */
+    virtual void FillHistograms();
+
+    /** Reset event specific values (Et etc.) */
+    virtual void ResetEventValues();
+    
+    /** Sum of the total Et for all events */
+    Double_t GetSumEt() { return fSumEt; }
+
+    /** Sum of the total Et within our acceptance for all events */
+    Double_t GetSumEtAcc() { return fSumEtAcc; }
+
+    /** Total Et in the event (without acceptance cuts) */
+    Double_t GetTotEt() { return fTotEt; }
+
+    /** Total Et in the event within the acceptance cuts */
+    Double_t GetTotEtAcc() { return fTotEtAcc; }
+
+   /** Total neutral Et in the event (without acceptance cuts) */
+    Double_t GetTotNeutralEt() { return fTotNeutralEt; }
+
+    /** Total neutral Et in the event within the acceptance cuts */
+    Double_t GetTotNeutralEtAcc() { return fTotNeutralEtAcc; }
+    
+    /** Total charged Et in the event (without acceptance cuts) */
+    Double_t GetTotChargedEt() { return fTotChargedEt; }
+
+    /** Total charged Et in the event within the acceptance cuts */
+    Double_t GetTotChargedEtAcc() { return fTotChargedEtAcc; }
+
+
+protected:
+   
+    /** The suffix for the histogram names */
+    TString fHistogramNameSuffix;
+
+    /** PDG Database */
+    TDatabasePDG *fPdgDB;
+
+    /** Sum of the total Et for all events */
+    Double_t fSumEt;
+
+    /** Sum of the total Et within our acceptance for all events */
+    Double_t fSumEtAcc;
+
+    /** Total Et in the event (without acceptance cuts) */
+    Double_t fTotEt;
+
+    /** Total Et in the event within the acceptance cuts */
+    Double_t fTotEtAcc;
+
+    /** Total neutral Et in the event */
+    Double_t fTotNeutralEt;
+
+    /** Total neutral Et in the event within the acceptance cuts */
+    Double_t fTotNeutralEtAcc;
+
+    /** Total charged Et in the event */
+    Double_t fTotChargedEt;
+
+    /** Total charged Et in the event within the acceptance cuts */
+    Double_t fTotChargedEtAcc;
+
+    /** Multiplicity of particles in the event */
+    Int_t fMultiplicity;
+    
+    /** Multiplicity of charged particles in the event */
+    Int_t fChargedMultiplicity;
+    
+    /** Multiplicity of neutral particles in the event */
+    Int_t fNeutralMultiplicity; 
+    
+    /** Cut in eta ( normally |eta| < 0.5 */
+    Double_t fEtaCut;
+
+    /** Eta cut for our acceptance */
+    Double_t fEtaCutAcc;
+
+    /** Min phi cut for our acceptance in radians */
+    Double_t fPhiCutAccMin;
+
+    /** Max phi cut for our acceptance in radians */
+    Double_t fPhiCutAccMax;
+
+    /** Detector radius */
+    Double_t fDetectorRadius;
+
+    /** Vertex cuts */
+    Double_t fVertexXCut;
+    Double_t fVertexYCut;
+    Double_t fVertexZCut;
+
+    /** Impact parameter cuts */
+    Double_t fIPxyCut;
+    Double_t fIPzCut;
+
+    /** Cut on the cluster energy */
+    Double_t fClusterEnergyCut;
+
+    /** Cut on track pt */
+    Double_t fTrackPtCut;
+
+    /** Minimum energy to cut on single cell cluster */
+    Double_t fSingleCellEnergyCut;
+    
+    // Declare the histograms
+
+    /** The full Et spectrum measured */
+    TH1F *fHistEt; //Et spectrum
+
+    /** The full charged Et spectrum measured */
+    TH1F *fHistChargedEt; //Charged Et spectrum
+
+    /** The full neutral Et spectrum measured */
+    TH1F *fHistNeutralEt; //Neutral Et spectrum
+
+    /** The Et spectrum within the calorimeter acceptance */
+    TH1F *fHistEtAcc; //Et in acceptance
+
+    /** The charged Et spectrum within the calorimeter acceptance */
+    TH1F *fHistChargedEtAcc; //Charged Et in acceptance
+
+    /** The neutral Et spectrum within the calorimeter acceptance */
+    TH1F *fHistNeutralEtAcc; //Et in acceptance
+
+    /** Multiplicity of particles in the events */
+    TH1F *fHistMult; //Multiplicity
+
+    /** Charged multiplicity of particles in the events */
+    TH1F *fHistChargedMult; //Charged multiplicity
+
+    /** Neutral multiplicity of particles in the events */
+    TH1F *fHistNeutralMult; //Neutral multiplicity
+
+    /* Acceptance plots */
+    TH2F *fHistPhivsPtPos; //phi vs pT plot for positive tracks
+    TH2F *fHistPhivsPtNeg; //phi vs pT plot for negative tracks
+
+    /* PID plots */
+    TH1F *fHistBaryonEt;
+    TH1F *fHistAntiBaryonEt;
+    TH1F *fHistMesonEt;
+
+    TH1F *fHistBaryonEtAcc;
+    TH1F *fHistAntiBaryonEtAcc;
+    TH1F *fHistMesonEtAcc;
+
+    /* Correction plots */
+    TH2F *fHistEtRecvsEtMC; //Reconstructed Et versus MC Et
+
+    /* Track matching plots */
+    TH1F *fHistTMDeltaR;
+
+    ClassDef(AliAnalysisEt, 0);
+};
+
+#endif // ALIANALYSISET_H
diff --git a/PWG4/totEt/AliAnalysisEtCuts.h b/PWG4/totEt/AliAnalysisEtCuts.h
new file mode 100644 (file)
index 0000000..d579b0f
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef ALIANALYSISETCOMMONCUTS_H
+#define ALIANALYSISETCOMMONCUTS_H
+
+#include "Rtypes.h"
+
+namespace EtCommonCuts
+{
+   
+   const Double_t kEtaCut = 0.5;
+   const Double_t kClusterEnergyCut = 0.0;
+   const Double_t kTrackPtCut = 0.0;
+   
+   const Int_t kSingleCell = 1;
+   
+};
+
+namespace EtGeometryCutsPhos
+{
+   const Double_t kEtaAccCut = 0.12;
+   const Double_t kPhiAccMinCut = 260.0;
+   const Double_t kPhiAccMaxCut = 320.0;
+   const Double_t kDetectorRadius = 460.0;
+};
+
+namespace EtGeometryCutsEmcal
+{
+   const Double_t kEtaAccCut = 0.7;
+   const Double_t kPhiAccMinCut = 80.0; // rad 1.4
+   const Double_t kPhiAccMaxCut = 120.0; // rad 2.1
+   const Double_t kDetectorRadius = 440.0;
+};
+
+namespace EtReconstructedCuts
+{
+   const Double_t kVertexXCut = 0.5;
+   const Double_t kVertexYCut = 0.5;
+   const Double_t kVertexZCut = 12.0;
+   const Double_t kIPxyCut = 1.5;
+   const Double_t kIPzCut = 1.5;
+   
+   const Int_t kNTpcClustersCut = 30;
+   const Int_t knItsClustersCut = 3;
+   
+};
+
+namespace EtReconstructedCutsPhos
+{
+   const Char_t kClusterType = -1;
+   
+   const Double_t kClusterEnergyCut = 0.0;
+   const Double_t kSingleCellEnergyCut = 0.5;
+   
+   const Double_t kTrackDistanceCut = 15.0;
+   
+};
+
+namespace EtReconstructedCutsEmcal
+{
+   const Char_t kClusterType = -1;
+   
+   const Double_t kClusterEnergyCut = 0.0;
+   const Double_t kSingleCellEnergyCut = 0.5;
+   
+   const Double_t kTrackDistanceCut = 15.0;
+   
+};
+
+namespace EtMonteCarloCuts
+{
+   
+   const Double_t kSingleChargedParticle = 3;
+   const Double_t kNeutralParticle = 0;
+   
+};
+
+#endif
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarlo.cxx b/PWG4/totEt/AliAnalysisEtMonteCarlo.cxx
new file mode 100644 (file)
index 0000000..d7be236
--- /dev/null
@@ -0,0 +1,103 @@
+#include "AliAnalysisEtMonteCarlo.h"
+#include "AliAnalysisEtCuts.h"
+
+#include "AliStack.h"
+#include "AliMCEvent.h"
+
+Int_t AliAnalysisEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
+{
+     ResetEventValues();
+     
+    // Get us an mc event
+    AliMCEvent *event = dynamic_cast<AliMCEvent*>(ev);
+
+    // Let's play with the stack!
+    AliStack *stack = event->Stack();
+
+    Int_t nPrim = stack->GetNtrack();
+
+    Double_t particleMassPart = 0; //The mass part in the Et calculation for this particle
+
+    for (Int_t iPart = 0; iPart < nPrim; iPart++)
+    {
+
+        TParticle *part = stack->Particle(iPart);
+
+        if (!part)
+        {
+            Printf("ERROR: Could not get particle %d", iPart);
+            continue;
+        }
+
+        TParticlePDG *pc = part->GetPDG(0);
+
+        // Check if it is a primary particle
+        if (!stack->IsPhysicalPrimary(iPart)) continue;
+
+        // Check for reasonable (for now neutral and singly charged) charge on the particle
+        //TODO:Maybe not only singly charged?
+        if (TMath::Abs(pc->Charge()) != EtMonteCarloCuts::kSingleChargedParticle && pc->Charge() != EtMonteCarloCuts::kNeutralParticle) continue;
+
+        fMultiplicity++;
+
+        if (TMath::Abs(part->Eta()) < fEtaCut)
+        {
+
+            TParticlePDG *pdgCode =  part->GetPDG(0);
+            if (
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("proton")->PdgCode() ||
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("neutron")->PdgCode() ||
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("Lambda0")->PdgCode() ||
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("Xi-")->PdgCode() ||
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("Xi0")->PdgCode() ||
+                TMath::Abs(pdgCode->PdgCode()) == fPdgDB->GetParticle("Omega-")->PdgCode()
+              )
+            {
+                particleMassPart = -TMath::Sign(pdgCode->PdgCode(), pdgCode->PdgCode())*pdgCode->Mass();
+            }
+            
+            if (pdgCode->Charge() == EtMonteCarloCuts::kNeutralParticle)
+            {
+              fNeutralMultiplicity++;
+                fTotNeutralEt += part->Energy()*TMath::Sin(part->Theta());
+
+                if (TMath::Abs(part->Eta()) < fEtaCutAcc && part->Phi() < fPhiCutAccMax && part->Phi() > fPhiCutAccMin)
+                {
+                    fTotNeutralEtAcc += part->Energy()*TMath::Sin(part->Theta());
+                    fTotEtAcc += part->Energy()*TMath::Sin(part->Theta());
+                }
+            }
+            else if (pdgCode->Charge() != EtMonteCarloCuts::kNeutralParticle)
+            {
+              fChargedMultiplicity++;
+                fTotChargedEt += part->Energy()*TMath::Sin(part->Theta());
+                if (TMath::Abs(part->Eta()) < fEtaCutAcc && part->Phi() < fPhiCutAccMax && part->Phi() > fPhiCutAccMin)
+                {
+                    fTotChargedEtAcc += part->Energy()*TMath::Sin(part->Theta());
+                    fTotEtAcc += part->Energy()*TMath::Sin(part->Theta());
+                }
+            }
+        }
+    }
+    
+    fTotNeutralEtAcc = fTotNeutralEt;
+    fTotEt = fTotChargedEt + fTotNeutralEt;
+    fTotEtAcc = fTotChargedEtAcc + fTotNeutralEtAcc;
+    
+    FillHistograms();
+
+    return 0;    
+}
+
+void AliAnalysisEtMonteCarlo::Init()
+{
+
+    AliAnalysisEt::Init();
+
+    fVertexXCut = EtReconstructedCuts::kVertexXCut;
+    fVertexYCut = EtReconstructedCuts::kVertexYCut;
+    fVertexZCut = EtReconstructedCuts::kVertexZCut;
+    fIPxyCut = EtReconstructedCuts::kIPxyCut;
+    fIPzCut = EtReconstructedCuts::kIPzCut;
+
+}
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarlo.h b/PWG4/totEt/AliAnalysisEtMonteCarlo.h
new file mode 100644 (file)
index 0000000..7ea6db6
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef ALIANALYSISETMONTECARLO_H
+#define ALIANALYSISETMONTECARLO_H
+
+#include "AliAnalysisEt.h"
+
+
+class AliAnalysisEtMonteCarlo : public AliAnalysisEt
+{
+
+public:
+   
+    AliAnalysisEtMonteCarlo() {}
+   
+    virtual Int_t AnalyseEvent(AliVEvent* event);
+
+    virtual void Init();
+    
+};
+
+#endif // ALIANALYSISETMONTECARLO_H
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarloEmcal.cxx b/PWG4/totEt/AliAnalysisEtMonteCarloEmcal.cxx
new file mode 100644 (file)
index 0000000..1064bc3
--- /dev/null
@@ -0,0 +1,23 @@
+#include "AliAnalysisEtMonteCarloEmcal.h"
+#include "AliAnalysisEtCuts.h"
+#include "AliESDtrack.h"
+
+AliAnalysisEtMonteCarloEmcal::AliAnalysisEtMonteCarloEmcal()
+{
+   fHistogramNameSuffix = TString("EmcalMC");
+}
+
+
+void AliAnalysisEtMonteCarloEmcal::Init()
+{
+    AliAnalysisEtMonteCarlo::Init();
+    
+    fDetectorRadius = EtGeometryCutsEmcal::kDetectorRadius;
+    fEtaCutAcc = EtGeometryCutsEmcal::kEtaAccCut;
+    fPhiCutAccMax = EtGeometryCutsEmcal::kPhiAccMaxCut*TMath::Pi()/180.;
+    fPhiCutAccMin = EtGeometryCutsEmcal::kPhiAccMinCut*TMath::Pi()/180.;
+    fDetectorRadius = EtGeometryCutsEmcal::kDetectorRadius;
+    fClusterEnergyCut = EtReconstructedCutsEmcal::kClusterEnergyCut;
+    fSingleCellEnergyCut = EtReconstructedCutsEmcal::kSingleCellEnergyCut;
+    
+}
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarloEmcal.h b/PWG4/totEt/AliAnalysisEtMonteCarloEmcal.h
new file mode 100644 (file)
index 0000000..df6df3e
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ALIANALYSISETMONTECARLOEMCAL_H
+#define ALIANALYSISETMONTECARLOEMCAL_H
+
+#include "AliAnalysisEtMonteCarlo.h"
+
+
+class AliAnalysisEtMonteCarloEmcal : public AliAnalysisEtMonteCarlo
+{
+
+public:
+   
+    AliAnalysisEtMonteCarloEmcal();
+
+    virtual void Init();
+    
+};
+
+#endif // ALIANALYSISETRECONSTRUCTEDEMCAL_H
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarloPhos.cxx b/PWG4/totEt/AliAnalysisEtMonteCarloPhos.cxx
new file mode 100644 (file)
index 0000000..c70c8fb
--- /dev/null
@@ -0,0 +1,23 @@
+#include "AliAnalysisEtMonteCarloPhos.h"
+#include "AliAnalysisEtCuts.h"
+#include "AliESDtrack.h"
+
+AliAnalysisEtMonteCarloPhos::AliAnalysisEtMonteCarloPhos()
+{
+   fHistogramNameSuffix = TString("PhosMC");
+}
+
+
+void AliAnalysisEtMonteCarloPhos::Init()
+{
+    AliAnalysisEtMonteCarlo::Init();
+    
+    fDetectorRadius = EtGeometryCutsPhos::kDetectorRadius;
+    fEtaCutAcc = EtGeometryCutsPhos::kEtaAccCut;
+    fPhiCutAccMax = EtGeometryCutsPhos::kPhiAccMaxCut*TMath::Pi()/180.;
+    fPhiCutAccMin = EtGeometryCutsPhos::kPhiAccMinCut*TMath::Pi()/180.;
+    fDetectorRadius = EtGeometryCutsPhos::kDetectorRadius;
+    fClusterEnergyCut = EtReconstructedCutsPhos::kClusterEnergyCut;
+    fSingleCellEnergyCut = EtReconstructedCutsPhos::kSingleCellEnergyCut;
+    
+}
diff --git a/PWG4/totEt/AliAnalysisEtMonteCarloPhos.h b/PWG4/totEt/AliAnalysisEtMonteCarloPhos.h
new file mode 100644 (file)
index 0000000..f0f4961
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef ALIANALYSISETMONTECARLOPHOS_H
+#define ALIANALYSISETMONTECARLOPHOS_H
+
+#include "AliAnalysisEtMonteCarlo.h"
+
+
+class AliAnalysisEtMonteCarloPhos : public AliAnalysisEtMonteCarlo
+{
+
+public:
+   
+    AliAnalysisEtMonteCarloPhos();
+
+    virtual void Init();
+    
+};
+
+#endif // ALIANALYSISETRECONSTRUCTEDPHOS_H
diff --git a/PWG4/totEt/AliAnalysisEtReconstructed.cxx b/PWG4/totEt/AliAnalysisEtReconstructed.cxx
new file mode 100644 (file)
index 0000000..81d22ab
--- /dev/null
@@ -0,0 +1,180 @@
+
+#include "AliAnalysisEtReconstructed.h"
+#include "AliAnalysisEtCuts.h"
+#include "AliESDtrack.h"
+#include "AliESDCaloCluster.h"
+#include "TVector3.h"
+#include "AliVEvent.h"
+#include "AliESDEvent.h"
+#include "AliVParticle.h"
+#include <iostream>
+#include "TH2F.h"
+
+AliAnalysisEtReconstructed::AliAnalysisEtReconstructed() :
+        AliAnalysisEt()
+        ,fNTpcClustersCut(EtReconstructedCuts::kNTpcClustersCut)
+        ,fNItsClustersCut(EtReconstructedCuts::knItsClustersCut)
+        ,fTrackDistanceCut(0)
+        ,fClusterType(0)
+{
+
+}
+
+Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
+{
+    ResetEventValues();
+    AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
+
+    for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++)
+    {
+        AliVParticle *track = event->GetTrack(iTrack);
+        if (!track)
+        {
+            Printf("ERROR: Could not get track %d", iTrack);
+            continue;
+        }
+
+        fMultiplicity++;
+
+        Int_t nItsClusters = dynamic_cast<AliESDtrack*>(track)->GetNcls(0);
+        Int_t nTPCClusters = dynamic_cast<AliESDtrack*>(track)->GetNcls(1);
+
+        Float_t massPart = 0;
+
+        const Double_t *pidWeights = track->PID();
+        if (pidWeights)
+        {
+            Int_t maxpid = -1;
+            Float_t maxpidweight = 0;
+            for (Int_t p =0; p < AliPID::kSPECIES; p++)
+            {
+                if (pidWeights[p] > maxpidweight)
+                {
+                    maxpidweight = pidWeights[p];
+                    maxpid = p;
+                }
+            }
+            if (maxpid == AliPID::kProton)
+            {
+                //     massPart = -0.938*track->Charge();
+            }
+
+        }
+
+        Double_t et = track->E() * TMath::Sin(track->Theta()) + massPart;
+
+        if (TMath::Abs(track->Eta()) < fEtaCut && CheckGoodVertex(track) && nItsClusters > fNItsClustersCut && nTPCClusters > fNTpcClustersCut)
+        {
+           fTotChargedEt +=  et;
+            fChargedMultiplicity++;
+
+            if (TMath::Abs(track->Eta()) < fEtaCutAcc && track->Phi() < fPhiCutAccMax && track->Phi() > fPhiCutAccMin)
+            {
+                fTotChargedEtAcc += track->E()*TMath::Sin(track->Theta()) + massPart;
+            }
+        }
+
+        Double_t phi = track->Phi();
+        Double_t pt = track->Pt();
+        if (TrackHitsCalorimeter(track, event->GetMagneticField()))
+        {
+            if (track->Charge() > 0) fHistPhivsPtPos->Fill(phi,pt);
+            else fHistPhivsPtNeg->Fill(phi, pt);
+        }
+    }
+
+    for (Int_t iCluster = 0; iCluster < event->GetNumberOfCaloClusters(); iCluster++)
+    {
+        AliESDCaloCluster* cluster = event->GetCaloCluster(iCluster);
+        if (!cluster)
+        {
+            Printf("ERROR: Could not get cluster %d", iCluster);
+            continue;
+        }
+
+        if (cluster->GetType() != fClusterType) continue;
+
+        if (cluster->E() < fClusterEnergyCut) continue;
+        Float_t pos[3];
+        TVector3 cp(pos);
+        cluster->GetPosition(pos);
+        //if (pos[0] < -(32.0*2.2)) continue; //Ensure that modules 0 and 1 are not used
+        // if(cp.Phi() < 260.*TMath::Pi()/180.) continue;
+        fHistTMDeltaR->Fill(cluster->GetEmcCpvDistance());
+        if (cluster->GetEmcCpvDistance() < fTrackDistanceCut)
+        {
+            continue;
+            //AliVParticle *matchedTrack = event->GetTrack(cluster->GetTrackMatched());
+//         if(CheckGoodVertex(matchedTrack))
+//         {
+//            totChargedEnergy +=  matchedTrack->E();;
+//            totChargedEt += matchedTrack->E()*TMath::Sin(matchedTrack);
+//         }
+        }
+
+        if (cluster->E() >  fSingleCellEnergyCut && cluster->GetNCells() == EtCommonCuts::kSingleCell) continue;
+
+        cluster->GetPosition(pos);
+      
+       // TODO: replace with TVector3, too lazy now...
+
+        float dist = TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
+
+        float theta = TMath::ATan(pos[2]/dist)+TMath::Pi()/2;
+        // float eta = TMath::Log(TMath::Abs( TMath::Tan( 0.5 * theta ) ) );
+        fTotNeutralEt += cluster->E() * TMath::Sin(theta);
+
+        fMultiplicity++;
+
+    }
+
+    fTotNeutralEtAcc = fTotNeutralEt;
+    fTotEt = fTotChargedEt + fTotNeutralEt;
+    fTotEtAcc = fTotChargedEtAcc + fTotNeutralEtAcc;
+
+    std::cout << fTotChargedEtAcc << std::endl;
+    // Fill the histograms...
+    FillHistograms();
+
+    return 0;
+}
+
+bool AliAnalysisEtReconstructed::CheckGoodVertex(AliVParticle* track)
+{
+
+    Float_t bxy = 999.;
+    Float_t bz = 999.;
+    dynamic_cast<AliESDtrack*>(track)->GetImpactParametersTPC(bxy,bz);
+
+    return TMath::Abs(track->Xv()) < fVertexXCut && TMath::Abs(track->Yv()) < fVertexYCut && TMath::Abs(track->Zv()) < fVertexZCut && TMath::Abs(bxy) < fIPxyCut && TMath::Abs(bz) < fIPzCut;;
+
+}
+
+void AliAnalysisEtReconstructed::Init()
+{
+
+    AliAnalysisEt::Init();
+
+    fVertexXCut = EtReconstructedCuts::kVertexXCut;
+    fVertexYCut = EtReconstructedCuts::kVertexYCut;
+    fVertexZCut = EtReconstructedCuts::kVertexZCut;
+    fIPxyCut = EtReconstructedCuts::kIPxyCut;
+    fIPzCut = EtReconstructedCuts::kIPzCut;
+
+}
+
+bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
+{
+
+   AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
+    // Printf("Propagating track: eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
+
+    Bool_t prop = esdTrack->PropagateTo(fDetectorRadius, magField);
+
+    //if(prop)Printf("Track propagated, eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
+    return prop && 
+                  TMath::Abs(esdTrack->Eta()) < fEtaCutAcc && 
+                  esdTrack->Phi() > fPhiCutAccMin*TMath::Pi()/180. && 
+                  esdTrack->Phi() < fPhiCutAccMax*TMath::Pi()/180.;
+}
+
diff --git a/PWG4/totEt/AliAnalysisEtReconstructed.h b/PWG4/totEt/AliAnalysisEtReconstructed.h
new file mode 100644 (file)
index 0000000..91b1539
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef ALIANALYSISETRECONSTRUCTED_H
+#define ALIANALYSISETRECONSTRUCTED_H
+
+#include "AliAnalysisEt.h"
+
+class AliVParticle;
+
+class AliAnalysisEtReconstructed : public AliAnalysisEt
+{
+
+public:
+   
+    AliAnalysisEtReconstructed();
+   
+    virtual Int_t AnalyseEvent(AliVEvent* event);
+
+    virtual void Init();
+    
+protected:
+
+    bool CheckGoodVertex(AliVParticle *track);
+    virtual bool TrackHitsCalorimeter(AliVParticle *track, Double_t magField);
+
+    Int_t fNTpcClustersCut;
+    Int_t fNItsClustersCut;
+   
+    Double_t fTrackDistanceCut;
+    
+    Char_t fClusterType;
+    
+};
+
+#endif // ALIANALYSISETRECONSTRUCTED_H
diff --git a/PWG4/totEt/AliAnalysisEtReconstructedEmcal.cxx b/PWG4/totEt/AliAnalysisEtReconstructedEmcal.cxx
new file mode 100644 (file)
index 0000000..5670969
--- /dev/null
@@ -0,0 +1,30 @@
+#include "AliAnalysisEtReconstructedEmcal.h"
+#include "AliAnalysisEtCuts.h"
+#include "AliESDtrack.h"
+
+AliAnalysisEtReconstructedEmcal::AliAnalysisEtReconstructedEmcal() :
+AliAnalysisEtReconstructed()
+{
+   fHistogramNameSuffix = TString("EmcalRec");    
+}
+
+
+void AliAnalysisEtReconstructedEmcal::Init()
+{
+    AliAnalysisEtReconstructed::Init();
+    
+    fClusterType = EtReconstructedCutsEmcal::kClusterType;
+    fDetectorRadius = EtGeometryCutsEmcal::kDetectorRadius;    
+    fEtaCutAcc = EtGeometryCutsEmcal::kEtaAccCut;
+    fPhiCutAccMax = EtGeometryCutsEmcal::kPhiAccMaxCut*TMath::Pi()/180.;
+    fPhiCutAccMin = EtGeometryCutsEmcal::kPhiAccMinCut*TMath::Pi()/180.;
+    fClusterEnergyCut = EtReconstructedCutsEmcal::kClusterEnergyCut;
+    fSingleCellEnergyCut = EtReconstructedCutsEmcal::kSingleCellEnergyCut;
+    fTrackDistanceCut = EtReconstructedCutsEmcal::kTrackDistanceCut;
+        
+}
+
+bool AliAnalysisEtReconstructedEmcal::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
+{
+  return  AliAnalysisEtReconstructed::TrackHitsCalorimeter(track, magField);
+}
diff --git a/PWG4/totEt/AliAnalysisEtReconstructedEmcal.h b/PWG4/totEt/AliAnalysisEtReconstructedEmcal.h
new file mode 100644 (file)
index 0000000..c2dc147
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef ALIANALYSISETRECONSTRUCTEDEMCAL_H
+#define ALIANALYSISETRECONSTRUCTEDEMCAL_H
+
+#include "AliAnalysisEtReconstructed.h"
+
+
+class AliAnalysisEtReconstructedEmcal : public AliAnalysisEtReconstructed
+{
+
+public:
+   
+    AliAnalysisEtReconstructedEmcal();
+
+    virtual void Init();
+    
+   protected:
+      
+      virtual bool TrackHitsCalorimeter(AliVParticle *track, Double_t magField);
+};
+
+#endif // ALIANALYSISETRECONSTRUCTEDEMCAL_H
diff --git a/PWG4/totEt/AliAnalysisEtReconstructedPhos.cxx b/PWG4/totEt/AliAnalysisEtReconstructedPhos.cxx
new file mode 100644 (file)
index 0000000..8eab2a5
--- /dev/null
@@ -0,0 +1,31 @@
+#include "AliAnalysisEtReconstructedPhos.h"
+#include "AliAnalysisEtCuts.h"
+#include "AliESDtrack.h"
+
+AliAnalysisEtReconstructedPhos::AliAnalysisEtReconstructedPhos() :
+AliAnalysisEtReconstructed()
+{
+   fHistogramNameSuffix = TString("PhosRec");    
+}
+
+
+void AliAnalysisEtReconstructedPhos::Init()
+{
+    AliAnalysisEtReconstructed::Init();
+    
+    fClusterType = EtReconstructedCutsPhos::kClusterType;
+    fDetectorRadius = EtGeometryCutsPhos::kDetectorRadius;
+    fEtaCutAcc = EtGeometryCutsPhos::kEtaAccCut;
+    fPhiCutAccMax = EtGeometryCutsPhos::kPhiAccMaxCut*TMath::Pi()/180.;
+    fPhiCutAccMin = EtGeometryCutsPhos::kPhiAccMinCut*TMath::Pi()/180.;
+    fClusterEnergyCut = EtReconstructedCutsPhos::kClusterEnergyCut;
+    fSingleCellEnergyCut = EtReconstructedCutsPhos::kSingleCellEnergyCut;
+    fTrackDistanceCut = EtReconstructedCutsPhos::kTrackDistanceCut;
+        
+}
+
+bool AliAnalysisEtReconstructedPhos::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
+{
+  return  AliAnalysisEtReconstructed::TrackHitsCalorimeter(track, magField);
+}
+
diff --git a/PWG4/totEt/AliAnalysisEtReconstructedPhos.h b/PWG4/totEt/AliAnalysisEtReconstructedPhos.h
new file mode 100644 (file)
index 0000000..37f88ec
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef ALIANALYSISETRECONSTRUCTEDPHOS_H
+#define ALIANALYSISETRECONSTRUCTEDPHOS_H
+
+#include "AliAnalysisEtReconstructed.h"
+
+
+class AliAnalysisEtReconstructedPhos : public AliAnalysisEtReconstructed
+{
+
+public:
+   
+    AliAnalysisEtReconstructedPhos();
+
+    virtual void Init();
+    
+   protected:
+      
+      virtual bool TrackHitsCalorimeter(AliVParticle *track, Double_t magField);
+};
+
+#endif // ALIANALYSISETRECONSTRUCTEDPHOS_H
diff --git a/PWG4/totEt/AliAnalysisTaskTotEt.cxx b/PWG4/totEt/AliAnalysisTaskTotEt.cxx
new file mode 100644 (file)
index 0000000..ec27528
--- /dev/null
@@ -0,0 +1,139 @@
+#include "TChain.h"
+#include "TTree.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TNtuple.h"
+#include "TCanvas.h"
+#include "TMath.h"
+#include "TObjArray.h"
+
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+
+#include "AliESDEvent.h"
+#include "AliAODEvent.h"
+#include "AliVEvent.h"
+#include "AliVTrack.h"
+#include "AliVParticle.h"
+#include "AliESDCaloCluster.h"
+#include "AliESDCaloCells.h"
+#include "AliESDtrack.h"
+#include "AliESDInputHandler.h"
+#include "AliMCEvent.h"
+#include "AliMCParticle.h"
+#include "TDatabasePDG.h"
+#include "AliAnalysisTaskTotEt.h"
+#include "AliAnalysisEtReconstructedPhos.h"
+#include "AliAnalysisEtReconstructedEmcal.h"
+#include "AliAnalysisEtMonteCarloPhos.h"
+#include "AliAnalysisEtMonteCarloEmcal.h"
+
+#include <iostream>
+#include "AliStack.h"
+
+using namespace std;
+
+ClassImp(AliAnalysisTaskTotEt)
+
+//________________________________________________________________________
+AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) :
+        AliAnalysisTaskSE(name)
+        ,fESD(0)
+        ,fOutputList(0)
+        ,fRecAnalysis(0)
+        ,fMCAnalysis(0)
+        ,fHistEtRecvsEtMC(0)
+        ,fTriggerSelection(false)
+        ,fCount(0)
+        ,fkPhotonPdg(22)
+        ,fkProtonMass(.938)
+        ,fPdgDB(0)
+        ,fRecEventVars(0)
+        ,fSimEventVars(0)
+        ,fRecParticleArray(0)
+        ,fSimParticleArray(0)
+{
+    // Constructor
+
+    // select if we should use EMCal or PHOS class
+    // PHOS by default, EMCal if name string contains EMC
+    TString t(name);
+    t.ToUpper();
+    if (t.Contains("EMC")) {
+      fRecAnalysis = new AliAnalysisEtReconstructedEmcal(); 
+      fMCAnalysis = new AliAnalysisEtMonteCarloEmcal();
+    }
+    else {
+      fRecAnalysis = new AliAnalysisEtReconstructedPhos(); 
+      fMCAnalysis = new AliAnalysisEtMonteCarloPhos();
+    }
+
+    fRecAnalysis->Init();
+    fMCAnalysis->Init();
+
+    fPdgDB = new TDatabasePDG();
+
+
+    // Define input and output slots here
+    // Input slot #0 works with a TChain
+    DefineInput(0, TChain::Class());
+    // Output slot #1 writes into a TH1 container
+
+    DefineOutput(1, TList::Class());
+
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskTotEt::UserCreateOutputObjects()
+{
+    // Create histograms
+    // Called once
+    fMCAnalysis->CreateHistograms();
+    fRecAnalysis->CreateHistograms();
+    fOutputList = new TList;
+    fRecAnalysis->FillOutputList(fOutputList);
+    fMCAnalysis->FillOutputList(fOutputList);
+    fHistEtRecvsEtMC = new TH2F("fHistEtRecvsEtMC", "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100);
+    fOutputList->Add(fHistEtRecvsEtMC);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskTotEt::UserExec(Option_t *)
+{
+    AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
+    if (!event) {
+        Printf("ERROR: Could not retrieve event");
+        return;
+    }
+
+    fRecAnalysis->AnalyseEvent(event);
+
+    AliMCEvent* mcEvent = MCEvent();
+    if (mcEvent)
+    {
+        fMCAnalysis->AnalyseEvent(mcEvent);
+    }
+
+    fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt());
+
+// Post output data.
+    PostData(1, fOutputList);
+
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskTotEt::Terminate(Option_t *)
+{
+    // Draw result to the screen
+    // Called once at the end of the query
+
+    fOutputList = dynamic_cast<TList*> (GetOutputData(1));
+    if (!fOutputList) {
+        printf("ERROR: Output list not available\n");
+        return;
+    }
+}
+
+
+
diff --git a/PWG4/totEt/AliAnalysisTaskTotEt.h b/PWG4/totEt/AliAnalysisTaskTotEt.h
new file mode 100644 (file)
index 0000000..b2c4713
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef AliAnalysisTaskTotEt_cxx\r
+#define AliAnalysisTaskTotEt_cxx\r
+\r
+class AliAnalysisEt;\r
+class TTree;\r
+class AliVParticle;\r
+class TH1F;\r
+class TH2F;\r
+class TNtuple;\r
+class TObjArray;\r
+class AliESDEvent;\r
+class AliMCParticle;\r
+class TDatabasePDG;\r
+\r
+#include "AliAnalysisTaskSE.h"\r
+#include "TObject.h"\r
+\r
+//class ParticleVars : public TObject        // Inherit from TObject to put in TClonesArray\r
+//{\r
+//public:\r
+//  \r
+//  ParticleVars() : TObject(){}\r
+//  Int_t fPdgCode; // from MC\r
+//  Int_t fPid; //from ESDs\r
+//  Int_t fMass;\r
+//  Int_t fCharge;\r
+//  Double_t fEt;\r
+//  Double_t fPhi;\r
+//  Double_t fEta;\r
+//  \r
+//  ClassDef(ParticleVars, 1);\r
+//  \r
+//};\r
+//\r
+class AliAnalysisTaskTotEt : public AliAnalysisTaskSE {\r
+  \r
+public:\r
+  AliAnalysisTaskTotEt(const char *name = "AliAnalysisTaskTotEt");\r
+  virtual ~AliAnalysisTaskTotEt() {}\r
+private:\r
+  //Declare it private to avoid compilation warning\r
+  AliAnalysisTaskTotEt & operator = (const AliAnalysisTaskTotEt & g) ;//cpy assignment\r
+  AliAnalysisTaskTotEt(const AliAnalysisTaskTotEt & g) ; // cpy ctor\r
+  \r
+public:\r
+  \r
+  //  virtual void   ConnectInputData(Option_t *);\r
+  virtual void   UserCreateOutputObjects();\r
+  virtual void   UserExec(Option_t *option);\r
+  virtual void   Terminate(Option_t *);\r
+  \r
+  virtual void SetTriggerSelection(Bool_t v) {\r
+    fTriggerSelection = v;\r
+  }\r
+  \r
+  /* // Not yet implemented methods commented out for now..\r
+   private:\r
+   \r
+   Float_t CorrectForCaloAcceptance(Float_t energy);\r
+   bool CheckGoodVertex(AliVParticle *track);\r
+   bool TrackHitsCalorimeter(AliVParticle *track, Double_t magField);\r
+   bool ParticleInCalorimeter(AliMCParticle *part);\r
+   */\r
+  \r
+private:\r
+  \r
+  AliESDEvent *fESD;    //ESD object\r
+  \r
+  TList *fOutputList;\r
+  \r
+  AliAnalysisEt *fRecAnalysis;\r
+  AliAnalysisEt *fMCAnalysis;\r
+  \r
+  TH2F *fHistEtRecvsEtMC;\r
+  \r
+  Bool_t fTriggerSelection;\r
+  \r
+  Int_t fCount;\r
+  \r
+  const int fkPhotonPdg;\r
+  \r
+  const Float_t fkProtonMass;\r
+  \r
+  TDatabasePDG *fPdgDB;\r
+  \r
+  class EventVars\r
+  {\r
+  public:\r
+    Double_t fTotEt;\r
+    Double_t fTotEtAcc;\r
+    Double_t fTotEnergy;\r
+    \r
+    Double_t fTotNeutralEt;\r
+    Double_t fTotNeutralEtAcc;\r
+    \r
+    Double_t fTotChargedEt;\r
+    Double_t fTotChargedEtAcc;\r
+    \r
+    Int_t fChargedMultiplicity;\r
+    Int_t fNeutralMultiplicity;\r
+    \r
+  };\r
+  \r
+  EventVars *fRecEventVars;\r
+  EventVars *fSimEventVars;\r
+  \r
+  \r
+  TClonesArray *fRecParticleArray;\r
+  TClonesArray *fSimParticleArray;\r
+  \r
+  ClassDef(AliAnalysisTaskTotEt, 1); // example of analysis\r
+};\r
+\r
+#endif\r