]>
Commit | Line | Data |
---|---|---|
e5b96aa0 | 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 | **************************************************************************/ | |
f1a3e20a | 15 | |
16 | /* $Id$ */ | |
e5b96aa0 | 17 | |
18 | #include <TROOT.h> | |
19 | #include <TSystem.h> | |
20 | #include <TInterpreter.h> | |
21 | #include <TChain.h> | |
76c48857 | 22 | #include <TFile.h> |
22003a60 | 23 | #include <TList.h> |
e5b96aa0 | 24 | |
25 | #include "AliAnalysisTaskJets.h" | |
1d27ecd2 | 26 | #include "AliAnalysisManager.h" |
e5b96aa0 | 27 | #include "AliJetFinder.h" |
22003a60 | 28 | #include "AliJetHistos.h" |
1b307662 | 29 | #include "AliESDEvent.h" |
1d27ecd2 | 30 | #include "AliAODEvent.h" |
31 | #include "AliAODHandler.h" | |
691685d6 | 32 | #include "AliMCEventHandler.h" |
33 | #include "AliStack.h" | |
1d27ecd2 | 34 | |
e5b96aa0 | 35 | |
36 | ClassImp(AliAnalysisTaskJets) | |
37 | ||
38 | //////////////////////////////////////////////////////////////////////// | |
39 | ||
19e6695b | 40 | AliAnalysisTaskJets::AliAnalysisTaskJets(): |
41 | fDebug(0), | |
42 | fJetFinder(0x0), | |
43 | fChain(0x0), | |
eaabc21f | 44 | fESD(0x0), |
1d27ecd2 | 45 | fAOD(0x0), |
aa049fb2 | 46 | fTreeA(0x0), |
22003a60 | 47 | fHistos(0x0), |
48 | fListOfHistos(0x0) | |
19e6695b | 49 | { |
50 | // Default constructor | |
51 | } | |
52 | ||
e5b96aa0 | 53 | AliAnalysisTaskJets::AliAnalysisTaskJets(const char* name): |
54 | AliAnalysisTask(name, "AnalysisTaskJets"), | |
68093d75 | 55 | fDebug(0), |
e5b96aa0 | 56 | fJetFinder(0x0), |
57 | fChain(0x0), | |
eaabc21f | 58 | fESD(0x0), |
1d27ecd2 | 59 | fAOD(0x0), |
aa049fb2 | 60 | fTreeA(0x0), |
22003a60 | 61 | fHistos(0x0), |
62 | fListOfHistos(0x0) | |
e5b96aa0 | 63 | { |
64 | // Default constructor | |
65 | DefineInput (0, TChain::Class()); | |
eaabc21f | 66 | DefineOutput(0, TTree::Class()); |
22003a60 | 67 | DefineOutput(1, TList::Class()); |
eaabc21f | 68 | } |
69 | ||
70 | void AliAnalysisTaskJets::CreateOutputObjects() | |
71 | { | |
72 | // Create the output container | |
aa049fb2 | 73 | // |
74 | // Default AOD | |
1b307662 | 75 | if (fDebug > 1) printf("AnalysisTaskJets::CreateOutPutData() \n"); |
691685d6 | 76 | AliAODHandler* handler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); |
77 | ||
1d27ecd2 | 78 | fAOD = handler->GetAOD(); |
79 | fTreeA = handler->GetTree(); | |
80 | fJetFinder->ConnectAOD(fAOD); | |
aa049fb2 | 81 | // |
22003a60 | 82 | // Histograms |
aa049fb2 | 83 | OpenFile(1); |
22003a60 | 84 | fListOfHistos = new TList(); |
85 | fHistos = new AliJetHistos(); | |
86 | fHistos->AddHistosToList(fListOfHistos); | |
e5b96aa0 | 87 | } |
88 | ||
19e6695b | 89 | void AliAnalysisTaskJets::Init() |
e5b96aa0 | 90 | { |
19e6695b | 91 | // Initialization |
92 | if (fDebug > 1) printf("AnalysisTaskJets::Init() \n"); | |
eaabc21f | 93 | |
e5b96aa0 | 94 | // Call configuration file |
95 | gROOT->LoadMacro("ConfigJetAnalysis.C"); | |
96 | fJetFinder = (AliJetFinder*) gInterpreter->ProcessLine("ConfigJetAnalysis()"); | |
97 | // Initialise Jet Analysis | |
98 | fJetFinder->Init(); | |
76c48857 | 99 | // Write header information to local file |
100 | fJetFinder->WriteHeaders(); | |
19e6695b | 101 | } |
102 | ||
103 | void AliAnalysisTaskJets::ConnectInputData(Option_t */*option*/) | |
104 | { | |
105 | // Connect the input data | |
19e6695b | 106 | if (fDebug > 1) printf("AnalysisTaskJets::ConnectInputData() \n"); |
76c48857 | 107 | fChain = (TChain*)GetInputData(0); |
1b307662 | 108 | fESD = new AliESDEvent(); |
109 | fESD->ReadFromTree(fChain); | |
85c7d469 | 110 | |
0999c4b9 | 111 | AliMCEventHandler* mcTruth = (AliMCEventHandler*) |
112 | ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); | |
113 | ||
114 | fJetFinder->GetReader()->SetInputEvent(fESD, fAOD, mcTruth); | |
e5b96aa0 | 115 | } |
116 | ||
117 | void AliAnalysisTaskJets::Exec(Option_t */*option*/) | |
118 | { | |
119 | // Execute analysis for current event | |
120 | // | |
691685d6 | 121 | AliMCEventHandler* mctruth = (AliMCEventHandler*) |
122 | ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler()); | |
f1a3e20a | 123 | if (mctruth) { |
124 | AliStack* stack = mctruth->Stack(); | |
125 | printf("AliAnalysisTaskJets: Number of tracks on stack %5d\n", stack->GetNtrack()); | |
126 | } | |
127 | ||
85c7d469 | 128 | AliESD* old = fESD->GetAliESDOld(); |
129 | if (old) { | |
85c7d469 | 130 | fESD->CopyFromOldESD(); |
131 | } | |
132 | ||
e5b96aa0 | 133 | Long64_t ientry = fChain->GetReadEntry(); |
76c48857 | 134 | if (fDebug > 1) printf("Analysing event # %5d\n", (Int_t) ientry); |
e5b96aa0 | 135 | fJetFinder->ProcessEvent(ientry); |
22003a60 | 136 | |
137 | // Fill control histos | |
138 | fHistos->FillHistos(fAOD->GetJets()); | |
139 | ||
140 | // Post the data | |
1d27ecd2 | 141 | PostData(0, fTreeA); |
22003a60 | 142 | PostData(1, fListOfHistos); |
e5b96aa0 | 143 | } |
144 | ||
145 | void AliAnalysisTaskJets::Terminate(Option_t */*option*/) | |
146 | { | |
147 | // Terminate analysis | |
148 | // | |
19e6695b | 149 | if (fDebug > 1) printf("AnalysisJets: Terminate() \n"); |
76c48857 | 150 | // if (fJetFinder) fJetFinder->FinishRun(); |
e5b96aa0 | 151 | } |
152 |