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 #include "Riostream.h" //needed as include
21 class AliAnalysisTask;
22 #include "AliAnalysisManager.h"
23 #include "AliFlowEventSimple.h"
26 #include "AliAnalysisTaskMCEventPlane.h"
27 #include "AliFlowAnalysisWithMCEventPlane.h"
28 #include "AliFlowCommonHist.h"
29 #include "AliFlowCommonHistResults.h"
31 // AliAnalysisTaskMCEventPlane:
33 // analysis task for Monte Carlo Event Plane
35 // Author: Naomi van der Kolk (kolk@nikhef.nl)
37 ClassImp(AliAnalysisTaskMCEventPlane)
39 //________________________________________________________________________
40 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name) :
41 AliAnalysisTask(name, ""),
47 cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane(const char *name)"<<endl;
49 // Define input and output slots here
50 // Input slot #0 works with a TChain
51 DefineInput(0, AliFlowEventSimple::Class());
52 // Output slot #0 writes into a TList container
53 DefineOutput(0, TList::Class());
56 //________________________________________________________________________
57 AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane() :
63 cout<<"AliAnalysisTaskMCEventPlane::AliAnalysisTaskMCEventPlane()"<<endl;
67 //________________________________________________________________________
68 AliAnalysisTaskMCEventPlane::~AliAnalysisTaskMCEventPlane()
75 //________________________________________________________________________
76 void AliAnalysisTaskMCEventPlane::ConnectInputData(Option_t *)
78 // Connect ESD or AOD here
80 cout<<"AliAnalysisTaskMCEventPlane::ConnectInputData(Option_t *)"<<endl;
84 //________________________________________________________________________
85 void AliAnalysisTaskMCEventPlane::CreateOutputObjects()
88 cout<<"AliAnalysisTaskMCEventPlane::CreateOutputObjects()"<<endl;
91 fMc = new AliFlowAnalysisWithMCEventPlane() ;
95 if (fMc->GetHistList()) {
96 //fMc->GetHistList()->Print();
97 fListHistos = fMc->GetHistList();
98 //fListHistos->Print();
100 else {Printf("ERROR: Could not retrieve histogram list"); }
104 //________________________________________________________________________
105 void AliAnalysisTaskMCEventPlane::Exec(Option_t *)
108 // Called for each event
110 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
115 cout << "Warning no input data!!!" << endl;
118 PostData(0,fListHistos);
122 //________________________________________________________________________
123 void AliAnalysisTaskMCEventPlane::Terminate(Option_t *)
125 // Called once at the end of the query
126 AliFlowAnalysisWithMCEventPlane* fMcTerm = new AliFlowAnalysisWithMCEventPlane() ;
129 fListHistos = (TList*)GetOutputData(0);
130 // cout << "histogram list in Terminate" << endl;
132 //Get the common histograms from the output list
133 AliFlowCommonHist *pCommonHists = dynamic_cast<AliFlowCommonHist*>
134 (fListHistos->FindObject("AliFlowCommonHistMCEP"));
135 AliFlowCommonHistResults *pCommonHistResults =
136 dynamic_cast<AliFlowCommonHistResults*>
137 (fListHistos->FindObject("AliFlowCommonHistResultsMCEP"));
139 TProfile *pHistProIntFlow = dynamic_cast<TProfile*>
140 (fListHistos->FindObject("FlowPro_V_MCEP"));
142 TProfile *pHistProDiffFlowPtRP = dynamic_cast<TProfile*>
143 (fListHistos->FindObject("FlowPro_VPtRP_MCEP"));
145 TProfile *pHistProDiffFlowEtaRP = dynamic_cast<TProfile*>
146 (fListHistos->FindObject("FlowPro_VetaRP_MCEP"));
148 TProfile *pHistProDiffFlowPtPOI = dynamic_cast<TProfile*>
149 (fListHistos->FindObject("FlowPro_VPtPOI_MCEP"));
151 TProfile *pHistProDiffFlowEtaPOI = dynamic_cast<TProfile*>
152 (fListHistos->FindObject("FlowPro_VetaPOI_MCEP"));
154 if (pCommonHists && pCommonHistResults && pHistProIntFlow &&
155 pHistProDiffFlowPtRP && pHistProDiffFlowEtaRP &&
156 pHistProDiffFlowPtPOI && pHistProDiffFlowEtaPOI) {
157 fMcTerm->SetCommonHists(pCommonHists);
158 fMcTerm->SetCommonHistsRes(pCommonHistResults);
159 fMcTerm->SetHistProIntFlow(pHistProIntFlow);
160 fMcTerm->SetHistProDiffFlowPtRP(pHistProDiffFlowPtRP);
161 fMcTerm->SetHistProDiffFlowEtaRP(pHistProDiffFlowEtaRP);
162 fMcTerm->SetHistProDiffFlowPtPOI(pHistProDiffFlowPtPOI);
163 fMcTerm->SetHistProDiffFlowEtaPOI(pHistProDiffFlowEtaPOI);
165 PostData(0,fListHistos);
167 cout<<"WARNING: Histograms needed to run Finish() are not accessable!"<<endl; }
169 //fListHistos->Print();
170 } else { cout << "histogram list pointer is empty" << endl;}