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