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