]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliAnalysisTaskJets.cxx
7c12a94fff177c67e3e022f8684191f5d92ac071
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskJets.cxx
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>
20 #include <TH1.h>
21
22 #include "AliAnalysisTaskJets.h"
23 #include "AliJetFinder.h"
24 #include "AliESD.h"
25
26 ClassImp(AliAnalysisTaskJets)
27
28 ////////////////////////////////////////////////////////////////////////
29
30 AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name):
31     AliAnalysisTask(name, "AnalysisTaskJets"),
32     fDebug(0),
33     fJetFinder(0x0),
34     fChain(0x0),
35     fESD(0x0)
36 {
37   // Default constructor
38     DefineInput (0, TChain::Class());
39     DefineOutput(0, TH1::Class());
40 }
41
42 void AliAnalysisTaskJets::ConnectInputData(Option_t */*option*/)
43 {
44 // Initialisation
45 //
46     if (fDebug > 1) printf("AnalysisJets::Init() \n");
47
48     // Call configuration file
49     gROOT->LoadMacro("ConfigJetAnalysis.C");
50     fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
51     // Initialise Jet Analysis
52     fJetFinder->Init();
53     fChain = (TChain*)GetInputData(0);
54     fJetFinder->ConnectTree(fChain);
55     fJetFinder->WriteHeaders();
56 }
57
58 void AliAnalysisTaskJets::Exec(Option_t */*option*/)
59 {
60 // Execute analysis for current event
61 //
62     Long64_t ientry = fChain->GetReadEntry();
63      if (fDebug > 1) printf("Analysing event # %5d \n", (Int_t) ientry);
64     
65     fJetFinder->ProcessEvent(ientry);
66 }
67
68 void AliAnalysisTaskJets::Terminate(Option_t */*option*/)
69 {
70 // Terminate analysis
71 //
72     printf("AnalysisJets: Terminate() \n");
73     if (fJetFinder) fJetFinder->FinishRun();
74 }
75