]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskFittingQDistribution.cxx
2 more places with Cavern atmosferic pressure changed to sensor 2
[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 class TFile;
29 class TList;
30 class AliAnalysisTaskSE; 
31  
32 #include "Riostream.h"
33 #include "AliFlowEventSimple.h"
34 #include "AliAnalysisTaskFittingQDistribution.h"
35 #include "AliFlowAnalysisWithFittingQDistribution.h"
36
37 ClassImp(AliAnalysisTaskFittingQDistribution)
38
39 //================================================================================================================
40
41 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights): 
42  AliAnalysisTaskSE(name), 
43  fEvent(NULL),
44  fFQD(NULL),
45  fListHistos(NULL),
46  fUseWeights(useWeights),
47  fUsePhiWeights(kFALSE),
48  fListWeights(NULL),
49  fqMin(0.),
50  fqMax(1000.),
51  fqNbins(10000)
52  {
53   //constructor
54   cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights)"<<endl;
55   
56   // Define input and output slots here
57   // Input slot #0 works with an AliFlowEventSimple
58   DefineInput(0, AliFlowEventSimple::Class());
59   
60   // Input slot #1 is needed for the weights input files 
61   if(useWeights) 
62   {
63    DefineInput(1, TList::Class());   
64   }
65   // Output slot #0 is reserved
66   // Output slot #1 writes into a TList container
67   DefineOutput(1, TList::Class());  
68  }
69
70 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(): 
71  AliAnalysisTaskSE(),
72  fEvent(NULL),
73  fFQD(NULL),
74  fListHistos(NULL),  
75  fUseWeights(kFALSE),
76  fUsePhiWeights(kFALSE),
77  fListWeights(NULL),
78  fqMin(0.),
79  fqMax(0.),
80  fqNbins(0)
81  {
82   // Dummy constructor
83   cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
84  }
85
86 //================================================================================================================
87
88 void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects() 
89 {
90   // Called at every worker node to initialize
91   cout<<"AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()"<<endl;
92   
93   // Analyser:
94   fFQD = new AliFlowAnalysisWithFittingQDistribution();
95   
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);
108   }
109   // Settings for q-distribution:
110   fFQD->SetqMin(fqMin);
111   fFQD->SetqMax(fqMax);
112   fFQD->SetqNbins(fqNbins); 
113
114   fFQD->Init();
115   
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     }
124
125  PostData(1,fListHistos);
126   
127 } // end of void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
128
129 //================================================================================================================
130
131 void AliAnalysisTaskFittingQDistribution::UserExec(Option_t *) 
132 {
133   // Main loop (called for each event):
134   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
135
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); 
146 }
147
148 //================================================================================================================
149
150 void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *) 
151 {  
152   //accessing the output list
153   fListHistos = (TList*)GetOutputData(1);
154   
155   fFQD = new AliFlowAnalysisWithFittingQDistribution();
156   
157   if(fListHistos) 
158   {          
159    fFQD->GetOutputHistograms(fListHistos);
160    fFQD->Finish();  
161    PostData(1,fListHistos);
162   } else 
163     {
164      cout<<" WARNING: histogram list pointer is empty (FQD, Task::Terminate()) !!!!"<<endl;
165      cout<<endl;
166     }
167     
168 } // end of void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
169
170 //================================================================================================================
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189