Separation of ALICE independent ANALYSIS code and ALICE specific code.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskSE.cxx
CommitLineData
5232d0de 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 "AliAnalysisTaskSE.h"
26#include "AliAnalysisManager.h"
27#include "AliESDEvent.h"
28#include "AliESD.h"
29#include "AliAODEvent.h"
30#include "AliVEvent.h"
31#include "AliAODHandler.h"
32#include "AliMCEventHandler.h"
33#include "AliInputEventHandler.h"
34#include "AliMCEvent.h"
35#include "AliStack.h"
36
37
38ClassImp(AliAnalysisTaskSE)
39
40////////////////////////////////////////////////////////////////////////
41
42AliAnalysisTaskSE::AliAnalysisTaskSE():
43 AliAnalysisTask(),
44 fDebug(0),
45 fInputEvent(0x0),
46 fOutputAOD(0x0),
47 fMCEvent(0x0),
48 fTreeA(0x0)
49{
50 // Default constructor
51}
52
53AliAnalysisTaskSE::AliAnalysisTaskSE(const char* name):
54 AliAnalysisTask(name, "AnalysisTaskSE"),
55 fDebug(0),
56 fInputEvent(0x0),
57 fOutputAOD(0x0),
58 fMCEvent(0x0),
59 fTreeA(0x0)
60{
61 // Default constructor
62 DefineInput (0, TChain::Class());
63 DefineOutput(0, TTree::Class());
64}
65
66
67
68void AliAnalysisTaskSE::ConnectInputData(Option_t* /*option*/)
69{
70// Connect the input data
71 if (fDebug > 1) printf("AnalysisTaskSE::ConnectInputData() \n");
72//
73// ESD
74//
75 AliInputEventHandler* handler = (AliInputEventHandler*)
76 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
77 if (handler) fInputEvent = handler->GetEvent();
78//
79// Monte Carlo
80//
81 AliMCEventHandler* mcH = 0;
82 mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
83 if (mcH) fMCEvent = mcH->MCEvent();
84}
85
86void AliAnalysisTaskSE::CreateOutputObjects()
87{
88// Create the output container
89//
90// Default AOD
91 if (fDebug > 1) printf("AnalysisTaskSE::CreateOutPutData() \n");
92
93 AliAODHandler* handler = (AliAODHandler*)
94 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
95
96 fOutputAOD = handler->GetAOD();
97 fTreeA = handler->GetTree();
98 UserCreateOutputObjects();
99}
100
101void AliAnalysisTaskSE::Exec(Option_t* option)
102{
103//
104// Exec analysis of one event
105 PostData(0, fTreeA);
106 UserExec(option);
107}
108
109
110