]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskQCumulants.cxx
adding some setters for multiplicity range
[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),
2ed70edf 45 fHarmonic(2),
46 fApplyCorrectionForNUA(kTRUE),
47 fCalculate2DFlow(kFALSE),
48 fStoreDistributions(kFALSE),
067e9bc8 49 fnBinsMult(10000),
50 fMinMult(0.),
51 fMaxMult(10000.),
2ed70edf 52 fUseParticleWeights(useParticleWeights),
e04e4ec5 53 fUsePhiWeights(kFALSE),
54 fUsePtWeights(kFALSE),
55 fUseEtaWeights(kFALSE),
2ed70edf 56 fWeightsList(NULL),
57 fMultiplicityWeight(NULL)
bc92c0cb 58{
7183fe85 59 // constructor
2ed70edf 60 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights)"<<endl;
bc92c0cb 61
62 // Define input and output slots here
2ed70edf 63 // Input slot #0 works with an AliFlowEventSimple
64 DefineInput(0, AliFlowEventSimple::Class());
65 // Input slot #1 is needed for the weights input file:
66 if(useParticleWeights)
e04e4ec5 67 {
68 DefineInput(1, TList::Class());
2ed70edf 69 }
70 // Output slot #0 is reserved
71 // Output slot #1 writes into a TList container
72 DefineOutput(1, TList::Class());
e04e4ec5 73
2ed70edf 74 // Event weights:
75 fMultiplicityWeight = new TString("combinations");
bc92c0cb 76}
77
78AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants():
2ed70edf 79 AliAnalysisTaskSE(),
7183fe85 80 fEvent(NULL),
2ed70edf 81 fQC(NULL),
7183fe85 82 fListHistos(NULL),
2ed70edf 83 fHarmonic(0),
84 fApplyCorrectionForNUA(kFALSE),
85 fCalculate2DFlow(kFALSE),
86 fStoreDistributions(kFALSE),
067e9bc8 87 fnBinsMult(0),
88 fMinMult(0.),
89 fMaxMult(0.),
2ed70edf 90 fUseParticleWeights(kFALSE),
e04e4ec5 91 fUsePhiWeights(kFALSE),
92 fUsePtWeights(kFALSE),
93 fUseEtaWeights(kFALSE),
2ed70edf 94 fWeightsList(NULL),
95 fMultiplicityWeight(NULL)
bc92c0cb 96{
2ed70edf 97 // Dummy constructor
bc92c0cb 98 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()"<<endl;
99}
100
101//================================================================================================================
102
2ed70edf 103void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 104{
2ed70edf 105 // Called at every worker node to initialize
106 cout<<"AliAnalysisTaskQCumulants::UserCreateOutputObjects()"<<endl;
bc92c0cb 107
2ed70edf 108 // Analyser:
109 fQC = new AliFlowAnalysisWithQCumulants();
e04e4ec5 110
2ed70edf 111 // Common:
112 fQC->SetHarmonic(fHarmonic);
113 fQC->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
114 fQC->SetCalculate2DFlow(fCalculate2DFlow);
115 fQC->SetStoreDistributions(fStoreDistributions);
067e9bc8 116 // multiparticle correlations vs multiplicity:
117 fQC->SetnBinsMult(fnBinsMult);
118 fQC->SetMinMult(fMinMult);
119 fQC->SetMaxMult(fMaxMult);
2ed70edf 120 // Particle weights:
121 if(fUseParticleWeights)
e04e4ec5 122 {
2ed70edf 123 // Pass the flags to class:
124 if(fUsePhiWeights) fQC->SetUsePhiWeights(fUsePhiWeights);
125 if(fUsePtWeights) fQC->SetUsePtWeights(fUsePtWeights);
126 if(fUseEtaWeights) fQC->SetUseEtaWeights(fUseEtaWeights);
127 // Get data from input slot #1 which is used for weights:
e04e4ec5 128 if(GetNinputs()==2)
129 {
2ed70edf 130 fWeightsList = (TList*)GetInputData(1);
e04e4ec5 131 }
2ed70edf 132 // Pass the list with weights to class:
133 if(fWeightsList) fQC->SetWeightsList(fWeightsList);
e04e4ec5 134 }
2ed70edf 135 // Event weights:
136 if(!(strcmp(fMultiplicityWeight->Data(),"combinations")==0)) // default is "combinations"
bc92c0cb 137 {
2ed70edf 138 fQC->SetMultiplicityWeight(fMultiplicityWeight->Data());
bc92c0cb 139 }
e04e4ec5 140
2ed70edf 141 fQC->Init();
bc92c0cb 142
2ed70edf 143 if(fQC->GetHistList())
144 {
145 fListHistos = fQC->GetHistList();
146 // fListHistos->Print();
147 } else
148 {
149 Printf("ERROR: Could not retrieve histogram list (QC, Task::UserCreateOutputObjects()) !!!!");
150 }
61e0c8c0 151
152 PostData(1,fListHistos);
153
2ed70edf 154} // end of void AliAnalysisTaskQCumulants::UserCreateOutputObjects()
bc92c0cb 155
156//================================================================================================================
157
2ed70edf 158void AliAnalysisTaskQCumulants::UserExec(Option_t *)
bc92c0cb 159{
2ed70edf 160 // main loop (called for each event)
7183fe85 161 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
162
163 // Q-cumulants
164 if(fEvent)
165 {
2ed70edf 166 fQC->Make(fEvent);
167 } else
168 {
169 cout<<"WARNING: No input data (QC, Task::UserExec()) !!!!"<<endl;
170 cout<<endl;
171 }
bc92c0cb 172
2ed70edf 173 PostData(1,fListHistos);
bc92c0cb 174}
175
176//================================================================================================================
177
178void AliAnalysisTaskQCumulants::Terminate(Option_t *)
8842fb2b 179{
2ed70edf 180 //accessing the merged output list:
181 fListHistos = (TList*)GetOutputData(1);
77515452 182
2ed70edf 183 fQC = new AliFlowAnalysisWithQCumulants();
8842fb2b 184
2ed70edf 185 if(fListHistos)
fd46c3dd 186 {
2ed70edf 187 fQC->GetOutputHistograms(fListHistos);
188 fQC->Finish();
189 PostData(1,fListHistos);
190 } else
191 {
192 cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate()) !!!!"<<endl;
193 cout<<endl;
194 }
195
196} // end of void AliAnalysisTaskQCumulants::Terminate(Option_t *)
bc92c0cb 197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217