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