]>
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 | ||
27 | #include "Riostream.h" | |
924fafb7 | 28 | #include "TChain.h" |
29 | #include "TTree.h" | |
30 | #include "TFile.h" | |
aaebd73d | 31 | #include "TList.h" |
32 | #include "TH1.h" | |
aaebd73d | 33 | #include "TProfile.h" |
34 | #include "TProfile2D.h" | |
35 | #include "TProfile3D.h" | |
924fafb7 | 36 | |
aaebd73d | 37 | #include "AliAnalysisTask.h" |
38 | #include "AliAnalysisDataSlot.h" | |
39 | #include "AliAnalysisDataContainer.h" | |
924fafb7 | 40 | #include "AliAnalysisManager.h" |
41 | ||
7183fe85 | 42 | #include "AliFlowEventSimple.h" |
924fafb7 | 43 | #include "AliAnalysisTaskCumulants.h" |
924fafb7 | 44 | #include "AliFlowAnalysisWithCumulants.h" |
aaebd73d | 45 | #include "AliFlowCumuConstants.h" |
46 | #include "AliFlowCommonConstants.h" | |
813a4157 | 47 | #include "AliFlowCommonHist.h" |
aaebd73d | 48 | #include "AliFlowCommonHistResults.h" |
aaebd73d | 49 | #include "AliCumulantsFunctions.h" |
924fafb7 | 50 | |
924fafb7 | 51 | ClassImp(AliAnalysisTaskCumulants) |
52 | ||
2188af53 | 53 | //================================================================================================================ |
54 | ||
7183fe85 | 55 | AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights): |
2188af53 | 56 | AliAnalysisTask(name,""), |
7183fe85 | 57 | fEvent(NULL), |
58 | fGFCA(NULL), // Generating Function Cumulant (GFCA) analysis object | |
6d4fa5d3 | 59 | fListHistos(NULL), |
e5e75b58 | 60 | fUseWeights(useWeights), |
61 | fUsePhiWeights(kFALSE), | |
62 | fUsePtWeights(kFALSE), | |
63 | fUseEtaWeights(kFALSE), | |
64 | fListWeights(NULL) | |
924fafb7 | 65 | { |
7183fe85 | 66 | // constructor |
52021ae2 | 67 | cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name)"<<endl; |
fe488c8a | 68 | |
69 | // Define input and output slots here | |
70 | // Input slot #0 works with a TChain | |
7183fe85 | 71 | DefineInput(0, AliFlowEventSimple::Class()); |
e5e75b58 | 72 | |
73 | // Input slot #1 is needed for the weights | |
74 | if(useWeights) | |
75 | { | |
76 | DefineInput(1, TList::Class()); | |
77 | } | |
fe488c8a | 78 | |
79 | // Output slot #0 writes into a TList container | |
7183fe85 | 80 | DefineOutput(0, TList::Class()); |
924fafb7 | 81 | } |
2188af53 | 82 | |
7183fe85 | 83 | AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(): |
84 | fEvent(NULL), | |
85 | fGFCA(NULL), // Generating Function Cumulant (GFCA) analysis object | |
86 | fListHistos(NULL), | |
e5e75b58 | 87 | fUseWeights(kFALSE), |
88 | fUsePhiWeights(kFALSE), | |
89 | fUsePtWeights(kFALSE), | |
90 | fUseEtaWeights(kFALSE), | |
91 | fListWeights(NULL) | |
aaebd73d | 92 | { |
7183fe85 | 93 | // dummy constructor |
2188af53 | 94 | cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants()"<<endl; |
95 | } | |
96 | ||
97 | //================================================================================================================ | |
924fafb7 | 98 | |
924fafb7 | 99 | void AliAnalysisTaskCumulants::ConnectInputData(Option_t *) |
100 | { | |
7183fe85 | 101 | // connect ESD or AOD (called once) |
2188af53 | 102 | cout<<"AliAnalysisTaskCumulants::ConnectInputData(Option_t *)"<<endl; |
924fafb7 | 103 | } |
104 | ||
2188af53 | 105 | //================================================================================================================ |
106 | ||
924fafb7 | 107 | void AliAnalysisTaskCumulants::CreateOutputObjects() |
108 | { | |
7183fe85 | 109 | // called at every worker node to initialize |
2188af53 | 110 | cout<<"AliAnalysisTaskCumulants::CreateOutputObjects()"<<endl; |
924fafb7 | 111 | |
7183fe85 | 112 | // analyser |
113 | fGFCA = new AliFlowAnalysisWithCumulants(); | |
114 | fGFCA->Init(); | |
e5e75b58 | 115 | |
116 | //weights: | |
117 | if(fUseWeights) | |
118 | { | |
119 | //pass the flags to class: | |
7183fe85 | 120 | if(fUsePhiWeights) fGFCA->SetUsePhiWeights(fUsePhiWeights); |
121 | if(fUsePtWeights) fGFCA->SetUsePtWeights(fUsePtWeights); | |
122 | if(fUseEtaWeights) fGFCA->SetUseEtaWeights(fUseEtaWeights); | |
e5e75b58 | 123 | //get data from input slot #1 which is used for weights: |
124 | if(GetNinputs()==2) | |
125 | { | |
126 | fListWeights = (TList*)GetInputData(1); | |
127 | } | |
128 | //pass the list with weights to class: | |
7183fe85 | 129 | if(fListWeights) fGFCA->SetWeightsList(fListWeights); |
e5e75b58 | 130 | } |
2188af53 | 131 | |
7183fe85 | 132 | if(fGFCA->GetHistList()) |
2188af53 | 133 | { |
7183fe85 | 134 | fListHistos = fGFCA->GetHistList(); |
2188af53 | 135 | //fListHistos->Print(); |
aaebd73d | 136 | } |
7183fe85 | 137 | else |
2188af53 | 138 | { |
7183fe85 | 139 | Printf(" ERROR: Could not retrieve histogram list (GFCA, Task::COO)"); |
2188af53 | 140 | } |
2188af53 | 141 | } |
142 | ||
143 | //================================================================================================================ | |
924fafb7 | 144 | |
924fafb7 | 145 | void AliAnalysisTaskCumulants::Exec(Option_t *) |
146 | { | |
7183fe85 | 147 | // main loop (called for each event) |
148 | fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0)); | |
aaebd73d | 149 | |
7183fe85 | 150 | // generating function cumulants |
151 | if(fEvent) | |
152 | { | |
153 | fGFCA->Make(fEvent); | |
154 | }else | |
6d4fa5d3 | 155 | { |
7183fe85 | 156 | cout<<" WARNING: No input data (GFCA, Task::E) !!!"<<endl; |
157 | cout<<endl; | |
6d4fa5d3 | 158 | } |
7183fe85 | 159 | |
160 | PostData(0,fListHistos); | |
924fafb7 | 161 | } |
162 | ||
2188af53 | 163 | //================================================================================================================ |
164 | ||
924fafb7 | 165 | void AliAnalysisTaskCumulants::Terminate(Option_t *) |
aaebd73d | 166 | { |
2188af53 | 167 | //accessing the output list which contains the merged 2D and 3D profiles from all worker nodes |
168 | fListHistos = (TList*)GetOutputData(0); | |
169 | //fListHistos->Print(); | |
170 | ||
fd46c3dd | 171 | fGFCA = new AliFlowAnalysisWithCumulants(); |
172 | ||
2188af53 | 173 | if(fListHistos) |
52021ae2 | 174 | { |
fd46c3dd | 175 | fGFCA->GetOutputHistograms(fListHistos); |
7183fe85 | 176 | fGFCA->Finish(); |
fd46c3dd | 177 | } else |
178 | { | |
179 | cout<<" WARNING: histogram list pointer is empty (GFC, Task::T)"<<endl; | |
180 | cout<<endl; | |
181 | } | |
aaebd73d | 182 | } |
183 | ||
184 | ||
185 | ||
186 | ||
187 | ||
188 | ||
189 | ||
190 | ||
191 | ||
192 | ||
193 | ||
194 | ||
195 | ||
196 | ||
197 | ||
198 | ||
924fafb7 | 199 | |
924fafb7 | 200 | |
924fafb7 | 201 | |
924fafb7 | 202 | |
c75fdbdc | 203 |