Manager class for control histos added. (Guillermo Contreras)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Aug 2007 14:09:45 +0000 (14:09 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Aug 2007 14:09:45 +0000 (14:09 +0000)
JETAN/AliAnalysisTaskJets.cxx
JETAN/AliAnalysisTaskJets.h
JETAN/AliJetHistos.cxx [new file with mode: 0644]
JETAN/AliJetHistos.h [new file with mode: 0644]
JETAN/JETANLinkDef.h
JETAN/libJETAN.pkg

index 9b5b684ce8b2f8886dc77948ed453cc58b16879f..8aee78126262c610b5bd05400c2d880685fc73ec 100644 (file)
 #include <TInterpreter.h>
 #include <TChain.h>
 #include <TFile.h>
-#include <TH1.h>
+#include <TList.h>
 
 #include "AliAnalysisTaskJets.h"
 #include "AliAnalysisManager.h"
 #include "AliJetFinder.h"
+#include "AliJetHistos.h"
 #include "AliESDEvent.h"
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
@@ -43,7 +44,8 @@ AliAnalysisTaskJets::AliAnalysisTaskJets():
     fESD(0x0),
     fAOD(0x0),
     fTreeA(0x0),
-    fHisto(0x0)
+    fHistos(0x0),
+    fListOfHistos(0x0)
 {
   // Default constructor
 }
@@ -56,12 +58,13 @@ AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name):
     fESD(0x0),
     fAOD(0x0),
     fTreeA(0x0),
-    fHisto(0x0)
+    fHistos(0x0),
+    fListOfHistos(0x0)
 {
   // Default constructor
     DefineInput (0, TChain::Class());
     DefineOutput(0, TTree::Class());
-    DefineOutput(1, TH1F::Class());
+    DefineOutput(1, TList::Class());
 }
 
 void AliAnalysisTaskJets::CreateOutputObjects()
@@ -76,10 +79,11 @@ void AliAnalysisTaskJets::CreateOutputObjects()
     fTreeA = handler->GetTree();
     fJetFinder->ConnectAOD(fAOD);
 //
-//  Histogram
+//  Histograms
     OpenFile(1);
-    fHisto = new TH1F("fHisto", "Jet Et", 100, 0., 100.);
-    
+    fListOfHistos = new TList();
+    fHistos       = new AliJetHistos();
+    fHistos->AddHistosToList(fListOfHistos);
 }
 
 void AliAnalysisTaskJets::Init()
@@ -129,8 +133,13 @@ void AliAnalysisTaskJets::Exec(Option_t */*option*/)
     Long64_t ientry = fChain->GetReadEntry();
     if (fDebug > 1) printf("Analysing event # %5d\n", (Int_t) ientry);
     fJetFinder->ProcessEvent(ientry);
+
+    // Fill control histos
+    fHistos->FillHistos(fAOD->GetJets());
+    
+    // Post the data
     PostData(0, fTreeA);
-    PostData(1, fHisto);
+    PostData(1, fListOfHistos);
 }
 
 void AliAnalysisTaskJets::Terminate(Option_t */*option*/)
index 8210f30928d1369ca94e402ab2e91d8ae89953c1..3001fbc673a367965b2fa86c47e32ad2abfb0886 100644 (file)
@@ -9,6 +9,8 @@ class AliJetFinder;
 class AliESDEvent;
 class TChain;
 class AliAODEvent;
+class AliJetHistos;
+
 
 class AliAnalysisTaskJets : public AliAnalysisTask
 {
@@ -26,14 +28,16 @@ class AliAnalysisTaskJets : public AliAnalysisTask
     virtual void SetDebugLevel(Int_t level) {fDebug = level;}
     
  private:
-    Int_t         fDebug;     //  Debug flag
-    AliJetFinder* fJetFinder; //  Pointer to the jet finder 
-    TChain*       fChain;     //! chained files
-    AliESDEvent*  fESD;       //! ESD
-    AliAODEvent*  fAOD;       //! AOD
-    TTree*        fTreeA;     //  tree of reconstructed jets
-    TH1F*         fHisto;     //  Histogram
-    ClassDef(AliAnalysisTaskJets, 1); // Analysis task for standard jet analysis
+    Int_t         fDebug;        //  Debug flag
+    AliJetFinder* fJetFinder;    //  Pointer to the jet finder 
+    TChain*       fChain;        //! chained files
+    AliESDEvent*  fESD;          //! ESD
+    AliAODEvent*  fAOD;          //! AOD
+    TTree*        fTreeA;        //  tree of reconstructed jets
+    AliJetHistos* fHistos;       //  Histogram manager class
+    TList*        fListOfHistos; //  Output list of histograms
+    
+    ClassDef(AliAnalysisTaskJets, 2); // Analysis task for standard jet analysis
 };
  
 #endif
