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 *f
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 * analysis task for fitting *
20 * authors: Naomi van der Kolk *
23 * (snelling@nikhef.nl) *
26 * ***********************************/
28 #include "Riostream.h"
36 #include "AliAnalysisTask.h"
37 #include "AliAnalysisDataSlot.h"
38 #include "AliAnalysisDataContainer.h"
39 #include "AliAnalysisManager.h"
41 #include "AliFlowEventSimple.h"
42 #include "AliAnalysisTaskFittingQDistribution.h"
43 #include "AliFlowAnalysisWithFittingQDistribution.h"
44 #include "AliFlowCommonConstants.h"
45 #include "AliFlowCommonHistResults.h"
47 ClassImp(AliAnalysisTaskFittingQDistribution)
49 //================================================================================================================
51 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights):
52 AliAnalysisTask(name,""),
54 fFQDA(NULL),//Fitting Q_Distribution Analysis (FQDA) object
56 fUseWeights(useWeights),
57 fUsePhiWeights(kFALSE),
61 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name)"<<endl;
63 // Define input and output slots here
64 // Input slot #0 works with a TChain
65 DefineInput(0, AliFlowEventSimple::Class());
67 // Input slot #1 is needed for the weights
69 DefineInput(1, TList::Class());
72 // Output slot #0 writes into a TList container
73 DefineOutput(0, TList::Class());
76 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution():
78 fFQDA(NULL),//Fitting q-distribution Analysis (FQDA) object
81 fUsePhiWeights(kFALSE),
85 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
88 //================================================================================================================
90 void AliAnalysisTaskFittingQDistribution::ConnectInputData(Option_t *)
92 //connect ESD or AOD (called once)
93 cout<<"AliAnalysisTaskFittingQDistribution::ConnectInputData(Option_t *)"<<endl;
97 //================================================================================================================
99 void AliAnalysisTaskFittingQDistribution::CreateOutputObjects()
101 //called at every worker node to initialize
102 cout<<"AliAnalysisTaskFittingQDistribution::CreateOutputObjects()"<<endl;
106 fFQDA = new AliFlowAnalysisWithFittingQDistribution();
111 //pass the flags to class:
112 if(fUsePhiWeights) fFQDA->SetUsePhiWeights(fUsePhiWeights);
113 //get data from input slot #1 which is used for weights:
114 if(GetNinputs()==2) {
115 fListWeights = (TList*)GetInputData(1);
117 //pass the list with weights to class:
118 if(fListWeights) fFQDA->SetWeightsList(fListWeights);
121 if(fFQDA->GetHistList()) {
122 fListHistos = fFQDA->GetHistList();
123 //fListHistos->Print();
126 Printf("ERROR: Could not retrieve histogram list");
131 //================================================================================================================
133 void AliAnalysisTaskFittingQDistribution::Exec(Option_t *)
135 //main loop (called for each event)
136 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
138 //fitting q-distribution
143 cout << "Warning no input data!!!" << endl;
145 PostData(0,fListHistos);
148 //================================================================================================================
150 void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
152 //accessing the output list
153 fListHistos = (TList*)GetOutputData(0);
154 //fListHistos->Print();
156 fFQDA = new AliFlowAnalysisWithFittingQDistribution();
160 fFQDA->GetOutputHistograms(fListHistos);
164 cout<<"histogram list pointer is empty"<<endl;
168 //================================================================================================================