1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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"
24 #include "TMath.h" //needed as include
27 #include "AliFlowVector.h"
35 // Description: Class to organise common histograms for Flow Analysis
37 // authors: N. van der Kolk (kolk@nikhef.nl), A. Bilandzic (anteb@nikhef.nl), RS
40 ClassImp(AliFlowCommonHist)
42 //-----------------------------------------------------------------------
44 AliFlowCommonHist::AliFlowCommonHist():
48 fHistMultPOIvsRP(NULL),
63 fHistProMeanPtperBin(NULL),
66 fHistAngleQSub0(NULL),
67 fHistAngleQSub1(NULL),
69 fRefMultVsNoOfRPs(NULL),
77 AliFlowCommonHist::AliFlowCommonHist(const AliFlowCommonHist& a):
79 fHistMultRP(new TH1F(*a.fHistMultRP)),
80 fHistMultPOI(new TH1F(*a.fHistMultPOI)),
81 fHistMultPOIvsRP(new TH2F(*a.fHistMultPOIvsRP)),
82 fHistPtRP(new TH1F(*a.fHistPtRP)),
83 fHistPtPOI(new TH1F(*a.fHistPtPOI)),
84 fHistPtSub0(new TH1F(*a.fHistPtSub0)),
85 fHistPtSub1(new TH1F(*a.fHistPtSub1)),
86 fHistPhiRP(new TH1F(*a.fHistPhiRP)),
87 fHistPhiPOI(new TH1F(*a.fHistPhiPOI)),
88 fHistPhiSub0(new TH1F(*a.fHistPhiSub0)),
89 fHistPhiSub1(new TH1F(*a.fHistPhiSub1)),
90 fHistEtaRP(new TH1F(*a.fHistEtaRP)),
91 fHistEtaPOI(new TH1F(*a.fHistEtaPOI)),
92 fHistEtaSub0(new TH1F(*a.fHistEtaSub0)),
93 fHistEtaSub1(new TH1F(*a.fHistEtaSub1)),
94 fHistPhiEtaRP(new TH2F(*a.fHistPhiEtaRP)),
95 fHistPhiEtaPOI(new TH2F(*a.fHistPhiEtaPOI)),
96 fHistProMeanPtperBin(new TProfile(*a.fHistProMeanPtperBin)),
97 fHistQ(new TH1F(*a.fHistQ)),
98 fHistAngleQ(new TH1F(*a.fHistAngleQ)),
99 fHistAngleQSub0(new TH1F(*a.fHistAngleQSub0)),
100 fHistAngleQSub1(new TH1F(*a.fHistAngleQSub1)),
101 fHarmonic(new TProfile(*a.fHarmonic)),
102 fRefMultVsNoOfRPs(new TProfile(*a.fRefMultVsNoOfRPs)),
107 fHistList = new TList();
108 fHistList-> Add(fHistMultRP);
109 fHistList-> Add(fHistMultPOI);
110 fHistList-> Add(fHistMultPOIvsRP);
111 fHistList-> Add(fHistPtRP);
112 fHistList-> Add(fHistPtPOI);
113 fHistList-> Add(fHistPtSub0);
114 fHistList-> Add(fHistPtSub1);
115 fHistList-> Add(fHistPhiRP);
116 fHistList-> Add(fHistPhiPOI);
117 fHistList-> Add(fHistPhiSub0);
118 fHistList-> Add(fHistPhiSub1);
119 fHistList-> Add(fHistEtaRP);
120 fHistList-> Add(fHistEtaPOI);
121 fHistList-> Add(fHistEtaSub0);
122 fHistList-> Add(fHistEtaSub1);
123 fHistList-> Add(fHistPhiEtaRP);
124 fHistList-> Add(fHistPhiEtaPOI);
125 fHistList-> Add(fHistProMeanPtperBin);
126 fHistList-> Add(fHarmonic);
127 fHistList-> Add(fRefMultVsNoOfRPs);
128 fHistList-> Add(fHistQ);
129 fHistList-> Add(fHistAngleQ);
130 fHistList-> Add(fHistAngleQSub0);
131 fHistList-> Add(fHistAngleQSub1);
132 // TListIter next = TListIter(a.fHistList);
137 //-----------------------------------------------------------------------
139 AliFlowCommonHist::AliFlowCommonHist(const char *anInput,const char *title):
140 TNamed(anInput,title),
143 fHistMultPOIvsRP(NULL),
157 fHistPhiEtaPOI(NULL),
158 fHistProMeanPtperBin(NULL),
161 fHistAngleQSub0(NULL),
162 fHistAngleQSub1(NULL),
164 fRefMultVsNoOfRPs(NULL),
168 //constructor creating histograms
169 Int_t iNbinsMult = AliFlowCommonConstants::GetMaster()->GetNbinsMult();
170 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
171 Int_t iNbinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
172 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
173 Int_t iNbinsQ = AliFlowCommonConstants::GetMaster()->GetNbinsQ();
176 Double_t dMultMin = AliFlowCommonConstants::GetMaster()->GetMultMin();
177 Double_t dMultMax = AliFlowCommonConstants::GetMaster()->GetMultMax();
178 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
179 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
180 Double_t dPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();
181 Double_t dPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
182 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
183 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
184 Double_t dQMin = AliFlowCommonConstants::GetMaster()->GetQMin();
185 Double_t dQMax = AliFlowCommonConstants::GetMaster()->GetQMax();
187 cout<<"The settings for the common histograms are as follows:"<<endl;
188 cout<<"Multiplicity: "<<iNbinsMult<<" bins between "<<dMultMin<<" and "<<dMultMax<<endl;
189 cout<<"Pt: "<<iNbinsPt<<" bins between "<<dPtMin<<" and "<<dPtMax<<endl;
190 cout<<"Phi: "<<iNbinsPhi<<" bins between "<<dPhiMin<<" and "<<dPhiMax<<endl;
191 cout<<"Eta: "<<iNbinsEta<<" bins between "<<dEtaMin<<" and "<<dEtaMax<<endl;
192 cout<<"Q: "<<iNbinsQ<<" bins between "<<dQMin<<" and "<<dQMax<<endl;
195 sName = "Control_Flow_MultRP_";
197 fHistMultRP = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
198 fHistMultRP ->SetXTitle("Multiplicity for RP selection");
199 fHistMultRP ->SetYTitle("Counts");
201 sName = "Control_Flow_MultPOI_";
203 fHistMultPOI = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
204 fHistMultPOI ->SetXTitle("Multiplicity for POI selection");
205 fHistMultPOI ->SetYTitle("Counts");
207 sName = "Control_Flow_MultPOIvsRP_";
209 fHistMultPOIvsRP = new TH2F(sName.Data(), sName.Data(),100, dMultMin, dMultMax,100, dMultMin, dMultMax);
210 fHistMultPOIvsRP->SetXTitle("Multiplicity for RP selection");
211 fHistMultPOIvsRP->SetYTitle("Multiplicity for POI selection");
214 sName = "Control_Flow_PtRP_";
216 fHistPtRP = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
217 fHistPtRP ->SetXTitle("P_{t} (GeV/c) for RP selection");
218 fHistPtRP ->SetYTitle("Counts");
220 sName = "Control_Flow_PtPOI_";
222 fHistPtPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
223 //binning has to be the same as for fHistProVPt! use to get Nprime!
224 fHistPtPOI ->SetXTitle("P_{t} (GeV/c) for POI selection");
225 fHistPtPOI ->SetYTitle("Counts");
227 sName = "Control_Flow_PtSub0_";
229 fHistPtSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
230 fHistPtSub0 ->SetXTitle("P_{t} (GeV/c) for Subevent 0 selection");
231 fHistPtSub0 ->SetYTitle("Counts");
233 sName = "Control_Flow_PtSub1_";
235 fHistPtSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
236 fHistPtSub1 ->SetXTitle("P_{t} (GeV/c) for Subevent 1 selection");
237 fHistPtSub1 ->SetYTitle("Counts");
240 sName = "Control_Flow_PhiRP_";
242 fHistPhiRP = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
243 fHistPhiRP ->SetXTitle("#phi for RP selection");
244 fHistPhiRP ->SetYTitle("Counts");
246 sName = "Control_Flow_PhiPOI_";
248 fHistPhiPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
249 fHistPhiPOI ->SetXTitle("#phi for POI selection");
250 fHistPhiPOI ->SetYTitle("Counts");
252 sName = "Control_Flow_PhiSub0_";
254 fHistPhiSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
255 fHistPhiSub0 ->SetXTitle("#phi for Subevent 0 selection");
256 fHistPhiSub0 ->SetYTitle("Counts");
258 sName = "Control_Flow_PhiSub1_";
260 fHistPhiSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
261 fHistPhiSub1 ->SetXTitle("#phi for Subevent 1 selection");
262 fHistPhiSub1 ->SetYTitle("Counts");
265 sName = "Control_Flow_EtaRP_";
267 fHistEtaRP = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
268 fHistEtaRP ->SetXTitle("#eta for RP selection");
269 fHistEtaRP ->SetYTitle("Counts");
271 sName = "Control_Flow_EtaPOI_";
273 fHistEtaPOI = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
274 fHistEtaPOI ->SetXTitle("#eta for POI selection");
275 fHistEtaPOI ->SetYTitle("Counts");
277 sName = "Control_Flow_EtaSub0_";
279 fHistEtaSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
280 fHistEtaSub0 ->SetXTitle("#eta for Subevent 0 selection");
281 fHistEtaSub0 ->SetYTitle("Counts");
283 sName = "Control_Flow_EtaSub1_";
285 fHistEtaSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
286 fHistEtaSub1 ->SetXTitle("#eta for Subevent 1 selection");
287 fHistEtaSub1 ->SetYTitle("Counts");
290 sName = "Control_Flow_PhiEtaRP_";
292 fHistPhiEtaRP = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
293 fHistPhiEtaRP ->SetXTitle("#eta");
294 fHistPhiEtaRP ->SetYTitle("#phi");
296 sName = "Control_Flow_PhiEtaPOI_";
298 fHistPhiEtaPOI = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
299 fHistPhiEtaPOI ->SetXTitle("#eta");
300 fHistPhiEtaPOI ->SetYTitle("#phi");
303 sName = "Control_FlowPro_MeanPtperBin_";
305 fHistProMeanPtperBin = new TProfile(sName.Data(), sName.Data(),iNbinsPt,dPtMin,dPtMax);
306 fHistProMeanPtperBin ->SetXTitle("P_{t} (GeV/c) ");
307 fHistProMeanPtperBin ->SetYTitle("<P_{t}> (GeV/c) ");
310 sName = "Control_Flow_Q_";
312 fHistQ = new TH1F(sName.Data(), sName.Data(),iNbinsQ, dQMin, dQMax);
313 fHistQ ->SetXTitle("Q_{vector}/Mult");
314 fHistQ ->SetYTitle("Counts");
317 sName = "Control_Flow_AngleQ_";
319 fHistAngleQ = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
320 fHistAngleQ ->SetXTitle("Angle of Q_{vector}");
321 fHistAngleQ ->SetYTitle("Counts");
323 sName = "Control_Flow_AngleQSub0_";
325 fHistAngleQSub0 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
326 fHistAngleQSub0 ->SetXTitle("Angle of Q_{vector} for Subevent 0");
327 fHistAngleQSub0 ->SetYTitle("Counts");
329 sName = "Control_Flow_AngleQSub1_";
331 fHistAngleQSub1 = new TH1F(sName.Data(), sName.Data(),72, 0., TMath::Pi());
332 fHistAngleQSub1 ->SetXTitle("Angle of Q_{vector} for Subevent 1");
333 fHistAngleQSub1 ->SetYTitle("Counts");
336 sName = "Control_Flow_Harmonic_";
338 fHarmonic = new TProfile(sName.Data(),sName.Data(),1,0,1);
339 fHarmonic ->SetYTitle("harmonic");
341 //<reference multiplicity> versus # of RPs
342 sName = "Reference_Multiplicity_Vs_Number_Of_RPs_";
344 fRefMultVsNoOfRPs = new TProfile(sName.Data(),sName.Data(),iNbinsMult, dMultMin, dMultMax);
345 fRefMultVsNoOfRPs->SetYTitle("<reference multiplicity>");
346 fRefMultVsNoOfRPs->SetXTitle("# of RPs");
348 //list of histograms if added here also add in copy constructor
349 fHistList = new TList();
350 fHistList-> Add(fHistMultRP);
351 fHistList-> Add(fHistMultPOI);
352 fHistList-> Add(fHistMultPOIvsRP);
353 fHistList-> Add(fHistPtRP);
354 fHistList-> Add(fHistPtPOI);
355 fHistList-> Add(fHistPtSub0);
356 fHistList-> Add(fHistPtSub1);
357 fHistList-> Add(fHistPhiRP);
358 fHistList-> Add(fHistPhiPOI);
359 fHistList-> Add(fHistPhiSub0);
360 fHistList-> Add(fHistPhiSub1);
361 fHistList-> Add(fHistEtaRP);
362 fHistList-> Add(fHistEtaPOI);
363 fHistList-> Add(fHistEtaSub0);
364 fHistList-> Add(fHistEtaSub1);
365 fHistList-> Add(fHistPhiEtaRP);
366 fHistList-> Add(fHistPhiEtaPOI);
367 fHistList-> Add(fHistProMeanPtperBin);
368 fHistList-> Add(fHarmonic);
369 fHistList-> Add(fRefMultVsNoOfRPs);
370 fHistList-> Add(fHistQ);
371 fHistList-> Add(fHistAngleQ);
372 fHistList-> Add(fHistAngleQSub0);
373 fHistList-> Add(fHistAngleQSub1);
378 //-----------------------------------------------------------------------
380 AliFlowCommonHist::~AliFlowCommonHist()
385 delete fHistMultPOIvsRP;
398 delete fHistPhiEtaRP;
399 delete fHistPhiEtaPOI;
400 delete fHistProMeanPtperBin;
403 delete fHistAngleQSub0;
404 delete fHistAngleQSub1;
406 delete fRefMultVsNoOfRPs;
411 //-----------------------------------------------------------------------
413 Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent)
415 //Fills the control histograms
417 cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
421 Double_t dPt, dPhi, dEta, dWeight;
423 //fill the histograms
424 AliFlowVector vQ = anEvent->GetQ();
425 //weight by the Multiplicity
428 if (vQ.GetMult()!=0) {
429 dQX = vQ.X()/vQ.GetMult();
430 dQY = vQ.Y()/vQ.GetMult();
433 fHistQ->Fill(vQ.Mod());
434 fHistAngleQ->Fill(vQ.Phi()/2);
436 AliFlowVector* vQSub = new AliFlowVector[2];
437 anEvent->Get2Qsub(vQSub);
438 AliFlowVector vQa = vQSub[0];
439 AliFlowVector vQb = vQSub[1];
440 fHistAngleQSub0->Fill(vQa.Phi()/2);
441 fHistAngleQSub1->Fill(vQb.Phi()/2);
443 Double_t dMultRP = 0.;
444 Double_t dMultPOI = 0.;
446 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
447 AliFlowTrackSimple* pTrack = NULL;
449 for (Int_t i=0;i<iNumberOfTracks;i++) {
450 pTrack = anEvent->GetTrack(i);
452 dWeight = pTrack->Weight();
453 if (pTrack->InRPSelection()){
456 fHistPtRP->Fill(dPt,dWeight);
458 dPhi = pTrack->Phi();
459 if (dPhi<0.) dPhi+=2*TMath::Pi();
460 fHistPhiRP->Fill(dPhi,dWeight);
462 dEta = pTrack->Eta();
463 fHistEtaRP->Fill(dEta,dWeight);
465 fHistPhiEtaRP->Fill(dEta,dPhi,dWeight);
468 if (pTrack->InSubevent(0)){
469 //Fill distributions for the subevent
470 fHistPtSub0 -> Fill(dPt,dWeight);
471 fHistPhiSub0 -> Fill(dPhi,dWeight);
472 fHistEtaSub0 -> Fill(dEta,dWeight);
474 else if (pTrack->InSubevent(1)){
475 //Fill distributions for the subevent
476 fHistPtSub1 -> Fill(dPt,dWeight);
477 fHistPhiSub1 -> Fill(dPhi,dWeight);
478 fHistEtaSub1 -> Fill(dEta,dWeight);
481 if (pTrack->InPOISelection()){
484 fHistPtPOI->Fill(dPt,dWeight);
486 dPhi = pTrack->Phi();
487 if (dPhi<0.) dPhi+=2*TMath::Pi();
488 fHistPhiPOI->Fill(dPhi,dWeight);
490 dEta = pTrack->Eta();
491 fHistEtaPOI->Fill(dEta,dWeight);
493 fHistPhiEtaPOI->Fill(dEta,dPhi,dWeight);
495 fHistProMeanPtperBin->Fill(dPt,dPt,dWeight);
502 fHistMultRP->Fill(dMultRP);
503 fHistMultPOI->Fill(dMultPOI);
504 fHistMultPOIvsRP->Fill(dMultRP,dMultPOI);
506 //<reference multiplicity> versus # of RPs:
507 fRefMultVsNoOfRPs->Fill(dMultRP+0.5,anEvent->GetReferenceMultiplicity(),1.);
512 //-----------------------------------------------------------------------
514 Double_t AliFlowCommonHist::GetEntriesInPtBinRP(Int_t aBin)
516 //get entries in bin aBin from fHistPtRP
517 Double_t dEntries = fHistPtRP->GetBinContent(aBin);
523 //-----------------------------------------------------------------------
525 Double_t AliFlowCommonHist::GetEntriesInPtBinPOI(Int_t aBin)
527 //get entries in bin aBin from fHistPtPOI
528 Double_t dEntries = fHistPtPOI->GetBinContent(aBin);
534 //-----------------------------------------------------------------------
536 Double_t AliFlowCommonHist::GetEntriesInEtaBinRP(Int_t aBin)
538 //get entries in bin aBin from fHistPtRP
539 Double_t dEntries = fHistEtaRP->GetBinContent(aBin);
545 //-----------------------------------------------------------------------
547 Double_t AliFlowCommonHist::GetEntriesInEtaBinPOI(Int_t aBin)
549 //get entries in bin aBin from fHistPtPOI
550 Double_t dEntries = fHistEtaPOI->GetBinContent(aBin);
556 //-----------------------------------------------------------------------
558 Double_t AliFlowCommonHist::GetMeanPt(Int_t aBin)
560 //Get entry from bin aBin from fHistProMeanPtperBin
561 Double_t dMeanPt = fHistProMeanPtperBin->GetBinContent(aBin);
568 //-----------------------------------------------------------------------
569 Double_t AliFlowCommonHist::Merge(TCollection *aList)
572 //cout<<"entering merge function"<<endl;
573 if (!aList) return 0;
574 if (aList->IsEmpty()) return 0; //no merging is needed
577 TIter next(aList); // list is supposed to contain only objects of the same type as this
578 AliFlowCommonHist *toMerge;
579 // make a temporary list
580 TList *pTemp = new TList();
581 while ((toMerge=(AliFlowCommonHist*)next())) {
582 pTemp->Add(toMerge->GetHistList());
585 // Now call merge for fHistList providing temp list
586 fHistList->Merge(pTemp);
590 //cout<<"Merged"<<endl;
591 return (double)iCount;
595 void AliFlowCommonHist::Print(Option_t *option) const
597 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
598 // ===============================================
599 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
600 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
603 fHistList->Print(option);
607 printf( "Empty histogram list \n");
611 //-----------------------------------------------------------------------
612 void AliFlowCommonHist::Browse(TBrowser *b)
616 if (fHistList) b->Add(fHistList,"AliFlowCommonHistList");