]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommonHistResults.cxx
Merge methods
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommonHistResults.cxx
CommitLineData
f1d945a1 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
f1d945a1 16#include "Riostream.h" //needed as include
17#include "AliFlowCommonConstants.h" //needed as include
18#include "AliFlowCommonHistResults.h"
19
20#include "TString.h"
21#include "TH1D.h" //needed as include
22#include "TMath.h" //needed as include
8de6876d 23#include "TList.h"
f1d945a1 24
25class TH1F;
26class AliFlowVector;
27class AliFlowCommonHist;
28
29// AliFlowCommonHistResults:
30// Class to organize the common histograms for Flow Analysis
31// Holds v2(pt), integrated v2 and chi (resolution)
32//
6300ec0a 33// authors: N.K A.B. R.S
f1d945a1 34
35ClassImp(AliFlowCommonHistResults)
36
37//-----------------------------------------------------------------------
38
8de6876d 39 AliFlowCommonHistResults::AliFlowCommonHistResults():
40 TObject(),
41 fHistIntFlow(0),
42 fHistDiffFlow(0),
43 fHistChi(0),
44 fHistList(NULL)
45{
46 //default constructor
47}
48
49//-----------------------------------------------------------------------
50
51 AliFlowCommonHistResults::AliFlowCommonHistResults(TString input):
52 TObject(),
53 fHistIntFlow(0),
54 fHistDiffFlow(0),
55 fHistChi(0),
56 fHistList(NULL)
57{
f1d945a1 58 //constructor creating histograms
0b4cb25b 59 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
f1d945a1 60 TString name;
61
0b4cb25b 62 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
63 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
f1d945a1 64
65 //integrated flow
66 name = "Flow_Integrated_";
67 name +=input;
68 fHistIntFlow = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
69 fHistIntFlow ->SetXTitle("");
70 fHistIntFlow ->SetYTitle("Integrated Flow value (%)");
71
72 //differential flow
73 name = "Flow_Differential_Pt_";
74 name +=input;
0b4cb25b 75 fHistDiffFlow = new TH1D(name.Data(), name.Data(),iNbinsPt,dPtMin,dPtMax);
f1d945a1 76 fHistDiffFlow ->SetXTitle("Pt");
77 fHistDiffFlow ->SetYTitle("v (%)");
78
79 //Chi (needed for rebinning later on)
80 name = "Flow_Chi_";
81 name +=input;
82 fHistChi = new TH1D(name.Data(), name.Data(),1,0.5,1.5);
83 fHistChi ->SetXTitle("");
84 fHistChi ->SetYTitle("Chi");
8de6876d 85
86 //list of histograms
87 fHistList = new TList();
88 fHistList-> Add(fHistIntFlow);
89 fHistList-> Add(fHistDiffFlow);
90 fHistList-> Add(fHistChi);
91
f1d945a1 92 }
93
94//-----------------------------------------------------------------------
95
96AliFlowCommonHistResults::~AliFlowCommonHistResults()
97{
98 //deletes histograms
99 delete fHistIntFlow;
100 delete fHistDiffFlow;
101 delete fHistChi;
8de6876d 102 delete fHistList;
f1d945a1 103}
104
105//-----------------------------------------------------------------------
106
0b4cb25b 107Bool_t AliFlowCommonHistResults::FillIntegratedFlow(Double_t aV, Double_t anError)
f1d945a1 108{
109 //Fill fHistIntFlow
0b4cb25b 110 fHistIntFlow -> SetBinContent(1,aV);
111 fHistIntFlow -> SetBinError(1,anError);
f1d945a1 112
113 return kTRUE;
114}
115
116//-----------------------------------------------------------------------
117
0b4cb25b 118Bool_t AliFlowCommonHistResults::FillDifferentialFlow(Int_t aBin, Double_t av, Double_t anError)
f1d945a1 119{
120 //Fill fHistDiffFlow
0b4cb25b 121 fHistDiffFlow ->SetBinContent(aBin,av);
122 fHistDiffFlow ->SetBinError(aBin,anError);
f1d945a1 123
124 return kTRUE;
125}
126
127//-----------------------------------------------------------------------
128
0b4cb25b 129Bool_t AliFlowCommonHistResults::FillChi(Double_t aChi)
f1d945a1 130{
131 //Fill fHistChi
0b4cb25b 132 fHistChi -> SetBinContent(1,aChi);
f1d945a1 133
134 return kTRUE;
135}
136
0683b7d5 137//-----------------------------------------------------------------------
8de6876d 138 Double_t AliFlowCommonHistResults::Merge(TCollection *aList)
139{
140 //merge fuction
141 cout<<"entering merge function"<<endl;
142 if (!aList) return 0;
143 if (aList->IsEmpty()) return 0; //no merging is needed
144
145 Int_t iCount = 0;
146 TIter next(aList); // list is supposed to contain only objects of the same type as this
147 AliFlowCommonHistResults *toMerge;
148 // make a temporary list
149 TList *pTemp = new TList();
150 while ((toMerge=(AliFlowCommonHistResults*)next())) {
151 pTemp->Add(toMerge->GetHistList());
152 iCount++;
153 }
154 // Now call merge for fHistList providing temp list
155 fHistList->Merge(pTemp);
156 // Cleanup
157 delete pTemp;
158
159 cout<<"Merged"<<endl;
160 return (double)iCount;
161
162}
0683b7d5 163
164