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 * ***********************************/
30 class AliAnalysisTaskSE;
32 #include "Riostream.h"
33 #include "AliFlowEventSimple.h"
34 #include "AliAnalysisTaskFittingQDistribution.h"
35 #include "AliFlowAnalysisWithFittingQDistribution.h"
37 ClassImp(AliAnalysisTaskFittingQDistribution)
39 //================================================================================================================
41 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights):
42 AliAnalysisTaskSE(name),
46 fUseWeights(useWeights),
47 fUsePhiWeights(kFALSE),
51 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution(const char *name, Bool_t useWeights)"<<endl;
53 // Define input and output slots here
54 // Input slot #0 works with an AliFlowEventSimple
55 DefineInput(0, AliFlowEventSimple::Class());
57 // Input slot #1 is needed for the weights input files
60 DefineInput(1, TList::Class());
62 // Output slot #0 is reserved
63 // Output slot #1 writes into a TList container
64 DefineOutput(1, TList::Class());
67 AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution():
73 fUsePhiWeights(kFALSE),
77 cout<<"AliAnalysisTaskFittingQDistribution::AliAnalysisTaskFittingQDistribution()"<<endl;
80 //================================================================================================================
82 void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
84 // Called at every worker node to initialize
85 cout<<"AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()"<<endl;
88 fFQD = new AliFlowAnalysisWithFittingQDistribution();
93 // Pass the flags to class:
94 if(fUsePhiWeights) fFQD->SetUsePhiWeights(fUsePhiWeights);
95 // Get data from input slot #1 which is used for weights:
98 fListWeights = (TList*)GetInputData(1);
100 // Pass the list with weights to class:
101 if(fListWeights) fFQD->SetWeightsList(fListWeights);
106 if(fFQD->GetHistList())
108 fListHistos = fFQD->GetHistList();
109 //fListHistos->Print();
112 Printf("ERROR: Could not retrieve histogram list (FQD, Task::UserCreateOutputObjects()) !!!!");
115 } // end of void AliAnalysisTaskFittingQDistribution::UserCreateOutputObjects()
117 //================================================================================================================
119 void AliAnalysisTaskFittingQDistribution::UserExec(Option_t *)
121 // Main loop (called for each event):
122 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
124 // Fitting q-distribution:
130 cout<<"WARNING: No input data (FQD, Task::UserExec()) !!!!"<<endl;
133 PostData(1,fListHistos);
136 //================================================================================================================
138 void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
140 //accessing the output list
141 fListHistos = (TList*)GetOutputData(1);
143 fFQD = new AliFlowAnalysisWithFittingQDistribution();
147 fFQD->GetOutputHistograms(fListHistos);
149 PostData(1,fListHistos);
152 cout<<" WARNING: histogram list pointer is empty (FQD, Task::Terminate()) !!!!"<<endl;
156 } // end of void AliAnalysisTaskFittingQDistribution::Terminate(Option_t *)
158 //================================================================================================================