]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Tasks/AliAnalysisTaskQCumulants.cxx
Moving/split PWG2/FLOW to PWGCF/FLOW, PWG/FLOW/Base, PWG/FLOW/Tasks, PWG/Glauber
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskQCumulants.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 Q-cumulants      * 
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 "AliAnalysisTaskQCumulants.h"
35 #include "AliFlowAnalysisWithQCumulants.h"
36
37 ClassImp(AliAnalysisTaskQCumulants)
38
39 //================================================================================================================
40
41 AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights): 
42  AliAnalysisTaskSE(name), 
43  fEvent(NULL),
44  fQC(NULL), 
45  fListHistos(NULL),
46  fBookOnlyBasicCCH(kFALSE),
47  fFillMultipleControlHistograms(kFALSE),
48  fHarmonic(2),  
49  fApplyCorrectionForNUA(kFALSE), 
50  fApplyCorrectionForNUAVsM(kFALSE), 
51  fPropagateErrorAlsoFromNIT(kFALSE),
52  fCalculateDiffFlow(kTRUE),
53  fCalculate2DDiffFlow(kFALSE),
54  fCalculateDiffFlowVsEta(kTRUE),
55  fStoreDistributions(kFALSE),
56  fCalculateCumulantsVsM(kFALSE), 
57  fCalculateAllCorrelationsVsM(kFALSE), 
58  fMinimumBiasReferenceFlow(kTRUE), 
59  fForgetAboutCovariances(kFALSE),  
60  fStorePhiDistributionForOneEvent(kFALSE),
61  fnBinsMult(10000),
62  fMinMult(0.),  
63  fMaxMult(10000.), 
64  fUseParticleWeights(useParticleWeights),
65  fUsePhiWeights(kFALSE),
66  fUsePtWeights(kFALSE),
67  fUseEtaWeights(kFALSE),
68  fUseTrackWeights(kFALSE),
69  fWeightsList(NULL),
70  fMultiplicityWeight(NULL)
71 {
72  // constructor
73  cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useParticleWeights)"<<endl;
74  
75  // Define input and output slots here
76  // Input slot #0 works with an AliFlowEventSimple
77  DefineInput(0, AliFlowEventSimple::Class());  
78  // Input slot #1 is needed for the weights input file:
79  if(useParticleWeights)
80  {
81   DefineInput(1, TList::Class());   
82  }  
83  // Output slot #0 is reserved              
84  // Output slot #1 writes into a TList container
85  DefineOutput(1, TList::Class());  
86  
87  // Event weights:
88  fMultiplicityWeight = new TString("combinations");
89  
90  // Store phi distribution for one event to illustrate flow:
91  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
92  {
93   fPhiDistributionForOneEventSettings[p] = 0.;
94  } 
95   
96 }
97
98 AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(): 
99  AliAnalysisTaskSE(),
100  fEvent(NULL),
101  fQC(NULL),
102  fListHistos(NULL),
103  fBookOnlyBasicCCH(kFALSE),
104  fFillMultipleControlHistograms(kFALSE),
105  fHarmonic(0),  
106  fApplyCorrectionForNUA(kFALSE), 
107  fApplyCorrectionForNUAVsM(kFALSE), 
108  fPropagateErrorAlsoFromNIT(kFALSE),
109  fCalculateDiffFlow(kFALSE),
110  fCalculate2DDiffFlow(kFALSE),
111  fCalculateDiffFlowVsEta(kTRUE),
112  fStoreDistributions(kFALSE),
113  fCalculateCumulantsVsM(kFALSE),  
114  fCalculateAllCorrelationsVsM(kFALSE),   
115  fMinimumBiasReferenceFlow(kFALSE), 
116  fForgetAboutCovariances(kFALSE), 
117  fStorePhiDistributionForOneEvent(kFALSE), 
118  fnBinsMult(0),
119  fMinMult(0.),  
120  fMaxMult(0.), 
121  fUseParticleWeights(kFALSE),
122  fUsePhiWeights(kFALSE),
123  fUsePtWeights(kFALSE),
124  fUseEtaWeights(kFALSE),
125  fUseTrackWeights(kFALSE),
126  fWeightsList(NULL),
127  fMultiplicityWeight(NULL)
128 {
129  // Dummy constructor
130  cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()"<<endl;
131  
132  // Store phi distribution for one event to illustrate flow:
133  for(Int_t p=0;p<4;p++) // [v_min,v_max,refMult_min,refMult_max]
134  {
135   fPhiDistributionForOneEventSettings[p] = 0.;
136  } 
137  
138 }
139
140 //================================================================================================================
141
142 void AliAnalysisTaskQCumulants::UserCreateOutputObjects() 
143 {
144  // Called at every worker node to initialize
145  cout<<"AliAnalysisTaskQCumulants::UserCreateOutputObjects()"<<endl;
146
147  // Analyser:
148  fQC = new AliFlowAnalysisWithQCumulants();
149  
150  // Common:
151  fQC->SetBookOnlyBasicCCH(fBookOnlyBasicCCH);
152  fQC->SetFillMultipleControlHistograms(fFillMultipleControlHistograms);
153  fQC->SetHarmonic(fHarmonic);
154  fQC->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
155  fQC->SetApplyCorrectionForNUAVsM(fApplyCorrectionForNUAVsM);
156  fQC->SetPropagateErrorAlsoFromNIT(fPropagateErrorAlsoFromNIT);
157  fQC->SetCalculateDiffFlow(fCalculateDiffFlow);
158  fQC->SetCalculate2DDiffFlow(fCalculate2DDiffFlow);
159  fQC->SetCalculateDiffFlowVsEta(fCalculateDiffFlowVsEta);
160  fQC->SetStoreDistributions(fStoreDistributions);
161  fQC->SetCalculateCumulantsVsM(fCalculateCumulantsVsM);
162  fQC->SetCalculateAllCorrelationsVsM(fCalculateAllCorrelationsVsM);
163  fQC->SetMinimumBiasReferenceFlow(fMinimumBiasReferenceFlow); 
164  fQC->SetForgetAboutCovariances(fForgetAboutCovariances); 
165  // Multiparticle correlations vs multiplicity:
166  fQC->SetnBinsMult(fnBinsMult);
167  fQC->SetMinMult(fMinMult);
168  fQC->SetMaxMult(fMaxMult);
169  // Particle weights:
170  if(fUseParticleWeights)
171  {
172   // Pass the flags to class:
173   if(fUsePhiWeights){fQC->SetUsePhiWeights(fUsePhiWeights);}
174   if(fUsePtWeights){fQC->SetUsePtWeights(fUsePtWeights);}
175   if(fUseEtaWeights){fQC->SetUseEtaWeights(fUseEtaWeights);}
176   if(fUseTrackWeights){fQC->SetUseTrackWeights(fUseTrackWeights);}
177   // Get data from input slot #1 which is used for weights:
178   if(GetNinputs()==2) 
179   {                   
180    fWeightsList = (TList*)GetInputData(1); 
181   }
182   // Pass the list with weights to class:
183   if(fWeightsList) fQC->SetWeightsList(fWeightsList);
184  }
185  // Event weights:
186  if(!(strcmp(fMultiplicityWeight->Data(),"combinations")==0)) // default is "combinations"
187  {
188   fQC->SetMultiplicityWeight(fMultiplicityWeight->Data());
189  }
190
191  // Store phi distribution for one event to illustrate flow:
192  fQC->SetStorePhiDistributionForOneEvent(fStorePhiDistributionForOneEvent);
193  for(Int_t i=0;i<4;i++)
194  {
195   fQC->SetPhiDistributionForOneEventSettings(fPhiDistributionForOneEventSettings[i],i);
196  }
197   
198  fQC->Init();
199  
200  if(fQC->GetHistList()) 
201  {
202   fListHistos = fQC->GetHistList();
203   // fListHistos->Print();
204  } else 
205    {
206     Printf("ERROR: Could not retrieve histogram list (QC, Task::UserCreateOutputObjects()) !!!!"); 
207    }
208  
209  PostData(1,fListHistos);
210   
211 } // end of void AliAnalysisTaskQCumulants::UserCreateOutputObjects() 
212
213 //================================================================================================================
214
215 void AliAnalysisTaskQCumulants::UserExec(Option_t *) 
216 {
217  // main loop (called for each event)
218  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
219
220  // Q-cumulants
221  if(fEvent) 
222  {
223   fQC->Make(fEvent);
224  } else 
225    {
226     cout<<"WARNING: No input data (QC, Task::UserExec()) !!!!"<<endl;
227     cout<<endl;
228    }
229   
230  PostData(1,fListHistos);
231 }
232
233 //================================================================================================================
234
235 void AliAnalysisTaskQCumulants::Terminate(Option_t *) 
236 {
237  //accessing the merged output list: 
238  fListHistos = (TList*)GetOutputData(1);
239  
240  fQC = new AliFlowAnalysisWithQCumulants(); 
241  
242  if(fListHistos) 
243  {
244   fQC->GetOutputHistograms(fListHistos);
245   fQC->Finish();
246   PostData(1,fListHistos);
247  } else
248    {
249     cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate()) !!!!"<<endl;
250     cout<<endl;
251    }
252     
253 } // end of void AliAnalysisTaskQCumulants::Terminate(Option_t *)
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274