]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx
mean pt cut
[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 AliAnalysisTaskSE;
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   AliAnalysisTaskSE(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(1, TList::Class());  
59    
60
61
62 //________________________________________________________________________
63 AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros() :
64   AliAnalysisTaskSE(),
65   fEvent(0),
66   fLyz(0),
67   fFirstRunFile(0),
68   fListHistos(NULL),
69   fFirstRunLYZ(kTRUE), //set boolean for firstrun to initial value
70   fUseSumLYZ(kTRUE)    //set boolean for use sum to initial value
71 {
72   // Constructor
73   cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros()"<<endl;
74
75 }
76
77 //________________________________________________________________________
78 AliAnalysisTaskLeeYangZeros::~AliAnalysisTaskLeeYangZeros()
79 {
80
81   //destructor
82
83 }
84
85 //________________________________________________________________________
86 void AliAnalysisTaskLeeYangZeros::UserCreateOutputObjects() 
87 {
88   // Called once
89   cout<<"AliAnalysisTaskLeeYangZeros::CreateOutputObjects()"<<endl;
90
91   
92   //Analyser
93   fLyz = new AliFlowAnalysisWithLeeYangZeros() ;
94   fLyz -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
95   fLyz -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
96
97   // Get data from input slot 1
98   if (GetNinputs() == 2) {                   //if there are two input slots
99     TList* pFirstRunList = (TList*)GetInputData(1);
100     if (pFirstRunList) {
101       fLyz -> SetFirstRunList(pFirstRunList);
102     } else { cout<<"No first run List!"<<endl; exit(0); }
103   }
104   
105   fLyz -> Init();
106
107   if (fLyz->GetHistList()) {
108     fListHistos = fLyz->GetHistList();
109     //    fListHistos->Print();
110   }
111   else {Printf("ERROR: Could not retrieve histogram list"); }
112
113  PostData(1,fListHistos);
114   
115 }
116
117 //________________________________________________________________________
118 void AliAnalysisTaskLeeYangZeros::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);
126   }
127   else {
128     cout << "Warning no input data!!!" << endl; }
129   
130   PostData(1,fListHistos); 
131   
132 }      
133
134 //________________________________________________________________________
135 void AliAnalysisTaskLeeYangZeros::Terminate(Option_t *) 
136 {
137   // Called once at the end of the query
138   
139   AliFlowAnalysisWithLeeYangZeros* fLyzTerm = new AliFlowAnalysisWithLeeYangZeros() ;
140   fLyzTerm -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
141   fLyzTerm -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
142    
143   fListHistos = (TList*)GetOutputData(1);
144   
145   if(fListHistos) 
146   {
147    fLyzTerm -> GetOutputHistograms(fListHistos);
148    fLyzTerm -> Finish();
149         PostData(1,fListHistos);
150   } else 
151     {
152      cout << "histogram list pointer in Lee-Yang Zeros is empty in AliAnalysisTaskLYZ::Terminate ()" << endl;
153     } 
154
155   
156 }