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"
44 ClassImp(AliAnalysisTaskScalarProduct)
46 //________________________________________________________________________
47 AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name, Bool_t usePhiWeights) :
48 AliAnalysisTaskSE(name),
53 fUsePhiWeights(usePhiWeights),
56 fApplyCorrectionForNUA(kFALSE),
58 fNormalizationType(1),
62 AliDebug(2,"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)");
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
69 DefineInput(1, TList::Class()); }
70 // Output slot #0 writes into a TList container
71 DefineOutput(1, TList::Class());
73 // Total Q-vector is: "QaQb" (means Qa+Qb), "Qa" or "Qb"
74 fTotalQvector = new TString("QaQb");
77 //________________________________________________________________________
78 AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() :
84 fUsePhiWeights(kFALSE),
87 fApplyCorrectionForNUA(kFALSE),
89 fNormalizationType(1),
93 AliDebug(2,"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()");
96 //________________________________________________________________________
97 AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct()
103 // histograms are in the output list and deleted when the output
104 // list is deleted by the TSelector dtor
107 // delete fListHistos;
108 // fListHistos = NULL;
112 //________________________________________________________________________
113 void AliAnalysisTaskScalarProduct::UserCreateOutputObjects()
115 // Called at every worker node to initialize
116 AliDebug(2,"AliAnalysisTaskScalarProduct::CreateOutputObjects()");
119 fSP = new AliFlowAnalysisWithScalarProduct();
120 fSP->SetBookOnlyBasicCCH(fMinimalBook);
122 //set the allowed relative difference in the subevent multiplicities
123 //fSP->SetRelDiffMsub(fRelDiffMsub);
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");
129 fSP->SetApplyCorrectionForNUA(fApplyCorrectionForNUA);
131 fSP->SetHarmonic(fHarmonic);
132 fSP->SetNormalizationType( fNormalizationType );
135 if( fTotalQvector->Contains("Qa") ) totalQ += 1;
136 if( fTotalQvector->Contains("Qb") ) totalQ += 2;
137 fSP->SetTotalQvector( totalQ );
138 //for using phi weights:
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);
146 //pass the list with weights to the analysis class:
147 if(fListWeights) fSP->SetWeightsList(fListWeights);
152 if (fSP->GetHistList()) {
153 fListHistos = fSP->GetHistList();
155 else {Printf("ERROR: Could not retrieve histogram list"); }
157 PostData(1,fListHistos);
161 //________________________________________________________________________
162 void AliAnalysisTaskScalarProduct::UserExec(Option_t *)
165 // Called for each event
168 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
170 fSP->ProcessEvent(fEvent);
173 cout << "Warning no input data for Scalar Product task!!!" << endl;
176 //fListHistos->Print();
177 PostData(1,fListHistos);
181 //________________________________________________________________________
182 void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
184 // Called once at the end of the query
185 AliFlowAnalysisWithScalarProduct* fSPTerm = new AliFlowAnalysisWithScalarProduct() ;
186 fListHistos = (TList*)GetOutputData(1);
188 fSPTerm -> GetOutputHistograms(fListHistos);
190 PostData(1,fListHistos);
193 else { cout << "histgram list pointer is empty in Scalar Product" << endl; }