]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskQCumulants.cxx
patching flow cuts (Panos)
[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),
d9e6d8bb 68 fExactNoRPs(0),
067e9bc8 69 fnBinsMult(10000),
70 fMinMult(0.),
71 fMaxMult(10000.),
2ed70edf 72 fUseParticleWeights(useParticleWeights),
e04e4ec5 73 fUsePhiWeights(kFALSE),
74 fUsePtWeights(kFALSE),
75 fUseEtaWeights(kFALSE),
403e3389 76 fUseTrackWeights(kFALSE),
2ed70edf 77 fWeightsList(NULL),
df23c5ae 78 fMultiplicityWeight(NULL),
79 fMultiplicityIs(AliFlowCommonConstants::kRP)
bc92c0cb 80{
7183fe85 81 // constructor
df23c5ae 82 AliDebug(2,"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights)");
bc92c0cb 83
84 // Define input and output slots here
2ed70edf 85 // Input slot #0 works with an AliFlowEventSimple
86 DefineInput(0, AliFlowEventSimple::Class());
87 // Input slot #1 is needed for the weights input file:
88 if(useParticleWeights)
e04e4ec5 89 {
90 DefineInput(1, TList::Class());
2ed70edf 91 }
92 // Output slot #0 is reserved
93 // Output slot #1 writes into a TList container
94 DefineOutput(1, TList::Class());
e04e4ec5 95
2ed70edf 96 // Event weights:
97 fMultiplicityWeight = new TString("combinations");
e5834fcb 98
99 // Store phi distribution for one event to illustrate flow:
100 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
101 {
102 fPhiDistributionForOneEventSettings[p] = 0.;
103 }
d9e6d8bb 104
105 // Initialize default min and max values of correlations:
106 // (Remark: The default values bellow were chosen for v2=5% and M=500)
107 fMinValueOfCorrelation[0] = -0.01; // <2>_min
108 fMaxValueOfCorrelation[0] = 0.04; // <2>_max
109 fMinValueOfCorrelation[1] = -0.00002; // <4>_min
110 fMaxValueOfCorrelation[1] = 0.00015; // <4>_max
111 fMinValueOfCorrelation[2] = -0.0000003; // <6>_min
112 fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max
113 fMinValueOfCorrelation[3] = -0.000000006; // <8>_min
114 fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max
115
bc92c0cb 116}
117
d9e6d8bb 118//================================================================================================================
119
bc92c0cb 120AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants():
2ed70edf 121 AliAnalysisTaskSE(),
7183fe85 122 fEvent(NULL),
2ed70edf 123 fQC(NULL),
7183fe85 124 fListHistos(NULL),
62d19320 125 fBookOnlyBasicCCH(kFALSE),
dd442cd2 126 fFillMultipleControlHistograms(kFALSE),
2ed70edf 127 fHarmonic(0),
128 fApplyCorrectionForNUA(kFALSE),
050c0a54 129 fApplyCorrectionForNUAVsM(kFALSE),
b77b6434 130 fPropagateErrorAlsoFromNIT(kFALSE),
1268c371 131 fCalculateDiffFlow(kFALSE),
132 fCalculate2DDiffFlow(kFALSE),
62e36168 133 fCalculateDiffFlowVsEta(kTRUE),
2ed70edf 134 fStoreDistributions(kFALSE),
b3dacf6b 135 fCalculateCumulantsVsM(kFALSE),
3842bdcd 136 fCalculateAllCorrelationsVsM(kFALSE),
8f0fcf13 137 fCalculateMixedHarmonics(kFALSE),
138 fCalculateMixedHarmonicsVsM(kFALSE),
df23c5ae 139 fStoreControlHistograms(kFALSE),
0dd3b008 140 fMinimumBiasReferenceFlow(kFALSE),
8e1cefdd 141 fForgetAboutCovariances(kFALSE),
e5834fcb 142 fStorePhiDistributionForOneEvent(kFALSE),
d9e6d8bb 143 fExactNoRPs(0),
067e9bc8 144 fnBinsMult(0),
145 fMinMult(0.),
146 fMaxMult(0.),
2ed70edf 147 fUseParticleWeights(kFALSE),
e04e4ec5 148 fUsePhiWeights(kFALSE),
149 fUsePtWeights(kFALSE),
150 fUseEtaWeights(kFALSE),
403e3389 151 fUseTrackWeights(kFALSE),
2ed70edf 152 fWeightsList(NULL),
df23c5ae 153 fMultiplicityWeight(NULL),
154 fMultiplicityIs(AliFlowCommonConstants::kRP)
bc92c0cb 155{
2ed70edf 156 // Dummy constructor
cea49479 157 AliDebug(2,"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()");
e5834fcb 158
159 // Store phi distribution for one event to illustrate flow:
160 for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
161 {
162 fPhiDistributionForOneEventSettings[p] = 0.;
163 }
164
d9e6d8bb 165 // Initialize default min and max values of correlations:
166 // (Remark: The default values bellow were chosen for v2=5% and M=500)
167 fMinValueOfCorrelation[0] = -0.01; // <2>_min
168 fMaxValueOfCorrelation[0] = 0.04; // <2>_max
169 fMinValueOfCorrelation[1] = -0.00002; // <4>_min
170 fMaxValueOfCorrelation[1] = 0.00015; // <4>_max
171 fMinValueOfCorrelation[2] = -0.0000003; // <6>_min
172 fMaxValueOfCorrelation[2] = 0.0000006; // <6>_max
173 fMinValueOfCorrelation[3] = -0.000000006; // <8>_min
174 fMaxValueOfCorrelation[3] = 0.000000003; // <8>_max
175
bc92c0cb 176}
177
178//================================================================================================================
179
2ed70edf 180void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 181{
2ed70edf 182 // Called at every worker node to initialize
cea49479 183 AliDebug(2,"AliAnalysisTaskQCumulants::UserCreateOutputObjects()");
bc92c0cb 184
2ed70edf 185 // Analyser:
186 fQC = new AliFlowAnalysisWithQCumulants();
e04e4ec5 187
2ed70edf 188 // Common:
62d19320 189 fQC->SetBookOnlyBasicCCH(fBookOnlyBasicCCH);
dd442cd2 190 fQC->SetFillMultipleControlHistograms(fFillMultipleControlHistograms);
2ed70edf 191 fQC->SetHarmonic(fHarmonic);
192 fQC->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
050c0a54 193 fQC->SetApplyCorrectionForNUAVsM(fApplyCorrectionForNUAVsM);
b77b6434 194 fQC->SetPropagateErrorAlsoFromNIT(fPropagateErrorAlsoFromNIT);
1268c371 195 fQC->SetCalculateDiffFlow(fCalculateDiffFlow);
196 fQC->SetCalculate2DDiffFlow(fCalculate2DDiffFlow);
62e36168 197 fQC->SetCalculateDiffFlowVsEta(fCalculateDiffFlowVsEta);
2ed70edf 198 fQC->SetStoreDistributions(fStoreDistributions);
b3dacf6b 199 fQC->SetCalculateCumulantsVsM(fCalculateCumulantsVsM);
3435cacb 200 fQC->SetCalculateAllCorrelationsVsM(fCalculateAllCorrelationsVsM);
8f0fcf13 201 fQC->SetCalculateMixedHarmonics(fCalculateMixedHarmonics);
202 fQC->SetCalculateMixedHarmonicsVsM(fCalculateMixedHarmonicsVsM);
df23c5ae 203 fQC->SetStoreControlHistograms(fStoreControlHistograms);
0dd3b008 204 fQC->SetMinimumBiasReferenceFlow(fMinimumBiasReferenceFlow);
8e1cefdd 205 fQC->SetForgetAboutCovariances(fForgetAboutCovariances);
d9e6d8bb 206 fQC->SetExactNoRPs(fExactNoRPs);
b3dacf6b 207 // Multiparticle correlations vs multiplicity:
067e9bc8 208 fQC->SetnBinsMult(fnBinsMult);
209 fQC->SetMinMult(fMinMult);
210 fQC->SetMaxMult(fMaxMult);
2ed70edf 211 // Particle weights:
212 if(fUseParticleWeights)
e04e4ec5 213 {
2ed70edf 214 // Pass the flags to class:
403e3389 215 if(fUsePhiWeights){fQC->SetUsePhiWeights(fUsePhiWeights);}
216 if(fUsePtWeights){fQC->SetUsePtWeights(fUsePtWeights);}
217 if(fUseEtaWeights){fQC->SetUseEtaWeights(fUseEtaWeights);}
218 if(fUseTrackWeights){fQC->SetUseTrackWeights(fUseTrackWeights);}
2ed70edf 219 // Get data from input slot #1 which is used for weights:
e04e4ec5 220 if(GetNinputs()==2)
221 {
2ed70edf 222 fWeightsList = (TList*)GetInputData(1);
e04e4ec5 223 }
2ed70edf 224 // Pass the list with weights to class:
225 if(fWeightsList) fQC->SetWeightsList(fWeightsList);
e04e4ec5 226 }
2ed70edf 227 // Event weights:
df23c5ae 228 if(!fMultiplicityWeight->Contains("combinations")) // default is "combinations"
bc92c0cb 229 {
2ed70edf 230 fQC->SetMultiplicityWeight(fMultiplicityWeight->Data());
bc92c0cb 231 }
e04e4ec5 232
df23c5ae 233 fQC->SetMultiplicityIs(fMultiplicityIs);
234
e5834fcb 235 // Store phi distribution for one event to illustrate flow:
236 fQC->SetStorePhiDistributionForOneEvent(fStorePhiDistributionForOneEvent);
237 for(Int_t i=0;i<4;i++)
238 {
239 fQC->SetPhiDistributionForOneEventSettings(fPhiDistributionForOneEventSettings[i],i);
240 }
d9e6d8bb 241
242 // Initialize default min and max values of correlations:
243 for(Int_t ci=0;ci<4;ci++)
244 {
245 fQC->SetMinValueOfCorrelation(ci,fMinValueOfCorrelation[ci]);
246 fQC->SetMaxValueOfCorrelation(ci,fMaxValueOfCorrelation[ci]);
247 }
248
2ed70edf 249 fQC->Init();
bc92c0cb 250
2ed70edf 251 if(fQC->GetHistList())
252 {
253 fListHistos = fQC->GetHistList();
254 // fListHistos->Print();
255 } else
256 {
257 Printf("ERROR: Could not retrieve histogram list (QC, Task::UserCreateOutputObjects()) !!!!");
258 }
61e0c8c0 259
260 PostData(1,fListHistos);
261
2ed70edf 262} // end of void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 263
264//================================================================================================================
265
2ed70edf 266void AliAnalysisTaskQCumulants::UserExec(Option_t *)
bc92c0cb 267{
2ed70edf 268 // main loop (called for each event)
7183fe85 269 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
270
271 // Q-cumulants
272 if(fEvent)
273 {
2ed70edf 274 fQC->Make(fEvent);
275 } else
276 {
277 cout<<"WARNING: No input data (QC, Task::UserExec()) !!!!"<<endl;
278 cout<<endl;
279 }
bc92c0cb 280
2ed70edf 281 PostData(1,fListHistos);
bc92c0cb 282}
283
284//================================================================================================================
285
286void AliAnalysisTaskQCumulants::Terminate(Option_t *)
8842fb2b 287{
2ed70edf 288 //accessing the merged output list:
289 fListHistos = (TList*)GetOutputData(1);
77515452 290
2ed70edf 291 fQC = new AliFlowAnalysisWithQCumulants();
8842fb2b 292
2ed70edf 293 if(fListHistos)
fd46c3dd 294 {
2ed70edf 295 fQC->GetOutputHistograms(fListHistos);
296 fQC->Finish();
297 PostData(1,fListHistos);
298 } else
299 {
300 cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate()) !!!!"<<endl;
301 cout<<endl;
302 }
303
304} // end of void AliAnalysisTaskQCumulants::Terminate(Option_t *)
bc92c0cb 305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325