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