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