]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommonHist.cxx
Protection for a sqrt in the DA for SDD PULSER (F. Prino)
[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
f1d945a1 16#include "Riostream.h" //needed as include
17#include "AliFlowCommonConstants.h" //needed as include
18#include "AliFlowCommonHist.h"
19#include "AliFlowEventSimple.h"
20#include "AliFlowTrackSimple.h"
21
22#include "TString.h"
23#include "TProfile.h"
24#include "TMath.h" //needed as include
e35ddff0 25#include "TList.h"
f1d945a1 26#include "AliFlowVector.h"
27
28class TH1F;
29class TH1D;
30
31// AliFlowCommonHist:
32//
33// Description: Class to organise common histograms for Flow Analysis
34
35// authors: N. van der Kolk (kolk@nikhef.nl) and A. Bilandzic (anteb@nikhef.nl)
36
37
38ClassImp(AliFlowCommonHist)
39
40//-----------------------------------------------------------------------
41
e35ddff0 42 AliFlowCommonHist::AliFlowCommonHist():TObject(),
7ffdc193 43 fHistMultOrig(NULL),
44 fHistMultInt(NULL),
45 fHistMultDiff(NULL),
46 fHistPtInt(NULL),
47 fHistPtDiff(NULL),
48 fHistPhiInt(NULL),
49 fHistPhiDiff(NULL),
50 fHistEtaInt(NULL),
51 fHistEtaDiff(NULL),
52 fHistProMeanPtperBin(NULL),
e35ddff0 53 fHistQ(NULL),
54 fHistList(NULL)
f1d945a1 55 {
e35ddff0 56
57 //default constructor
58
59 }
60
61//-----------------------------------------------------------------------
62
63 AliFlowCommonHist::AliFlowCommonHist(TString anInput):TObject(),
64 fHistMultOrig(NULL),
65 fHistMultInt(NULL),
66 fHistMultDiff(NULL),
67 fHistPtInt(NULL),
68 fHistPtDiff(NULL),
69 fHistPhiInt(NULL),
70 fHistPhiDiff(NULL),
71 fHistEtaInt(NULL),
72 fHistEtaDiff(NULL),
73 fHistProMeanPtperBin(NULL),
74 fHistQ(NULL),
75 fHistList(NULL)
76 {
77
f1d945a1 78 //constructor creating histograms
e35ddff0 79 Int_t iNbinsMult = AliFlowCommonConstants::GetNbinsMult();
80 Int_t iNbinsPt = AliFlowCommonConstants::GetNbinsPt();
81 Int_t iNbinsPhi = AliFlowCommonConstants::GetNbinsPhi();
82 Int_t iNbinsEta = AliFlowCommonConstants::GetNbinsEta();
83 Int_t iNbinsQ = AliFlowCommonConstants::GetNbinsQ();
84 TString sName;
85
86 Double_t dMultMin = AliFlowCommonConstants::GetMultMin();
87 Double_t dMultMax = AliFlowCommonConstants::GetMultMax();
88 Double_t dPtMin = AliFlowCommonConstants::GetPtMin();
89 Double_t dPtMax = AliFlowCommonConstants::GetPtMax();
90 Double_t dPhiMin = AliFlowCommonConstants::GetPhiMin();
91 Double_t dPhiMax = AliFlowCommonConstants::GetPhiMax();
92 Double_t dEtaMin = AliFlowCommonConstants::GetEtaMin();
93 Double_t dEtaMax = AliFlowCommonConstants::GetEtaMax();
94 Double_t dQMin = AliFlowCommonConstants::GetQMin();
95 Double_t dQMax = AliFlowCommonConstants::GetQMax();
f1d945a1 96
97 cout<<"The settings for the common histograms are as follows:"<<endl;
e35ddff0 98 cout<<"Multiplicity: "<<iNbinsMult<<" bins between "<<dMultMin<<" and "<<dMultMax<<endl;
99 cout<<"Pt: "<<iNbinsPt<<" bins between "<<dPtMin<<" and "<<dPtMax<<endl;
100 cout<<"Phi: "<<iNbinsPhi<<" bins between "<<dPhiMin<<" and "<<dPhiMax<<endl;
101 cout<<"Eta: "<<iNbinsEta<<" bins between "<<dEtaMin<<" and "<<dEtaMax<<endl;
102 cout<<"Q: "<<iNbinsQ<<" bins between "<<dQMin<<" and "<<dQMax<<endl;
f1d945a1 103
104 //Multiplicity
e35ddff0 105 sName = "Control_Flow_OrigMult_";
106 sName +=anInput;
107 fHistMultOrig = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
f1d945a1 108 fHistMultOrig ->SetXTitle("Original Multiplicity");
109 fHistMultOrig ->SetYTitle("Counts");
110
e35ddff0 111 sName = "Control_Flow_MultInt_";
112 sName +=anInput;
113 fHistMultInt = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
f1d945a1 114 fHistMultInt ->SetXTitle("Multiplicity for integrated flow");
115 fHistMultInt ->SetYTitle("Counts");
116
e35ddff0 117 sName = "Control_Flow_MultDiff_";
118 sName +=anInput;
119 fHistMultDiff = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
f1d945a1 120 fHistMultDiff ->SetXTitle("Multiplicity for differential flow");
121 fHistMultDiff ->SetYTitle("Counts");
122
123 //Pt
e35ddff0 124 sName = "Control_Flow_PtInt_";
125 sName +=anInput;
126 fHistPtInt = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
f1d945a1 127 fHistPtInt ->SetXTitle("Pt (GeV/c) for integrated flow");
128 fHistPtInt ->SetYTitle("Counts");
129
e35ddff0 130 sName = "Control_Flow_PtDiff_";
131 sName +=anInput;
132 fHistPtDiff = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
f1d945a1 133 //binning has to be the same as for fHistProVPt! use to get Nprime!
134 fHistPtDiff ->SetXTitle("Pt (GeV/c) for differential flow");
135 fHistPtDiff ->SetYTitle("Counts");
136
137 //Phi
e35ddff0 138 sName = "Control_Flow_PhiInt_";
139 sName +=anInput;
140 fHistPhiInt = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
f1d945a1 141 fHistPhiInt ->SetXTitle("Phi for integrated flow");
142 fHistPhiInt ->SetYTitle("Counts");
143
e35ddff0 144 sName = "Control_Flow_PhiDiff_";
145 sName +=anInput;
146 fHistPhiDiff = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
f1d945a1 147 fHistPhiDiff ->SetXTitle("Phi for differential flow");
148 fHistPhiDiff ->SetYTitle("Counts");
149
150 //Eta
e35ddff0 151 sName = "Control_Flow_EtaInt_";
152 sName +=anInput;
153 fHistEtaInt = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
f1d945a1 154 fHistEtaInt ->SetXTitle("Eta for integrated flow");
155 fHistEtaInt ->SetYTitle("Counts");
156
e35ddff0 157 sName = "Control_Flow_EtaDiff_";
158 sName +=anInput;
159 fHistEtaDiff = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
f1d945a1 160 fHistEtaDiff ->SetXTitle("Eta for differential flow");
161 fHistEtaDiff ->SetYTitle("Counts");
162
163 //Mean Pt per pt bin
e35ddff0 164 sName = "Control_FlowPro_MeanPtperBin_";
165 sName +=anInput;
166 fHistProMeanPtperBin = new TProfile(sName.Data(), sName.Data(),iNbinsPt,dPtMin,dPtMax);
f1d945a1 167 fHistProMeanPtperBin ->SetXTitle("Pt");
168 fHistProMeanPtperBin ->SetYTitle("<Pt>");
169
170 //Q vector
e35ddff0 171 sName = "Control_Flow_Q_";
172 sName +=anInput;
173 fHistQ = new TH1F(sName.Data(), sName.Data(),iNbinsQ, dQMin, dQMax);
f1d945a1 174 fHistQ ->SetXTitle("Qvector/Mult");
175 fHistQ ->SetYTitle("Counts");
e35ddff0 176
177 //list of histograms
178 fHistList = new TList();
179 fHistList-> Add(fHistMultOrig);
180 fHistList-> Add(fHistMultInt);
181 fHistList-> Add(fHistMultDiff);
182 fHistList-> Add(fHistPtInt);
183 fHistList-> Add(fHistPtDiff);
184 fHistList-> Add(fHistPhiInt);
185 fHistList-> Add(fHistPhiDiff);
186 fHistList-> Add(fHistEtaInt);
187 fHistList-> Add(fHistEtaDiff);
188 fHistList-> Add(fHistProMeanPtperBin);
189 fHistList-> Add(fHistQ);
190
191
192
f1d945a1 193}
194
195
196//-----------------------------------------------------------------------
197
198AliFlowCommonHist::~AliFlowCommonHist()
199{
200 //deletes histograms
201 delete fHistMultOrig;
202 delete fHistMultInt;
203 delete fHistMultDiff;
204 delete fHistPtInt;
205 delete fHistPtDiff;
206 delete fHistPhiInt;
207 delete fHistPhiDiff;
208 delete fHistEtaInt;
209 delete fHistEtaDiff;
210 delete fHistProMeanPtperBin;
211 delete fHistQ;
e35ddff0 212 delete fHistList;
f1d945a1 213}
214
215
216//-----------------------------------------------------------------------
217
e35ddff0 218Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent)
f1d945a1 219{
220 //Fills the control histograms
e35ddff0 221 if (!anEvent){
f1d945a1 222 cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
223 return kFALSE;
224 }
225
e35ddff0 226 Double_t dPt, dPhi, dEta;
f1d945a1 227
228
229 //fill the histograms
e35ddff0 230 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
231 fHistMultOrig->Fill(iNumberOfTracks);
f1d945a1 232
e35ddff0 233 AliFlowVector vQ = anEvent->GetQ();
f1d945a1 234 //weight by the Multiplicity
e35ddff0 235 Double_t dQX = vQ.X()/vQ.GetMult();
236 Double_t dQY = vQ.Y()/vQ.GetMult();
237 vQ.Set(dQX,dQY);
238 fHistQ->Fill(vQ.Mod());
f1d945a1 239
e35ddff0 240 Int_t iMultInt = 0;
241 Int_t iMultDiff = 0;
7ffdc193 242
e35ddff0 243 AliFlowTrackSimple* pTrack = NULL;
244
245 for (Int_t i=0;i<iNumberOfTracks;i++) {
246 pTrack = anEvent->GetTrack(i);
247 if (pTrack ) {
248 if (pTrack->UseForIntegratedFlow()){
249 dPt = pTrack->Pt();
250 fHistPtInt->Fill(dPt);
251 dPhi = pTrack->Phi();
252 if (dPhi<0.) dPhi+=2*TMath::Pi();
253 fHistPhiInt->Fill(dPhi);
254 dEta = pTrack->Eta();
255 fHistEtaInt->Fill(dEta);
256 iMultInt++;
f1d945a1 257 }
e35ddff0 258 if (pTrack->UseForDifferentialFlow()){
259 dPt = pTrack->Pt();
260 fHistPtDiff->Fill(dPt);
261 dPhi = pTrack->Phi();
262 if (dPhi<0.) dPhi+=2*TMath::Pi();
263 fHistPhiDiff->Fill(dPhi);
264 dEta = pTrack->Eta();
265 fHistEtaDiff->Fill(dEta);
266 fHistProMeanPtperBin->Fill(dPt,dPt);
267 iMultDiff++;
f1d945a1 268 }
269 } //track
270 } //loop over tracks
271
e35ddff0 272 fHistMultInt->Fill(iMultInt);
273 fHistMultDiff->Fill(iMultDiff);
f1d945a1 274
275 return kTRUE;
276}
277
278//-----------------------------------------------------------------------
279
e35ddff0 280Double_t AliFlowCommonHist::GetEntriesInPtBin(Int_t aBin)
f1d945a1 281{
e35ddff0 282 //get entries in bin aBin from fHistPtDiff
283 Double_t dEntries = fHistPtDiff->GetBinContent(aBin);
f1d945a1 284
e35ddff0 285 return dEntries;
f1d945a1 286
287}
288
289//-----------------------------------------------------------------------
290
e35ddff0 291Double_t AliFlowCommonHist::GetMeanPt(Int_t aBin)
f1d945a1 292{
e35ddff0 293 //Get entry from bin aBin from fHistProMeanPtperBin
294 Double_t dMeanPt = fHistProMeanPtperBin->GetBinContent(aBin);
f1d945a1 295
e35ddff0 296 return dMeanPt;
f1d945a1 297
0683b7d5 298}
299
300
e35ddff0 301//-----------------------------------------------------------------------
302 Double_t AliFlowCommonHist::Merge(TCollection *aList)
303{
304 //merge fuction
305 cout<<"entering merge function"<<endl;
306 if (!aList) return 0;
307 if (aList->IsEmpty()) return 0; //no merging is needed
308
309 Int_t iCount = 0;
310 TIter next(aList); // list is supposed to contain only objects of the same type as this
311 AliFlowCommonHist *toMerge;
312 // make a temporary list
313 TList *pTemp = new TList();
314 while ((toMerge=(AliFlowCommonHist*)next())) {
315 pTemp->Add(toMerge->GetHistList());
316 iCount++;
317 }
318 // Now call merge for fHistList providing temp list
319 fHistList->Merge(pTemp);
320 // Cleanup
321 delete pTemp;
322
323 cout<<"Merged"<<endl;
324 return (double)iCount;
325
326}
327
9825d4a9 328void AliFlowCommonHist::Print(Option_t *option) const
329{
330 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
331 // ===============================================
332 //
333 // If option "base" is given, number of bins and ranges are also printed
334 // If option "range" is given, bin contents and errors are also printed
335 // for all bins in the current range (default 1-->nbins)
336 // If option "all" is given, bin contents and errors are also printed
337 // for all bins including under and overflows.
338 //
339 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
340 printf( "Class.Print Name = AliFlowCommonHist, Histogram list:");
341
342 fHistList->Print(option);
343
344}
345
346
347
e35ddff0 348
349
350