]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskLeeYangZeros.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskLeeYangZeros.cxx
CommitLineData
f1d945a1 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"
88e00a8a 20#include "TList.h"
9d062fe3 21#include "TProfile.h"
f1d945a1 22
22063257 23class AliAnalysisTaskSE;
f1d945a1 24#include "AliAnalysisManager.h"
9808604e 25#include "AliFlowEventSimple.h"
bc92c0cb 26#include "AliFlowLYZConstants.h"
f1d945a1 27#include "AliAnalysisTaskLeeYangZeros.h"
9d062fe3 28#include "AliFlowCommonHist.h"
29#include "AliFlowCommonHistResults.h"
30#include "AliFlowLYZHist1.h"
31#include "AliFlowLYZHist2.h"
f1d945a1 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
3a7af7bd 38using std::cout;
39using std::endl;
f1d945a1 40ClassImp(AliAnalysisTaskLeeYangZeros)
41
42//________________________________________________________________________
9808604e 43AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros(const char *name, Bool_t firstrun) :
22063257 44 AliAnalysisTaskSE(name),
9808604e 45 fEvent(0),
f1d945a1 46 fLyz(0),
f1d945a1 47 fFirstRunFile(0),
88e00a8a 48 fListHistos(NULL),
9808604e 49 fFirstRunLYZ(firstrun), //set boolean for firstrun to initial value
50 fUseSumLYZ(kTRUE) //set boolean for use sum to initial value
f1d945a1 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
9808604e 57 DefineInput(0, AliFlowEventSimple::Class());
f1d945a1 58 if (!firstrun) DefineInput(1, TList::Class()); //for second loop
59 // Output slot #0 writes into a TList container
22063257 60 DefineOutput(1, TList::Class());
9808604e 61
9d062fe3 62}
63
88e00a8a 64//________________________________________________________________________
22063257 65AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros() :
66 AliAnalysisTaskSE(),
9808604e 67 fEvent(0),
88e00a8a 68 fLyz(0),
88e00a8a 69 fFirstRunFile(0),
70 fListHistos(NULL),
71 fFirstRunLYZ(kTRUE), //set boolean for firstrun to initial value
9808604e 72 fUseSumLYZ(kTRUE) //set boolean for use sum to initial value
88e00a8a 73{
74 // Constructor
9d062fe3 75 cout<<"AliAnalysisTaskLeeYangZeros::AliAnalysisTaskLeeYangZeros()"<<endl;
88e00a8a 76
77}
78
88e00a8a 79//________________________________________________________________________
80AliAnalysisTaskLeeYangZeros::~AliAnalysisTaskLeeYangZeros()
81{
82
83 //destructor
84
85}
86
f1d945a1 87//________________________________________________________________________
22063257 88void AliAnalysisTaskLeeYangZeros::UserCreateOutputObjects()
f1d945a1 89{
90 // Called once
91 cout<<"AliAnalysisTaskLeeYangZeros::CreateOutputObjects()"<<endl;
92
9808604e 93
f1d945a1 94 //Analyser
95 fLyz = new AliFlowAnalysisWithLeeYangZeros() ;
f1d945a1 96 fLyz -> SetFirstRun(GetFirstRunLYZ()); //set first run true or false
97 fLyz -> SetUseSum(GetUseSumLYZ()); //set use sum true or false
98
f1d945a1 99 // Get data from input slot 1
100 if (GetNinputs() == 2) { //if there are two input slots
9d062fe3 101 TList* pFirstRunList = (TList*)GetInputData(1);
102 if (pFirstRunList) {
103 fLyz -> SetFirstRunList(pFirstRunList);
104 } else { cout<<"No first run List!"<<endl; exit(0); }
f1d945a1 105 }
106
9d062fe3 107 fLyz -> Init();
f1d945a1 108
88e00a8a 109 if (fLyz->GetHistList()) {
9d062fe3 110 fListHistos = fLyz->GetHistList();
a58fb92e 111 // fListHistos->Print();
88e00a8a 112 }
113 else {Printf("ERROR: Could not retrieve histogram list"); }
61e0c8c0 114
115 PostData(1,fListHistos);
88e00a8a 116
f1d945a1 117}
118
119//________________________________________________________________________
22063257 120void AliAnalysisTaskLeeYangZeros::UserExec(Option_t *)
f1d945a1 121{
122 // Main loop
123 // Called for each event
f1d945a1 124
9808604e 125 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
126 if (fEvent) {
f1d945a1 127 fLyz->Make(fEvent);
f1d945a1 128 }
9808604e 129 else {
130 cout << "Warning no input data!!!" << endl; }
f1d945a1 131
22063257 132 PostData(1,fListHistos);
9808604e 133
f1d945a1 134}
135
136//________________________________________________________________________
137void AliAnalysisTaskLeeYangZeros::Terminate(Option_t *)
138{
139 // Called once at the end of the query
48385911 140
5104aa35 141 AliFlowAnalysisWithLeeYangZeros* lyzTerm = new AliFlowAnalysisWithLeeYangZeros() ;
142 lyzTerm -> SetFirstRun(GetFirstRunLYZ()); //set first run true or false
143 lyzTerm -> SetUseSum(GetUseSumLYZ()); //set use sum true or false
9d062fe3 144
22063257 145 fListHistos = (TList*)GetOutputData(1);
48385911 146
147 if(fListHistos)
148 {
5104aa35 149 lyzTerm -> GetOutputHistograms(fListHistos);
150 lyzTerm -> Finish();
22063257 151 PostData(1,fListHistos);
48385911 152 } else
153 {
154 cout << "histogram list pointer in Lee-Yang Zeros is empty in AliAnalysisTaskLYZ::Terminate ()" << endl;
155 }
5104aa35 156
157 delete lyzTerm;
22063257 158
f1d945a1 159}