1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /**************************************
17 * analysis task for cumulant method *
19 * authors: Naomi van der Kolk *
22 * (snelling@nikhef.nl) *
25 * ***********************************/
29 class AliAnalysisTaskSE;
31 #include "Riostream.h"
32 #include "AliFlowEventSimple.h"
33 #include "AliAnalysisTaskCumulants.h"
34 #include "AliFlowAnalysisWithCumulants.h"
36 ClassImp(AliAnalysisTaskCumulants)
38 //================================================================================================================
40 AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights):
41 AliAnalysisTaskSE(name),
47 fCalculateVsMultiplicity(kFALSE),
51 fUseWeights(useWeights),
52 fUsePhiWeights(kFALSE),
53 fUsePtWeights(kFALSE),
54 fUseEtaWeights(kFALSE),
56 fTuneParameters(kFALSE)
59 cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights)"<<endl;
61 // Define input and output slots here
62 // Input slot #0 works with an AliFlowEventSimple
63 DefineInput(0, AliFlowEventSimple::Class());
65 // Input slot #1 is needed for the weights input files
68 DefineInput(1, TList::Class());
70 // Output slot #0 is reserved
71 // Output slot #1 writes into a TList container
72 DefineOutput(1, TList::Class());
75 for(Int_t r=0;r<10;r++)
79 } // end of constructor
81 AliAnalysisTaskCumulants::AliAnalysisTaskCumulants():
88 fCalculateVsMultiplicity(kFALSE),
93 fUsePhiWeights(kFALSE),
94 fUsePtWeights(kFALSE),
95 fUseEtaWeights(kFALSE),
97 fTuneParameters(kFALSE)
100 cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants()"<<endl;
103 for(Int_t r=0;r<10;r++)
109 //================================================================================================================
111 void AliAnalysisTaskCumulants::UserCreateOutputObjects()
113 // Called at every worker node to initialize
114 cout<<"AliAnalysisTaskCumulants::UserCreateOutputObjects()"<<endl;
117 fGFC = new AliFlowAnalysisWithCumulants();
119 // Calculation vs multiplicity:
120 if(fCalculateVsMultiplicity)
122 fGFC->SetCalculateVsMultiplicity(fCalculateVsMultiplicity);
123 fGFC->SetnBinsMult(fnBinsMult);
124 fGFC->SetMinMult(fMinMult);
125 fGFC->SetMaxMult(fMaxMult);
131 // Pass the flags to class:
132 if(fUsePhiWeights) fGFC->SetUsePhiWeights(fUsePhiWeights);
133 if(fUsePtWeights) fGFC->SetUsePtWeights(fUsePtWeights);
134 if(fUseEtaWeights) fGFC->SetUseEtaWeights(fUseEtaWeights);
135 // Get data from input slot #1 which is used for weights:
138 fWeightsList = (TList*)GetInputData(1);
140 // Pass the list with weights to class:
141 if(fWeightsList) fGFC->SetWeightsList(fWeightsList);
147 fGFC->SetTuneParameters(fTuneParameters);
148 for(Int_t r=0;r<10;r++) {fGFC->SetTuningR0(fTuningR0[r],r);}
153 if(fGFC->GetHistList())
155 fListHistos = fGFC->GetHistList();
156 //fListHistos->Print();
159 Printf("ERROR: Could not retrieve histogram list (GFC, Task::UserCreateOutputObjects()) !!!!");
162 PostData(1,fListHistos);
164 } // end of void AliAnalysisTaskCumulants::UserCreateOutputObjects()
166 //================================================================================================================
168 void AliAnalysisTaskCumulants::UserExec(Option_t *)
170 // Main loop (called for each event)
171 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
173 // Generating function cumulants (GFC):
179 cout<<"WARNING: No input data (GFC, Task::UserExec()) !!!!"<<endl;
182 PostData(1,fListHistos);
184 } // end of void AliAnalysisTaskCumulants::UserExec(Option_t *)
186 //================================================================================================================
188 void AliAnalysisTaskCumulants::Terminate(Option_t *)
190 // Accessing the output list which contains the merged 2D and 3D profiles from all worker nodes
191 fListHistos = (TList*)GetOutputData(1);
192 //fListHistos->Print();
194 fGFC = new AliFlowAnalysisWithCumulants();
198 fGFC->GetOutputHistograms(fListHistos);
200 PostData(1,fListHistos);
203 cout<<"WARNING: histogram list pointer is empty (GFC, Task::Terminate()) !!!!"<<endl;
207 } // end of void AliAnalysisTaskCumulants::Terminate(Option_t *)