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