AliPhysics  8d00e07 (8d00e07)
AliAnalysisTaskFittingQDistribution.cxx
Go to the documentation of this file.
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  * (abilandzic@gmail.com) *
26  * ***********************************/
27 
28 class TFile;
29 class TString;
30 class TList;
31 class AliAnalysisTaskSE;
32 
33 #include "Riostream.h"
34 #include "AliFlowEventSimple.h"
37 #include "TH2D.h"
38 
39 using std::cout;
40 using std::endl;
42 
43 //================================================================================================================
44 
46  AliAnalysisTaskSE(name),
47  fEvent(NULL),
48  fFQD(NULL),
49  fListHistos(NULL),
50  fBookOnlyBasicCCH(kTRUE),
51  fUseWeights(useWeights),
52  fUsePhiWeights(kFALSE),
53  fListWeights(NULL),
54  fHarmonic(2),
55  fqMin(0.),
56  fqMax(100.),
57  fqNbins(10000),
58  fStoreqDistributionVsMult(kFALSE),
59  fqDistributionVsMult(NULL),
60  fMinMult(0.),
61  fMaxMult(10000.),
62  fnBinsMult(1000),
63  fDoFit(kTRUE),
64  fExactNoRPs(0),
65  fMultiplicityIs(AliFlowCommonConstants::kRP)
66  {
67  //constructor
68  //cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights)"<<endl;
69 
70  // Define input and output slots here
71  // Input slot #0 works with an AliFlowEventSimple
72  DefineInput(0, AliFlowEventSimple::Class());
73 
74  // Input slot #1 is needed for the weights input files
75  if(useWeights)
76  {
77  DefineInput(1, TList::Class());
78  }
79  // Output slot #0 is reserved
80  // Output slot #1 writes into a TList container
81  DefineOutput(1, TList::Class());
82  }
83 
86  fEvent(NULL),
87  fFQD(NULL),
88  fListHistos(NULL),
89  fBookOnlyBasicCCH(kFALSE),
90  fUseWeights(kFALSE),
91  fUsePhiWeights(kFALSE),
92  fListWeights(NULL),
93  fHarmonic(0),
94  fqMin(0.),
95  fqMax(0.),
96  fqNbins(0),
97  fStoreqDistributionVsMult(kFALSE),
98  fqDistributionVsMult(NULL),
99  fMinMult(0.),
100  fMaxMult(0.),
101  fnBinsMult(0),
102  fDoFit(kTRUE),
103  fExactNoRPs(0),
104  fMultiplicityIs(AliFlowCommonConstants::kRP)
105  {
106  // Dummy constructor
107  //cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
108  }
109 
110 //================================================================================================================
111 
113 {
114  // Called at every worker node to initialize
115  cout<<"AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()"<<endl;
116 
117  // Analyser:
119 
121  // Particle weights:
122  if(fUseWeights)
123  {
124  // Pass the flags to class:
126  // Get data from input slot #1 which is used for weights:
127  if(GetNinputs()==2)
128  {
129  fListWeights = (TList*)GetInputData(1);
130  }
131  // Pass the list with weights to class:
133  }
135  // Settings for q-distribution:
136  fFQD->SetqMin(fqMin);
137  fFQD->SetqMax(fqMax);
144  fFQD->SetDoFit(fDoFit);
147 
148  fFQD->Init();
149 
150  if(fFQD->GetHistList())
151  {
153  //fListHistos->Print();
154  } else
155  {
156  Printf("ERROR: Could not retrieve histogram list (FQD, Task::UserCreateOutputObjects()) !!!!");
157  }
158 
159  PostData(1,fListHistos);
160 
161 } // end of void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
162 
163 //================================================================================================================
164 
166 {
167  // Main loop (called for each event):
168  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
169 
170  // Fitting q-distribution:
171  if(fEvent)
172  {
173  fFQD->Make(fEvent);
174  } else
175  {
176  cout<<"WARNING: No input data (FQD, Task::UserExec()) !!!!"<<endl;
177  }
178 
179  PostData(1,fListHistos);
180 }
181 
182 //================================================================================================================
183 
185 {
186  //accessing the output list
187  fListHistos = (TList*)GetOutputData(1);
188 
190 
191  if(fListHistos)
192  {
194  fFQD->Finish();
195  PostData(1,fListHistos);
196  } else
197  {
198  cout<<" WARNING: histogram list pointer is empty (FQD, Task::Terminate()) !!!!"<<endl;
199  cout<<endl;
200  }
201 
202 } // end of void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
203 
204 //================================================================================================================
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
void SetMultiplicityIs(AliFlowCommonConstants::ERefMultSource mi)
AliFlowAnalysisWithFittingQDistribution * fFQD
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
AliFlowCommonConstants::ERefMultSource fMultiplicityIs