Compatibility with ROOT trunk
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskJetsCDF.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 /* $Id: AliAnalysisTaskJets.cxx 24457 2008-03-13 10:02:22Z morsch $ */
17
18 #include <TROOT.h>
19 #include <TSystem.h>
20 #include <TInterpreter.h>
21 #include <TChain.h>
22 #include <TFile.h>
23 #include <TList.h>
24
25 #include "AliAnalysisManager.h"
26 #include "AliCdfJetFinder.h"
27 #include "AliESDEvent.h"
28 #include "AliESD.h"
29 #include "AliAODEvent.h"
30 #include "AliAODHandler.h"
31 #include "AliMCEventHandler.h"
32 #include "AliESDInputHandler.h"
33 #include "AliMCEvent.h"
34 #include "AliStack.h"
35 #include "AliJetReader.h"
36
37 #include "AliAnalysisTaskJetsCDF.h"
38
39 ClassImp(AliAnalysisTaskJetsCDF)
40
41 //______________________________________________________________________________
42 AliAnalysisTaskJetsCDF::AliAnalysisTaskJetsCDF():
43     AliAnalysisTaskSE(),
44     fJetFinder(0x0),
45     fListOfHistos(0x0)
46 {
47   // Default constructor
48 }
49
50 //______________________________________________________________________________
51 AliAnalysisTaskJetsCDF::AliAnalysisTaskJetsCDF(const char* name):
52     AliAnalysisTaskSE(name),
53     fJetFinder(0x0),
54     fListOfHistos(0x0)
55 {
56   // Default constructor
57     DefineOutput(1, TList::Class());
58 }
59
60 //______________________________________________________________________________
61 void AliAnalysisTaskJetsCDF::UserCreateOutputObjects()
62 {
63 // Create the output container
64 //
65     if (fDebug > 1) printf("AnalysisTaskJetsCDF::CreateOutPutData() \n");
66 //  Connect default AOD to jet finder
67
68     fJetFinder->ConnectAOD(AODEvent());
69 //
70 //  Histograms
71     OpenFile(1);
72     fListOfHistos = new TList();
73     if (!fJetFinder) {
74        Error("UserCreateOutputObjects", "No jet finder connected.");
75        return;
76     }
77     fJetFinder->CreateOutputObjects(fListOfHistos);
78 }
79
80 //______________________________________________________________________________
81 void AliAnalysisTaskJetsCDF::LocalInit()
82 {
83     // Initialization
84     if (fDebug > 1) printf("AnalysisTaskJets::Init() \n");
85
86     // Call configuration file
87     gROOT->LoadMacro("ConfigJetAnalysisCDF.C");
88     fJetFinder = (AliCdfJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
89     // Initialise Jet Analysis
90     fJetFinder->Init();
91     // Write header information to local file
92     fJetFinder->WriteHeaders();
93 }
94
95 //______________________________________________________________________________
96 void AliAnalysisTaskJetsCDF::UserExec(Option_t */*option*/)
97 {
98 // Execute analysis for current event
99 //
100
101     fJetFinder->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent());
102     fJetFinder->ProcessEvent();
103
104     // Post the data
105     PostData(1, fListOfHistos);
106 }
107
108 //______________________________________________________________________________
109 void AliAnalysisTaskJetsCDF::Terminate(Option_t */*option*/)
110 {
111 // Terminate analysis
112 //
113     if (fDebug > 1) printf("AliAnalysisJetsCDF: Terminate() \n");
114 //    if (fJetFinder) fJetFinder->FinishRun();
115 }
116