]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Tasks/AliAnalysisTaskMixedHarmonics.cxx
change file permissions, expand systematic check and example macro, all on uncompile...
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskMixedHarmonics.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   *
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 mixed harmomics  * 
18  *                                    * 
19  * authors: Naomi van der Kolk        *
20  *           (kolk@nikhef.nl)         *  
21  *          Raimond Snellings         *
22  *           (snelling@nikhef.nl)     * 
23  *          Ante Bilandzic            *
24  *           (anteb@nikhef.nl)        * 
25  * ***********************************/
26  
27 class TFile;
28 class TString;
29 class TList;
30 class AliAnalysisTaskSE; 
31  
32 #include "Riostream.h"
33 #include "AliFlowEventSimple.h"
34 #include "AliAnalysisTaskMixedHarmonics.h"
35 #include "AliFlowAnalysisWithMixedHarmonics.h"
36
37 using std::cout;
38 using std::endl;
39 ClassImp(AliAnalysisTaskMixedHarmonics)
40
41 //================================================================================================================
42
43 AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights): 
44 AliAnalysisTaskSE(name), 
45 fEvent(NULL),
46 fMH(NULL), 
47 fListHistos(NULL),
48 fHarmonic(1),
49 fNoOfMultipicityBins(100),
50 fMultipicityBinWidth(1.),
51 fMinMultiplicity(3.),
52 fOppositeChargesPOI(kFALSE),
53 fEvaluateDifferential3pCorrelator(kFALSE),
54 fCorrectForDetectorEffects(kFALSE),
55 fPrintOnTheScreen(kTRUE),
56 fCalculateVsM(kFALSE),
57 fShowBinLabelsVsM(kFALSE),
58 fUseParticleWeights(useParticleWeights),
59 fUsePhiWeights(kFALSE),
60 fUsePtWeights(kFALSE),
61 fUseEtaWeights(kFALSE),
62 fWeightsList(NULL)
63 {
64  // constructor
65  cout<<"AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(const char *name, Bool_t useParticleWeights)"<<endl;
66  
67  // Define input and output slots here
68  // Input slot #0 works with an AliFlowEventSimple
69  DefineInput(0, AliFlowEventSimple::Class());  
70  // Input slot #1 is needed for the weights input file:
71  if(useParticleWeights)
72  {
73   DefineInput(1, TList::Class());   
74  }  
75  // Output slot #0 is reserved              
76  // Output slot #1 writes into a TList container
77  DefineOutput(1, TList::Class());  
78 }
79
80 AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics(): 
81 AliAnalysisTaskSE(),
82 fEvent(NULL),
83 fMH(NULL),
84 fListHistos(NULL),
85 fHarmonic(0),
86 fNoOfMultipicityBins(0),
87 fMultipicityBinWidth(0),
88 fMinMultiplicity(0),
89 fOppositeChargesPOI(kFALSE),
90 fEvaluateDifferential3pCorrelator(kFALSE),
91 fCorrectForDetectorEffects(kFALSE),
92 fPrintOnTheScreen(kFALSE),
93 fCalculateVsM(kFALSE),
94 fShowBinLabelsVsM(kFALSE),
95 fUseParticleWeights(kFALSE),
96 fUsePhiWeights(kFALSE),
97 fUsePtWeights(kFALSE),
98 fUseEtaWeights(kFALSE),
99 fWeightsList(NULL)
100 {
101  // Dummy constructor
102  cout<<"AliAnalysisTaskMixedHarmonics::AliAnalysisTaskMixedHarmonics()"<<endl;
103 }
104
105 //================================================================================================================
106
107 void AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects() 
108 {
109  // Called at every worker node to initialize
110  cout<<"AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects()"<<endl;
111
112  // Analyser:
113  fMH = new AliFlowAnalysisWithMixedHarmonics();
114   
115  // Common:
116  fMH->SetHarmonic(fHarmonic);
117  fMH->SetNoOfMultipicityBins(fNoOfMultipicityBins);
118  fMH->SetMultipicityBinWidth(fMultipicityBinWidth);
119  fMH->SetMinMultiplicity(fMinMultiplicity);
120  fMH->SetOppositeChargesPOI(fOppositeChargesPOI);
121  fMH->SetEvaluateDifferential3pCorrelator(fEvaluateDifferential3pCorrelator); 
122  fMH->SetCorrectForDetectorEffects(fCorrectForDetectorEffects);
123  fMH->SetPrintOnTheScreen(fPrintOnTheScreen); 
124  fMH->SetCalculateVsM(fCalculateVsM); 
125  fMH->SetShowBinLabelsVsM(fShowBinLabelsVsM);
126  if(fUseParticleWeights)
127  {
128   // Pass the flags to class:
129   if(fUsePhiWeights) fMH->SetUsePhiWeights(fUsePhiWeights);
130   if(fUsePtWeights) fMH->SetUsePtWeights(fUsePtWeights);
131   if(fUseEtaWeights) fMH->SetUseEtaWeights(fUseEtaWeights);
132   // Get data from input slot #1 which is used for weights:
133   if(GetNinputs()==2) 
134   {                   
135    fWeightsList = (TList*)GetInputData(1); 
136   }
137   // Pass the list with weights to class:
138   if(fWeightsList) fMH->SetWeightsList(fWeightsList);
139  }
140  
141  fMH->Init();
142  
143  if(fMH->GetHistList()) 
144  {
145   fListHistos = fMH->GetHistList();
146   // fListHistos->Print();
147  } else 
148    {
149     Printf("ERROR: Could not retrieve histogram list (MH, Task::UserCreateOutputObjects()) !!!!"); 
150    }
151  
152  PostData(1,fListHistos);
153   
154 } // end of void AliAnalysisTaskMixedHarmonics::UserCreateOutputObjects() 
155
156 //================================================================================================================
157
158 void AliAnalysisTaskMixedHarmonics::UserExec(Option_t *) 
159 {
160  // main loop (called for each event)
161  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
162
163  // Mixed Harmonics:
164  if(fEvent) 
165  {
166   fMH->Make(fEvent);
167  } else 
168    {
169     cout<<"WARNING: No input data (MH, Task::UserExec()) !!!!"<<endl;
170     cout<<endl;
171    }
172   
173  PostData(1,fListHistos);
174 }
175
176 //================================================================================================================
177
178 void AliAnalysisTaskMixedHarmonics::Terminate(Option_t *) 
179 {
180  //accessing the merged output list: 
181  fListHistos = (TList*)GetOutputData(1);
182  
183  fMH = new AliFlowAnalysisWithMixedHarmonics(); 
184  
185  if(fListHistos) 
186  {
187   fMH->GetOutputHistograms(fListHistos);
188   fMH->Finish();
189   PostData(1,fListHistos);
190  } else
191    {
192     cout<<" WARNING: histogram list pointer is empty (MH, Task::Terminate()) !!!!"<<endl;
193     cout<<endl;
194    }
195     
196 } // end of void AliAnalysisTaskMixedHarmonics::Terminate(Option_t *)
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217