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():
63 fHistProMeanPtperBin(NULL),
66 fRefMultVsNoOfRPs(NULL),
74 AliFlowCommonHist::AliFlowCommonHist(const AliFlowCommonHist& a):
76 fHistMultOrig(new TH1F(*a.fHistMultOrig)),
77 fHistMultRP(new TH1F(*a.fHistMultRP)),
78 fHistMultPOI(new TH1F(*a.fHistMultPOI)),
79 fHistPtRP(new TH1F(*a.fHistPtRP)),
80 fHistPtPOI(new TH1F(*a.fHistPtPOI)),
81 fHistPtSub0(new TH1F(*a.fHistPtSub0)),
82 fHistPtSub1(new TH1F(*a.fHistPtSub1)),
83 fHistPhiRP(new TH1F(*a.fHistPhiRP)),
84 fHistPhiPOI(new TH1F(*a.fHistPhiPOI)),
85 fHistPhiSub0(new TH1F(*a.fHistPhiSub0)),
86 fHistPhiSub1(new TH1F(*a.fHistPhiSub1)),
87 fHistEtaRP(new TH1F(*a.fHistEtaRP)),
88 fHistEtaPOI(new TH1F(*a.fHistEtaPOI)),
89 fHistEtaSub0(new TH1F(*a.fHistEtaSub0)),
90 fHistEtaSub1(new TH1F(*a.fHistEtaSub1)),
91 fHistPhiEtaRP(new TH2F(*a.fHistPhiEtaRP)),
92 fHistPhiEtaPOI(new TH2F(*a.fHistPhiEtaPOI)),
93 fHistProMeanPtperBin(new TProfile(*a.fHistProMeanPtperBin)),
94 fHistQ(new TH1F(*a.fHistQ)),
95 fHarmonic(new TProfile(*a.fHarmonic)),
96 fRefMultVsNoOfRPs(new TProfile(*a.fRefMultVsNoOfRPs)),
101 fHistList = new TList();
102 fHistList-> Add(fHistMultOrig);
103 fHistList-> Add(fHistMultRP);
104 fHistList-> Add(fHistMultPOI);
105 fHistList-> Add(fHistPtRP);
106 fHistList-> Add(fHistPtPOI);
107 fHistList-> Add(fHistPtSub0);
108 fHistList-> Add(fHistPtSub1);
109 fHistList-> Add(fHistPhiRP);
110 fHistList-> Add(fHistPhiPOI);
111 fHistList-> Add(fHistPhiSub0);
112 fHistList-> Add(fHistPhiSub1);
113 fHistList-> Add(fHistEtaRP);
114 fHistList-> Add(fHistEtaPOI);
115 fHistList-> Add(fHistEtaSub0);
116 fHistList-> Add(fHistEtaSub1);
117 fHistList-> Add(fHistPhiEtaRP);
118 fHistList-> Add(fHistPhiEtaPOI);
119 fHistList-> Add(fHistProMeanPtperBin);
120 fHistList-> Add(fHarmonic);
121 fHistList-> Add(fRefMultVsNoOfRPs);
122 fHistList-> Add(fHistQ);
123 // TListIter next = TListIter(a.fHistList);
127 // AliFlowCommonHist& AliFlowCommonHist::operator=(const AliFlowCommonHist& a)
129 // *fHistMultOrig = *a.fHistMultOrig;
130 // *fHistMultInt = *a.fHistMultInt;
131 // *fHistMultDiff = *a.fHistMultDiff;
132 // *fHistPtInt = *a.fHistPtInt;
133 // *fHistPtDiff = *a.fHistPtDiff;
134 // *fHistPhiInt = *a.fHistPhiInt;
135 // *fHistPhiDiff = *a.fHistPhiDiff;
136 // *fHistEtaInt = *a.fHistEtaInt;
137 // *fHistEtaDiff = *a.fHistEtaDiff;
138 // *fHistProMeanPtperBin = *a.fHistProMeanPtperBin;
139 // *fHistQ = *a.fHistQ;
140 // // *fHistList = *a.fHistList;
146 //-----------------------------------------------------------------------
148 AliFlowCommonHist::AliFlowCommonHist(const char *anInput,const char *title):
149 TNamed(anInput,title),
166 fHistPhiEtaPOI(NULL),
167 fHistProMeanPtperBin(NULL),
170 fRefMultVsNoOfRPs(NULL),
174 //constructor creating histograms
175 Int_t iNbinsMult = AliFlowCommonConstants::GetMaster()->GetNbinsMult();
176 Int_t iNbinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();
177 Int_t iNbinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();
178 Int_t iNbinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();
179 Int_t iNbinsQ = AliFlowCommonConstants::GetMaster()->GetNbinsQ();
182 Double_t dMultMin = AliFlowCommonConstants::GetMaster()->GetMultMin();
183 Double_t dMultMax = AliFlowCommonConstants::GetMaster()->GetMultMax();
184 Double_t dPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();
185 Double_t dPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();
186 Double_t dPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();
187 Double_t dPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();
188 Double_t dEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();
189 Double_t dEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();
190 Double_t dQMin = AliFlowCommonConstants::GetMaster()->GetQMin();
191 Double_t dQMax = AliFlowCommonConstants::GetMaster()->GetQMax();
193 cout<<"The settings for the common histograms are as follows:"<<endl;
194 cout<<"Multiplicity: "<<iNbinsMult<<" bins between "<<dMultMin<<" and "<<dMultMax<<endl;
195 cout<<"Pt: "<<iNbinsPt<<" bins between "<<dPtMin<<" and "<<dPtMax<<endl;
196 cout<<"Phi: "<<iNbinsPhi<<" bins between "<<dPhiMin<<" and "<<dPhiMax<<endl;
197 cout<<"Eta: "<<iNbinsEta<<" bins between "<<dEtaMin<<" and "<<dEtaMax<<endl;
198 cout<<"Q: "<<iNbinsQ<<" bins between "<<dQMin<<" and "<<dQMax<<endl;
201 sName = "Control_Flow_OrigMult_";
203 fHistMultOrig = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
204 fHistMultOrig ->SetXTitle("Original Multiplicity");
205 fHistMultOrig ->SetYTitle("Counts");
207 sName = "Control_Flow_MultRP_";
209 fHistMultRP = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
210 fHistMultRP ->SetXTitle("Multiplicity for RP selection");
211 fHistMultRP ->SetYTitle("Counts");
213 sName = "Control_Flow_MultPOI_";
215 fHistMultPOI = new TH1F(sName.Data(), sName.Data(),iNbinsMult, dMultMin, dMultMax);
216 fHistMultPOI ->SetXTitle("Multiplicity for POI selection");
217 fHistMultPOI ->SetYTitle("Counts");
220 sName = "Control_Flow_PtRP_";
222 fHistPtRP = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
223 fHistPtRP ->SetXTitle("P_{t} (GeV/c) for RP selection");
224 fHistPtRP ->SetYTitle("Counts");
226 sName = "Control_Flow_PtPOI_";
228 fHistPtPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
229 //binning has to be the same as for fHistProVPt! use to get Nprime!
230 fHistPtPOI ->SetXTitle("P_{t} (GeV/c) for POI selection");
231 fHistPtPOI ->SetYTitle("Counts");
233 sName = "Control_Flow_PtSub0_";
235 fHistPtSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
236 fHistPtSub0 ->SetXTitle("P_{t} (GeV/c) for Subevent 0 selection");
237 fHistPtSub0 ->SetYTitle("Counts");
239 sName = "Control_Flow_PtSub1_";
241 fHistPtSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPt, dPtMin, dPtMax);
242 fHistPtSub1 ->SetXTitle("P_{t} (GeV/c) for Subevent 1 selection");
243 fHistPtSub1 ->SetYTitle("Counts");
246 sName = "Control_Flow_PhiRP_";
248 fHistPhiRP = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
249 fHistPhiRP ->SetXTitle("#phi for RP selection");
250 fHistPhiRP ->SetYTitle("Counts");
252 sName = "Control_Flow_PhiPOI_";
254 fHistPhiPOI = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
255 fHistPhiPOI ->SetXTitle("#phi for POI selection");
256 fHistPhiPOI ->SetYTitle("Counts");
258 sName = "Control_Flow_PhiSub0_";
260 fHistPhiSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
261 fHistPhiSub0 ->SetXTitle("#phi for Subevent 0 selection");
262 fHistPhiSub0 ->SetYTitle("Counts");
264 sName = "Control_Flow_PhiSub1_";
266 fHistPhiSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsPhi, dPhiMin, dPhiMax);
267 fHistPhiSub1 ->SetXTitle("#phi for Subevent 1 selection");
268 fHistPhiSub1 ->SetYTitle("Counts");
271 sName = "Control_Flow_EtaRP_";
273 fHistEtaRP = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
274 fHistEtaRP ->SetXTitle("#eta for RP selection");
275 fHistEtaRP ->SetYTitle("Counts");
277 sName = "Control_Flow_EtaPOI_";
279 fHistEtaPOI = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
280 fHistEtaPOI ->SetXTitle("#eta for POI selection");
281 fHistEtaPOI ->SetYTitle("Counts");
283 sName = "Control_Flow_EtaSub0_";
285 fHistEtaSub0 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
286 fHistEtaSub0 ->SetXTitle("#eta for Subevent 0 selection");
287 fHistEtaSub0 ->SetYTitle("Counts");
289 sName = "Control_Flow_EtaSub1_";
291 fHistEtaSub1 = new TH1F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax);
292 fHistEtaSub1 ->SetXTitle("#eta for Subevent 1 selection");
293 fHistEtaSub1 ->SetYTitle("Counts");
296 sName = "Control_Flow_PhiEtaRP_";
298 fHistPhiEtaRP = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
299 fHistPhiEtaRP ->SetXTitle("#eta");
300 fHistPhiEtaRP ->SetYTitle("#phi");
302 sName = "Control_Flow_PhiEtaPOI_";
304 fHistPhiEtaPOI = new TH2F(sName.Data(), sName.Data(),iNbinsEta, dEtaMin, dEtaMax, iNbinsPhi, dPhiMin, dPhiMax);
305 fHistPhiEtaPOI ->SetXTitle("#eta");
306 fHistPhiEtaPOI ->SetYTitle("#phi");
309 sName = "Control_FlowPro_MeanPtperBin_";
311 fHistProMeanPtperBin = new TProfile(sName.Data(), sName.Data(),iNbinsPt,dPtMin,dPtMax);
312 fHistProMeanPtperBin ->SetXTitle("P_{t} (GeV/c) ");
313 fHistProMeanPtperBin ->SetYTitle("<P_{t}> (GeV/c) ");
316 sName = "Control_Flow_Q_";
318 fHistQ = new TH1F(sName.Data(), sName.Data(),iNbinsQ, dQMin, dQMax);
319 fHistQ ->SetXTitle("Q_{vector}/Mult");
320 fHistQ ->SetYTitle("Counts");
323 sName = "Control_Flow_Harmonic_";
325 fHarmonic = new TProfile(sName.Data(),sName.Data(),1,0,1);
326 fHarmonic ->SetYTitle("harmonic");
328 //<reference multiplicity> versus # of RPs
329 sName = "Reference_Multiplicity_Vs_Number_Of_RPs_";
331 fRefMultVsNoOfRPs = new TProfile(sName.Data(),sName.Data(),iNbinsMult, dMultMin, dMultMax);
332 fRefMultVsNoOfRPs->SetYTitle("<reference multiplicity>");
333 fRefMultVsNoOfRPs->SetXTitle("# of RPs");
335 //list of histograms if added here also add in copy constructor
336 fHistList = new TList();
337 fHistList-> Add(fHistMultOrig);
338 fHistList-> Add(fHistMultRP);
339 fHistList-> Add(fHistMultPOI);
340 fHistList-> Add(fHistPtRP);
341 fHistList-> Add(fHistPtPOI);
342 fHistList-> Add(fHistPtSub0);
343 fHistList-> Add(fHistPtSub1);
344 fHistList-> Add(fHistPhiRP);
345 fHistList-> Add(fHistPhiPOI);
346 fHistList-> Add(fHistPhiSub0);
347 fHistList-> Add(fHistPhiSub1);
348 fHistList-> Add(fHistEtaRP);
349 fHistList-> Add(fHistEtaPOI);
350 fHistList-> Add(fHistEtaSub0);
351 fHistList-> Add(fHistEtaSub1);
352 fHistList-> Add(fHistPhiEtaRP);
353 fHistList-> Add(fHistPhiEtaPOI);
354 fHistList-> Add(fHistProMeanPtperBin);
355 fHistList-> Add(fHarmonic);
356 fHistList-> Add(fRefMultVsNoOfRPs);
357 fHistList-> Add(fHistQ);
362 //-----------------------------------------------------------------------
364 AliFlowCommonHist::~AliFlowCommonHist()
367 delete fHistMultOrig;
382 delete fHistPhiEtaRP;
383 delete fHistPhiEtaPOI;
384 delete fHistProMeanPtperBin;
387 delete fRefMultVsNoOfRPs;
392 //-----------------------------------------------------------------------
394 Bool_t AliFlowCommonHist::FillControlHistograms(AliFlowEventSimple* anEvent)
396 //Fills the control histograms
398 cout<<"##### FillControlHistograms: FlowEvent pointer null"<<endl;
402 Double_t dPt, dPhi, dEta, dWeight;
405 //fill the histograms
406 Int_t iNumberOfTracks = anEvent->NumberOfTracks();
407 fHistMultOrig->Fill(iNumberOfTracks);
409 AliFlowVector vQ = anEvent->GetQ();
410 //weight by the Multiplicity
413 if (vQ.GetMult()!=0) {
414 dQX = vQ.X()/vQ.GetMult();
415 dQY = vQ.Y()/vQ.GetMult();
418 fHistQ->Fill(vQ.Mod());
420 Double_t dMultRP = 0.;
421 Double_t dMultPOI = 0.;
423 AliFlowTrackSimple* pTrack = NULL;
425 for (Int_t i=0;i<iNumberOfTracks;i++) {
426 pTrack = anEvent->GetTrack(i);
428 dWeight = pTrack->Weight();
429 if (pTrack->InRPSelection()){
432 fHistPtRP->Fill(dPt,dWeight);
434 dPhi = pTrack->Phi();
435 if (dPhi<0.) dPhi+=2*TMath::Pi();
436 fHistPhiRP->Fill(dPhi,dWeight);
438 dEta = pTrack->Eta();
439 fHistEtaRP->Fill(dEta,dWeight);
441 fHistPhiEtaRP->Fill(dEta,dPhi,dWeight);
444 if (pTrack->InSubevent(0)){
445 //Fill distributions for the subevent
446 fHistPtSub0 -> Fill(dPt,dWeight);
447 fHistPhiSub0 -> Fill(dPhi,dWeight);
448 fHistEtaSub0 -> Fill(dEta,dWeight);
450 else if (pTrack->InSubevent(1)){
451 //Fill distributions for the subevent
452 fHistPtSub1 -> Fill(dPt,dWeight);
453 fHistPhiSub1 -> Fill(dPhi,dWeight);
454 fHistEtaSub1 -> Fill(dEta,dWeight);
457 if (pTrack->InPOISelection()){
460 fHistPtPOI->Fill(dPt,dWeight);
462 dPhi = pTrack->Phi();
463 if (dPhi<0.) dPhi+=2*TMath::Pi();
464 fHistPhiPOI->Fill(dPhi,dWeight);
466 dEta = pTrack->Eta();
467 fHistEtaPOI->Fill(dEta,dWeight);
469 fHistPhiEtaPOI->Fill(dEta,dPhi,dWeight);
471 fHistProMeanPtperBin->Fill(dPt,dPt,dWeight);
478 fHistMultRP->Fill(dMultRP);
479 fHistMultPOI->Fill(dMultPOI);
481 //<reference multiplicity> versus # of RPs:
482 fRefMultVsNoOfRPs->Fill(dMultRP+0.5,anEvent->GetReferenceMultiplicity(),1.);
487 //-----------------------------------------------------------------------
489 Double_t AliFlowCommonHist::GetEntriesInPtBinRP(Int_t aBin)
491 //get entries in bin aBin from fHistPtRP
492 Double_t dEntries = fHistPtRP->GetBinContent(aBin);
498 //-----------------------------------------------------------------------
500 Double_t AliFlowCommonHist::GetEntriesInPtBinPOI(Int_t aBin)
502 //get entries in bin aBin from fHistPtPOI
503 Double_t dEntries = fHistPtPOI->GetBinContent(aBin);
509 //-----------------------------------------------------------------------
511 Double_t AliFlowCommonHist::GetEntriesInEtaBinRP(Int_t aBin)
513 //get entries in bin aBin from fHistPtRP
514 Double_t dEntries = fHistEtaRP->GetBinContent(aBin);
520 //-----------------------------------------------------------------------
522 Double_t AliFlowCommonHist::GetEntriesInEtaBinPOI(Int_t aBin)
524 //get entries in bin aBin from fHistPtPOI
525 Double_t dEntries = fHistEtaPOI->GetBinContent(aBin);
531 //-----------------------------------------------------------------------
533 Double_t AliFlowCommonHist::GetMeanPt(Int_t aBin)
535 //Get entry from bin aBin from fHistProMeanPtperBin
536 Double_t dMeanPt = fHistProMeanPtperBin->GetBinContent(aBin);
543 //-----------------------------------------------------------------------
544 Double_t AliFlowCommonHist::Merge(TCollection *aList)
547 //cout<<"entering merge function"<<endl;
548 if (!aList) return 0;
549 if (aList->IsEmpty()) return 0; //no merging is needed
552 TIter next(aList); // list is supposed to contain only objects of the same type as this
553 AliFlowCommonHist *toMerge;
554 // make a temporary list
555 TList *pTemp = new TList();
556 while ((toMerge=(AliFlowCommonHist*)next())) {
557 pTemp->Add(toMerge->GetHistList());
560 // Now call merge for fHistList providing temp list
561 fHistList->Merge(pTemp);
565 //cout<<"Merged"<<endl;
566 return (double)iCount;
570 void AliFlowCommonHist::Print(Option_t *option) const
572 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
573 // ===============================================
574 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
575 printf( "Class.Print Name = %s, Histogram list:\n",GetName());
578 fHistList->Print(option);
582 printf( "Empty histogram list \n");
586 //-----------------------------------------------------------------------
587 void AliFlowCommonHist::Browse(TBrowser *b)
591 if (fHistList) b->Add(fHistList,"AliFlowCommonHistList");