]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx
fix for cuts
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskLeeYangZeros.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 "Riostream.h" //needed as include
17 #include "TChain.h"
18 #include "TTree.h"
19 #include "TFile.h"
20 #include "TList.h"
21 #include "TProfile.h"
22
23 class AliAnalysisTask;
24 #include "AliAnalysisManager.h"
25 #include "AliFlowEventSimple.h"
26 #include "AliFlowLYZConstants.h"   
27 #include "AliAnalysisTaskLeeYangZeros.h"
28 #include "AliFlowCommonHist.h"
29 #include "AliFlowCommonHistResults.h"
30 #include "AliFlowLYZHist1.h"
31 #include "AliFlowLYZHist2.h"
32 #include "AliFlowAnalysisWithLeeYangZeros.h"
33
34 // AliAnalysisTaskLeeYangZeros:
35 // analysis task for Lee Yang Zeros method
36 // Author: Naomi van der Kolk (kolk@nikhef.nl)
37
38 ClassImp(AliAnalysisTaskLeeYangZeros)
39
40 //________________________________________________________________________
41 AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name, Bool_t firstrun) : 
42   AliAnalysisTask(name, ""), 
43   fEvent(0),
44   fLyz(0),
45   fFirstRunFile(0),
46   fListHistos(NULL),
47   fFirstRunLYZ(firstrun), //set boolean for firstrun to initial value
48   fUseSumLYZ(kTRUE)       //set boolean for use sum to initial value
49 {
50   // Constructor
51   cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name)"<<endl;
52
53   // Define input and output slots here
54   // Input slot #0 works with a TChain
55   DefineInput(0, AliFlowEventSimple::Class());
56   if (!firstrun) DefineInput(1, TList::Class()); //for second loop 
57   // Output slot #0 writes into a TList container
58   DefineOutput(0, TList::Class());  
59    
60
61
62 //________________________________________________________________________
63 AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros() :  
64   fEvent(0),
65   fLyz(0),
66   fFirstRunFile(0),
67   fListHistos(NULL),
68   fFirstRunLYZ(kTRUE), //set boolean for firstrun to initial value
69   fUseSumLYZ(kTRUE)    //set boolean for use sum to initial value
70 {
71   // Constructor
72   cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros()"<<endl;
73
74 }
75
76 //________________________________________________________________________
77 AliAnalysisTaskLeeYangZeros::~AliAnalysisTaskLeeYangZeros()
78 {
79
80   //destructor
81
82 }
83
84 //________________________________________________________________________
85 void AliAnalysisTaskLeeYangZeros::ConnectInputData(Option_t *) 
86 {
87   // Connect ESD or AOD here
88   // Called once
89   cout<<"AliAnalysisTaskLeeYangZeros::ConnectInputData(Option_t *)"<<endl;
90  
91 }
92
93 //________________________________________________________________________
94 void AliAnalysisTaskLeeYangZeros::CreateOutputObjects() 
95 {
96   // Called once
97   cout<<"AliAnalysisTaskLeeYangZeros::CreateOutputObjects()"<<endl;
98
99   
100   //Analyser
101   fLyz = new AliFlowAnalysisWithLeeYangZeros() ;
102   fLyz -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
103   fLyz -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
104
105   // Get data from input slot 1
106   if (GetNinputs() == 2) {                   //if there are two input slots
107     TList* pFirstRunList = (TList*)GetInputData(1);
108     if (pFirstRunList) {
109       fLyz -> SetFirstRunList(pFirstRunList);
110     } else { cout<<"No first run List!"<<endl; exit(0); }
111   }
112   
113   fLyz -> Init();
114
115   if (fLyz->GetHistList()) {
116     fListHistos = fLyz->GetHistList();
117     //    fListHistos->Print();
118   }
119   else {Printf("ERROR: Could not retrieve histogram list"); }
120   
121 }
122
123 //________________________________________________________________________
124 void AliAnalysisTaskLeeYangZeros::Exec(Option_t *) 
125 {
126   // Main loop
127   // Called for each event
128
129   fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
130   if (fEvent) {
131     fLyz->Make(fEvent);
132   }
133   else {
134     cout << "Warning no input data!!!" << endl; }
135   
136   PostData(0,fListHistos); //here for CAF
137   
138 }      
139
140 //________________________________________________________________________
141 void AliAnalysisTaskLeeYangZeros::Terminate(Option_t *) 
142 {
143   // Called once at the end of the query
144   
145   AliFlowAnalysisWithLeeYangZeros* fLyzTerm = new AliFlowAnalysisWithLeeYangZeros() ;
146   fLyzTerm -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
147   fLyzTerm -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
148    
149   fListHistos = (TList*)GetOutputData(0);
150   
151   if(fListHistos) 
152   {
153    fLyzTerm -> GetOutputHistograms(fListHistos);
154    fLyzTerm -> Finish();
155         PostData(0,fListHistos);
156   } else 
157     {
158      cout << "histogram list pointer in Lee-Yang Zeros is empty in AliAnalysisTaskLYZ::Terminate ()" << endl;
159     } 
160
161   //cout<<".....finished"<<endl;
162 }