]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/FLOW/Tasks/AliAnalysisTaskLYZEventPlane.cxx
Initialize the path name to the geometry file in the Init and not in the InitParameters
[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 ClassImp(AliAnalysisTaskLYZEventPlane)
41
42 //________________________________________________________________________
43 AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane(const char *name) : 
44   AliAnalysisTaskSE(name), 
45   fEvent(NULL), 
46   fLyzEp(NULL),
47   fLyz(NULL),
48   fListHistos(NULL),
49   fSecondRunFile(NULL)
50 {
51   // Constructor
52   cout<<"AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane(const char *name)"<<endl;
53
54   // Define input and output slots here
55   // Input slot #0 works with an AliFlowEventSimple
56   DefineInput(0, AliFlowEventSimple::Class());
57   DefineInput(1, TList::Class());
58   // Output slot #0 writes into a TList container
59   DefineOutput(1, TList::Class());
60   
61 }
62
63 //________________________________________________________________________
64 AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane() : 
65   AliAnalysisTaskSE(),
66   fEvent(NULL), 
67   fLyzEp(NULL),
68   fLyz(NULL),
69   fListHistos(NULL),
70   fSecondRunFile(NULL)
71 {
72   // Constructor
73   cout<<"AliAnalysisTaskLYZEventPlane::AliAnalysisTaskLYZEventPlane()"<<endl;
74 }
75
76
77 //________________________________________________________________________
78 AliAnalysisTaskLYZEventPlane::~AliAnalysisTaskLYZEventPlane() 
79 {
80   //destructor
81
82 }
83
84 //________________________________________________________________________
85 void AliAnalysisTaskLYZEventPlane::UserCreateOutputObjects() 
86 {
87   // Called once
88   cout<<"AliAnalysisTaskLYZEventPlane::CreateOutputObjects()"<<endl;
89   
90   //lee yang zeros event plane
91   fLyzEp = new AliFlowLYZEventPlane() ;
92   //Analyser
93   fLyz = new AliFlowAnalysisWithLYZEventPlane() ;
94      
95   // Get data from input slot
96   TList* pSecondRunList = (TList*)GetInputData(1);
97   if (pSecondRunList) {
98     fLyzEp -> SetSecondRunList(pSecondRunList);
99     fLyz -> SetSecondRunList(pSecondRunList);
100   } else { cout<<"No Second run List!"<<endl; exit(0); }
101
102   fLyzEp-> Init();
103   fLyz-> Init();
104
105   if (fLyz->GetHistList()) {
106     fListHistos = fLyz->GetHistList();
107     //fListHistos->Print();
108   }
109   else { cout<<"ERROR: Could not retrieve histogram list"<<endl;}
110
111  PostData(1,fListHistos);
112
113 }
114
115 //________________________________________________________________________
116 void AliAnalysisTaskLYZEventPlane::UserExec(Option_t *) 
117 {
118   // Main loop
119   // Called for each event
120
121   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
122   if (fEvent) {
123     fLyz->Make(fEvent,fLyzEp);
124   }
125   else {
126     cout << "Warning no input data!!!" << endl;}
127     
128   PostData(1,fListHistos);
129   
130 }      
131
132 //________________________________________________________________________
133 void AliAnalysisTaskLYZEventPlane::Terminate(Option_t *) 
134 {
135   // Called once at the end of the query
136   AliFlowAnalysisWithLYZEventPlane* lyzTerm = new AliFlowAnalysisWithLYZEventPlane() ;
137   fListHistos = (TList*)GetOutputData(1);
138   //cout << "histogram list in Terminate" << endl;
139    if (fListHistos) {
140       lyzTerm -> GetOutputHistograms(fListHistos);
141       lyzTerm -> Finish();
142       PostData(1,fListHistos);
143       //fListHistos->Print(); 
144   } else { cout << "histogram list pointer is empty" << endl;}
145
146   //cout<<".....finished LYZ EventPlane"<<endl;  
147    delete lyzTerm;
148 }
149
150