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