]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskNestedLoops.cxx
Fix XML list creation from tag cuts - reset list counter for each file tag
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskNestedLoops.cxx
CommitLineData
67a6b178 1/*************************************************************************
2* Copyright(c) 1998-2008, 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
16/**********************************
17 * analysis task for nested loops *
18 * *
19 * authors: Naomi van der Kolk *
20 * (kolk@nikhef.nl) *
21 * Raimond Snellings *
22 * (snelling@nikhef.nl) *
23 * Ante Bilandzic *
24 * (anteb@nikhef.nl) *
25 * *******************************/
26
27class TFile;
28class TList;
29class AliAnalysisTaskSE;
30
31#include "Riostream.h"
32#include "AliFlowEventSimple.h"
33#include "AliAnalysisTaskNestedLoops.h"
34#include "AliFlowAnalysisWithNestedLoops.h"
35
36ClassImp(AliAnalysisTaskNestedLoops)
37
38//================================================================================================================
39
40AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights):
41AliAnalysisTaskSE(name),
42fEvent(NULL),
43fNL(NULL),
44fListHistos(NULL),
e999459d 45fHarmonic(0),
46fOppositeChargesPOI(kFALSE),
47fEvaluateDifferential3pCorrelator(kFALSE),
67a6b178 48fUseParticleWeights(useParticleWeights),
49fUsePhiWeights(kFALSE),
50fUsePtWeights(kFALSE),
51fUseEtaWeights(kFALSE),
e999459d 52fWeightsList(NULL),
53fEvaluateNestedLoopsForRAD(kTRUE),
54fEvaluateNestedLoopsForQC(kFALSE),
55fEvaluateNestedLoopsForMH(kFALSE)
67a6b178 56{
57 // constructor
58 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights)"<<endl;
59
60 // Define input and output slots here
61 // Input slot #0 works with an AliFlowEventSimple
62 DefineInput(0, AliFlowEventSimple::Class());
63 // Input slot #1 is needed for the weights input file:
64 if(useParticleWeights)
65 {
66 DefineInput(1, TList::Class());
67 }
68 // Output slot #0 is reserved
69 // Output slot #1 writes into a TList container
70 DefineOutput(1, TList::Class());
71}
72
73AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops():
74AliAnalysisTaskSE(),
75fEvent(NULL),
76fNL(NULL),
77fListHistos(NULL),
e999459d 78fHarmonic(0),
79fOppositeChargesPOI(kFALSE),
80fEvaluateDifferential3pCorrelator(kFALSE),
67a6b178 81fUseParticleWeights(kFALSE),
82fUsePhiWeights(kFALSE),
83fUsePtWeights(kFALSE),
84fUseEtaWeights(kFALSE),
e999459d 85fWeightsList(NULL),
86fEvaluateNestedLoopsForRAD(kFALSE),
87fEvaluateNestedLoopsForQC(kFALSE),
88fEvaluateNestedLoopsForMH(kFALSE)
67a6b178 89{
90 // Dummy constructor
91 cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops()"<<endl;
92}
93
94//================================================================================================================
95
96void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
97{
98 // Called at every worker node to initialize
99 cout<<"AliAnalysisTaskNestedLoops::UserCreateOutputObjects()"<<endl;
100
101 // Analyser:
102 fNL = new AliFlowAnalysisWithNestedLoops();
103
e999459d 104 fNL->SetHarmonic(fHarmonic);
105 fNL->SetOppositeChargesPOI(fOppositeChargesPOI);
106 fNL->SetEvaluateDifferential3pCorrelator(fEvaluateDifferential3pCorrelator);
107
67a6b178 108 if(fUseParticleWeights)
109 {
110 // Pass the flags to class:
111 if(fUsePhiWeights) fNL->SetUsePhiWeights(fUsePhiWeights);
112 if(fUsePtWeights) fNL->SetUsePtWeights(fUsePtWeights);
113 if(fUseEtaWeights) fNL->SetUseEtaWeights(fUseEtaWeights);
114 // Get data from input slot #1 which is used for weights:
115 if(GetNinputs()==2)
116 {
117 fWeightsList = (TList*)GetInputData(1);
118 }
119 // Pass the list with weights to class:
120 if(fWeightsList) fNL->SetWeightsList(fWeightsList);
121 }
122
e999459d 123 fNL->SetEvaluateNestedLoopsForRAD(fEvaluateNestedLoopsForRAD);
124 fNL->SetEvaluateNestedLoopsForQC(fEvaluateNestedLoopsForQC);
125 fNL->SetEvaluateNestedLoopsForMH(fEvaluateNestedLoopsForMH);
126
67a6b178 127 fNL->Init();
128
129 if(fNL->GetHistList())
130 {
131 fListHistos = fNL->GetHistList();
132 // fListHistos->Print();
133 } else
134 {
135 Printf("ERROR: Could not retrieve histogram list (NL, Task::UserCreateOutputObjects()) !!!!");
136 }
61e0c8c0 137
138 PostData(1,fListHistos);
139
67a6b178 140} // end of void AliAnalysisTaskNestedLoops::UserCreateOutputObjects()
141
142//================================================================================================================
143
144void AliAnalysisTaskNestedLoops::UserExec(Option_t *)
145{
146 // main loop (called for each event)
147 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
148
149 // Nested Loops:
150 if(fEvent)
151 {
152 fNL->Make(fEvent);
153 } else
154 {
155 cout<<"WARNING: No input data (NL, Task::UserExec()) !!!!"<<endl;
156 cout<<endl;
157 }
158
159 PostData(1,fListHistos);
160}
161
162//================================================================================================================
163
164void AliAnalysisTaskNestedLoops::Terminate(Option_t *)
165{
166 //accessing the merged output list:
167 fListHistos = (TList*)GetOutputData(1);
168
169 fNL = new AliFlowAnalysisWithNestedLoops();
170
171 if(fListHistos)
172 {
173 fNL->GetOutputHistograms(fListHistos);
174 fNL->Finish();
175 PostData(1,fListHistos);
176 } else
177 {
178 cout<<" WARNING: histogram list pointer is empty (NL, Task::Terminate()) !!!!"<<endl;
179 cout<<endl;
180 }
181
182} // end of void AliAnalysisTaskNestedLoops::Terminate(Option_t *)
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203