]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx
Consistent naming for FQD class
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskFittingQDistribution.cxx
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  
28 #include "Riostream.h"
29 #include "TChain.h"
30 #include "TTree.h"
31 #include "TFile.h"
32 #include "TList.h"
33 #include "TH1.h"
34 #include "TProfile.h"
35
36 #include "AliAnalysisTask.h"
37 #include "AliAnalysisDataSlot.h"
38 #include "AliAnalysisDataContainer.h"
39 #include "AliAnalysisManager.h"
40
41 #include "AliFlowEventSimple.h"
42 #include "AliAnalysisTaskFittingQDistribution.h"
43 #include "AliFlowAnalysisWithFittingQDistribution.h"
44 #include "AliFlowCommonConstants.h"
45 #include "AliFlowCommonHistResults.h"
46
47 ClassImp(AliAnalysisTaskFittingQDistribution)
48
49 //================================================================================================================
50
51 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights): 
52   AliAnalysisTask(name,""), 
53   fEvent(NULL),
54   fFQDA(NULL),//Fitting Q_Distribution Analysis (FQDA) object
55   fListHistos(NULL),
56   fUseWeights(useWeights),
57   fUsePhiWeights(kFALSE),
58   fListWeights(NULL)
59 {
60   //constructor
61   cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name)"<<endl;
62   
63   // Define input and output slots here
64   // Input slot #0 works with a TChain
65   DefineInput(0, AliFlowEventSimple::Class());
66   
67   // Input slot #1 is needed for the weights 
68   if(useWeights) {
69     DefineInput(1, TList::Class());   
70   }
71   
72   // Output slot #0 writes into a TList container
73   DefineOutput(0, TList::Class());  
74 }
75
76 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(): 
77   fEvent(NULL),
78   fFQDA(NULL),//Fitting q-distribution Analysis (FQDA) object
79   fListHistos(NULL),  
80   fUseWeights(kFALSE),
81   fUsePhiWeights(kFALSE),
82   fListWeights(NULL)
83 {
84  //dummy constructor
85  cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
86 }
87
88 //================================================================================================================
89
90 void AliAnalysisTaskFittingQDistribution::ConnectInputData(Option_t *) 
91 {
92  //connect ESD or AOD (called once)
93  cout<<"AliAnalysisTaskFittingQDistribution::ConnectInputData(Option_t *)"<<endl;
94
95 }
96
97 //================================================================================================================
98
99 void AliAnalysisTaskFittingQDistribution::CreateOutputObjects() 
100 {
101   //called at every worker node to initialize
102   cout<<"AliAnalysisTaskFittingQDistribution::CreateOutputObjects()"<<endl;
103   
104   
105   //analyser
106   fFQDA = new AliFlowAnalysisWithFittingQDistribution();
107   fFQDA->Init();
108   
109   //weights:
110   if(fUseWeights) {
111     //pass the flags to class:
112     if(fUsePhiWeights) fFQDA->SetUsePhiWeights(fUsePhiWeights);
113     //get data from input slot #1 which is used for weights:
114     if(GetNinputs()==2) {                   
115       fListWeights = (TList*)GetInputData(1); 
116     }
117     //pass the list with weights to class:
118     if(fListWeights) fFQDA->SetWeightsList(fListWeights);
119   }
120   
121   if(fFQDA->GetHistList()) {
122     fListHistos = fFQDA->GetHistList();
123     //fListHistos->Print();
124   }
125   else {
126     Printf("ERROR: Could not retrieve histogram list"); 
127   }
128   
129 }
130
131 //================================================================================================================
132
133 void AliAnalysisTaskFittingQDistribution::Exec(Option_t *) 
134 {
135   //main loop (called for each event)
136   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
137
138   //fitting q-distribution 
139   if (fEvent) {
140     fFQDA->Make(fEvent);
141   }
142   else {
143     cout << "Warning no input data!!!" << endl;
144   }
145   PostData(0,fListHistos); 
146 }
147
148 //================================================================================================================
149
150 void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *) 
151 {  
152   //accessing the output list
153   fListHistos = (TList*)GetOutputData(0);
154   //fListHistos->Print();
155   
156   fFQDA = new AliFlowAnalysisWithFittingQDistribution();
157   
158   if(fListHistos) 
159   {          
160    fFQDA->GetOutputHistograms(fListHistos);
161    fFQDA->Finish();  
162   } else 
163     {
164      cout<<"histogram list pointer is empty"<<endl;
165     }
166 }
167
168 //================================================================================================================
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187