]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAnalysisTaskSE.cxx
AliMUON*TrackerData
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskSE.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 "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
38 ClassImp(AliAnalysisTaskSE)
39
40 ////////////////////////////////////////////////////////////////////////
41
42 AliAnalysisTaskSE::AliAnalysisTaskSE():
43     AliAnalysisTask(),
44     fDebug(0),
45     fInputEvent(0x0),
46     fOutputAOD(0x0),
47     fMCEvent(0x0),
48     fTreeA(0x0)
49 {
50   // Default constructor
51 }
52
53 AliAnalysisTaskSE::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 AliAnalysisTaskSE::AliAnalysisTaskSE(const AliAnalysisTaskSE& obj):
67     AliAnalysisTask(obj),
68     fDebug(0),
69     fInputEvent(0x0),
70     fOutputAOD(0x0),
71     fMCEvent(0x0),
72     fTreeA(0x0)
73 {
74 // Copy constructor
75     fDebug      = obj.fDebug;
76     fInputEvent = obj.fInputEvent;
77     fOutputAOD  = obj.fOutputAOD;
78     fMCEvent    = obj.fMCEvent;
79     fTreeA      = obj.fTreeA;    
80 }
81
82
83 AliAnalysisTaskSE& AliAnalysisTaskSE::operator=(const AliAnalysisTaskSE& other)
84 {
85 // Assignment
86     AliAnalysisTask::operator=(other);
87     fDebug      = other.fDebug;
88     fInputEvent = other.fInputEvent;
89     fOutputAOD  = other.fOutputAOD;
90     fMCEvent    = other.fMCEvent;
91     fTreeA      = other.fTreeA;    
92     return *this;
93 }
94
95
96 void AliAnalysisTaskSE::ConnectInputData(Option_t* /*option*/)
97 {
98 // Connect the input data
99     if (fDebug > 1) printf("AnalysisTaskSE::ConnectInputData() \n");
100 //
101 //  ESD
102 //
103     AliInputEventHandler* handler = (AliInputEventHandler*) 
104         ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
105     if (handler) fInputEvent = handler->GetEvent();
106 //
107 //  Monte Carlo
108 //
109     AliMCEventHandler*    mcH = 0;
110     mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
111     if (mcH) fMCEvent = mcH->MCEvent();
112 }
113
114 void AliAnalysisTaskSE::CreateOutputObjects()
115 {
116 // Create the output container
117 //
118 //  Default AOD
119     if (fDebug > 1) printf("AnalysisTaskSE::CreateOutPutData() \n");
120
121     AliAODHandler* handler = (AliAODHandler*) 
122         ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
123     
124     fOutputAOD   = handler->GetAOD();
125     fTreeA = handler->GetTree();
126     UserCreateOutputObjects();
127 }
128
129 void AliAnalysisTaskSE::Exec(Option_t* option)
130 {
131 //
132 // Exec analysis of one event
133     PostData(0, fTreeA);
134     UserExec(option);
135 }
136
137
138