]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliAnalysisTaskJets.cxx
Derive from AliAnalysisTaskSE.
[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 /* $Id$ */
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 "AliAnalysisTaskJets.h"
26 #include "AliAnalysisManager.h"
27 #include "AliJetFinder.h"
28 #include "AliJetHistos.h"
29 #include "AliESDEvent.h"
30 #include "AliESD.h"
31 #include "AliAODEvent.h"
32 #include "AliAODHandler.h"
33 #include "AliMCEventHandler.h"
34 #include "AliESDInputHandler.h"
35 #include "AliMCEvent.h"
36 #include "AliStack.h"
37
38
39 ClassImp(AliAnalysisTaskJets)
40
41 ////////////////////////////////////////////////////////////////////////
42
43 AliAnalysisTaskJets::AliAnalysisTaskJets():
44     AliAnalysisTaskSE(),
45     fDebug(0),
46     fJetFinder(0x0),
47     fTree(0x0),
48     fHistos(0x0),
49     fListOfHistos(0x0)
50 {
51   // Default constructor
52 }
53
54 AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name):
55     AliAnalysisTaskSE(name),
56     fDebug(0),
57     fJetFinder(0x0),
58     fTree(0x0),
59     fHistos(0x0),
60     fListOfHistos(0x0)
61 {
62   // Default constructor
63     DefineOutput(1, TList::Class());
64 }
65
66 void AliAnalysisTaskJets::UserCreateOutputObjects()
67 {
68 // Create the output container
69 //
70     if (fDebug > 1) printf("AnalysisTaskJets::CreateOutPutData() \n");
71 //  Connec default AOD to jet finder
72
73     fJetFinder->ConnectAOD(AODEvent());
74 //
75 //  Histograms
76     OpenFile(1);
77     fListOfHistos = new TList();
78     fHistos       = new AliJetHistos();
79     fHistos->AddHistosToList(fListOfHistos);
80 }
81
82 void AliAnalysisTaskJets::Init()
83 {
84     // Initialization
85     if (fDebug > 1) printf("AnalysisTaskJets::Init() \n");
86
87     // Call configuration file
88     gROOT->LoadMacro("ConfigJetAnalysis.C");
89     fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
90     // Initialise Jet Analysis
91     fJetFinder->Init();
92     // Write header information to local file
93     fJetFinder->WriteHeaders();
94 }
95
96     
97
98
99
100 void AliAnalysisTaskJets::UserExec(Option_t */*option*/)
101 {
102 // Execute analysis for current event
103 //
104     
105     if (MCEvent()) {
106         AliStack* stack = MCEvent()->Stack();
107     }
108     fJetFinder->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent());
109     fJetFinder->ProcessEvent();
110
111     // Fill control histos
112     fHistos->FillHistos(AODEvent()->GetJets());
113     // Post the data
114     PostData(1, fListOfHistos);
115 }
116
117 void AliAnalysisTaskJets::Terminate(Option_t */*option*/)
118 {
119 // Terminate analysis
120 //
121     if (fDebug > 1) printf("AnalysisJets: Terminate() \n");
122 //    if (fJetFinder) fJetFinder->FinishRun();
123 }
124