1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////
17 // AliAnalysisTaskScalarProduct:
19 // analysis task for Scalar Product Method
21 // Author: Naomi van der Kolk (kolk@nikhef.nl)
22 ///////////////////////////////////////////////
25 #include "Riostream.h" //needed as include
29 class AliAnalysisTaskSE;
31 #include "TProfile.h" //needed as include
32 #include "AliAnalysisManager.h"
33 #include "AliFlowEventSimple.h"
35 #include "AliAnalysisTaskScalarProduct.h"
36 #include "AliFlowAnalysisWithScalarProduct.h"
37 #include "AliFlowCommonHist.h"
38 #include "AliFlowCommonHistResults.h"
40 ClassImp(AliAnalysisTaskScalarProduct)
42 //________________________________________________________________________
43 AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name, Bool_t usePhiWeights) :
44 AliAnalysisTaskSE(name),
48 fUsePhiWeights(usePhiWeights),
51 fApplyCorrectionForNUA(kFALSE),
56 cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl;
58 // Define input and output slots here
59 // Input slot #0 works with an AliFlowEventSimple
60 DefineInput(0, AliFlowEventSimple::Class());
61 // Input slot #1 is needed for the weights input file
63 DefineInput(1, TList::Class()); }
64 // Output slot #0 writes into a TList container
65 DefineOutput(1, TList::Class());
67 // Total Q-vector is: "QaQb" (means Qa+Qb), "Qa" or "Qb"
68 fTotalQvector = new TString("QaQb");
71 //________________________________________________________________________
72 AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() :
77 fUsePhiWeights(kFALSE),
80 fApplyCorrectionForNUA(kFALSE),
85 cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()"<<endl;
88 //________________________________________________________________________
89 AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct()
95 // histograms are in the output list and deleted when the output
96 // list is deleted by the TSelector dtor
99 // delete fListHistos;
100 // fListHistos = NULL;
104 //________________________________________________________________________
105 void AliAnalysisTaskScalarProduct::UserCreateOutputObjects()
107 // Called at every worker node to initialize
108 cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl;
111 fSP = new AliFlowAnalysisWithScalarProduct();
113 //set the allowed relative difference in the subevent multiplicities
114 fSP->SetRelDiffMsub(fRelDiffMsub);
116 //apply automatic correction for non-uniform acceptance:
117 if (fApplyCorrectionForNUA) {
118 cout<<"Corrections for non-uniform acceptance applied in the Scalar Product method"<<endl;
120 fSP->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
122 fSP->SetHarmonic(fHarmonic);
124 if(!(strcmp(fTotalQvector->Data(),"QaQb")==0)) // default is "QaQb" (means Qa+Qb)
126 fSP->SetTotalQvector(fTotalQvector->Data());
129 //for using phi weights:
131 //pass the flag to the analysis class:
132 fSP->SetUsePhiWeights(fUsePhiWeights);
133 //get data from input slot #1 which is used for weights:
134 if(GetNinputs()==2) {
135 fListWeights = (TList*)GetInputData(1);
137 //pass the list with weights to the analysis class:
138 if(fListWeights) fSP->SetWeightsList(fListWeights);
143 if (fSP->GetHistList()) {
144 fListHistos = fSP->GetHistList();
146 else {Printf("ERROR: Could not retrieve histogram list"); }
148 PostData(1,fListHistos);
152 //________________________________________________________________________
153 void AliAnalysisTaskScalarProduct::UserExec(Option_t *)
156 // Called for each event
159 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
164 cout << "Warning no input data for Scalar Product task!!!" << endl;
167 //fListHistos->Print();
168 PostData(1,fListHistos);
172 //________________________________________________________________________
173 void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
175 // Called once at the end of the query
176 AliFlowAnalysisWithScalarProduct* fSPTerm = new AliFlowAnalysisWithScalarProduct() ;
177 fListHistos = (TList*)GetOutputData(1);
179 fSPTerm -> GetOutputHistograms(fListHistos);
181 PostData(1,fListHistos);
184 else { cout << "histgram list pointer is empty in Scalar Product" << endl; }