Change of sette/getter in AliAnalysisManager
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskJets.cxx
CommitLineData
e5b96aa0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16#include <TROOT.h>
17#include <TSystem.h>
18#include <TInterpreter.h>
19#include <TChain.h>
76c48857 20#include <TFile.h>
e5b96aa0 21#include <TH1.h>
22
23#include "AliAnalysisTaskJets.h"
1d27ecd2 24#include "AliAnalysisManager.h"
e5b96aa0 25#include "AliJetFinder.h"
1b307662 26#include "AliESDEvent.h"
1d27ecd2 27#include "AliAODEvent.h"
28#include "AliAODHandler.h"
29
e5b96aa0 30
31ClassImp(AliAnalysisTaskJets)
32
33////////////////////////////////////////////////////////////////////////
34
19e6695b 35AliAnalysisTaskJets::AliAnalysisTaskJets():
36 fDebug(0),
37 fJetFinder(0x0),
38 fChain(0x0),
eaabc21f 39 fESD(0x0),
1d27ecd2 40 fAOD(0x0),
aa049fb2 41 fTreeA(0x0),
42 fHisto(0x0)
19e6695b 43{
44 // Default constructor
45}
46
e5b96aa0 47AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name):
48 AliAnalysisTask(name, "AnalysisTaskJets"),
68093d75 49 fDebug(0),
e5b96aa0 50 fJetFinder(0x0),
51 fChain(0x0),
eaabc21f 52 fESD(0x0),
1d27ecd2 53 fAOD(0x0),
aa049fb2 54 fTreeA(0x0),
55 fHisto(0x0)
e5b96aa0 56{
57 // Default constructor
58 DefineInput (0, TChain::Class());
eaabc21f 59 DefineOutput(0, TTree::Class());
aa049fb2 60 DefineOutput(1, TH1F::Class());
eaabc21f 61}
62
63void AliAnalysisTaskJets::CreateOutputObjects()
64{
65// Create the output container
aa049fb2 66//
67// Default AOD
1b307662 68 if (fDebug > 1) printf("AnalysisTaskJets::CreateOutPutData() \n");
1d27ecd2 69 AliAODHandler* handler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetEventHandler());
1d27ecd2 70 fAOD = handler->GetAOD();
71 fTreeA = handler->GetTree();
72 fJetFinder->ConnectAOD(fAOD);
aa049fb2 73//
74// Histogram
75 OpenFile(1);
76 fHisto = new TH1F("fHisto", "Jet Et", 100, 0., 100.);
e5b96aa0 77}
78
19e6695b 79void AliAnalysisTaskJets::Init()
e5b96aa0 80{
19e6695b 81 // Initialization
82 if (fDebug > 1) printf("AnalysisTaskJets::Init() \n");
eaabc21f 83
e5b96aa0 84 // Call configuration file
85 gROOT->LoadMacro("ConfigJetAnalysis.C");
86 fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
87 // Initialise Jet Analysis
88 fJetFinder->Init();
76c48857 89 // Write header information to local file
90 fJetFinder->WriteHeaders();
19e6695b 91}
92
93void AliAnalysisTaskJets::ConnectInputData(Option_t */*option*/)
94{
95// Connect the input data
19e6695b 96 if (fDebug > 1) printf("AnalysisTaskJets::ConnectInputData() \n");
76c48857 97 fChain = (TChain*)GetInputData(0);
1b307662 98 fESD = new AliESDEvent();
99 fESD->ReadFromTree(fChain);
f3f3617d 100 fJetFinder->ConnectTree(fChain, fESD);
e5b96aa0 101}
102
103void AliAnalysisTaskJets::Exec(Option_t */*option*/)
104{
105// Execute analysis for current event
106//
107 Long64_t ientry = fChain->GetReadEntry();
76c48857 108 if (fDebug > 1) printf("Analysing event # %5d\n", (Int_t) ientry);
e5b96aa0 109 fJetFinder->ProcessEvent(ientry);
1d27ecd2 110 PostData(0, fTreeA);
aa049fb2 111 PostData(1, fHisto);
e5b96aa0 112}
113
114void AliAnalysisTaskJets::Terminate(Option_t */*option*/)
115{
116// Terminate analysis
117//
19e6695b 118 if (fDebug > 1) printf("AnalysisJets: Terminate() \n");
76c48857 119 // if (fJetFinder) fJetFinder->FinishRun();
e5b96aa0 120}
121