1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 #include <TInterpreter.h>
25 #include "AliAnalysisTaskSE.h"
26 #include "AliAnalysisManager.h"
27 #include "AliESDEvent.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"
39 ClassImp(AliAnalysisTaskSE)
41 ////////////////////////////////////////////////////////////////////////
43 AliAnalysisTaskSE::AliAnalysisTaskSE():
53 // Default constructor
56 AliAnalysisTaskSE::AliAnalysisTaskSE(const char* name):
57 AliAnalysisTask(name, "AnalysisTaskSE"),
66 // Default constructor
67 DefineInput (0, TChain::Class());
68 DefineOutput(0, TTree::Class());
71 AliAnalysisTaskSE::AliAnalysisTaskSE(const AliAnalysisTaskSE& obj):
84 fInputEvent = obj.fInputEvent;
85 fInputHandler = obj.fInputHandler;
86 fOutputAOD = obj.fOutputAOD;
87 fMCEvent = obj.fMCEvent;
89 printf("Constructor (3) \n");
93 AliAnalysisTaskSE& AliAnalysisTaskSE::operator=(const AliAnalysisTaskSE& other)
96 AliAnalysisTask::operator=(other);
97 fDebug = other.fDebug;
98 fEntry = other.fEntry;
99 fInputEvent = other.fInputEvent;
100 fInputHandler = other.fInputHandler;
101 fOutputAOD = other.fOutputAOD;
102 fMCEvent = other.fMCEvent;
103 fTreeA = other.fTreeA;
108 void AliAnalysisTaskSE::ConnectInputData(Option_t* /*option*/)
110 // Connect the input data
111 if (fDebug > 1) printf("AnalysisTaskSE::ConnectInputData() \n");
115 fInputHandler = (AliInputEventHandler*)
116 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
118 fInputEvent = fInputHandler->GetEvent();
120 AliError("No Input Event Handler connected") ;
126 AliMCEventHandler* mcH = 0;
127 mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
128 if (mcH) fMCEvent = mcH->MCEvent();
131 void AliAnalysisTaskSE::CreateOutputObjects()
133 // Create the output container
136 if (fDebug > 1) printf("AnalysisTaskSE::CreateOutPutData() \n");
138 AliAODHandler* handler = (AliAODHandler*)
139 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
141 fOutputAOD = handler->GetAOD();
142 fTreeA = handler->GetTree();
143 UserCreateOutputObjects();
146 void AliAnalysisTaskSE::Exec(Option_t* option)
149 // Exec analysis of one event
150 if (fDebug > 1) printf("AliAnalysisTaskSE::Exec() \n");
151 fEntry = fInputHandler->GetReadEntry();
152 if ( !((Entry()-1)%100) && fDebug > 0)
153 AliInfo(Form("%s ----> Processing event # %lld", CurrentFileName(), Entry()));
154 // Call the user analysis
160 const char* AliAnalysisTaskSE::CurrentFileName()
162 // Returns the current file name
163 return fInputHandler->GetTree()->GetCurrentFile()->GetName();