]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskQCumulants.cxx
Added missing header protection declaration
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskQCumulants.cxx
CommitLineData
bc92c0cb 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* *
52021ae2 7* Permission to use, copy, modify and distribute this software and its *
bc92c0cb 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 Q-cumulants *
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
2ed70edf 27class TFile;
28class TList;
29class AliAnalysisTaskSE;
30
bc92c0cb 31#include "Riostream.h"
7183fe85 32#include "AliFlowEventSimple.h"
bc92c0cb 33#include "AliAnalysisTaskQCumulants.h"
bc92c0cb 34#include "AliFlowAnalysisWithQCumulants.h"
bc92c0cb 35
36ClassImp(AliAnalysisTaskQCumulants)
37
38//================================================================================================================
39
2ed70edf 40AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights):
41 AliAnalysisTaskSE(name),
7183fe85 42 fEvent(NULL),
2ed70edf 43 fQC(NULL),
77515452 44 fListHistos(NULL),
2ed70edf 45 fHarmonic(2),
050c0a54 46 fApplyCorrectionForNUA(kFALSE),
47 fApplyCorrectionForNUAVsM(kFALSE),
b77b6434 48 fPropagateErrorAlsoFromNIT(kFALSE),
2ed70edf 49 fCalculate2DFlow(kFALSE),
50 fStoreDistributions(kFALSE),
b3dacf6b 51 fCalculateCumulantsVsM(kTRUE),
050c0a54 52 fMinimumBiasReferenceFlow(kTRUE),
e5834fcb 53 fForgetAboutCovariances(kFALSE),
54 fStorePhiDistributionForOneEvent(kFALSE),
067e9bc8 55 fnBinsMult(10000),
56 fMinMult(0.),
57 fMaxMult(10000.),
2ed70edf 58 fUseParticleWeights(useParticleWeights),
e04e4ec5 59 fUsePhiWeights(kFALSE),
60 fUsePtWeights(kFALSE),
61 fUseEtaWeights(kFALSE),
2ed70edf 62 fWeightsList(NULL),
63 fMultiplicityWeight(NULL)
bc92c0cb 64{
7183fe85 65 // constructor
2ed70edf 66 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights)"<<endl;
bc92c0cb 67
68 // Define input and output slots here
2ed70edf 69 // Input slot #0 works with an AliFlowEventSimple
70 DefineInput(0, AliFlowEventSimple::Class());
71 // Input slot #1 is needed for the weights input file:
72 if(useParticleWeights)
e04e4ec5 73 {
74 DefineInput(1, TList::Class());
2ed70edf 75 }
76 // Output slot #0 is reserved
77 // Output slot #1 writes into a TList container
78 DefineOutput(1, TList::Class());
e04e4ec5 79
2ed70edf 80 // Event weights:
81 fMultiplicityWeight = new TString("combinations");
e5834fcb 82
83 // Store phi distribution for one event to illustrate flow:
84 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
85 {
86 fPhiDistributionForOneEventSettings[p] = 0.;
87 }
88
bc92c0cb 89}
90
91AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants():
2ed70edf 92 AliAnalysisTaskSE(),
7183fe85 93 fEvent(NULL),
2ed70edf 94 fQC(NULL),
7183fe85 95 fListHistos(NULL),
2ed70edf 96 fHarmonic(0),
97 fApplyCorrectionForNUA(kFALSE),
050c0a54 98 fApplyCorrectionForNUAVsM(kFALSE),
b77b6434 99 fPropagateErrorAlsoFromNIT(kFALSE),
2ed70edf 100 fCalculate2DFlow(kFALSE),
101 fStoreDistributions(kFALSE),
b3dacf6b 102 fCalculateCumulantsVsM(kFALSE),
0dd3b008 103 fMinimumBiasReferenceFlow(kFALSE),
8e1cefdd 104 fForgetAboutCovariances(kFALSE),
e5834fcb 105 fStorePhiDistributionForOneEvent(kFALSE),
067e9bc8 106 fnBinsMult(0),
107 fMinMult(0.),
108 fMaxMult(0.),
2ed70edf 109 fUseParticleWeights(kFALSE),
e04e4ec5 110 fUsePhiWeights(kFALSE),
111 fUsePtWeights(kFALSE),
112 fUseEtaWeights(kFALSE),
2ed70edf 113 fWeightsList(NULL),
114 fMultiplicityWeight(NULL)
bc92c0cb 115{
2ed70edf 116 // Dummy constructor
bc92c0cb 117 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()"<<endl;
e5834fcb 118
119 // Store phi distribution for one event to illustrate flow:
120 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
121 {
122 fPhiDistributionForOneEventSettings[p] = 0.;
123 }
124
bc92c0cb 125}
126
127//================================================================================================================
128
2ed70edf 129void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 130{
2ed70edf 131 // Called at every worker node to initialize
132 cout<<"AliAnalysisTaskQCumulants::UserCreateOutputObjects()"<<endl;
bc92c0cb 133
2ed70edf 134 // Analyser:
135 fQC = new AliFlowAnalysisWithQCumulants();
e04e4ec5 136
2ed70edf 137 // Common:
138 fQC->SetHarmonic(fHarmonic);
139 fQC->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
050c0a54 140 fQC->SetApplyCorrectionForNUAVsM(fApplyCorrectionForNUAVsM);
b77b6434 141 fQC->SetPropagateErrorAlsoFromNIT(fPropagateErrorAlsoFromNIT);
2ed70edf 142 fQC->SetCalculate2DFlow(fCalculate2DFlow);
143 fQC->SetStoreDistributions(fStoreDistributions);
b3dacf6b 144 fQC->SetCalculateCumulantsVsM(fCalculateCumulantsVsM);
0dd3b008 145 fQC->SetMinimumBiasReferenceFlow(fMinimumBiasReferenceFlow);
8e1cefdd 146 fQC->SetForgetAboutCovariances(fForgetAboutCovariances);
b3dacf6b 147 // Multiparticle correlations vs multiplicity:
067e9bc8 148 fQC->SetnBinsMult(fnBinsMult);
149 fQC->SetMinMult(fMinMult);
150 fQC->SetMaxMult(fMaxMult);
2ed70edf 151 // Particle weights:
152 if(fUseParticleWeights)
e04e4ec5 153 {
2ed70edf 154 // Pass the flags to class:
155 if(fUsePhiWeights) fQC->SetUsePhiWeights(fUsePhiWeights);
156 if(fUsePtWeights) fQC->SetUsePtWeights(fUsePtWeights);
157 if(fUseEtaWeights) fQC->SetUseEtaWeights(fUseEtaWeights);
158 // Get data from input slot #1 which is used for weights:
e04e4ec5 159 if(GetNinputs()==2)
160 {
2ed70edf 161 fWeightsList = (TList*)GetInputData(1);
e04e4ec5 162 }
2ed70edf 163 // Pass the list with weights to class:
164 if(fWeightsList) fQC->SetWeightsList(fWeightsList);
e04e4ec5 165 }
2ed70edf 166 // Event weights:
167 if(!(strcmp(fMultiplicityWeight->Data(),"combinations")==0)) // default is "combinations"
bc92c0cb 168 {
2ed70edf 169 fQC->SetMultiplicityWeight(fMultiplicityWeight->Data());
bc92c0cb 170 }
e04e4ec5 171
e5834fcb 172 // Store phi distribution for one event to illustrate flow:
173 fQC->SetStorePhiDistributionForOneEvent(fStorePhiDistributionForOneEvent);
174 for(Int_t i=0;i<4;i++)
175 {
176 fQC->SetPhiDistributionForOneEventSettings(fPhiDistributionForOneEventSettings[i],i);
177 }
178
2ed70edf 179 fQC->Init();
bc92c0cb 180
2ed70edf 181 if(fQC->GetHistList())
182 {
183 fListHistos = fQC->GetHistList();
184 // fListHistos->Print();
185 } else
186 {
187 Printf("ERROR: Could not retrieve histogram list (QC, Task::UserCreateOutputObjects()) !!!!");
188 }
61e0c8c0 189
190 PostData(1,fListHistos);
191
2ed70edf 192} // end of void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 193
194//================================================================================================================
195
2ed70edf 196void AliAnalysisTaskQCumulants::UserExec(Option_t *)
bc92c0cb 197{
2ed70edf 198 // main loop (called for each event)
7183fe85 199 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
200
201 // Q-cumulants
202 if(fEvent)
203 {
2ed70edf 204 fQC->Make(fEvent);
205 } else
206 {
207 cout<<"WARNING: No input data (QC, Task::UserExec()) !!!!"<<endl;
208 cout<<endl;
209 }
bc92c0cb 210
2ed70edf 211 PostData(1,fListHistos);
bc92c0cb 212}
213
214//================================================================================================================
215
216void AliAnalysisTaskQCumulants::Terminate(Option_t *)
8842fb2b 217{
2ed70edf 218 //accessing the merged output list:
219 fListHistos = (TList*)GetOutputData(1);
77515452 220
2ed70edf 221 fQC = new AliFlowAnalysisWithQCumulants();
8842fb2b 222
2ed70edf 223 if(fListHistos)
fd46c3dd 224 {
2ed70edf 225 fQC->GetOutputHistograms(fListHistos);
226 fQC->Finish();
227 PostData(1,fListHistos);
228 } else
229 {
230 cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate()) !!!!"<<endl;
231 cout<<endl;
232 }
233
234} // end of void AliAnalysisTaskQCumulants::Terminate(Option_t *)
bc92c0cb 235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255