]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommonHist.cxx
added functionality to handle CDH and RCU trailer
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommonHist.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
16/*
17$Log$
18*/
19
20#include "Riostream.h" //needed as include
21#include "AliFlowCommonConstants.h" //needed as include
22#include "AliFlowCommonHist.h"
23#include "AliFlowEventSimple.h"
24#include "AliFlowTrackSimple.h"
25
26#include "TString.h"
27#include "TProfile.h"
28#include "TMath.h" //needed as include
29#include "AliFlowVector.h"
30
31class TH1F;
32class TH1D;
33
34// AliFlowCommonHist:
35//
36// Description: Class to organise common histograms for Flow Analysis
37
38// authors: N. van der Kolk (kolk@nikhef.nl) and A. Bilandzic (anteb@nikhef.nl)
39
40
41ClassImp(AliFlowCommonHist)
42
43//-----------------------------------------------------------------------
44
45 AliFlowCommonHist::AliFlowCommonHist(TString input):
46 fEvent(0),
47 fTrack(0),
48 fHistMultOrig(0),
49 fHistMultInt(0),
50 fHistMultDiff(0),
51 fHistPtInt(0),
52 fHistPtDiff(0),
53 fHistPhiInt(0),
54 fHistPhiDiff(0),
55 fHistEtaInt(0),
56 fHistEtaDiff(0),
57 fHistProMeanPtperBin(0),
58 fHistQ(0)
59 {
60 //constructor creating histograms
61 Int_t fNbinsMult = AliFlowCommonConstants::GetNbinsMult();
62 Int_t fNbinsPt = AliFlowCommonConstants::GetNbinsPt();
63 Int_t fNbinsPhi = AliFlowCommonConstants::GetNbinsPhi();
64 Int_t fNbinsEta = AliFlowCommonConstants::GetNbinsEta();
65 Int_t fNbinsQ = AliFlowCommonConstants::GetNbinsQ();
66 TString name;
67
68 Double_t fMultMin = AliFlowCommonConstants::GetMultMin();
69 Double_t fMultMax = AliFlowCommonConstants::GetMultMax();
70 Double_t fPtMin = AliFlowCommonConstants::GetPtMin();
71 Double_t fPtMax = AliFlowCommonConstants::GetPtMax();
72 Double_t fPhiMin = AliFlowCommonConstants::GetPhiMin();
73 Double_t fPhiMax = AliFlowCommonConstants::GetPhiMax();
74 Double_t fEtaMin = AliFlowCommonConstants::GetEtaMin();
75 Double_t fEtaMax = AliFlowCommonConstants::GetEtaMax();
76 Double_t fQMin = AliFlowCommonConstants::GetQMin();
77 Double_t fQMax = AliFlowCommonConstants::GetQMax();
78
79 cout<<"The settings for the common histograms are as follows:"<<endl;
80 cout<<"Multiplicity: "<<fNbinsMult<<" bins between "<<fMultMin<<" and "<<fMultMax<<endl;
81 cout<<"Pt: "<<fNbinsPt<<" bins between "<<fPtMin<<" and "<<fPtMax<<endl;
82 cout<<"Phi: "<<fNbinsPhi<<" bins between "<<fPhiMin<<" and "<<fPhiMax<<endl;
83 cout<<"Eta: "<<fNbinsEta<<" bins between "<<fEtaMin<<" and "<<fEtaMax<<endl;
84 cout<<"Q: "<<fNbinsQ<<" bins between "<<fQMin<<" and "<<fQMax<<endl;
85
86 //Multiplicity
87 name = "Control_Flow_OrigMult_";
88 name +=input;
89 fHistMultOrig = new TH1F(name.Data(), name.Data(),fNbinsMult, fMultMin, fMultMax);
90 fHistMultOrig ->SetXTitle("Original Multiplicity");
91 fHistMultOrig ->SetYTitle("Counts");
92
93 name = "Control_Flow_MultInt_";
94 name +=input;
95 fHistMultInt = new TH1F(name.Data(), name.Data(),fNbinsMult, fMultMin, fMultMax);
96 fHistMultInt ->SetXTitle("Multiplicity for integrated flow");
97 fHistMultInt ->SetYTitle("Counts");
98
99 name = "Control_Flow_MultDiff_";
100 name +=input;
101 fHistMultDiff = new TH1F(name.Data(), name.Data(),fNbinsMult, fMultMin, fMultMax);
102 fHistMultDiff ->SetXTitle("Multiplicity for differential flow");
103 fHistMultDiff ->SetYTitle("Counts");
104
105 //Pt
106 name = "Control_Flow_PtInt_";
107 name +=input;
108 fHistPtInt = new TH1F(name.Data(), name.Data(),fNbinsPt, fPtMin, fPtMax);
109 fHistPtInt ->SetXTitle("Pt (GeV/c) for integrated flow");
110 fHistPtInt ->SetYTitle("Counts");
111
112 name = "Control_Flow_PtDiff_";
113 name +=input;
114 fHistPtDiff = new TH1F(name.Data(), name.Data(),fNbinsPt, fPtMin, fPtMax);
115 //binning has to be the same as for fHistProVPt! use to get Nprime!
116 fHistPtDiff ->SetXTitle("Pt (GeV/c) for differential flow");
117 fHistPtDiff ->SetYTitle("Counts");
118
119 //Phi
120 name = "Control_Flow_PhiInt_";
121 name +=input;
122 fHistPhiInt = new TH1F(name.Data(), name.Data(),fNbinsPhi, fPhiMin, fPhiMax);
123 fHistPhiInt ->SetXTitle("Phi for integrated flow");
124 fHistPhiInt ->SetYTitle("Counts");
125
126 name = "Control_Flow_PhiDiff_";
127 name +=input;
128 fHistPhiDiff = new TH1F(name.Data(), name.Data(),fNbinsPhi, fPhiMin, fPhiMax);
129 fHistPhiDiff ->SetXTitle("Phi for differential flow");
130 fHistPhiDiff ->SetYTitle("Counts");
131
132 //Eta
133 name = "Control_Flow_EtaInt_";
134 name +=input;
135 fHistEtaInt = new TH1F(name.Data(), name.Data(),fNbinsEta, fEtaMin, fEtaMax);
136 fHistEtaInt ->SetXTitle("Eta for integrated flow");
137 fHistEtaInt ->SetYTitle("Counts");
138
139 name = "Control_Flow_EtaDiff_";
140 name +=input;
141 fHistEtaDiff = new TH1F(name.Data(), name.Data(),fNbinsEta, fEtaMin, fEtaMax);
142 fHistEtaDiff ->SetXTitle("Eta for differential flow");
143 fHistEtaDiff ->SetYTitle("Counts");
144
145 //Mean Pt per pt bin
146 name = "Control_FlowPro_MeanPtperBin_";
147 name +=input;
148 fHistProMeanPtperBin = new TProfile(name.Data(), name.Data(),fNbinsPt,fPtMin,fPtMax);
149 fHistProMeanPtperBin ->SetXTitle("Pt");
150 fHistProMeanPtperBin ->SetYTitle("<Pt>");
151
152 //Q vector
153 name = "Control_Flow_Q_";
154 name +=input;
155 fHistQ = new TH1F(name.Data(), name.Data(),fNbinsQ, fQMin, fQMax);
156 fHistQ ->SetXTitle("Qvector/Mult");
157 fHistQ ->SetYTitle("Counts");
158}
159
160
161//-----------------------------------------------------------------------
162
163AliFlowCommonHist::~AliFlowCommonHist()
164{
165 //deletes histograms
166 delete fHistMultOrig;
167 delete fHistMultInt;
168 delete fHistMultDiff;
169 delete fHistPtInt;
170 delete fHistPtDiff;
171 delete fHistPhiInt;
172 delete fHistPhiDiff;
173 delete fHistEtaInt;
174 delete fHistEtaDiff;
175 delete fHistProMeanPtperBin;
176 delete fHistQ;
177}
178
179
180//-----------------------------------------------------------------------
181
182Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* fEvent)
183{
184 //Fills the control histograms
185 if (!fEvent){
186 cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
187 return kFALSE;
188 }
189
190 Double_t fPt, fPhi, fEta;
191
192
193 //fill the histograms
194 Int_t fNumberOfTracks = fEvent->NumberOfTracks();
195 fHistMultOrig->Fill(fNumberOfTracks);
196
197 AliFlowVector fQ = fEvent->GetQ();
198 //weight by the Multiplicity
199 Double_t fQX = fQ.X()/fQ.GetMult();
200 Double_t fQY = fQ.Y()/fQ.GetMult();
201 fQ.Set(fQX,fQY);
202 fHistQ->Fill(fQ.Mod());
203
204 Int_t fMultInt = 0;
205 Int_t fMultDiff = 0;
206 for (Int_t i=0;i<fNumberOfTracks;i++) {
207 fTrack = fEvent->GetTrack(i);
208 if (fTrack ) {
209 if (fTrack->UseForIntegratedFlow()){
210 fPt = fTrack->Pt();
211 fHistPtInt->Fill(fPt);
212 fPhi = fTrack->Phi();
213 if (fPhi<0.) fPhi+=2*TMath::Pi();
214 fHistPhiInt->Fill(fPhi);
215 fEta = fTrack->Eta();
216 fHistEtaInt->Fill(fEta);
217 fMultInt++;
218 }
219 if (fTrack->UseForDifferentialFlow()){
220 fPt = fTrack->Pt();
221 fHistPtDiff->Fill(fPt);
222 fPhi = fTrack->Phi();
223 if (fPhi<0.) fPhi+=2*TMath::Pi();
224 fHistPhiDiff->Fill(fPhi);
225 fEta = fTrack->Eta();
226 fHistEtaDiff->Fill(fEta);
227 fHistProMeanPtperBin->Fill(fPt,fPt);
228 fMultDiff++;
229 }
230 } //track
231 } //loop over tracks
232
233 fHistMultInt->Fill(fMultInt);
234 fHistMultDiff->Fill(fMultDiff);
235
236 return kTRUE;
237}
238
239//-----------------------------------------------------------------------
240
241Double_t AliFlowCommonHist::GetEntriesInPtBin(Int_t fBin)
242{
243 //get entries in bin fBin from fHistPtDiff
244 Double_t fEntries = fHistPtDiff->GetBinContent(fBin);
245
246 return fEntries;
247
248}
249
250//-----------------------------------------------------------------------
251
252Double_t AliFlowCommonHist::GetMeanPt(Int_t fBin)
253{
254 //Get entry from bin fBin from fHistProMeanPtperBin
255 Double_t fMeanPt = fHistProMeanPtperBin->GetBinContent(fBin);
256
257 return fMeanPt;
258
259}