]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 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 | /* $Id: $ */ | |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // Analysis task that executes the analysis classes | |
19 | // that depend on the PartCorr frame, frame for Particle identification and correlations. | |
20 | // Specially designed for calorimeters but also can be used for charged tracks | |
21 | // Input of this task is a configuration file that contains all the settings of the analyis | |
22 | // | |
23 | // -- Author: Gustavo Conesa (INFN-LNF) | |
24 | ||
25 | ||
26 | // root | |
27 | #include <TROOT.h> | |
28 | #include <TSystem.h> | |
29 | #include <TInterpreter.h> | |
30 | #include <TChain.h> | |
31 | #include <TFile.h> | |
32 | //#include <Riostream.h> | |
33 | ||
34 | // analysis | |
35 | #include "AliAnalysisTaskParticleCorrelation.h" | |
36 | #include "AliAnalysisManager.h" | |
37 | #include "AliESDInputHandler.h" | |
38 | #include "AliMCEventHandler.h" | |
39 | #include "AliMCEvent.h" | |
40 | #include "AliAnaPartCorrMaker.h" | |
41 | #include "AliCaloTrackReader.h" | |
42 | #include "AliESDEvent.h" | |
43 | #include "AliAODEvent.h" | |
44 | #include "AliAODHandler.h" | |
45 | #include "AliStack.h" | |
46 | #include "AliLog.h" | |
47 | ||
48 | ClassImp(AliAnalysisTaskParticleCorrelation) | |
49 | ||
50 | //////////////////////////////////////////////////////////////////////// | |
51 | ||
52 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): | |
53 | AliAnalysisTaskSE(), | |
54 | fAna(0x0), | |
55 | fOutputContainer(0x0), | |
56 | //fAODBranch(0x0), | |
57 | fConfigName(0) | |
58 | { | |
59 | // Default constructor | |
60 | } | |
61 | ||
62 | //_____________________________________________________ | |
63 | AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): | |
64 | AliAnalysisTaskSE(name), | |
65 | fAna(0x0), | |
66 | fOutputContainer(0x0), | |
67 | // fAODBranch(0x0), | |
68 | fConfigName("ConfigAnalysis") | |
69 | { | |
70 | // Default constructor | |
71 | ||
72 | DefineOutput(1, TList::Class()); | |
73 | ||
74 | } | |
75 | ||
76 | //_____________________________________________________ | |
77 | AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() | |
78 | { | |
79 | // Remove all pointers | |
80 | ||
81 | if(fOutputContainer){ | |
82 | fOutputContainer->Clear() ; | |
83 | delete fOutputContainer ; | |
84 | } | |
85 | ||
86 | } | |
87 | ||
88 | //_____________________________________________________ | |
89 | void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() | |
90 | { | |
91 | // Create the output container | |
92 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::CreateOutputData() \n"); | |
93 | ||
94 | ||
95 | // TClonesArray * aodBranch = new TClonesArray(fAna->GetAODBranchClassName(), 0); | |
96 | // aodBranch->SetName(fAna->GetAODBranchName()); | |
97 | // AddAODBranch("TClonesArray", &aodBranch); | |
98 | // fAna->SetAODBranch(aodBranch); | |
99 | ||
100 | //Get list of aod arrays, add each aod array to analysis frame | |
101 | TClonesArray * array = 0; | |
102 | TList * list = fAna->GetAODBranchList(); | |
103 | for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){ | |
104 | array = (TClonesArray*) list->At(iaod); | |
105 | AddAODBranch("TClonesArray", &array); | |
106 | } | |
107 | ||
108 | //Histograms container | |
109 | OpenFile(1); | |
110 | fOutputContainer = fAna->GetOutputContainer(); | |
111 | ||
112 | } | |
113 | ||
114 | //_____________________________________________________ | |
115 | void AliAnalysisTaskParticleCorrelation::Init() | |
116 | { | |
117 | // Initialization | |
118 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Init() \n"); | |
119 | ||
120 | // Call configuration file | |
121 | ||
122 | if(fConfigName == ""){ | |
123 | fConfigName="ConfigAnalysis"; | |
124 | } | |
125 | ||
126 | AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); | |
127 | gROOT->LoadMacro(fConfigName+".C"); | |
128 | fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); | |
129 | ||
130 | if(!fAna) | |
131 | AliFatal("Analysis pointer not initialized, abort analysis!"); | |
132 | ||
133 | // Initialise analysis | |
134 | fAna->Init(); | |
135 | ||
136 | AliDebug(1,"End"); | |
137 | ||
138 | } | |
139 | ||
140 | ||
141 | //_____________________________________________________ | |
142 | void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) | |
143 | { | |
144 | // Execute analysis for current event | |
145 | // | |
146 | if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Exec() \n"); | |
147 | ||
148 | //Get the type of data, check if type is correct | |
149 | Int_t datatype = fAna->GetReader()->GetDataType(); | |
150 | if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && | |
151 | datatype != AliCaloTrackReader::kMC){ | |
152 | AliFatal("Wrong type of data"); | |
153 | return ; | |
154 | } | |
155 | ||
156 | fAna->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent()); | |
157 | ||
158 | //Process event | |
159 | fAna->ProcessEvent((Int_t) Entry()); | |
160 | ||
161 | PostData(1, fOutputContainer); | |
162 | ||
163 | } | |
164 | ||
165 | //_____________________________________________________ | |
166 | void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) | |
167 | { | |
168 | // Terminate analysis | |
169 | // | |
170 | AliDebug(1,"Do nothing in Terminate"); | |
171 | //fAna->Terminate(); | |
172 | } | |
173 |