]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Tasks/AliAnalysisTaskLYZEventPlane.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskLYZEventPlane.cxx
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 <stdlib.h>
17
18 #include "Riostream.h" //needed as include
19 #include "TChain.h"
20 #include "TTree.h"
21 #include "TProfile.h"
22 #include "TFile.h"
23 #include "TList.h"
24
25 class AliAnalysisTaskSE;
26 #include "AliAnalysisManager.h"
27 #include "AliFlowEventSimple.h"
28 #include "AliAnalysisTaskLYZEventPlane.h"
29 #include "AliFlowCommonHist.h"
30 #include "AliFlowCommonHistResults.h"
31 #include "AliFlowLYZEventPlane.h"
32 #include "AliFlowAnalysisWithLYZEventPlane.h"
33
34 // AliAnalysisTaskLYZEventPlane:
35 //
36 // analysis task for Lee Yang Zeros Event Plane
37 //
38 // Author: Naomi van der Kolk (kolk@nikhef.nl)
39
40 using std::cout;
41 using std::endl;
42 ClassImp(AliAnalysisTaskLYZEventPlane)
43
44 //________________________________________________________________________
45 AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane(const char *name) : 
46   AliAnalysisTaskSE(name), 
47   fEvent(NULL), 
48   fLyzEp(NULL),
49   fLyz(NULL),
50   fListHistos(NULL),
51   fSecondRunFile(NULL)
52 {
53   // Constructor
54   cout<<"AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane(const char *name)"<<endl;
55
56   // Define input and output slots here
57   // Input slot #0 works with an AliFlowEventSimple
58   DefineInput(0, AliFlowEventSimple::Class());
59   DefineInput(1, TList::Class());
60   // Output slot #0 writes into a TList container
61   DefineOutput(1, TList::Class());
62   
63 }
64
65 //________________________________________________________________________
66 AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane() : 
67   AliAnalysisTaskSE(),
68   fEvent(NULL), 
69   fLyzEp(NULL),
70   fLyz(NULL),
71   fListHistos(NULL),
72   fSecondRunFile(NULL)
73 {
74   // Constructor
75   cout<<"AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane()"<<endl;
76 }
77
78
79 //________________________________________________________________________
80 AliAnalysisTaskLYZEventPlane::~AliAnalysisTaskLYZEventPlane() 
81 {
82   //destructor
83
84 }
85
86 //________________________________________________________________________
87 void AliAnalysisTaskLYZEventPlane::UserCreateOutputObjects() 
88 {
89   // Called once
90   cout<<"AliAnalysisTaskLYZEventPlane::CreateOutputObjects()"<<endl;
91   
92   //lee yang zeros event plane
93   fLyzEp = new AliFlowLYZEventPlane() ;
94   //Analyser
95   fLyz = new AliFlowAnalysisWithLYZEventPlane() ;
96      
97   // Get data from input slot
98   TList* pSecondRunList = (TList*)GetInputData(1);
99   if (pSecondRunList) {
100     fLyzEp -> SetSecondRunList(pSecondRunList);
101     fLyz -> SetSecondRunList(pSecondRunList);
102   } else { cout<<"No Second run List!"<<endl; exit(0); }
103
104   fLyzEp-> Init();
105   fLyz-> Init();
106
107   if (fLyz->GetHistList()) {
108     fListHistos = fLyz->GetHistList();
109     //fListHistos->Print();
110   }
111   else { cout<<"ERROR: Could not retrieve histogram list"<<endl;}
112
113  PostData(1,fListHistos);
114
115 }
116
117 //________________________________________________________________________
118 void AliAnalysisTaskLYZEventPlane::UserExec(Option_t *) 
119 {
120   // Main loop
121   // Called for each event
122
123   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
124   if (fEvent) {
125     fLyz->Make(fEvent,fLyzEp);
126   }
127   else {
128     cout << "Warning no input data!!!" << endl;}
129     
130   PostData(1,fListHistos);
131   
132 }      
133
134 //________________________________________________________________________
135 void AliAnalysisTaskLYZEventPlane::Terminate(Option_t *) 
136 {
137   // Called once at the end of the query
138   AliFlowAnalysisWithLYZEventPlane* lyzTerm = new AliFlowAnalysisWithLYZEventPlane() ;
139   fListHistos = (TList*)GetOutputData(1);
140   //cout << "histogram list in Terminate" << endl;
141    if (fListHistos) {
142       lyzTerm -> GetOutputHistograms(fListHistos);
143       lyzTerm -> Finish();
144       PostData(1,fListHistos);
145       //fListHistos->Print(); 
146   } else { cout << "histogram list pointer is empty" << endl;}
147
148   //cout<<".....finished LYZ EventPlane"<<endl;  
149    delete lyzTerm;
150 }
151
152