]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG/FLOW/Tasks/AliAnalysisTaskScalarProduct.cxx
fix typo in partial derivative which is used to calculate correlated errors
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskScalarProduct.cxx
... / ...
CommitLineData
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// AliAnalysisTaskScalarProduct:
18//
19// analysis task for Scalar Product Method
20//
21// Author: Naomi van der Kolk (kolk@nikhef.nl)
22///////////////////////////////////////////////
23
24
25#include "Riostream.h" //needed as include
26
27class TFile;
28class TList;
29class AliAnalysisTaskSE;
30
31#include "TProfile.h" //needed as include
32#include "AliAnalysisManager.h"
33#include "AliFlowEventSimple.h"
34
35#include "AliAnalysisTaskScalarProduct.h"
36#include "AliFlowAnalysisWithScalarProduct.h"
37#include "AliFlowCommonHist.h"
38#include "AliFlowCommonHistResults.h"
39
40#include "AliLog.h"
41
42using std::endl;
43using std::cout;
44ClassImp(AliAnalysisTaskScalarProduct)
45
46//________________________________________________________________________
47AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(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 fNormalizationType(1),
59 fTotalQvector(NULL)
60{
61 // Constructor
62 AliDebug(2,"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)");
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(usePhiWeights) {
69 DefineInput(1, TList::Class()); }
70 // Output slot #0 writes into a TList container
71 DefineOutput(1, TList::Class());
72
73 // Total Q-vector is: "QaQb" (means Qa+Qb), "Qa" or "Qb"
74 fTotalQvector = new TString("QaQb");
75}
76
77//________________________________________________________________________
78AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() :
79 AliAnalysisTaskSE(),
80 fEvent(NULL),
81 fSP(NULL),
82 fListHistos(NULL),
83 fMinimalBook(kFALSE),
84 fUsePhiWeights(kFALSE),
85 fListWeights(NULL),
86 fRelDiffMsub(1.0),
87 fApplyCorrectionForNUA(kFALSE),
88 fHarmonic(0),
89 fNormalizationType(1),
90 fTotalQvector(NULL)
91 {
92 // Constructor
93 AliDebug(2,"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()");
94}
95
96//________________________________________________________________________
97AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct()
98{
99 //
100 // Destructor
101 //
102
103 // histograms are in the output list and deleted when the output
104 // list is deleted by the TSelector dtor
105
106 // if (ListHistos) {
107 // delete fListHistos;
108 // fListHistos = NULL;
109 // }
110}
111
112//________________________________________________________________________
113void AliAnalysisTaskScalarProduct::UserCreateOutputObjects()
114{
115 // Called at every worker node to initialize
116 AliDebug(2,"AliAnalysisTaskScalarProduct::CreateOutputObjects()");
117
118 //Analyser
119 fSP = new AliFlowAnalysisWithScalarProduct();
120 fSP->SetBookOnlyBasicCCH(fMinimalBook);
121
122 //set the allowed relative difference in the subevent multiplicities
123 //fSP->SetRelDiffMsub(fRelDiffMsub);
124
125 //apply automatic correction for non-uniform acceptance:
126 if (fApplyCorrectionForNUA) {
127 AliDebug(2,"Corrections for non-uniform acceptance applied in the Scalar Product method");
128 }
129 fSP->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
130 // harmonic:
131 fSP->SetHarmonic(fHarmonic);
132 fSP->SetNormalizationType( fNormalizationType );
133 // total Q-vector:
134 Int_t totalQ = 0;
135 if( fTotalQvector->Contains("Qa") ) totalQ += 1;
136 if( fTotalQvector->Contains("Qb") ) totalQ += 2;
137 fSP->SetTotalQvector( totalQ );
138 //for using phi weights:
139 if(fUsePhiWeights) {
140 //pass the flag to the analysis class:
141 fSP->SetUsePhiWeights(fUsePhiWeights);
142 //get data from input slot #1 which is used for weights:
143 if(GetNinputs()==2) {
144 fListWeights = (TList*)GetInputData(1);
145 }
146 //pass the list with weights to the analysis class:
147 if(fListWeights) fSP->SetWeightsList(fListWeights);
148 }
149
150 fSP-> Init();
151
152 if (fSP->GetHistList()) {
153 fListHistos = fSP->GetHistList();
154 }
155 else {Printf("ERROR: Could not retrieve histogram list"); }
156
157 PostData(1,fListHistos);
158
159}
160
161//________________________________________________________________________
162void AliAnalysisTaskScalarProduct::UserExec(Option_t *)
163{
164 // Main loop
165 // Called for each event
166
167
168 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
169 if (fEvent){
170 fSP->ProcessEvent(fEvent);
171 }
172 else {
173 cout << "Warning no input data for Scalar Product task!!!" << endl;
174 }
175
176 //fListHistos->Print();
177 PostData(1,fListHistos);
178
179}
180
181//________________________________________________________________________
182void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
183{
184 // Called once at the end of the query
185 AliFlowAnalysisWithScalarProduct* fSPTerm = new AliFlowAnalysisWithScalarProduct() ;
186 fListHistos = (TList*)GetOutputData(1);
187 if (fListHistos) {
188 fSPTerm -> GetOutputHistograms(fListHistos);
189 fSPTerm -> Finish();
190 PostData(1,fListHistos);
191 }
192
193 else { cout << "histgram list pointer is empty in Scalar Product" << endl; }
194
195}