diff --git a/JETAN/AliJetHistos.cxx b/JETAN/AliJetHistos.cxx
new file mode 100644 (file)
index 0000000..66e1999
--- /dev/null
@@ -0,0 +1,101 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include <TList.h>
+#include <TClonesArray.h>
+#include <TH1I.h>
+#include <TH1F.h>
+#include <TMath.h>
+
+#include "AliAODJet.h"
+#include "AliJetHistos.h"
+
+ClassImp(AliJetHistos)
+
+AliJetHistos::AliJetHistos():
+  fNJetsH(0x0),
+  fPtH(0x0),
+  fEtaH(0x0),
+  fEneH(0x0),
+  fPhiH(0x0)
+{
+  // Default constructor
+
+  fNJetsH = new TH1I("NJetsH","Number of Jets",12,0,11);
+  SetProperties(fNJetsH,"Number of jets","Entries");
+
+  fPtH = new TH1F("PtH","Pt of Jets",50,0.,200.);
+  SetProperties(fPtH,"P_{#perp} [GeV]","Entries");
+
+  fEtaH = new TH1F("EtaH","Pseudorapidity of Jets",30,-1.5,1.5);
+  SetProperties(fEtaH,"#eta","Entries");
+
+  fEneH = new TH1F("EneH","Energy of Jets",50,0.,200.);
+  SetProperties(fEneH,"Energy [GeV]","Entries");
+
+  fPhiH = new TH1F("PhiH","Azimuthal angle of Jets",
+                   60,0.,2.0*TMath::Pi());
+  SetProperties(fPhiH,"#phi","Entries");
+}
+
+AliJetHistos::~AliJetHistos()
+{
+  delete fNJetsH;
+  delete fPtH;
+  delete fEtaH;
+  delete fEneH;
+  delete fPhiH;
+}
+
+void AliJetHistos::SetProperties(TH1* h,const char* x, const char* y) const
+{
+// Sets the histogram style properties
+  h->SetMarkerStyle(20);
+  h->SetMarkerSize(.5);
+  h->SetMarkerColor(2);
+  h->SetXTitle(x);
+  h->SetYTitle(y);
+  h->Sumw2();
+}
+
+void AliJetHistos::AddHistosToList(TList *list)
+{
+  list->Add(fNJetsH);
+  list->Add(fPtH);
+  list->Add(fEtaH);
+  list->Add(fEneH);
+  list->Add(fPhiH);
+}
+
+
+void AliJetHistos::FillHistos(TClonesArray *jets)
+{
+  Int_t nj = jets->GetEntries();
+  fNJetsH->Fill(nj,1);
+
+  if (nj == 0 ) return;
+
+  AliAODJet *j;
+  for (Int_t i=0;i<nj;i++) {
+    j = (AliAODJet *) jets->At(i);
+    fPtH->Fill(j->Pt(),1);
+    fEtaH->Fill(j->Eta(),1);
+    fEneH->Fill(j->E(),1);
+    fPhiH->Fill(j->Phi(),1);
+  }
+  
+}
diff --git a/JETAN/AliJetHistos.h b/JETAN/AliJetHistos.h
new file mode 100644 (file)
index 0000000..75ebfee
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ALIJETHISTOS_H
+#define ALIJETHISTOS_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+class Tlist;
+class TClonesArray;
+class TH1I;
+class TH1F;
+
+class AliJetHistos : public TObject {
+ public:
+  AliJetHistos();
+  ~AliJetHistos();
+
+  void AddHistosToList(TList *list);
+  void FillHistos(TClonesArray *jets);
+
+ protected:
+  void SetProperties(TH1* h,const char* x, const char* y) const;
+ private:
+
+  TH1I *fNJetsH;   // distribution of number of jets
+  TH1F *fPtH;      // pt spectra
+  TH1F *fEtaH;     // eta distribution
+  TH1F *fEneH;     // energy distribution
+  TH1F *fPhiH;     // phi distribution
+
+
+  ClassDef(AliJetHistos,1)
+};
+
+#endif
+
index b466f248bf8e847667c7502c1013122967f280cc..e4668bb4b38e4b62050981934e75fdf75273d5b9 100644 (file)
@@ -36,4 +36,5 @@
 #pragma        link C++ class AliJetKineReaderHeader;
 #pragma        link C++ class AliJetMCReader;
 #pragma        link C++ class AliJetMCReaderHeader;
+#pragma        link C++ class AliJetHistos+;
 #endif
index 096002b7cdacce6948c1e43857f80d1b4726d54b..1fe5d253d32224c172f26fcc44fb8b73be5842a9 100644 (file)
@@ -21,7 +21,8 @@ SRCS =        AliJet.cxx AliJetHeader.cxx \
        AliJetKineReader.cxx \
        AliJetKineReaderHeader.cxx \
        AliJetMCReader.cxx \
-       AliJetMCReaderHeader.cxx
+       AliJetMCReaderHeader.cxx \
+       AliJetHistos.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h)