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 "AliAnalysisTaskJets.h"
26 #include "AliAnalysisManager.h"
27 #include "AliJetFinder.h"
28 #include "AliJetHistos.h"
29 #include "AliESDEvent.h"
31 #include "AliAODEvent.h"
32 #include "AliAODHandler.h"
33 #include "AliMCEventHandler.h"
34 #include "AliESDInputHandler.h"
35 #include "AliMCEvent.h"
39 ClassImp(AliAnalysisTaskJets)
41 ////////////////////////////////////////////////////////////////////////
43 AliAnalysisTaskJets::AliAnalysisTaskJets():
45 fConfigFile("ConfigJetAnalysis.C"),
51 // Default constructor
54 AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name):
55 AliAnalysisTaskSE(name),
56 fConfigFile("ConfigJetAnalysis.C"),
62 // Default constructor
63 DefineOutput(1, TList::Class());
66 void AliAnalysisTaskJets::UserCreateOutputObjects()
68 // Create the output container
70 if (fDebug > 1) printf("AnalysisTaskJets::CreateOutPutData() \n");
73 if(fNonStdBranch.Length()==0){
74 // Connec default AOD to jet finder
75 fJetFinder->ConnectAOD(AODEvent());
78 // Create a new branch for jets...
79 // how is this is reset cleared in the UserExec....
80 // Can this be handled by the framework?
81 TClonesArray *tca = new TClonesArray("AliAODJet", 0);
82 tca->SetName(fNonStdBranch);
83 AddAODBranch("TClonesArray",&tca);
84 fJetFinder->ConnectAODNonStd(AODEvent(),fNonStdBranch.Data());
88 fListOfHistos = new TList();
89 fHistos = new AliJetHistos();
90 fHistos->AddHistosToList(fListOfHistos);
94 void AliAnalysisTaskJets::Init()
97 if (fDebug > 1) printf("AnalysisTaskJets::Init() \n");
99 // Call configuration file
100 gROOT->LoadMacro(fConfigFile);
101 fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()");
102 // Initialise Jet Analysis
104 // Write header information to local file
105 fJetFinder->WriteHeaders();
112 void AliAnalysisTaskJets::UserExec(Option_t */*option*/)
114 // Execute analysis for current event
118 // Fill control histos
119 TClonesArray* jarray = 0;
120 if(fNonStdBranch.Length()==0){
121 jarray = AODEvent()->GetJets();
124 jarray = dynamic_cast<TClonesArray*>(AODEvent()->FindListObject(fNonStdBranch.Data()));
125 jarray->Delete(); // this is our responsibility, clear before filling again
128 fJetFinder->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent());
129 fJetFinder->ProcessEvent();
131 fHistos->FillHistos(jarray);
133 PostData(1, fListOfHistos);
136 void AliAnalysisTaskJets::Terminate(Option_t */*option*/)
138 // Terminate analysis
140 if (fDebug > 1) printf("AnalysisJets: Terminate() \n");
141 // if (fJetFinder) fJetFinder->FinishRun();