]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskScalarProduct.cxx
used floweventsimple exchange container
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskScalarProduct.cxx
CommitLineData
8d312f00 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#include "Riostream.h" //needed as include
17#include "TChain.h"
18#include "TTree.h"
9d062fe3 19#include "TFile.h" //needed as include
8d312f00 20#include "TList.h"
21
22
23class AliAnalysisTask;
24#include "AliAnalysisManager.h"
dc3481ef 25#include "AliFlowEventSimple.h"
88e00a8a 26
8d312f00 27#include "AliAnalysisTaskScalarProduct.h"
8d312f00 28#include "AliFlowAnalysisWithScalarProduct.h"
04f6283b 29#include "AliFlowCommonHist.h"
dc3481ef 30#include "AliFlowCommonHistResults.h"
8d312f00 31
32// AliAnalysisTaskScalarProduct:
33//
34// analysis task for Scalar Product Method
35//
36// Author: Naomi van der Kolk (kolk@nikhef.nl)
37
38ClassImp(AliAnalysisTaskScalarProduct)
39
40//________________________________________________________________________
dc3481ef 41AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name) :
8d312f00 42 AliAnalysisTask(name, ""),
dc3481ef 43 fEvent(NULL),
d7eb18ec 44 fSP(NULL),
dc3481ef 45 fListHistos(NULL)
46 {
8d312f00 47 // Constructor
48 cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct(const char *name)"<<endl;
49
50 // Define input and output slots here
dc3481ef 51 // Input slot #0 works with an AliFlowEventSimple
52 DefineInput(0, AliFlowEventSimple::Class());
8d312f00 53 // Output slot #0 writes into a TList container
54 DefineOutput(0, TList::Class());
dc3481ef 55
e2d51347 56}
57
882ffd6a 58//________________________________________________________________________
59AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct() :
dc3481ef 60 fEvent(NULL),
882ffd6a 61 fSP(NULL),
dc3481ef 62 fListHistos(NULL)
63 {
882ffd6a 64 // Constructor
65 cout<<"AliAnalysisTaskScalarProduct::AliAnalysisTaskScalarProduct()"<<endl;
66}
67
e2d51347 68//________________________________________________________________________
69AliAnalysisTaskScalarProduct::~AliAnalysisTaskScalarProduct()
70{
71 //
72 // Destructor
73 //
74
75 // histograms are in the output list and deleted when the output
76 // list is deleted by the TSelector dtor
77
78 // if (ListHistos) {
79 // delete fListHistos;
80 // fListHistos = NULL;
81 // }
8d312f00 82}
83
84//________________________________________________________________________
85void AliAnalysisTaskScalarProduct::ConnectInputData(Option_t *)
86{
87 // Connect ESD or AOD here
88 // Called once
89 cout<<"AliAnalysisTaskScalarProduct::ConnectInputData(Option_t *)"<<endl;
dc3481ef 90
8d312f00 91}
92
93//________________________________________________________________________
94void AliAnalysisTaskScalarProduct::CreateOutputObjects()
95{
e2d51347 96 // Called at every worker node to initialize
8d312f00 97 cout<<"AliAnalysisTaskScalarProduct::CreateOutputObjects()"<<endl;
dc3481ef 98
e2d51347 99 //Analyser
100 fSP = new AliFlowAnalysisWithScalarProduct() ;
101 fSP-> Init();
d7eb18ec 102
8d312f00 103
d7eb18ec 104 if (fSP->GetHistList()) {
9d062fe3 105 //fSP->GetHistList()->Print();
dc3481ef 106 fListHistos = fSP->GetHistList();
107 //fListHistos->Print();
8d312f00 108 }
d7eb18ec 109 else {Printf("ERROR: Could not retrieve histogram list"); }
8d312f00 110}
111
112//________________________________________________________________________
113void AliAnalysisTaskScalarProduct::Exec(Option_t *)
114{
115 // Main loop
116 // Called for each event
117
882ffd6a 118
dc3481ef 119 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
120 if (fEvent){
8d312f00 121 fSP->Make(fEvent);
8d312f00 122 }
dc3481ef 123 else {
124 cout << "Warning no input data!!!" << endl;
8d312f00 125 }
88e00a8a 126
88e00a8a 127 //fListHistos->Print();
d7eb18ec 128 PostData(0,fListHistos);
dc3481ef 129
882ffd6a 130}
8d312f00 131
132//________________________________________________________________________
133void AliAnalysisTaskScalarProduct::Terminate(Option_t *)
134{
9d062fe3 135 // Called once at the end of the query -- do not call in case of CAF
e35ddff0 136 // fSP->Finish();
e2d51347 137 // PostData(0,fListHistos);
88e00a8a 138
882ffd6a 139 fListHistos = (TList*)GetOutputData(0);
7b88dba1 140 // cout << "histgram list in Terminate" << endl;
9d062fe3 141 if (fListHistos) {
a58fb92e 142 // fListHistos->Print();
9d062fe3 143 }
144 else { cout << "histgram list pointer is empty" << endl; }
145
df802279 146}