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 **************************************************************************/
18 //----------------------------------------------------------------
19 // Analysis task for interfacing the jet reader with the analysis framework
21 // Author: magali.estienne@subatech.in2p3.fr
22 // alexandre.shabetai@cern.ch
23 //----------------------------------------------------------------
25 #include <Riostream.h>
27 #include <TInterpreter.h>
30 #include "AliAnalysisTaskJetsReader.h"
31 #include "AliAnalysisManager.h"
32 #include "AliJetReader.h"
33 #include "AliAODEvent.h"
34 #include "AliMCEvent.h"
35 #include "AliJetCalTrk.h"
37 ClassImp(AliAnalysisTaskJetsReader)
39 ////////////////////////////////////////////////////////////////////////
41 AliAnalysisTaskJetsReader::AliAnalysisTaskJetsReader():
43 fConfigFile("ConfigJetReaderAnalysis.C"),
45 fReadAODFromOutput(0),
49 // Default constructor
52 //----------------------------------------------------------------
53 AliAnalysisTaskJetsReader::AliAnalysisTaskJetsReader(const char* name):
54 AliAnalysisTaskSE(name),
55 fConfigFile("ConfigJetReaderAnalysis.C"),
57 fReadAODFromOutput(0),
61 // Default constructor
62 DefineOutput(1, TTree::Class());
66 //----------------------------------------------------------------
67 AliAnalysisTaskJetsReader::~AliAnalysisTaskJetsReader()
76 //----------------------------------------------------------------
77 void AliAnalysisTaskJetsReader::UserCreateOutputObjects()
79 // Create the TTree to be exchanged between the reader and finder
82 if (fDebug > 1) printf("AnalysisTaskJetsReader::CreateOutPutData() \n");
84 fExchangeTree = new TTree("jets_ExchangeContainer","ExchangeTree");
86 fJetReader->InitTasks();
88 fReaderEvent = fJetReader->GetCalTrkEvent();
90 fExchangeTree->Branch("AliJetCalTrkEvent", &fReaderEvent);
92 PostData(1, fExchangeTree);
96 //----------------------------------------------------------------
97 void AliAnalysisTaskJetsReader::Init()
100 if (fDebug > 1) printf("AnalysisTaskJets::Init() \n");
102 // Call configuration file
103 if (fConfigFile.Length()) {
104 gROOT->LoadMacro(fConfigFile);
105 fJetReader = (AliJetReader*) gInterpreter->ProcessLine("ConfigJetReaderAnalysis()");
110 //----------------------------------------------------------------
111 void AliAnalysisTaskJetsReader::UserExec(Option_t */*option*/)
114 // Execute analysis for current event
117 // Clear current CalTrkEvent
118 fReaderEvent->Clear();
120 fExchangeTree->Reset();
122 // Give InputEvent to the reader
123 if (dynamic_cast<AliAODEvent*>(InputEvent()) != 0 && !fReadAODFromOutput) {
124 // AOD is input event..........................................V
125 fJetReader->SetInputEvent(InputEvent(), InputEvent(), MCEvent());
127 // AOD is read from output ....................................V
128 fJetReader->SetInputEvent(InputEvent(), AODEvent(), MCEvent());
131 // Process current event
132 fJetReader->ProcessEvent();
134 // Fill object to be exchanged between reader and finder tasks
135 fExchangeTree->Fill();
138 PostData(1, fExchangeTree);
144 //----------------------------------------------------------------
145 void AliAnalysisTaskJetsReader::Terminate(Option_t */*option*/)
147 // Terminate analysis
148 if (fDebug > 1) printf("AnalysisJets: Terminate() \n");