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