]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx
switches to using the centrality framework + some fixes
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskFittingQDistribution.cxx
CommitLineData
9bed2723 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 *f
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 fitting *
18 * q-distribution *
19 * *
20 * authors: Naomi van der Kolk *
21 * (kolk@nikhef.nl) *
22 * Raimond Snellings *
23 * (snelling@nikhef.nl) *
24 * Ante Bilandzic *
25 * (anteb@nikhef.nl) *
26 * ***********************************/
27
2ed70edf 28class TFile;
29class TList;
30class AliAnalysisTaskSE;
31
9bed2723 32#include "Riostream.h"
d53e4563 33#include "AliFlowEventSimple.h"
9bed2723 34#include "AliAnalysisTaskFittingQDistribution.h"
ce4a88f5 35#include "AliFlowAnalysisWithFittingQDistribution.h"
9bed2723 36
37ClassImp(AliAnalysisTaskFittingQDistribution)
38
39//================================================================================================================
40
d53e4563 41AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights):
2ed70edf 42 AliAnalysisTaskSE(name),
43 fEvent(NULL),
44 fFQD(NULL),
45 fListHistos(NULL),
46 fUseWeights(useWeights),
47 fUsePhiWeights(kFALSE),
f0e0fbcd 48 fListWeights(NULL),
49 fqMin(0.),
50 fqMax(1000.),
51 fqNbins(10000)
2ed70edf 52 {
d53e4563 53 //constructor
2ed70edf 54 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights)"<<endl;
9bed2723 55
d53e4563 56 // Define input and output slots here
2ed70edf 57 // Input slot #0 works with an AliFlowEventSimple
d53e4563 58 DefineInput(0, AliFlowEventSimple::Class());
59
2ed70edf 60 // Input slot #1 is needed for the weights input files
61 if(useWeights)
62 {
63 DefineInput(1, TList::Class());
d53e4563 64 }
2ed70edf 65 // Output slot #0 is reserved
66 // Output slot #1 writes into a TList container
67 DefineOutput(1, TList::Class());
68 }
9bed2723 69
70AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution():
2ed70edf 71 AliAnalysisTaskSE(),
72 fEvent(NULL),
73 fFQD(NULL),
74 fListHistos(NULL),
75 fUseWeights(kFALSE),
76 fUsePhiWeights(kFALSE),
f0e0fbcd 77 fListWeights(NULL),
78 fqMin(0.),
79 fqMax(0.),
80 fqNbins(0)
2ed70edf 81 {
82 // Dummy constructor
83 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
84 }
9bed2723 85
86//================================================================================================================
87
2ed70edf 88void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
9bed2723 89{
2ed70edf 90 // Called at every worker node to initialize
91 cout<<"AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()"<<endl;
d53e4563 92
2ed70edf 93 // Analyser:
94 fFQD = new AliFlowAnalysisWithFittingQDistribution();
d53e4563 95
2ed70edf 96 // Particle weights:
97 if(fUseWeights)
98 {
99 // Pass the flags to class:
100 if(fUsePhiWeights) fFQD->SetUsePhiWeights(fUsePhiWeights);
101 // Get data from input slot #1 which is used for weights:
102 if(GetNinputs()==2)
103 {
104 fListWeights = (TList*)GetInputData(1);
105 }
106 // Pass the list with weights to class:
107 if(fListWeights) fFQD->SetWeightsList(fListWeights);
14db9c04 108 }
f0e0fbcd 109 // Settings for q-distribution:
110 fFQD->SetqMin(fqMin);
111 fFQD->SetqMax(fqMax);
112 fFQD->SetqNbins(fqNbins);
113
2ed70edf 114 fFQD->Init();
d53e4563 115
2ed70edf 116 if(fFQD->GetHistList())
117 {
118 fListHistos = fFQD->GetHistList();
119 //fListHistos->Print();
120 } else
121 {
122 Printf("ERROR: Could not retrieve histogram list (FQD, Task::UserCreateOutputObjects()) !!!!");
123 }
61e0c8c0 124
125 PostData(1,fListHistos);
2ed70edf 126
127} // end of void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
9bed2723 128
129//================================================================================================================
130
2ed70edf 131void AliAnalysisTaskFittingQDistribution::UserExec(Option_t *)
9bed2723 132{
2ed70edf 133 // Main loop (called for each event):
d53e4563 134 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
9bed2723 135
2ed70edf 136 // Fitting q-distribution:
137 if(fEvent)
138 {
139 fFQD->Make(fEvent);
140 } else
141 {
142 cout<<"WARNING: No input data (FQD, Task::UserExec()) !!!!"<<endl;
143 }
144
145 PostData(1,fListHistos);
9bed2723 146}
147
148//================================================================================================================
149
150void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
151{
d53e4563 152 //accessing the output list
2ed70edf 153 fListHistos = (TList*)GetOutputData(1);
4b2e3a73 154
2ed70edf 155 fFQD = new AliFlowAnalysisWithFittingQDistribution();
fd46c3dd 156
157 if(fListHistos)
158 {
2ed70edf 159 fFQD->GetOutputHistograms(fListHistos);
160 fFQD->Finish();
161 PostData(1,fListHistos);
fd46c3dd 162 } else
163 {
2ed70edf 164 cout<<" WARNING: histogram list pointer is empty (FQD, Task::Terminate()) !!!!"<<endl;
165 cout<<endl;
fd46c3dd 166 }
2ed70edf 167
168} // end of void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
9bed2723 169
4b2e3a73 170//================================================================================================================
9bed2723 171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189