]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskQCumulants.cxx
Ante Bilandzic: add POI as reference multiplicity estimator
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / 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;
2701c4bc 28class TString;
2ed70edf 29class TList;
30class AliAnalysisTaskSE;
31
bc92c0cb 32#include "Riostream.h"
7183fe85 33#include "AliFlowEventSimple.h"
bc92c0cb 34#include "AliAnalysisTaskQCumulants.h"
bc92c0cb 35#include "AliFlowAnalysisWithQCumulants.h"
bc92c0cb 36
cea49479 37#include "AliLog.h"
38
3a7af7bd 39using std::cout;
40using std::endl;
bc92c0cb 41ClassImp(AliAnalysisTaskQCumulants)
42
43//================================================================================================================
44
2ed70edf 45AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights):
46 AliAnalysisTaskSE(name),
7183fe85 47 fEvent(NULL),
2ed70edf 48 fQC(NULL),
77515452 49 fListHistos(NULL),
53884472 50 fBookOnlyBasicCCH(kTRUE),
dd442cd2 51 fFillMultipleControlHistograms(kFALSE),
2ed70edf 52 fHarmonic(2),
050c0a54 53 fApplyCorrectionForNUA(kFALSE),
54 fApplyCorrectionForNUAVsM(kFALSE),
b77b6434 55 fPropagateErrorAlsoFromNIT(kFALSE),
1268c371 56 fCalculateDiffFlow(kTRUE),
57 fCalculate2DDiffFlow(kFALSE),
62e36168 58 fCalculateDiffFlowVsEta(kTRUE),
2ed70edf 59 fStoreDistributions(kFALSE),
dd442cd2 60 fCalculateCumulantsVsM(kFALSE),
3435cacb 61 fCalculateAllCorrelationsVsM(kFALSE),
8f0fcf13 62 fCalculateMixedHarmonics(kFALSE),
63 fCalculateMixedHarmonicsVsM(kFALSE),
df23c5ae 64 fStoreControlHistograms(kFALSE),
050c0a54 65 fMinimumBiasReferenceFlow(kTRUE),
e5834fcb 66 fForgetAboutCovariances(kFALSE),
67 fStorePhiDistributionForOneEvent(kFALSE),
067e9bc8 68 fnBinsMult(10000),
69 fMinMult(0.),
70 fMaxMult(10000.),
2ed70edf 71 fUseParticleWeights(useParticleWeights),
e04e4ec5 72 fUsePhiWeights(kFALSE),
73 fUsePtWeights(kFALSE),
74 fUseEtaWeights(kFALSE),
403e3389 75 fUseTrackWeights(kFALSE),
2ed70edf 76 fWeightsList(NULL),
df23c5ae 77 fMultiplicityWeight(NULL),
78 fMultiplicityIs(AliFlowCommonConstants::kRP)
bc92c0cb 79{
7183fe85 80 // constructor
df23c5ae 81 AliDebug(2,"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights)");
bc92c0cb 82
83 // Define input and output slots here
2ed70edf 84 // Input slot #0 works with an AliFlowEventSimple
85 DefineInput(0, AliFlowEventSimple::Class());
86 // Input slot #1 is needed for the weights input file:
87 if(useParticleWeights)
e04e4ec5 88 {
89 DefineInput(1, TList::Class());
2ed70edf 90 }
91 // Output slot #0 is reserved
92 // Output slot #1 writes into a TList container
93 DefineOutput(1, TList::Class());
e04e4ec5 94
2ed70edf 95 // Event weights:
96 fMultiplicityWeight = new TString("combinations");
e5834fcb 97
98 // Store phi distribution for one event to illustrate flow:
99 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
100 {
101 fPhiDistributionForOneEventSettings[p] = 0.;
102 }
bc92c0cb 103}
104
105AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants():
2ed70edf 106 AliAnalysisTaskSE(),
7183fe85 107 fEvent(NULL),
2ed70edf 108 fQC(NULL),
7183fe85 109 fListHistos(NULL),
62d19320 110 fBookOnlyBasicCCH(kFALSE),
dd442cd2 111 fFillMultipleControlHistograms(kFALSE),
2ed70edf 112 fHarmonic(0),
113 fApplyCorrectionForNUA(kFALSE),
050c0a54 114 fApplyCorrectionForNUAVsM(kFALSE),
b77b6434 115 fPropagateErrorAlsoFromNIT(kFALSE),
1268c371 116 fCalculateDiffFlow(kFALSE),
117 fCalculate2DDiffFlow(kFALSE),
62e36168 118 fCalculateDiffFlowVsEta(kTRUE),
2ed70edf 119 fStoreDistributions(kFALSE),
b3dacf6b 120 fCalculateCumulantsVsM(kFALSE),
3842bdcd 121 fCalculateAllCorrelationsVsM(kFALSE),
8f0fcf13 122 fCalculateMixedHarmonics(kFALSE),
123 fCalculateMixedHarmonicsVsM(kFALSE),
df23c5ae 124 fStoreControlHistograms(kFALSE),
0dd3b008 125 fMinimumBiasReferenceFlow(kFALSE),
8e1cefdd 126 fForgetAboutCovariances(kFALSE),
e5834fcb 127 fStorePhiDistributionForOneEvent(kFALSE),
067e9bc8 128 fnBinsMult(0),
129 fMinMult(0.),
130 fMaxMult(0.),
2ed70edf 131 fUseParticleWeights(kFALSE),
e04e4ec5 132 fUsePhiWeights(kFALSE),
133 fUsePtWeights(kFALSE),
134 fUseEtaWeights(kFALSE),
403e3389 135 fUseTrackWeights(kFALSE),
2ed70edf 136 fWeightsList(NULL),
df23c5ae 137 fMultiplicityWeight(NULL),
138 fMultiplicityIs(AliFlowCommonConstants::kRP)
bc92c0cb 139{
2ed70edf 140 // Dummy constructor
cea49479 141 AliDebug(2,"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()");
e5834fcb 142
143 // Store phi distribution for one event to illustrate flow:
144 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
145 {
146 fPhiDistributionForOneEventSettings[p] = 0.;
147 }
148
bc92c0cb 149}
150
151//================================================================================================================
152
2ed70edf 153void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 154{
2ed70edf 155 // Called at every worker node to initialize
cea49479 156 AliDebug(2,"AliAnalysisTaskQCumulants::UserCreateOutputObjects()");
bc92c0cb 157
2ed70edf 158 // Analyser:
159 fQC = new AliFlowAnalysisWithQCumulants();
e04e4ec5 160
2ed70edf 161 // Common:
62d19320 162 fQC->SetBookOnlyBasicCCH(fBookOnlyBasicCCH);
dd442cd2 163 fQC->SetFillMultipleControlHistograms(fFillMultipleControlHistograms);
2ed70edf 164 fQC->SetHarmonic(fHarmonic);
165 fQC->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
050c0a54 166 fQC->SetApplyCorrectionForNUAVsM(fApplyCorrectionForNUAVsM);
b77b6434 167 fQC->SetPropagateErrorAlsoFromNIT(fPropagateErrorAlsoFromNIT);
1268c371 168 fQC->SetCalculateDiffFlow(fCalculateDiffFlow);
169 fQC->SetCalculate2DDiffFlow(fCalculate2DDiffFlow);
62e36168 170 fQC->SetCalculateDiffFlowVsEta(fCalculateDiffFlowVsEta);
2ed70edf 171 fQC->SetStoreDistributions(fStoreDistributions);
b3dacf6b 172 fQC->SetCalculateCumulantsVsM(fCalculateCumulantsVsM);
3435cacb 173 fQC->SetCalculateAllCorrelationsVsM(fCalculateAllCorrelationsVsM);
8f0fcf13 174 fQC->SetCalculateMixedHarmonics(fCalculateMixedHarmonics);
175 fQC->SetCalculateMixedHarmonicsVsM(fCalculateMixedHarmonicsVsM);
df23c5ae 176 fQC->SetStoreControlHistograms(fStoreControlHistograms);
0dd3b008 177 fQC->SetMinimumBiasReferenceFlow(fMinimumBiasReferenceFlow);
8e1cefdd 178 fQC->SetForgetAboutCovariances(fForgetAboutCovariances);
b3dacf6b 179 // Multiparticle correlations vs multiplicity:
067e9bc8 180 fQC->SetnBinsMult(fnBinsMult);
181 fQC->SetMinMult(fMinMult);
182 fQC->SetMaxMult(fMaxMult);
2ed70edf 183 // Particle weights:
184 if(fUseParticleWeights)
e04e4ec5 185 {
2ed70edf 186 // Pass the flags to class:
403e3389 187 if(fUsePhiWeights){fQC->SetUsePhiWeights(fUsePhiWeights);}
188 if(fUsePtWeights){fQC->SetUsePtWeights(fUsePtWeights);}
189 if(fUseEtaWeights){fQC->SetUseEtaWeights(fUseEtaWeights);}
190 if(fUseTrackWeights){fQC->SetUseTrackWeights(fUseTrackWeights);}
2ed70edf 191 // Get data from input slot #1 which is used for weights:
e04e4ec5 192 if(GetNinputs()==2)
193 {
2ed70edf 194 fWeightsList = (TList*)GetInputData(1);
e04e4ec5 195 }
2ed70edf 196 // Pass the list with weights to class:
197 if(fWeightsList) fQC->SetWeightsList(fWeightsList);
e04e4ec5 198 }
2ed70edf 199 // Event weights:
df23c5ae 200 if(!fMultiplicityWeight->Contains("combinations")) // default is "combinations"
bc92c0cb 201 {
2ed70edf 202 fQC->SetMultiplicityWeight(fMultiplicityWeight->Data());
bc92c0cb 203 }
e04e4ec5 204
df23c5ae 205 fQC->SetMultiplicityIs(fMultiplicityIs);
206
e5834fcb 207 // Store phi distribution for one event to illustrate flow:
208 fQC->SetStorePhiDistributionForOneEvent(fStorePhiDistributionForOneEvent);
209 for(Int_t i=0;i<4;i++)
210 {
211 fQC->SetPhiDistributionForOneEventSettings(fPhiDistributionForOneEventSettings[i],i);
212 }
213
2ed70edf 214 fQC->Init();
bc92c0cb 215
2ed70edf 216 if(fQC->GetHistList())
217 {
218 fListHistos = fQC->GetHistList();
219 // fListHistos->Print();
220 } else
221 {
222 Printf("ERROR: Could not retrieve histogram list (QC, Task::UserCreateOutputObjects()) !!!!");
223 }
61e0c8c0 224
225 PostData(1,fListHistos);
226
2ed70edf 227} // end of void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 228
229//================================================================================================================
230
2ed70edf 231void AliAnalysisTaskQCumulants::UserExec(Option_t *)
bc92c0cb 232{
2ed70edf 233 // main loop (called for each event)
7183fe85 234 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
235
236 // Q-cumulants
237 if(fEvent)
238 {
2ed70edf 239 fQC->Make(fEvent);
240 } else
241 {
242 cout<<"WARNING: No input data (QC, Task::UserExec()) !!!!"<<endl;
243 cout<<endl;
244 }
bc92c0cb 245
2ed70edf 246 PostData(1,fListHistos);
bc92c0cb 247}
248
249//================================================================================================================
250
251void AliAnalysisTaskQCumulants::Terminate(Option_t *)
8842fb2b 252{
2ed70edf 253 //accessing the merged output list:
254 fListHistos = (TList*)GetOutputData(1);
77515452 255
2ed70edf 256 fQC = new AliFlowAnalysisWithQCumulants();
8842fb2b 257
2ed70edf 258 if(fListHistos)
fd46c3dd 259 {
2ed70edf 260 fQC->GetOutputHistograms(fListHistos);
261 fQC->Finish();
262 PostData(1,fListHistos);
263 } else
264 {
265 cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate()) !!!!"<<endl;
266 cout<<endl;
267 }
268
269} // end of void AliAnalysisTaskQCumulants::Terminate(Option_t *)
bc92c0cb 270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290