]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliAnalysisTaskSE.cxx
entry# stored for each event.
[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),
80d13558 45 fEntry(0),
5232d0de 46 fInputEvent(0x0),
80d13558 47 fInputHandler(0x0),
5232d0de 48 fOutputAOD(0x0),
49 fMCEvent(0x0),
50 fTreeA(0x0)
51{
52 // Default constructor
53}
54
55AliAnalysisTaskSE::AliAnalysisTaskSE(const char* name):
56 AliAnalysisTask(name, "AnalysisTaskSE"),
57 fDebug(0),
80d13558 58 fEntry(0),
5232d0de 59 fInputEvent(0x0),
80d13558 60 fInputHandler(0x0),
5232d0de 61 fOutputAOD(0x0),
62 fMCEvent(0x0),
63 fTreeA(0x0)
64{
65 // Default constructor
66 DefineInput (0, TChain::Class());
67 DefineOutput(0, TTree::Class());
68}
69
26f071d8 70AliAnalysisTaskSE::AliAnalysisTaskSE(const AliAnalysisTaskSE& obj):
71 AliAnalysisTask(obj),
72 fDebug(0),
80d13558 73 fEntry(0),
26f071d8 74 fInputEvent(0x0),
80d13558 75 fInputHandler(0x0),
26f071d8 76 fOutputAOD(0x0),
77 fMCEvent(0x0),
78 fTreeA(0x0)
79{
80// Copy constructor
80d13558 81 fDebug = obj.fDebug;
82 fEntry = obj.fEntry;
83 fInputEvent = obj.fInputEvent;
84 fInputHandler = obj.fInputHandler;
85 fOutputAOD = obj.fOutputAOD;
86 fMCEvent = obj.fMCEvent;
87 fTreeA = obj.fTreeA;
26f071d8 88}
89
90
91AliAnalysisTaskSE& AliAnalysisTaskSE::operator=(const AliAnalysisTaskSE& other)
92{
93// Assignment
94 AliAnalysisTask::operator=(other);
80d13558 95 fDebug = other.fDebug;
96 fEntry = other.fEntry;
97 fInputEvent = other.fInputEvent;
98 fInputHandler = other.fInputHandler;
99 fOutputAOD = other.fOutputAOD;
100 fMCEvent = other.fMCEvent;
101 fTreeA = other.fTreeA;
26f071d8 102 return *this;
103}
5232d0de 104
105
106void AliAnalysisTaskSE::ConnectInputData(Option_t* /*option*/)
107{
108// Connect the input data
109 if (fDebug > 1) printf("AnalysisTaskSE::ConnectInputData() \n");
110//
111// ESD
112//
80d13558 113 AliInputEventHandler* fInputHandler = (AliInputEventHandler*)
5232d0de 114 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
80d13558 115 if (fInputHandler) fInputEvent = fInputHandler->GetEvent();
5232d0de 116//
117// Monte Carlo
118//
119 AliMCEventHandler* mcH = 0;
120 mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
121 if (mcH) fMCEvent = mcH->MCEvent();
122}
123
124void AliAnalysisTaskSE::CreateOutputObjects()
125{
126// Create the output container
127//
128// Default AOD
129 if (fDebug > 1) printf("AnalysisTaskSE::CreateOutPutData() \n");
130
131 AliAODHandler* handler = (AliAODHandler*)
132 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
133
134 fOutputAOD = handler->GetAOD();
135 fTreeA = handler->GetTree();
136 UserCreateOutputObjects();
137}
138
139void AliAnalysisTaskSE::Exec(Option_t* option)
140{
141//
142// Exec analysis of one event
80d13558 143 fEntry = fInputHandler->GetReadEntry();
5232d0de 144 UserExec(option);
145}
146
147
148