AliPhysics  7f2a7c4 (7f2a7c4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskLeeYangZeros.cxx
Go to the documentation of this file.
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"
28 #include "AliFlowCommonHist.h"
30 #include "AliFlowLYZHist1.h"
31 #include "AliFlowLYZHist2.h"
33 
34 // AliAnalysisTaskLeeYangZeros:
35 // analysis task for Lee Yang Zeros method
36 // Author: Naomi van der Kolk (kolk@nikhef.nl)
37 
38 using std::cout;
39 using std::endl;
41 
42 //________________________________________________________________________
44  AliAnalysisTaskSE(name),
45  fEvent(0),
46  fLyz(0),
47  fFirstRunFile(0),
48  fListHistos(NULL),
49  fFirstRunLYZ(firstrun), //set boolean for firstrun to initial value
50  fUseSumLYZ(kTRUE) //set boolean for use sum to initial value
51 {
52  // Constructor
53  cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name)"<<endl;
54 
55  // Define input and output slots here
56  // Input slot #0 works with a TChain
57  DefineInput(0, AliFlowEventSimple::Class());
58  if (!firstrun) DefineInput(1, TList::Class()); //for second loop
59  // Output slot #0 writes into a TList container
60  DefineOutput(1, TList::Class());
61 
62 }
63 
64 //________________________________________________________________________
67  fEvent(0),
68  fLyz(0),
69  fFirstRunFile(0),
70  fListHistos(NULL),
71  fFirstRunLYZ(kTRUE), //set boolean for firstrun to initial value
72  fUseSumLYZ(kTRUE) //set boolean for use sum to initial value
73 {
74  // Constructor
75  cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros()"<<endl;
76 
77 }
78 
79 //________________________________________________________________________
81 {
82 
83  //destructor
84 
85 }
86 
87 //________________________________________________________________________
89 {
90  // Called once
91  cout<<"AliAnalysisTaskLeeYangZeros::CreateOutputObjects()"<<endl;
92 
93 
94  //Analyser
96  fLyz -> SetFirstRun(GetFirstRunLYZ()); //set first run true or false
97  fLyz -> SetUseSum(GetUseSumLYZ()); //set use sum true or false
98 
99  // Get data from input slot 1
100  if (GetNinputs() == 2) { //if there are two input slots
101  TList* pFirstRunList = (TList*)GetInputData(1);
102  if (pFirstRunList) {
103  fLyz -> SetFirstRunList(pFirstRunList);
104  } else { cout<<"No first run List!"<<endl; exit(0); }
105  }
106 
107  fLyz -> Init();
108 
109  if (fLyz->GetHistList()) {
111  // fListHistos->Print();
112  }
113  else {Printf("ERROR: Could not retrieve histogram list"); }
114 
115  PostData(1,fListHistos);
116 
117 }
118 
119 //________________________________________________________________________
121 {
122  // Main loop
123  // Called for each event
124 
125  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
126  if (fEvent) {
127  fLyz->Make(fEvent);
128  }
129  else {
130  cout << "Warning no input data!!!" << endl; }
131 
132  PostData(1,fListHistos);
133 
134 }
135 
136 //________________________________________________________________________
138 {
139  // Called once at the end of the query
140 
142  lyzTerm -> SetFirstRun(GetFirstRunLYZ()); //set first run true or false
143  lyzTerm -> SetUseSum(GetUseSumLYZ()); //set use sum true or false
144 
145  fListHistos = (TList*)GetOutputData(1);
146 
147  if(fListHistos)
148  {
149  lyzTerm -> GetOutputHistograms(fListHistos);
150  lyzTerm -> Finish();
151  PostData(1,fListHistos);
152  } else
153  {
154  cout << "histogram list pointer in Lee-Yang Zeros is empty in AliAnalysisTaskLYZ::Terminate ()" << endl;
155  }
156 
157  delete lyzTerm;
158 
159 }
virtual void UserExec(Option_t *option)
AliFlowAnalysisWithLeeYangZeros * fLyz
ClassImp(AliAnalysisTaskLeeYangZeros) AliAnalysisTaskLeeYangZeros
Bool_t Make(AliFlowEventSimple *anEvent)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53