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