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