]>
Commit | Line | Data |
---|---|---|
924fafb7 | 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 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
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 | ||
2188af53 | 16 | /************************************** |
17 | * analysis task for cumulant method * | |
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 | 27 | class TFile; |
28 | class TList; | |
29 | class AliAnalysisTaskSE; | |
30 | ||
2188af53 | 31 | #include "Riostream.h" |
7183fe85 | 32 | #include "AliFlowEventSimple.h" |
924fafb7 | 33 | #include "AliAnalysisTaskCumulants.h" |
924fafb7 | 34 | #include "AliFlowAnalysisWithCumulants.h" |
35 | ||
3a7af7bd | 36 | using std::cout; |
37 | using std::endl; | |
924fafb7 | 38 | ClassImp(AliAnalysisTaskCumulants) |
39 | ||
2188af53 | 40 | //================================================================================================================ |
41 | ||
7183fe85 | 42 | AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights): |
2ed70edf | 43 | AliAnalysisTaskSE(name), |
44 | fEvent(NULL), | |
45 | fGFC(NULL), | |
46 | fListHistos(NULL), | |
3688e459 | 47 | fHarmonic(2), |
48 | fMultiple(1), | |
49 | fCalculateVsMultiplicity(kFALSE), | |
50 | fnBinsMult(10000), | |
51 | fMinMult(0.), | |
52 | fMaxMult(10000.), | |
2ed70edf | 53 | fUseWeights(useWeights), |
54 | fUsePhiWeights(kFALSE), | |
55 | fUsePtWeights(kFALSE), | |
56 | fUseEtaWeights(kFALSE), | |
3688e459 | 57 | fWeightsList(NULL), |
58 | fTuneParameters(kFALSE) | |
924fafb7 | 59 | { |
2ed70edf | 60 | // Constructor |
61 | cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights)"<<endl; | |
fe488c8a | 62 | |
63 | // Define input and output slots here | |
2ed70edf | 64 | // Input slot #0 works with an AliFlowEventSimple |
7183fe85 | 65 | DefineInput(0, AliFlowEventSimple::Class()); |
e5e75b58 | 66 | |
2ed70edf | 67 | // Input slot #1 is needed for the weights input files |
68 | if(useWeights) | |
e5e75b58 | 69 | { |
70 | DefineInput(1, TList::Class()); | |
71 | } | |
2ed70edf | 72 | // Output slot #0 is reserved |
73 | // Output slot #1 writes into a TList container | |
3688e459 | 74 | DefineOutput(1, TList::Class()); |
75 | ||
76 | // Initilize arrays: | |
77 | for(Int_t r=0;r<10;r++) | |
78 | { | |
79 | fTuningR0[r] = 0.; | |
80 | } | |
81 | } // end of constructor | |
2188af53 | 82 | |
7183fe85 | 83 | AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(): |
2ed70edf | 84 | AliAnalysisTaskSE(), |
85 | fEvent(NULL), | |
86 | fGFC(NULL), | |
87 | fListHistos(NULL), | |
3688e459 | 88 | fHarmonic(0), |
89 | fMultiple(0), | |
90 | fCalculateVsMultiplicity(kFALSE), | |
91 | fnBinsMult(0), | |
92 | fMinMult(0.), | |
93 | fMaxMult(0.), | |
2ed70edf | 94 | fUseWeights(kFALSE), |
95 | fUsePhiWeights(kFALSE), | |
96 | fUsePtWeights(kFALSE), | |
97 | fUseEtaWeights(kFALSE), | |
3688e459 | 98 | fWeightsList(NULL), |
99 | fTuneParameters(kFALSE) | |
aaebd73d | 100 | { |
2ed70edf | 101 | // Dummy constructor |
2188af53 | 102 | cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants()"<<endl; |
3688e459 | 103 | |
104 | // Initilize arrays: | |
105 | for(Int_t r=0;r<10;r++) | |
106 | { | |
107 | fTuningR0[r] = 0.; | |
108 | } | |
2188af53 | 109 | } |
110 | ||
111 | //================================================================================================================ | |
924fafb7 | 112 | |
2ed70edf | 113 | void AliAnalysisTaskCumulants::UserCreateOutputObjects() |
924fafb7 | 114 | { |
2ed70edf | 115 | // Called at every worker node to initialize |
116 | cout<<"AliAnalysisTaskCumulants::UserCreateOutputObjects()"<<endl; | |
2188af53 | 117 | |
2ed70edf | 118 | // Analyser: |
50fe33aa | 119 | fGFC = new AliFlowAnalysisWithCumulants(); |
120 | fGFC->SetHarmonic(fHarmonic); | |
e5e75b58 | 121 | |
3688e459 | 122 | // Calculation vs multiplicity: |
123 | if(fCalculateVsMultiplicity) | |
124 | { | |
125 | fGFC->SetCalculateVsMultiplicity(fCalculateVsMultiplicity); | |
126 | fGFC->SetnBinsMult(fnBinsMult); | |
127 | fGFC->SetMinMult(fMinMult); | |
128 | fGFC->SetMaxMult(fMaxMult); | |
129 | } | |
130 | ||
2ed70edf | 131 | // Weights: |
e5e75b58 | 132 | if(fUseWeights) |
133 | { | |
2ed70edf | 134 | // Pass the flags to class: |
135 | if(fUsePhiWeights) fGFC->SetUsePhiWeights(fUsePhiWeights); | |
136 | if(fUsePtWeights) fGFC->SetUsePtWeights(fUsePtWeights); | |
137 | if(fUseEtaWeights) fGFC->SetUseEtaWeights(fUseEtaWeights); | |
138 | // Get data from input slot #1 which is used for weights: | |
e5e75b58 | 139 | if(GetNinputs()==2) |
140 | { | |
3688e459 | 141 | fWeightsList = (TList*)GetInputData(1); |
e5e75b58 | 142 | } |
2ed70edf | 143 | // Pass the list with weights to class: |
3688e459 | 144 | if(fWeightsList) fGFC->SetWeightsList(fWeightsList); |
e5e75b58 | 145 | } |
2188af53 | 146 | |
3688e459 | 147 | // Tuning: |
148 | if(fTuneParameters) | |
149 | { | |
150 | fGFC->SetTuneParameters(fTuneParameters); | |
151 | for(Int_t r=0;r<10;r++) {fGFC->SetTuningR0(fTuningR0[r],r);} | |
152 | } | |
153 | ||
2ed70edf | 154 | fGFC->Init(); |
155 | ||
156 | if(fGFC->GetHistList()) | |
2188af53 | 157 | { |
2ed70edf | 158 | fListHistos = fGFC->GetHistList(); |
2188af53 | 159 | //fListHistos->Print(); |
2ed70edf | 160 | } else |
161 | { | |
162 | Printf("ERROR: Could not retrieve histogram list (GFC, Task::UserCreateOutputObjects()) !!!!"); | |
163 | } | |
61e0c8c0 | 164 | |
165 | PostData(1,fListHistos); | |
2ed70edf | 166 | |
167 | } // end of void AliAnalysisTaskCumulants::UserCreateOutputObjects() | |
2188af53 | 168 | |
169 | //================================================================================================================ | |
924fafb7 | 170 | |
2ed70edf | 171 | void AliAnalysisTaskCumulants::UserExec(Option_t *) |
924fafb7 | 172 | { |
2ed70edf | 173 | // Main loop (called for each event) |
7183fe85 | 174 | fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0)); |
aaebd73d | 175 | |
2ed70edf | 176 | // Generating function cumulants (GFC): |
7183fe85 | 177 | if(fEvent) |
178 | { | |
2ed70edf | 179 | fGFC->Make(fEvent); |
180 | } else | |
181 | { | |
182 | cout<<"WARNING: No input data (GFC, Task::UserExec()) !!!!"<<endl; | |
183 | } | |
7183fe85 | 184 | |
2ed70edf | 185 | PostData(1,fListHistos); |
186 | ||
187 | } // end of void AliAnalysisTaskCumulants::UserExec(Option_t *) | |
924fafb7 | 188 | |
2188af53 | 189 | //================================================================================================================ |
190 | ||
924fafb7 | 191 | void AliAnalysisTaskCumulants::Terminate(Option_t *) |
aaebd73d | 192 | { |
2ed70edf | 193 | // Accessing the output list which contains the merged 2D and 3D profiles from all worker nodes |
194 | fListHistos = (TList*)GetOutputData(1); | |
2188af53 | 195 | //fListHistos->Print(); |
196 | ||
2ed70edf | 197 | fGFC = new AliFlowAnalysisWithCumulants(); |
fd46c3dd | 198 | |
2188af53 | 199 | if(fListHistos) |
52021ae2 | 200 | { |
2ed70edf | 201 | fGFC->GetOutputHistograms(fListHistos); |
202 | fGFC->Finish(); | |
203 | PostData(1,fListHistos); | |
fd46c3dd | 204 | } else |
205 | { | |
2ed70edf | 206 | cout<<"WARNING: histogram list pointer is empty (GFC, Task::Terminate()) !!!!"<<endl; |
fd46c3dd | 207 | cout<<endl; |
208 | } | |
2ed70edf | 209 | |
210 | } // end of void AliAnalysisTaskCumulants::Terminate(Option_t *) | |
aaebd73d | 211 | |
212 | ||
213 | ||
214 | ||
215 | ||
216 | ||
217 | ||
218 | ||
219 | ||
220 | ||
221 | ||
222 | ||
223 | ||
224 | ||
225 | ||
226 | ||
924fafb7 | 227 | |
924fafb7 | 228 | |
924fafb7 | 229 | |
924fafb7 | 230 | |
c75fdbdc | 231 |