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