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();
118 fGFC->SetHarmonic(fHarmonic);
120 // Calculation vs multiplicity:
121 if(fCalculateVsMultiplicity)
123 fGFC->SetCalculateVsMultiplicity(fCalculateVsMultiplicity);
124 fGFC->SetnBinsMult(fnBinsMult);
125 fGFC->SetMinMult(fMinMult);
126 fGFC->SetMaxMult(fMaxMult);
132 // Pass the flags to class:
133 if(fUsePhiWeights) fGFC->SetUsePhiWeights(fUsePhiWeights);
134 if(fUsePtWeights) fGFC->SetUsePtWeights(fUsePtWeights);
135 if(fUseEtaWeights) fGFC->SetUseEtaWeights(fUseEtaWeights);
136 // Get data from input slot #1 which is used for weights:
139 fWeightsList = (TList*)GetInputData(1);
141 // Pass the list with weights to class:
142 if(fWeightsList) fGFC->SetWeightsList(fWeightsList);
148 fGFC->SetTuneParameters(fTuneParameters);
149 for(Int_t r=0;r<10;r++) {fGFC->SetTuningR0(fTuningR0[r],r);}
154 if(fGFC->GetHistList())
156 fListHistos = fGFC->GetHistList();
157 //fListHistos->Print();
160 Printf("ERROR: Could not retrieve histogram list (GFC, Task::UserCreateOutputObjects()) !!!!");
163 PostData(1,fListHistos);
165 } // end of void AliAnalysisTaskCumulants::UserCreateOutputObjects()
167 //================================================================================================================
169 void AliAnalysisTaskCumulants::UserExec(Option_t *)
171 // Main loop (called for each event)
172 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
174 // Generating function cumulants (GFC):
180 cout<<"WARNING: No input data (GFC, Task::UserExec()) !!!!"<<endl;
183 PostData(1,fListHistos);
185 } // end of void AliAnalysisTaskCumulants::UserExec(Option_t *)
187 //================================================================================================================
189 void AliAnalysisTaskCumulants::Terminate(Option_t *)
191 // Accessing the output list which contains the merged 2D and 3D profiles from all worker nodes
192 fListHistos = (TList*)GetOutputData(1);
193 //fListHistos->Print();
195 fGFC = new AliFlowAnalysisWithCumulants();
199 fGFC->GetOutputHistograms(fListHistos);
201 PostData(1,fListHistos);
204 cout<<"WARNING: histogram list pointer is empty (GFC, Task::Terminate()) !!!!"<<endl;
208 } // end of void AliAnalysisTaskCumulants::Terminate(Option_t *)