AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSimpleSP.cxx
Go to the documentation of this file.
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 
17 // AliAnalysisTaskSimpleSP:
18 //
19 // analysis task for Scalar Product Method
20 //
21 // Author: Naomi van der Kolk (kolk@nikhef.nl)
23 
24 
25 #include "Riostream.h" //needed as include
26 
27 class TFile;
28 class TList;
29 class AliAnalysisTaskSE;
30 
31 #include "TProfile.h" //needed as include
32 #include "AliAnalysisManager.h"
33 #include "AliFlowEventSimple.h"
34 
37 #include "AliFlowCommonHist.h"
39 
40 #include "AliLog.h"
41 
42 using std::endl;
43 using std::cout;
45 
46 //________________________________________________________________________
47 AliAnalysisTaskSimpleSP::AliAnalysisTaskSimpleSP(const char *name, Bool_t usePhiWeights) :
48  AliAnalysisTaskSE(name),
49  fEvent(NULL),
50  fSP(NULL),
51  fListHistos(NULL),
52  fMinimalBook(kFALSE),
53  fUsePhiWeights(usePhiWeights),
54  fListWeights(NULL),
55  fRelDiffMsub(1.0),
56  fApplyCorrectionForNUA(kFALSE),
57  fHarmonic(2),
58  fWeights(kFALSE),
59  fScaling(kTRUE),
60  fNormalizationType(1),
61  fV0SanityCheck(0),
62  fTotalQvector(NULL)
63 {
64  // Constructor
65  AliDebug(2,"AliAnalysisTaskSimpleSP::AliAnalysisTaskSimpleSP(const char *name)");
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(usePhiWeights) {
72  DefineInput(1, TList::Class()); }
73  // Output slot #0 writes into a TList container
74  DefineOutput(1, TList::Class());
75 
76  // Total Q-vector is: "QaQb" (means Qa+Qb), "Qa" or "Qb"
77  fTotalQvector = new TString("QaQb");
78 }
79 
80 //________________________________________________________________________
83  fEvent(NULL),
84  fSP(NULL),
85  fListHistos(NULL),
86  fMinimalBook(kFALSE),
87  fUsePhiWeights(kFALSE),
88  fListWeights(NULL),
89  fRelDiffMsub(1.0),
90  fApplyCorrectionForNUA(kFALSE),
91  fHarmonic(2),
92  fWeights(kFALSE),
93  fScaling(kTRUE),
94  fNormalizationType(1),
95  fV0SanityCheck(0),
96  fTotalQvector(NULL)
97  {
98  // Constructor
99  AliDebug(2,"AliAnalysisTaskSimpleSP::AliAnalysisTaskSimpleSP()");
100 }
101 
102 //________________________________________________________________________
104 {
105  //
106  // Destructor
107  //
108 
109  // histograms are in the output list and deleted when the output
110  // list is deleted by the TSelector dtor
111 
112  // if (ListHistos) {
113  // delete fListHistos;
114  // fListHistos = NULL;
115  // }
116 }
117 
118 //________________________________________________________________________
120 {
121  // Called at every worker node to initialize
122  AliDebug(2,"AliAnalysisTaskSimpleSP::CreateOutputObjects()");
123 
124  //Analyser
127 
128  //set the allowed relative difference in the subevent multiplicities
129  //fSP->SetRelDiffMsub(fRelDiffMsub);
130 
131  //apply automatic correction for non-uniform acceptance:
133  AliDebug(2,"Corrections for non-uniform acceptance applied in the Scalar Product method");
134  }
136  // harmonic:
142  // total Q-vector:
143  Int_t totalQ = 0;
144  if( fTotalQvector->Contains("Qa") ) totalQ += 1;
145  if( fTotalQvector->Contains("Qb") ) totalQ += 2;
146  fSP->SetTotalQvector( totalQ );
147  //for using phi weights:
148  if(fUsePhiWeights) {
149  //pass the flag to the analysis class:
151  //get data from input slot #1 which is used for weights:
152  if(GetNinputs()==2) {
153  fListWeights = (TList*)GetInputData(1);
154  }
155  //pass the list with weights to the analysis class:
157  }
158 
159  fSP-> Init();
160 
161  if (fSP->GetHistList()) {
163  }
164  else {Printf("ERROR: Could not retrieve histogram list"); }
165 
166  PostData(1,fListHistos);
167 
168 }
169 
170 //________________________________________________________________________
172 {
173  // Main loop
174  // Called for each event
175 
176 
177  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
178  if (fEvent){
180  }
181  else {
182  cout << "Warning no input data for Scalar Product task!!!" << endl;
183  }
184 
185  //fListHistos->Print();
186  PostData(1,fListHistos);
187 
188 }
189 
190 //________________________________________________________________________
192 {
193  // Called once at the end of the query
195  fListHistos = (TList*)GetOutputData(1);
196  if (fListHistos) {
197  fSPTerm -> GetOutputHistograms(fListHistos);
198  fSPTerm -> Finish();
199  PostData(1,fListHistos);
200  }
201 
202  else { cout << "histgram list pointer is empty in Scalar Product" << endl; }
203 
204 }
virtual void Terminate(Option_t *)
virtual void ProcessEvent(AliFlowEventSimple *)
AliFlowAnalysisWithSimpleSP * fSP
int Int_t
Definition: External.C:63
void SetWeightsList(TList *const aWeightsList)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
virtual void UserExec(Option_t *option)